| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| http://www.apache.org/licenses/LICENSE-2.0 |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <project name="aspects"> |
| <!-- Properties common for all fault injections --> |
| <property name="build-fi.dir" location="${basedir}/build-fi"/> |
| <property name="sqoop-fi.jar" location="${build.dir}/${final.name}-fi.jar"/> |
| <property name="compile-inject.output" |
| value="${build-fi.dir}/compile-fi.log"/> |
| <property name="aspectversion" value="${aspectj.version}"/> |
| <property name="javac.version" value="${targetJavaVersion}"/> |
| <property file="${basedir}/build.properties"/> |
| |
| <!--All Fault Injection (FI) related targets are located in this session --> |
| |
| <target name="clean-fi"> |
| <delete dir="${build-fi.dir}"/> |
| </target> |
| |
| <!-- Weaving aspects in place |
| Later on one can run 'ant jar-fault-inject' to create |
| Hadoop jar file with instrumented classes--> |
| |
| <target name="compile-fault-inject" depends="compile, compile-test"> |
| <!-- AspectJ task definition --> |
| <taskdef |
| resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"> |
| <classpath> |
| <pathelement |
| location="${build.ivy.lib.dir}/sqoop/hadoop${hadoopversion}test/aspectjtools-${aspectversion}.jar"/> |
| </classpath> |
| </taskdef> |
| <echo message="Start weaving aspects in place"/> |
| <iajc |
| encoding="${build.encoding}" |
| srcdir="${src.dir.path}" |
| includes="**/org/apache/sqoop/**/*.java, **/org/apache/sqoop/**/*.aj" |
| destDir="${build-fi.dir}/classes" |
| debug="${javac.debug}" |
| target="${javac.version}" |
| source="${javac.version}" |
| deprecation="${javac.deprecation}" |
| fork="true" |
| maxmem="1024m" |
| > |
| |
| <classpath> |
| <path refid="test.classpath"/> |
| <fileset dir="${build-fi.dir}/test"> |
| <include name="**/*.jar" /> |
| <exclude name="**/excluded/" /> |
| </fileset> |
| </classpath> |
| </iajc> |
| <loadfile property="injection.failure" srcfile="${compile-inject.output}"> |
| <filterchain> |
| <linecontainsregexp> |
| <regexp pattern='iajc.*warning'/> |
| </linecontainsregexp> |
| </filterchain> |
| </loadfile> |
| <fail if="injection.failure"> |
| Broken binding of advises: ${line.separator}${injection.failure} |
| </fail> |
| <echo message="Weaving of aspects is finished"/> |
| </target> |
| |
| <target name="fi-init"> |
| <mkdir dir="${build-fi.dir}"/> |
| </target> |
| |
| <target name="injectfaults" |
| description="Instrument classes with faults and other AOP advices"> |
| <mkdir dir="${build-fi.dir}"/> |
| <delete file="${compile-inject.output}"/> |
| <echo message="In injectfaults ${src.dir}"/> |
| <weave-injectfault-aspects dest.dir="${build-fi.dir}/classes" |
| src.dir="${base.src.dir}"> |
| </weave-injectfault-aspects> |
| |
| </target> |
| <macrodef name="weave-injectfault-aspects"> |
| <attribute name="dest.dir" /> |
| <attribute name="src.dir" /> |
| <sequential> |
| <subant buildpath="build.xml" target="compile-fault-inject" |
| output="${compile-inject.output}"> |
| <property name="build.dir" value="${build-fi.dir}" /> |
| <property name="src.dir.path" value="@{src.dir}" /> |
| <property name="dest.dir" value="@{dest.dir}" /> |
| </subant> |
| </sequential> |
| </macrodef> |
| <macrodef name="macro-run-tests-fault-inject"> |
| <attribute name="target.name" /> |
| <attribute name="testcasesonly" /> |
| <sequential> |
| <subant buildpath="build.xml" target="@{target.name}"> |
| <property name="build.dir" value="${build-fi.dir}"/> |
| <property name="test.fault.inject" value="yes"/> |
| <property name="test.include" value="TestFi*"/> |
| <property name="test.timeout" value="3000000"/> |
| <!-- This one is needed for the special "regression" target only --> |
| <property name="special.fi.testcasesonly" value="@{testcasesonly}"/> |
| </subant> |
| </sequential> |
| </macrodef> |
| |
| <!-- ================================================================== --> |
| <!-- Make sqoop-fi.jar including all Fault injected artifacts --> |
| <!-- ================================================================== --> |
| <macrodef name="macro-jar-fault-inject"> |
| <attribute name="target.name" /> |
| <attribute name="build.dir" /> |
| <attribute name="jar.final.name" /> |
| <attribute name="jar.final.value" /> |
| <sequential> |
| <subant buildpath="build.xml" target="@{target.name}"> |
| <property name="build.dir" value="@{build.dir}"/> |
| <property name="@{jar.final.name}" value="@{jar.final.value}"/> |
| <property name="jar.extra.properties.list" |
| value="${test.dir}/fi-site.xml" /> |
| </subant> |
| </sequential> |
| </macrodef> |
| <!-- ================================================================== --> |
| <!-- Make test jar files including all Fault Injected artifacts --> |
| <!-- ================================================================== --> |
| <macrodef name="macro-jar-test-fault-inject"> |
| <attribute name="target.name" /> |
| <attribute name="jar.final.name" /> |
| <attribute name="jar.final.value" /> |
| <sequential> |
| <echo message="@{jar.final.value}"/> |
| <subant buildpath="build.xml" target="@{target.name}"> |
| <property name="build.dir" value="${build-fi.dir}"/> |
| <property name="@{jar.final.name}" |
| value="@{jar.final.value}"/> |
| </subant> |
| </sequential> |
| </macrodef> |
| <!--End of Fault Injection (FI) related session--> |
| </project> |