Skip to content

Commit

Permalink
add metadata to generated jars
Browse files Browse the repository at this point in the history
  • Loading branch information
psybers committed Nov 13, 2023
1 parent a94ccab commit caee4ce
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,47 @@


<!-- packaging -->
<target name="git.revision" description="Store git revision in ${repository.version}">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="log" />
<arg value="-1" />
<arg value="--pretty=format:%H" />
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater" />
</and>
</condition>
</target>

<target name="git.branch" description="Store git branch in ${repository.branch}">
<exec executable="git" outputproperty="git.branch" failifexecutionfails="false" errorproperty="">
<arg value="branch" />
<arg value="--show-current" />
</exec>
<condition property="repository.branch" value="${git.branch}" else="unknown">
<and>
<isset property="git.branch"/>
<length string="${git.branch}" trim="yes" length="0" when="greater" />
</and>
</condition>
</target>

<target name="package" depends="package-runtime,package-compiler" description="Package both the compiler and runtime JARs."/>

<target name="package-runtime" depends="compile" description="Package the runtime JAR.">
<target name="package-runtime" depends="compile,git.branch,git.revision" description="Package the runtime JAR.">
<tstamp>
<format property="time.stamp" pattern="yyyy-MM-dd_HH:mm:ss"/>
</tstamp>
<jar destfile="dist/boa-runtime.jar">
<manifest>
<section name="boa">
<attribute name="Boa-Compiler-Branch" value="${repository.branch}" />
<attribute name="Boa-Compiler-Commit" value="${repository.version}" />
<attribute name="Boa-Compiler-CompiledDate" value="${time.stamp}" />
</section>
</manifest>
<fileset dir="build/classes">
<patternset>
<include name="boa/" />
Expand All @@ -473,10 +510,18 @@
</jar>
</target>

<target name="package-compiler" depends="compile" description="Package the compiler JAR.">
<target name="package-compiler" depends="compile,git.branch,git.revision" description="Package the compiler JAR.">
<tstamp>
<format property="time.stamp" pattern="yyyy-MM-dd_HH:mm:ss"/>
</tstamp>
<jar destfile="dist/boa-compiler.jar">
<manifest>
<attribute name="Main-Class" value="boa.BoaMain" />
<section name="boa">
<attribute name="Boa-Compiler-Branch" value="${repository.branch}" />
<attribute name="Boa-Compiler-Commit" value="${repository.version}" />
<attribute name="Boa-Compiler-CompiledDate" value="${time.stamp}" />
</section>
</manifest>
<fileset dir="build/classes" />
<fileset dir="conf" />
Expand Down

0 comments on commit caee4ce

Please sign in to comment.