| <!-- |
| 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"> |
| <property name="build-fi.dir" value="${basedir}/build-fi"/> |
| <property name="hadoop-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="1.6.5"/> |
| <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 -classes-compilation has to be defined in build.xml and |
| needs to depend on classes compilation and test classes compilation |
| targets. This is a poor man parametrization for targets --> |
| <target name="compile-fault-inject" depends="-classes-compilation" > |
| <!-- AspectJ task definition --> |
| <taskdef |
| resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"> |
| <classpath> |
| <pathelement |
| location="${common.ivy.lib.dir}/aspectjtools-${aspectversion}.jar"/> |
| </classpath> |
| </taskdef> |
| <echo message="Start weaving aspects in place"/> |
| <iajc |
| encoding="${build.encoding}" |
| srcdir="${java.src.dir};${build.src};${test.src.dir}/aop" |
| includes="org/apache/hadoop/**/*.java, org/apache/hadoop/**/*.aj" |
| excludes="org/apache/hadoop/record/**/*" |
| destDir="${build.classes}" |
| debug="${javac.debug}" |
| target="${javac.version}" |
| source="${javac.version}" |
| deprecation="${javac.deprecation}"> |
| <classpath refid="test.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="injectfaults" |
| description="Instrument classes with faults and other AOP advices"> |
| <!--mkdir to prevent <subant> failure in case the folder has been removed--> |
| <mkdir dir="${build-fi.dir}"/> |
| <delete file="${compile-inject.output}"/> |
| <subant buildpath="${basedir}" target="compile-fault-inject" |
| output="${compile-inject.output}"> |
| <property name="build.dir" value="${build-fi.dir}"/> |
| </subant> |
| </target> |
| |
| <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*"/> |
| <!-- This one is needed for the special "regression" target only --> |
| <property name="special.fi.testcasesonly" value="@{testcasesonly}"/> |
| </subant> |
| </sequential> |
| </macrodef> |
| |
| <!-- ================================================================== --> |
| <!-- Make hadoop-fi.jar including all Fault injected artifacts --> |
| <!-- ================================================================== --> |
| <macrodef name="macro-jar-fault-inject"> |
| <attribute name="target.name" /> |
| <attribute name="jar.final.name" /> |
| <attribute name="jar.final.value" /> |
| <sequential> |
| <subant buildpath="build.xml" target="@{target.name}"> |
| <property name="build.dir" value="${build-fi.dir}"/> |
| <property name="@{jar.final.name}" value="@{jar.final.value}"/> |
| <property name="jar.extra.properties.list" |
| value="${test.src.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> |
| <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> |