Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Enhance build script to make it easier to create release builds. Fixes #30 #36

Merged
merged 1 commit into from

2 participants

@whimboo
Owner

No description provided.

build.xml
((27 lines not shown))
<xmlproperty file="extension/install.rdf" collapseAttributes="true"/>
<property name="build.version" value="${RDF.Description.em:version}"/>
- <echo>build.version: ${build.version}</echo>
@davehunt Owner

I found the tasks to be handy for MemChaser. Any reason for removing them?

@whimboo Owner
whimboo added a note

Well, we directly use it below in the filename and it also gets dumped to the console. Do we really need it?

@davehunt Owner

It's useful when we build up the filename from variable components. Echoing the version as it was extracted from the RDF before seeing how it appears in the final filename. I also think we should keen the 'getversion' target and make it a dependency for 'release' and 'build'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
build.xml
((39 lines not shown))
<isset property="release"/>
</condition>
- <property name="package.filename" value="${ant.project.name}-${build.version}-${build.number}.xpi"/>
- <delete file="${package.filename}"/>
- <zip destfile="${package.filename}" basedir="extension" excludesfile=".gitignore"/>
- <echo>package.filename: ${package.filename}</echo>
+
+ <mkdir dir="${release.dir}" />
@davehunt Owner

You're putting the XPI in the release directory even when it's not a release build, is this desired?

@whimboo Owner
whimboo added a note

Shall I rename the folder to 'xpi'?

@davehunt Owner

Perhaps. Is there an issue with them being in the top level?

@whimboo Owner
whimboo added a note

It's just a better structure and it also limits the amount of data located in the top level folder. It's annoying when coding and you see all those files in the project pane.

@davehunt Owner

Fair enough. I think 'release' could be misleading though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
build.xml
((8 lines not shown))
<tstamp>
<format property="build.number" pattern="yyyyMMddHHmm"/>
</tstamp>
- <target name="getversion" unless="build.version">
+ <!-- Clean-up release directory -->
+ <target name="clean">
+ <delete dir="${release.dir}"/>
+ </target>
+
+ <!-- Build a release version of the XPI file -->
+ <target name="release">
+ <property name="release" value="1"/>
@davehunt Owner

You don't really need the 'release' property any more, you can simply set the package.filename appropriately as properties are immutable.

@whimboo Owner
whimboo added a note

Not sure, how this should work. The target release is calling build which then itself will re-set the filename. There has to be a condition. Or how do you think it should work? Can you please explain?

@davehunt Owner

As I said, properties are immutable. It will not be re-set by the following targets.

@whimboo Owner
whimboo added a note

Please check the line below. The release target is calling the build target, which itself is the default one.

@davehunt Owner

I realise that. You can set the filename property before you do that, and then you don't need the 'release' property or the condition in the 'build' target.

@whimboo Owner
whimboo added a note

But where should the xpi.filename property be set if we do not build a release? It cannot be done in build, and earlier is not possible due to the necessary properties aren't set yet. I could completely duplicate release and build and add another target to simply build the xpi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
build.xml
((8 lines not shown))
<tstamp>
<format property="build.number" pattern="yyyyMMddHHmm"/>
</tstamp>
- <target name="getversion" unless="build.version">
+ <target name="release" depends="version">
+ <echo>Build a release version of the extension</echo>
@davehunt Owner

This should probably be in the target's description attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
build.xml
((8 lines not shown))
<tstamp>
<format property="build.number" pattern="yyyyMMddHHmm"/>
</tstamp>
- <target name="getversion" unless="build.version">
+ <target name="release" depends="version">
+ <echo>Build a release version of the extension</echo>
+ <property name="xpi.filename" value="${ant.project.name}-${build.version}.xpi" />
+ <antcall target="build" />
+ </target>
+
+ <target name="dev" depends="version">
+ <echo>Build a development version of the extension: ${build.number}</echo>
+ <property name="xpi.filename" value="${ant.project.name}-${build.version}-${build.number}.xpi" />
+ <antcall target="build" />
+ </target>
+
+ <target name="build" depends="clean">
@davehunt Owner

This would fail if called directly because xpi.filename is not set. Why not just make 'build' the default with the filename value from dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@davehunt
Owner

Looks good to me.

@whimboo whimboo was assigned
@whimboo whimboo merged commit eee335b into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 35 additions and 17 deletions.
  1. +1 −0  .gitignore
  2. +5 −5 README.md
  3. +29 −12 build.xml
View
1  .gitignore
@@ -1,3 +1,4 @@
+./xpi/
{8620c15f-30dc-4dba-a131-7c5d20cf4a29}
*.xpi
.DS_Store
View
10 README.md
@@ -11,15 +11,15 @@ Nightly Tester Tools is an addon for aiding testers of nightly builds of Mozilla
# Install
You can install the latest stable NTT from [addons.mozilla.org](https://addons.mozilla.org/en-US/firefox/addon/6543/). To install for development, clone the repo:
- git clone git://github.com/mozilla/nightlytt.git
+ git clone git://github.com/mozilla/nightlytt.git
then add a file titled '{8620c15f-30dc-4dba-a131-7c5d20cf4a29}' to the "extensions" directory in your [profile folder](http://kb.mozillazine.org/Profile_folder) with the text:
- ~/nightlytt/
+ ~/nightlytt/
or whatever the path to your nightlytt folder is.
-To package the extension into an xpi for distribution simply `ant` and the default build script/target will be invoked:
+To package the extension into an xpi for distribution simply `ant` and the default dev script/target will be invoked:
ant
@@ -27,9 +27,9 @@ You can override the build number used in the filename:
ant -Dbuild.number=1
-To build for release (no build version in filename):
+To build for release (no build number in filename):
- ant -Drelease=true
+ ant release
# Development
All bugs are reported to the Nightly Tester Tools component at bugzilla.mozilla.org. [bug list](https://bugzilla.mozilla.org/buglist.cgi?query_format=advanced&component=Nightly%20Tester%20Tools&product=Other%20Applications), [file a bug](https://bugzilla.mozilla.org/enter_bug.cgi?product=Other%20Applications&component=Nightly%20Tester%20Tools). Check out [the wiki](https://wiki.mozilla.org/Auto-tools/Projects/NightlyTesterTools) for a list of current and proposed features and feel free to file bugs and submit patches.
View
41 build.xml
@@ -1,24 +1,41 @@
<?xml version="1.0"?>
-<project name="nightlytt" default="package">
+<project name="nightlytt" default="dev">
+ <!-- Directories -->
+ <property name="xpi.dir" value="./xpi"/>
+
<tstamp>
<format property="build.number" pattern="yyyyMMddHHmm"/>
</tstamp>
- <target name="getversion" unless="build.version">
+ <target name="release" depends="version"
+ description="Builds a release version">
+ <property name="xpi.filename" value="${ant.project.name}-${build.version}.xpi" />
+
+ <antcall target="dev" />
+ </target>
+
+ <target name="dev" depends="clean, version"
+ description="Builds a development version">
+ <property name="xpi.filename" value="${ant.project.name}-${build.version}-${build.number}.xpi" />
+
+ <mkdir dir="${xpi.dir}" />
+ <zip destfile="${xpi.dir}/${xpi.filename}"
+ basedir="extension"
+ excludesfile=".gitignore"/>
+ </target>
+
+ <target name="clean"
+ description="Clean-up XPI directory">
+ <delete dir="${xpi.dir}"/>
+ </target>
+
+ <target name="version" unless="build.version"
+ description="Shows the current version">
<xmlproperty file="extension/install.rdf" collapseAttributes="true"/>
<property name="build.version" value="${RDF.Description.em:version}"/>
+
<echo>build.version: ${build.version}</echo>
</target>
-
- <target name="package" depends="getversion">
- <condition property="package.filename" value="${ant.project.name}-${build.version}.xpi">
- <isset property="release"/>
- </condition>
- <property name="package.filename" value="${ant.project.name}-${build.version}-${build.number}.xpi"/>
- <delete file="${package.filename}"/>
- <zip destfile="${package.filename}" basedir="extension" excludesfile=".gitignore"/>
- <echo>package.filename: ${package.filename}</echo>
- </target>
</project>
Something went wrong with that request. Please try again.