diff options
| -rw-r--r-- | altosdroid/.externalToolBuilders/Generate BuildInfo.java.launch | 11 | ||||
| -rw-r--r-- | altosdroid/.gitignore | 1 | ||||
| -rw-r--r-- | altosdroid/.project | 10 | ||||
| -rw-r--r-- | altosdroid/Makefile.am | 5 | ||||
| -rwxr-xr-x | altosdroid/buildinfo.sh | 31 | ||||
| -rw-r--r-- | altosdroid/src/org/altusmetrum/AltosDroid/BuildInfo.java.in | 28 | 
6 files changed, 86 insertions, 0 deletions
| diff --git a/altosdroid/.externalToolBuilders/Generate BuildInfo.java.launch b/altosdroid/.externalToolBuilders/Generate BuildInfo.java.launch new file mode 100644 index 00000000..3b8eff45 --- /dev/null +++ b/altosdroid/.externalToolBuilders/Generate BuildInfo.java.launch @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType"> +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?>
<resources>
<item path="/AltosDroid/src/org/altusmetrum/AltosDroid/BuildInfo.java" type="1"/>
</resources>}"/> +<booleanAttribute key="org.eclipse.debug.core.capture_output" value="false"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON" value="false"/> +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/AltosDroid/buildinfo.sh}"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/AltosDroid}"/> +</launchConfiguration> diff --git a/altosdroid/.gitignore b/altosdroid/.gitignore index c0bb8dd4..e3acba40 100644 --- a/altosdroid/.gitignore +++ b/altosdroid/.gitignore @@ -1,3 +1,4 @@  local.properties  bin  gen +src/org/altusmetrum/AltosDroid/BuildInfo.java diff --git a/altosdroid/.project b/altosdroid/.project index 7b56596a..ebe4a4bb 100644 --- a/altosdroid/.project +++ b/altosdroid/.project @@ -6,6 +6,16 @@  	</projects>  	<buildSpec>  		<buildCommand> +			<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> +			<triggers>auto,full,incremental,</triggers> +			<arguments> +				<dictionary> +					<key>LaunchConfigHandle</key> +					<value><project>/.externalToolBuilders/Generate BuildInfo.java.launch</value> +				</dictionary> +			</arguments> +		</buildCommand> +		<buildCommand>  			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>  			<arguments>  			</arguments> diff --git a/altosdroid/Makefile.am b/altosdroid/Makefile.am index 96831b72..3860e110 100644 --- a/altosdroid/Makefile.am +++ b/altosdroid/Makefile.am @@ -30,6 +30,7 @@ SRC=\  	$(SRC_DIR)/TelemetryLogger.java \  	$(SRC_DIR)/AltosBluetooth.java \  	$(SRC_DIR)/DeviceListActivity.java \ +	$(SRC_DIR)/BuildInfo.java \  	$(SRC_DIR)/Dumper.java  all: $(all_target) @@ -38,6 +39,9 @@ $(ALTOSLIB): $(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR)  	mkdir -p $(EXT_LIBDIR)  	cd $(EXT_LIBDIR) && ln -s $(shell echo $(EXT_LIBDIR) | sed 's|[^/]\+|..|g')/$(ALTOSLIB_SRCDIR)/$(ALTOSLIB_JAR) . +$(SRC_DIR)/BuildInfo.java: +	./buildinfo.sh +  if ANDROID  install-release: bin/AltosDroid-release.apk  	$(ADB) install -r bin/AltosDroid-release.apk @@ -55,3 +59,4 @@ endif  clean:  	$(clean_command) +.PHONY: $(SRC_DIR)/BuildInfo.java diff --git a/altosdroid/buildinfo.sh b/altosdroid/buildinfo.sh new file mode 100755 index 00000000..f620c4a0 --- /dev/null +++ b/altosdroid/buildinfo.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# + +describe=$(git describe --always 2>/dev/null || echo '') +if [ -n "$describe" ]; then +   version=$(echo $describe | cut -d- -f1) +   commitnum=$(echo $describe | cut -d- -f2) +   commithash=$(echo $describe | cut -d- -f3) +else +   . ../src/Version +   version=$VERSION +   commitnum='' +   commithash='' +fi + +builddate=$(date "+%Y-%m-%d") +buildtime=$(date "+%H:%M") + + +infile=src/org/altusmetrum/AltosDroid/BuildInfo.java.in +outfile=src/org/altusmetrum/AltosDroid/BuildInfo.java + +echo "Version $describe, built on $builddate, $buildtime" + +sed -e "s/@DESCRIBE@/$describe/" \ +    -e "s/@VERSION@/$version/" \ +    -e "s/@COMMITNUM@/$commitnum/" \ +    -e "s/@COMMITHASH@/$commithash/" \ +    -e "s/@BUILDDATE@/$builddate/" \ +    -e "s/@BUILDTIME@/$buildtime/" \ + $infile > $outfile diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/BuildInfo.java.in b/altosdroid/src/org/altusmetrum/AltosDroid/BuildInfo.java.in new file mode 100644 index 00000000..763f814e --- /dev/null +++ b/altosdroid/src/org/altusmetrum/AltosDroid/BuildInfo.java.in @@ -0,0 +1,28 @@ +/* + * Copyright © 2012 Mike Beattie <mike@ethernal.org> + * + * 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 + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.AltosDroid; + +public class BuildInfo { +	public static final String git_describe = "@DESCRIBE@"; +	public static final String version      = "@VERSION@"; +	public static final String commitnum    = "@COMMITNUM@"; +	public static final String commithash   = "@COMMITHASH@"; +	public static final String builddate    = "@BUILDDATE@"; +	public static final String buildtime    = "@BUILDTIME@"; +} + | 
