Skip to content
Snippets Groups Projects
Commit 9f2fec4d authored by Jesper's avatar Jesper
Browse files

Improved version handling

- build script can now tag and commit a new release
- added build-dist target to build only distribution files
- renamed version JastAdd.properties to Version.properties
- simplified release.sh
parent dac9c937
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@
<property name="bin.dir" location="bin"/>
<property name="tools.dir" value="tools"/>
<property name="tt.src.dir" value="tinytemplate/src/java"/>
<property file="${res.dir}/JastAdd.properties" prefix="jastadd"/>
<condition property="jastadd-jar" value="${jastadd.jar}"
else="${tools.dir}/jastadd2.jar">
......@@ -148,7 +147,35 @@
</zip>
</target>
<target name="release" description="build source-zip and bin-zip">
<target name="release" if="version"
description="tag and commit new JastAdd2 release">
<echo message="Bumping version string and tagging release ${version}"/>
<propertyfile file="${res.dir}/Version.properties">
<entry key="version" value="${version}"/>
</propertyfile>
<exec executable="git">
<arg value="update-index"/>
<arg value="--no-assume-unchanged"/>
<arg value="${res.dir}/Version.properties"/>
</exec>
<exec executable="git">
<arg value="commit"/>
<arg value="-m"/>
<arg value="Release ${version}"/>
<arg value="${res.dir}/Version.properties"/>
</exec>
<exec executable="git">
<arg value="tag"/>
<arg value="-a"/>
<arg value="${version}"/>
<arg value="-m"/>
<arg value="Version ${version}"/>
</exec>
<antcall target="build-dist"/>
</target>
<target name="build-dist"
description="build source and binary distribution files">
<antcall target="clean"/>
<antcall target="source-zip"/>
<antcall target="bin-zip"/>
......@@ -159,7 +186,8 @@
<copy file="jastadd2.jar" toDir="${tools.dir}"/>
</target>
<target name="update-version-string">
<!-- this target is only run if the 'version' property is undefined -->
<target name="update-version-string" unless="version">
<!-- get a new version string using git describe if possible -->
<echo message="Updating JastAdd version string..."/>
<exec executable="git" outputproperty="version"
......@@ -172,13 +200,13 @@
<target name="-store-version-string" if="version">
<!-- store the new version string in the correct property file -->
<echo message="version=${version}"/>
<propertyfile file="${res.dir}/JastAdd.properties">
<propertyfile file="${res.dir}/Version.properties">
<entry key="version" value="${version}"/>
</propertyfile>
<exec executable="git">
<arg value="update-index"/>
<arg value="--assume-unchanged"/>
<arg value="${res.dir}/JastAdd.properties"/>
<arg value="${res.dir}/Version.properties"/>
</exec>
</target>
......
......@@ -18,26 +18,8 @@ while true; do
esac
done
echo "Bumping version string..."
echo "version=$VERSION" > src/res/JastAdd.properties
echo "Patching documentation files to use the correct version number..."
sed -e 's/\(JastAdd2 Release \)R[0-9]*/\1'${VERSION}'/' \
doc/index.md > doc/index.md.new
mv doc/index.md.new doc/index.md
sed -e 's/\(manual for JastAdd2 \)R[0-9]*/\1'${VERSION}'/' \
doc/reference-manual.html > doc/reference-manual.html.new
mv doc/reference-manual.html.new doc/reference-manual.html
echo "Committing changes..."
git commit -m "Bumped version string" src/res/JastAdd.properties \
doc/index.md doc/reference-manual.html
echo "Tagging the release..."
git tag -a $VERSION -m "Version $VERSION"
echo "Building release..."
ant release
ant release -Dversion=$VERSION
echo "Creating new directory at jastadd.org..."
ssh login.cs.lth.se "mkdir /cs/jastadd/releases/jastadd2/$VERSION"
......
......@@ -53,32 +53,28 @@ import ast.AST.TokenComponent;
*/
public class JastAdd {
private static ResourceBundle resources = null;
private static String RESOURCE_NAME = "JastAdd";
private static String getString(String key) {
if (resources == null) {
private static final String version;
static {
try {
resources = ResourceBundle.getBundle(RESOURCE_NAME);
ResourceBundle resources = ResourceBundle.getBundle("Version");
version = resources.getString("version");
} catch (MissingResourceException e) {
throw new Error("Could not open the resource " + RESOURCE_NAME);
throw new Error("Could not open Version resource bundle");
}
}
return resources.getString(key);
}
/**
* @return Short version string
*/
public static String getVersionString() {
return "JastAdd2 " + getString("version");
return "JastAdd2 " + version;
}
/**
* @return Version string including link to JastAdd homepage
*/
public static String getLongVersionString() {
return "JastAdd2 (http://jastadd.org) version " +
getString("version");
return "JastAdd2 (http://jastadd.org) version " + version;
}
private final JastAddConfiguration config;
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment