Skip to content

Commit

Permalink
Update to build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainhalle committed Apr 29, 2021
1 parent a9785f0 commit 5d7bf85
Show file tree
Hide file tree
Showing 9 changed files with 458 additions and 162 deletions.
84 changes: 59 additions & 25 deletions Source/Core/build.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
AntRun, a general-purpose Ant build script
Copyright (C) 2015-2019 Sylvain Hallé
Copyright (C) 2015-2021 Sylvain Hallé
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -23,7 +23,7 @@
xmlns:jacoco="antlib:org.jacoco.ant">

<!-- The build script's version number. Do not edit! -->
<property name="antrun.version" value="1.4.3"/>
<property name="antrun.version" value="1.6.1"/>

<!-- Load project properties from XML file -->
<xmlproperty file="config.xml"/>
Expand All @@ -40,9 +40,12 @@
<!-- The project's version number -->
<property name="build.version" value="1.0"/>

<!-- The target JDK version for the build -->
<property name="build.targetjdk" value="1.6"/>

<!-- The folder where libraries (ant-contrib, etc.) will be downloaded
if necessary -->
<property name="build.libdir" value="lib"/>
<property name="build.libdir" value="Source/Core/lib"/>

<!-- The folder with the project's source files -->
<property name="build.srcdir" value="Source/Core/src"/>
Expand All @@ -51,7 +54,7 @@
<property name="build.bindir" value="Source/Core/bin"/>

<!-- The folder where the downloaded dependencies (if any) should go -->
<property name="build.depdir" value="dep"/>
<property name="build.depdir" value="Source/Core/dep"/>

<!-- The folder with the project's test source files -->
<property name="build.test.srcdir" value="Source/CoreTest/src"/>
Expand Down Expand Up @@ -94,7 +97,7 @@
<!-- The filename pattern to recognize test files -->
<property name="build.test.filenamepattern" value="**/*.java"/>

<!-- Location of the Java 6 boot classpath. If this is not set, the compiler
<!-- Location of the Java boot classpath. If this is not set, the compiler
will resort to the default boot classpath. -->
<property environment="env"/>
<property name="java6.boot.classpath" value="${env.JAVA6_BOOTCLASSES}"/>
Expand All @@ -105,7 +108,7 @@
<!-- Target: initialization
All other targets should ultimately
depend on this one (except perhaps very simple ones such as
"clean".
"clean" and "wipe".
-->
<target name="init" depends="ant-contrib,xmltask"
description="Initialize the project">
Expand Down Expand Up @@ -145,6 +148,9 @@
<pathelement location="${build.test.bindir}"/>
<pathelement path="${java.class.path}"/>
</path>
<!-- Create empty doc folders -->
<mkdir dir="${build.docdir}"/>
<mkdir dir="${build.docdir}/doc-files"/>
</target>

<!-- Check if a local rt.jar is present. If so, it will override the
Expand Down Expand Up @@ -183,10 +189,10 @@
<!-- Target: compile
Compiles the main project
-->
<target name="compile" depends="init,junit,check-rt" description="Compile the sources">
<target name="compile" depends="init,junit,check-rt,download-deps" description="Compile the sources">
<mkdir dir="${build.bindir}"/>
<javac
target="1.6" source="1.6"
target="${build.targetjdk}" source="${build.targetjdk}"
bootclasspath="${java6.boot.classpath}"
srcdir="${build.srcdir}"
destdir="${build.bindir}"
Expand Down Expand Up @@ -257,7 +263,7 @@
<!-- Target: jar
Generates a JAR file with the compiled files and javadoc
-->
<target name="jar" depends="compile,javadoc" description="Create the runnable JAR">
<target name="jar" depends="compile" description="Create the runnable JAR">
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
Expand All @@ -274,10 +280,10 @@
<include name="**/*.jar" if="${build.jar.withdeps}"/>
</zipgroupfileset>
<fileset dir="${build.srcdir}">
<include name="*" if="${build.jar.withsrc}"/>
<include name="**/*" if="${build.jar.withsrc}"/>
</fileset>
<fileset dir="${build.docdir}">
<include name="*" if="${build.jar.withdoc}"/>
<include name="**/*" if="${build.jar.withdoc}"/>
</fileset>
</jar>
</target>
Expand All @@ -292,7 +298,7 @@
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${build.libdir}/jacocoant.jar"/>
</taskdef>
<jacoco:coverage>
<jacoco:coverage destfile="${test.reportdir}/jacoco.exec">
<junit printsummary="yes" haltonfailure="false" fork="true"
failureproperty="test.failed">
<classpath refid="build.test.classpath"/>
Expand All @@ -315,7 +321,7 @@
<!-- JaCoCo report -->
<jacoco:report>
<executiondata>
<file file="jacoco.exec"/>
<file file="${test.reportdir}/jacoco.exec"/>
</executiondata>
<structure name="${build.name}">
<classfiles>
Expand All @@ -331,6 +337,12 @@
<fail if="test.failed"/>
</target>

<!-- Target: all
Downloads deps, compiles, runs tests, creates JAR
-->
<target name="all" depends="init,test,jar" description="Setup, compile, run tests, create JAR">
</target>

<!-- Target: install-deps
Copies whatever was fetched by the download-deps task into the
system's extension folder. This task should probably be run as
Expand All @@ -342,12 +354,12 @@
</copy>
</target>

<!-- Target: clean
<!-- Target: wipe
Wipes any temporary files or directories
-->
<target name="clean" description="Clean the project">
<target name="wipe" description="Wipes the project: deletes everything but sources">
<delete>
<fileset dir="." includes="**/*.xml~"/>
<fileset dir="." includes="**/*~"/>
</delete>
<delete dir="${build.libdir}"/>
<delete dir="${build.bindir}"/>
Expand All @@ -358,6 +370,19 @@
<delete file="jacoco.exec"/>
</target>

<!-- Target: clean
Deletes compiled files and test reports
-->
<target name="clean" description="Cleans compiled files and test reports">
<delete>
<fileset dir="." includes="**/*~"/>
</delete>
<delete dir="${build.bindir}"/>
<delete dir="${test.reportdir}"/>
<delete dir="${coverage.reportdir}"/>
<delete file="jacoco.exec"/>
</target>

<!-- Target: show-properties
Prints all the properties.
-->
Expand Down Expand Up @@ -429,12 +454,11 @@
<target name="download-rt6">
<get src="http://sylvainhalle.github.io/AntRun/dependencies/1.6.0_45/rt.jar" dest="${build.rtlocation}"/>
</target>


<!-- Target: junit
Download jUnit JARs if not present, and puts them in the lib folder
-->
<property name="junit.jarname" value="junit-4.12.jar"/>
<property name="junit.jarname" value="junit-4.13.2.jar"/>
<property name="junit.hamcrest" value="hamcrest-core-1.3.jar"/>
<condition property="junit.absent" value="false" else="true">
<and>
Expand All @@ -444,11 +468,7 @@
</condition>
<target name="junit" if="${junit.absent}" description="Install jUnit if not present">
<mkdir dir="${build.libdir}"/>
<!--
<get src="http://search.maven.org/remotecontent?filepath=junit/junit/4.12/${junit.jarname}" dest="${build.libdir}/${junit.jarname}"/>
<get src="http://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/${junit.hamcrest}" dest="${build.libdir}/${junit.hamcrest}"/>
-->
<get src="https://repo1.maven.org/maven2/junit/junit/4.12/${junit.jarname}" dest="${build.libdir}/${junit.jarname}"/>
<get src="https://repo1.maven.org/maven2/junit/junit/4.13.2/${junit.jarname}" dest="${build.libdir}/${junit.jarname}"/>
<get src="https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.3/${junit.hamcrest}" dest="${build.libdir}/${junit.hamcrest}"/>
</target>

Expand All @@ -461,7 +481,7 @@
</condition>
<target name="jacoco" if="${jacoco.absent}" description="Install JaCoCo if not present">
<mkdir dir="${build.libdir}"/>
<get src="http://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.1/jacoco-0.8.1.zip" dest="${build.libdir}/jacoco.zip"/>
<get src="http://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.6/jacoco-0.8.6.zip" dest="${build.libdir}/jacoco.zip"/>
<unzip src="${build.libdir}/jacoco.zip" dest="${build.libdir}">
<patternset>
<include name="**/*.jar"/>
Expand Down Expand Up @@ -550,6 +570,20 @@
</unzip>
</actions>
</call>
<call path="/build/dependencies/dependency[name='@{depname}']/files/tgz">
<param name="url" path="text()"/>
<actions>
<get src="@{url}" dest="${depdest}"/>
<var name="basename" unset="true"/>
<basename property="basename" file="@{url}"/>
<untar src="${depdest}/${basename}" dest="${depdest}" compression="gzip">
<patternset>
<include name="**/*.jar"/>
</patternset>
<mapper type="flatten"/>
</untar>
</actions>
</call>
</xmltask>
</else>
</if>
Expand All @@ -560,4 +594,4 @@
</sequential>
</target>
</project>
<!-- :tabWidth=2: -->
<!-- :tabWidth=2: -->
8 changes: 5 additions & 3 deletions Source/Core/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@
<filename>../azrael-core.jar</filename>
<basename>Azrael</basename>
</jar>


<!-- The project's main class -->
<!-- <mainclass>my.package.MainClass</mainclass> -->

<!-- The location of rt.jar -->
<rtlocation>../rt.jar</rtlocation>

<srcdir>src</srcdir>
<docdir>doc</docdir>
<depdir>dep</depdir>
<libdir>lib</libdir>
<libdir>../lib</libdir>
<bindir>bin</bindir>

<test>
Expand All @@ -50,7 +52,7 @@
<srcdir>src</srcdir>
<docdir>doc</docdir>
<depdir>dep</depdir>
<libdir>lib</libdir>
<libdir>../lib</libdir>
<bindir>bin</bindir>
</test>

Expand Down
Loading

0 comments on commit 5d7bf85

Please sign in to comment.