This project simulates the turing machine https://cromer.cl/mt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

262 lines
9.9KB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="fundamentos" default="all">
  3. <property file="mt.properties"/>
  4. <!-- Uncomment the following property if no tests compilation is needed -->
  5. <!--
  6. <property name="skip.tests" value="true"/>
  7. -->
  8. <!-- Compiler options -->
  9. <property name="compiler.debug" value="on"/>
  10. <property name="compiler.generate.no.warnings" value="off"/>
  11. <property name="compiler.args" value=""/>
  12. <property name="compiler.max.memory" value="700m"/>
  13. <patternset id="ignored.files">
  14. <exclude name="**/*.hprof/**"/>
  15. <exclude name="**/*.pyc/**"/>
  16. <exclude name="**/*.pyo/**"/>
  17. <exclude name="**/*.rbc/**"/>
  18. <exclude name="**/*.yarb/**"/>
  19. <exclude name="**/*~/**"/>
  20. <exclude name="**/.DS_Store/**"/>
  21. <exclude name="**/.git/**"/>
  22. <exclude name="**/.hg/**"/>
  23. <exclude name="**/.svn/**"/>
  24. <exclude name="**/CVS/**"/>
  25. <exclude name="**/__pycache__/**"/>
  26. <exclude name="**/_svn/**"/>
  27. <exclude name="**/vssver.scc/**"/>
  28. <exclude name="**/vssver2.scc/**"/>
  29. </patternset>
  30. <patternset id="library.patterns">
  31. <include name="*.war"/>
  32. <include name="*.swc"/>
  33. <include name="*.apk"/>
  34. <include name="*.zip"/>
  35. <include name="*.egg"/>
  36. <include name="*.ane"/>
  37. <include name="*.jar"/>
  38. <include name="*.ear"/>
  39. </patternset>
  40. <patternset id="compiler.resources">
  41. <exclude name="**/?*.java"/>
  42. <exclude name="**/?*.form"/>
  43. <exclude name="**/?*.class"/>
  44. <exclude name="**/?*.groovy"/>
  45. <exclude name="**/?*.scala"/>
  46. <exclude name="**/?*.flex"/>
  47. <exclude name="**/?*.kt"/>
  48. <exclude name="**/?*.clj"/>
  49. </patternset>
  50. <!-- JDK definitions -->
  51. <property name="jdk.bin.1.8" value="${jdk.home.1.8}/bin"/>
  52. <path id="jdk.classpath.1.8">
  53. <fileset dir="${jdk.home.1.8}">
  54. <include name="jre/lib/charsets.jar"/>
  55. <include name="jre/lib/deploy.jar"/>
  56. <include name="jre/lib/ext/cldrdata.jar"/>
  57. <include name="jre/lib/ext/dnsns.jar"/>
  58. <include name="jre/lib/ext/jaccess.jar"/>
  59. <include name="jre/lib/ext/jfxrt.jar"/>
  60. <include name="jre/lib/ext/localedata.jar"/>
  61. <include name="jre/lib/ext/nashorn.jar"/>
  62. <include name="jre/lib/ext/sunec.jar"/>
  63. <include name="jre/lib/ext/sunjce_provider.jar"/>
  64. <include name="jre/lib/ext/sunpkcs11.jar"/>
  65. <include name="jre/lib/ext/zipfs.jar"/>
  66. <include name="jre/lib/javaws.jar"/>
  67. <include name="jre/lib/jce.jar"/>
  68. <include name="jre/lib/jfr.jar"/>
  69. <include name="jre/lib/jfxswt.jar"/>
  70. <include name="jre/lib/jsse.jar"/>
  71. <include name="jre/lib/management-agent.jar"/>
  72. <include name="jre/lib/plugin.jar"/>
  73. <include name="jre/lib/resources.jar"/>
  74. <include name="jre/lib/rt.jar"/>
  75. </fileset>
  76. </path>
  77. <property name="project.jdk.home" value="${jdk.home.1.8}"/>
  78. <property name="project.jdk.bin" value="${jdk.bin.1.8}"/>
  79. <property name="project.jdk.classpath" value="jdk.classpath.1.8"/>
  80. <!-- Register Custom Compiler Taskdefs -->
  81. <property name="javac2.home" value="${idea.home}/lib"/>
  82. <path id="javac2.classpath">
  83. <pathelement location="${javac2.home}/javac2.jar"/>
  84. <pathelement location="${javac2.home}/jdom.jar"/>
  85. <pathelement location="${javac2.home}/asm-all.jar"/>
  86. <pathelement location="${javac2.home}/jgoodies-forms.jar"/>
  87. </path>
  88. <target name="register.custom.compilers">
  89. <taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
  90. <taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
  91. </target>
  92. <!-- Modules -->
  93. <!-- Module Fundamentos -->
  94. <dirname property="module.fundamentos.basedir" file="${ant.file}"/>
  95. <property name="module.jdk.home.fundamentos" value="${jdk.home.1.8}"/>
  96. <property name="module.jdk.bin.fundamentos" value="${jdk.bin.1.8}"/>
  97. <property name="module.jdk.classpath.fundamentos" value="jdk.classpath.1.8"/>
  98. <property name="compiler.args.fundamentos" value="-encoding UTF-8 -source 8 -target 8 ${compiler.args}"/>
  99. <property name="fundamentos.output.dir" value="${module.fundamentos.basedir}/out/production/Fundamentos"/>
  100. <property name="fundamentos.testoutput.dir" value="${module.fundamentos.basedir}/out/test/Fundamentos"/>
  101. <path id="fundamentos.module.bootclasspath">
  102. <!-- Paths to be included in compilation bootclasspath -->
  103. </path>
  104. <path id="fundamentos.module.production.classpath">
  105. <path refid="${module.jdk.classpath.fundamentos}"/>
  106. </path>
  107. <path id="fundamentos.runtime.production.module.classpath">
  108. <pathelement location="${fundamentos.output.dir}"/>
  109. </path>
  110. <path id="fundamentos.module.classpath">
  111. <path refid="${module.jdk.classpath.fundamentos}"/>
  112. <pathelement location="${fundamentos.output.dir}"/>
  113. </path>
  114. <path id="fundamentos.runtime.module.classpath">
  115. <pathelement location="${fundamentos.testoutput.dir}"/>
  116. <pathelement location="${fundamentos.output.dir}"/>
  117. </path>
  118. <patternset id="excluded.from.module.fundamentos">
  119. <patternset refid="ignored.files"/>
  120. </patternset>
  121. <patternset id="excluded.from.compilation.fundamentos">
  122. <patternset refid="excluded.from.module.fundamentos"/>
  123. </patternset>
  124. <path id="fundamentos.module.sourcepath">
  125. <dirset dir="${module.fundamentos.basedir}">
  126. <include name="src"/>
  127. </dirset>
  128. </path>
  129. <target name="compile.module.fundamentos" depends="compile.module.fundamentos.production,compile.module.fundamentos.tests" description="Compile module Fundamentos"/>
  130. <target name="compile.module.fundamentos.production" depends="register.custom.compilers" description="Compile module Fundamentos; production classes">
  131. <mkdir dir="${fundamentos.output.dir}"/>
  132. <javac2 destdir="${fundamentos.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true" executable="${module.jdk.bin.fundamentos}/javac">
  133. <compilerarg line="${compiler.args.fundamentos}"/>
  134. <bootclasspath refid="fundamentos.module.bootclasspath"/>
  135. <classpath refid="fundamentos.module.production.classpath"/>
  136. <src refid="fundamentos.module.sourcepath"/>
  137. <patternset refid="excluded.from.compilation.fundamentos"/>
  138. </javac2>
  139. <copy todir="${fundamentos.output.dir}">
  140. <fileset dir="${module.fundamentos.basedir}/src">
  141. <patternset refid="compiler.resources"/>
  142. <type type="file"/>
  143. </fileset>
  144. </copy>
  145. </target>
  146. <target name="compile.module.fundamentos.tests" depends="register.custom.compilers,compile.module.fundamentos.production" description="compile module Fundamentos; test classes" unless="skip.tests"/>
  147. <target name="clean.module.fundamentos" description="cleanup module">
  148. <delete dir="${fundamentos.output.dir}"/>
  149. <delete dir="${fundamentos.testoutput.dir}"/>
  150. </target>
  151. <target name="init" description="Build initialization">
  152. <!-- Perform any build initialization in this target -->
  153. </target>
  154. <target name="clean" depends="clean.module.fundamentos, clean.artifact.maquinaturing" description="cleanup all"/>
  155. <target name="build.modules" depends="init, clean, compile.module.fundamentos" description="build all modules"/>
  156. <target name="init.artifacts">
  157. <property name="artifacts.temp.dir" value="${basedir}/__artifacts_temp"/>
  158. <property name="artifact.output.maquinaturing" value="${basedir}/out/artifacts/MaquinaTuring"/>
  159. <mkdir dir="${artifacts.temp.dir}"/>
  160. <property name="artifact.temp.output.MT" value="${artifacts.temp.dir}/MT.jar"/>
  161. <taskdef resource="com/sun/javafx/tools/ant/antlib.xml" uri="javafx:com.sun.javafx.tools.ant" classpath="${jdk.home.1.8}/lib/ant-javafx.jar"/>
  162. </target>
  163. <target name="clean.artifact.maquinaturing" description="clean MaquinaTuring artifact output">
  164. <delete dir="${artifact.output.maquinaturing}"/>
  165. </target>
  166. <target xmlns:fx="javafx:com.sun.javafx.tools.ant" name="artifact.maquinaturing" depends="init.artifacts, compile.module.fundamentos" description="Build &#39;MaquinaTuring&#39; artifact">
  167. <mkdir dir="${artifact.output.maquinaturing}"/>
  168. <copy todir="${artifact.temp.output.MT}">
  169. <fileset dir="${fundamentos.output.dir}"/>
  170. </copy>
  171. <fx:fileset id="all_but_MT" dir="${artifact.temp.output.MT}" includes="**/*.jar">
  172. <exclude name="MT.jar"/>
  173. </fx:fileset>
  174. <fx:fileset id="all_MT" dir="${artifact.temp.output.MT}" includes="**/*.jar"/>
  175. <fx:application id="MT_id" name="MaquinaTuring" mainClass="cl.cromer.mt.MT"/>
  176. <fx:jar destfile="${artifact.temp.output.MT}/MT.jar">
  177. <fx:application refid="MT_id"/>
  178. <fileset dir="${artifact.temp.output.MT}" excludes="**/*.jar"/>
  179. <fx:resources>
  180. <fx:fileset refid="all_but_MT"/>
  181. </fx:resources>
  182. <manifest>
  183. <attribute name="Implementation-Title" value="Maquina Turning"/>
  184. <attribute name="Implementation-Version" value=""/>
  185. <attribute name="Implementation-Vendor" value=""/>
  186. </manifest>
  187. </fx:jar>
  188. <condition property="app.icon.path" value="${basedir}/src/cl/cromer/mt/images/icon.png">
  189. <and>
  190. <os family="unix"/>
  191. <not>
  192. <os family="mac"/>
  193. </not>
  194. </and>
  195. </condition>
  196. <condition property="app.icon.path" value="${basedir}/src/cl/cromer/mt/images/icon.icns">
  197. <os family="mac"/>
  198. </condition>
  199. <condition property="app.icon.path" value="${basedir}/src/cl/cromer/mt/images/icon.ico">
  200. <os family="windows"/>
  201. </condition>
  202. <fx:deploy width="640" height="480" updatemode="background" outdir="${artifact.temp.output.MT}/deploy" outfile="MT" nativeBundles="all">
  203. <fx:application refid="MT_id"/>
  204. <fx:info title="Maquina Turning">
  205. <fx:icon href="${app.icon.path}"/>
  206. </fx:info>
  207. <fx:resources>
  208. <fx:fileset refid="all_MT"/>
  209. </fx:resources>
  210. </fx:deploy>
  211. <copy todir="${artifact.output.maquinaturing}">
  212. <fileset dir="${artifact.temp.output.MT}/deploy"/>
  213. </copy>
  214. <delete includeemptydirs="true">
  215. <fileset dir="${artifact.temp.output.MT}"/>
  216. </delete>
  217. </target>
  218. <target name="build.all.artifacts" depends="artifact.maquinaturing" description="Build all artifacts">
  219. <!-- Delete temporary files -->
  220. <delete dir="${artifacts.temp.dir}"/>
  221. </target>
  222. <target name="all" depends="build.modules, build.all.artifacts" description="build all"/>
  223. </project>