|
| 1 | +<project name="TYPO3 Idea Plugin" default="test" basedir="."> |
| 2 | + |
| 3 | + <property file="build.properties" /> |
| 4 | + |
| 5 | + <!-- set global properties for this build --> |
| 6 | + <property name="build.compiler" value="modern"/> |
| 7 | + |
| 8 | + <property name="src" location="${basedir}/src"/> |
| 9 | + <property name="test.src" location="${basedir}/tests"/> |
| 10 | + <property name="build" location="build"/> |
| 11 | + <property name="test.build" location="build_test"/> |
| 12 | + <property name="resources" value="${basedir}/resources"/> |
| 13 | + <property name="idea.build" location="${basedir}/idea/" /> |
| 14 | + <property name="plugins" location="${basedir}/plugins"/> |
| 15 | + <property name="deploy" location="${basedir}/deploy"/> |
| 16 | + |
| 17 | + <path id="idea.classpath"> |
| 18 | + <fileset dir="${idea.build}/lib"> |
| 19 | + <include name="*.jar"/> |
| 20 | + </fileset> |
| 21 | + <fileset dir="${basedir}/lib"> |
| 22 | + <include name="*.jar"/> |
| 23 | + </fileset> |
| 24 | + <fileset dir="${plugins}"> |
| 25 | + <include name="*.jar"/> |
| 26 | + </fileset> |
| 27 | + <fileset dir="${plugins}/php/lib"> |
| 28 | + <include name="*.jar"/> |
| 29 | + </fileset> |
| 30 | + <fileset dir="${plugins}/twig/lib"> |
| 31 | + <include name="*.jar"/> |
| 32 | + </fileset> |
| 33 | + <fileset dir="${idea.build}/plugins/properties/lib"> |
| 34 | + <include name="*.jar"/> |
| 35 | + </fileset> |
| 36 | + <fileset dir="${idea.build}/plugins/java-i18n/lib"> |
| 37 | + <include name="*.jar"/> |
| 38 | + </fileset> |
| 39 | + <fileset dir="${idea.build}/plugins/CSS/lib"> |
| 40 | + <include name="*.jar"/> |
| 41 | + </fileset> |
| 42 | + <fileset dir="${idea.build}/plugins/yaml/lib"> |
| 43 | + <include name="*.jar"/> |
| 44 | + </fileset> |
| 45 | + <fileset dir="${idea.build}/plugins/webDeployment/lib"> |
| 46 | + <include name="*.jar"/> |
| 47 | + </fileset> |
| 48 | + </path> |
| 49 | + |
| 50 | + <path id="classpath"> |
| 51 | + <pathelement location="${build}"/> |
| 52 | + <path refid="idea.classpath"/> |
| 53 | + </path> |
| 54 | + |
| 55 | + <path id="classpath.test"> |
| 56 | + <pathelement location="${build}"/> |
| 57 | + <pathelement location="${test.build}"/> |
| 58 | + <fileset dir="${idea.build}/lib"> |
| 59 | + <include name="**/*.jar" /> |
| 60 | + <exclude name="ant/lib/**/*.jar" /> |
| 61 | + </fileset> |
| 62 | + <fileset dir="${plugins}"> |
| 63 | + <include name="*.jar"/> |
| 64 | + </fileset> |
| 65 | + <fileset dir="${plugins}/php/lib"> |
| 66 | + <include name="*.jar"/> |
| 67 | + </fileset> |
| 68 | + <fileset dir="${plugins}/twig/lib"> |
| 69 | + <include name="*.jar"/> |
| 70 | + </fileset> |
| 71 | + <fileset dir="${idea.build}/plugins/properties/lib"> |
| 72 | + <include name="*.jar"/> |
| 73 | + </fileset> |
| 74 | + <fileset dir="${idea.build}/plugins/java-i18n/lib"> |
| 75 | + <include name="*.jar"/> |
| 76 | + </fileset> |
| 77 | + <fileset dir="${idea.build}/plugins/CSS/lib"> |
| 78 | + <include name="*.jar"/> |
| 79 | + </fileset> |
| 80 | + <fileset dir="${idea.build}/plugins/yaml/lib"> |
| 81 | + <include name="*.jar"/> |
| 82 | + </fileset> |
| 83 | + <fileset dir="${idea.build}/plugins/webDeployment/lib"> |
| 84 | + <include name="*.jar"/> |
| 85 | + </fileset> |
| 86 | + <fileset dir="${java.home}/../lib"> |
| 87 | + <include name="**/*.jar" /> |
| 88 | + </fileset> |
| 89 | + </path> |
| 90 | + |
| 91 | + <taskdef name="javac2" classname="com.intellij.ant.Javac2"> |
| 92 | + <classpath> |
| 93 | + <pathelement location="${idea.build}/lib/javac2.jar"/> |
| 94 | + <path refid="idea.classpath"/> |
| 95 | + </classpath> |
| 96 | + </taskdef> |
| 97 | + |
| 98 | + <macrodef name="copy_resources"> |
| 99 | + <attribute name="dest"/> |
| 100 | + <attribute name="src"/> |
| 101 | + <sequential> |
| 102 | + <echo message="Copying resources"/> |
| 103 | + <patternset id="resources"> |
| 104 | + <include name="**/*.php"/> |
| 105 | + <include name="**/*.png"/> |
| 106 | + <include name="**/*.xml"/> |
| 107 | + <include name="**/*.yml"/> |
| 108 | + <include name="**/*.xlf"/> |
| 109 | + <include name="**/*.twig"/> |
| 110 | + <include name="**/*.json"/> |
| 111 | + <include name="**/*.xlf"/> |
| 112 | + <include name="**/*.xliff"/> |
| 113 | + <include name="**/*.html"/> |
| 114 | + </patternset> |
| 115 | + |
| 116 | + <copy toDir="@{dest}"> |
| 117 | + <fileset dir="@{src}"> |
| 118 | + <patternset refid="resources"/> |
| 119 | + </fileset> |
| 120 | + </copy> |
| 121 | + </sequential> |
| 122 | + </macrodef> |
| 123 | + |
| 124 | + <macrodef name="make_plugin"> |
| 125 | + <attribute name="dest"/> |
| 126 | + <sequential> |
| 127 | + <copy toDir="@{dest}/classes"> |
| 128 | + <fileset dir="${src}"/> |
| 129 | + </copy> |
| 130 | + <copy toDir="@{dest}/lib"> |
| 131 | + <fileset dir="${basedir}/lib"/> |
| 132 | + </copy> |
| 133 | + <copy toDir="@{dest}/META-INF"> |
| 134 | + <fileset dir="${basedir}/META-INF"/> |
| 135 | + </copy> |
| 136 | + </sequential> |
| 137 | + </macrodef> |
| 138 | + |
| 139 | + <target name="init"> |
| 140 | + <tstamp/> |
| 141 | + <mkdir dir="${build}"/> |
| 142 | + <mkdir dir="${test.build}"/> |
| 143 | + <mkdir dir="${plugins}/typo3-plugin"/> |
| 144 | + <echo message="Using IDEA build from: ${idea.build}"/> |
| 145 | + <echo message="Using JAVA_HOME: ${java.home}"/> |
| 146 | + </target> |
| 147 | + |
| 148 | + <target name="compile" depends="init" description="Compile the source code"> |
| 149 | + |
| 150 | + <sequential> |
| 151 | + <pathconvert property="classpathProp" refid="classpath"/> |
| 152 | + |
| 153 | + <javac2 destdir="${build}" classpathref="classpath" verbose="false" debug="true" source="1.8" target="1.8" includeantruntime="false"> |
| 154 | + <src path="${src}"/> |
| 155 | + </javac2> |
| 156 | + |
| 157 | + <copy_resources dest="${build}" src="${src}"/> |
| 158 | + <make_plugin dest="${plugins}/typo3-plugin"/> |
| 159 | + <copy todir="${build}/META-INF"> |
| 160 | + <fileset dir="META-INF"/> |
| 161 | + </copy> |
| 162 | + </sequential> |
| 163 | + </target> |
| 164 | + |
| 165 | + <target name="compile_test" depends="compile" description="Compile tests"> |
| 166 | + |
| 167 | + <sequential> |
| 168 | + <pathconvert property="classpathProp" refid="classpath"/> |
| 169 | + |
| 170 | + <javac2 destdir="${test.build}" classpathref="classpath" verbose="false" debug="true" source="1.8" target="1.8" includeantruntime="false"> |
| 171 | + <src path="${src}"/> |
| 172 | + <src path="${test.src}"/> |
| 173 | + </javac2> |
| 174 | + |
| 175 | + <copy_resources dest="${test.build}" src="${src}"/> |
| 176 | + <copy_resources dest="${test.build}" src="${test.src}"/> |
| 177 | + </sequential> |
| 178 | + </target> |
| 179 | + |
| 180 | + <target name="test" depends="compile_test" description="Run the tests"> |
| 181 | + <echo message="Running tests"/> |
| 182 | + |
| 183 | + <property name="suspend" value="n"/> |
| 184 | + |
| 185 | + <junit printsummary="yes" |
| 186 | + haltonfailure="false" |
| 187 | + failureProperty="failure_found" |
| 188 | + fork="yes" forkmode="once" reloading="no" showoutput="yes"> |
| 189 | + |
| 190 | + <jvmarg value="-Didea.home.path=${idea.build}"/> |
| 191 | + <jvmarg value="-Xbootclasspath/a:${idea.build}/lib/boot.jar"/> |
| 192 | + <jvmarg value="-Dfile.encoding=UTF-8"/> |
| 193 | + <jvmarg value="-Didea.load.plugins.id=com.jetbrains.php,com.jetbrains.twig,com.intellij.modules.platformorg.jetbrains.plugins.yaml,com.jetbrains.plugins.webDeployment,de.espend.idea.php.annotation,de.espend.idea.php.toolbox,com.cedricziel.idea.typo3"/> |
| 194 | + <jvmarg value="-ea"/> |
| 195 | + <jvmarg value="-Didea.plugins.path=${plugins}"/> |
| 196 | + <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=${suspend},address=43251"/> |
| 197 | + <jvmarg value="-Didea.launcher.bin.path=${idea.build}/bin"/> |
| 198 | + |
| 199 | + <classpath refid="classpath.test"/> |
| 200 | + |
| 201 | + <formatter type="brief" usefile="false"/> |
| 202 | + |
| 203 | + <batchtest> |
| 204 | + <fileset dir="${test.src}"> |
| 205 | + <include name="**/*Test.java"/> |
| 206 | + <exclude name="**/*TestCase.java"/> |
| 207 | + </fileset> |
| 208 | + </batchtest> |
| 209 | + </junit> |
| 210 | + |
| 211 | + <antcall target="check_test"/> |
| 212 | + </target> |
| 213 | + |
| 214 | + <target name="check_test" if="failure_found"> |
| 215 | + <fail message="Failures found"/> |
| 216 | + </target> |
| 217 | + |
| 218 | + <target name="jar" description="build the plugin jar" depends="compile"> |
| 219 | + <jar destfile="idea-php-typo3-plugin.jar" > |
| 220 | + <fileset dir="${build}"/> |
| 221 | + </jar> |
| 222 | + </target> |
| 223 | + |
| 224 | + <target name="clean" description="clean up"> |
| 225 | + <delete dir="${build}" /> |
| 226 | + <delete dir="${test.build}" /> |
| 227 | + <delete dir="${plugins}/typo3-plugin" /> |
| 228 | + </target> |
| 229 | + |
| 230 | +</project> |
0 commit comments