diff options
author | Jean-Philippe Lesot <jplesot@google.com> | 2014-11-05 19:33:26 +0100 |
---|---|---|
committer | Jean-Philippe Lesot <jplesot@google.com> | 2014-11-05 19:34:13 +0100 |
commit | 0f5335fb7a5710a26826df215d31289d91868d91 (patch) | |
tree | 1f8cb760e1a5090ce5cd39f8c4b427a53cd66929 /jill | |
parent | 3e80c4622e730e67bc99cace280bb4dd911df42d (diff) | |
download | toolchain_jill-0f5335fb7a5710a26826df215d31289d91868d91.zip toolchain_jill-0f5335fb7a5710a26826df215d31289d91868d91.tar.gz toolchain_jill-0f5335fb7a5710a26826df215d31289d91868d91.tar.bz2 |
Rework version management
Bug: 108682
Change-Id: Id2b85a5853938aa8993760407c0d71e912892e38
Diffstat (limited to 'jill')
-rw-r--r-- | jill/Android.mk | 25 | ||||
-rw-r--r-- | jill/rsc/jill.properties | 17 | ||||
-rw-r--r-- | jill/src/com/android/jill/Main.java | 33 |
3 files changed, 42 insertions, 33 deletions
diff --git a/jill/Android.mk b/jill/Android.mk index f2fd58c..0e7fc96 100644 --- a/jill/Android.mk +++ b/jill/Android.mk @@ -16,15 +16,13 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -JILL_BASE_VERSION_NAME := 1.0 -JILL_BASE_VERSION_CODE := 001 - LOCAL_MODULE := jill LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_JAVA_RESOURCE_DIRS := rsc LOCAL_JAR_MANIFEST := etc/manifest.txt LOCAL_STATIC_JAVA_LIBRARIES := \ @@ -34,19 +32,6 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ args4j-jack \ schedlib -ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" - JILL_VERSION_NAME_TAG := eng.$(USER) -else - JILL_VERSION_NAME_TAG := $(BUILD_NUMBER) -endif - -JILL_VERSION_NAME := "$(JILL_BASE_VERSION_NAME).$(JILL_BASE_VERSION_CODE).$(JILL_VERSION_NAME_TAG)" - -intermediates := $(call local-intermediates-dir,COMMON) -$(intermediates)/rsc/jill.properties: $(LOCAL_PATH)/Android.mk - $(hide) mkdir -p $(dir $@) - $(hide) echo "jill.version=$(JILL_VERSION_NAME)" > $@ - LOCAL_JAVA_RESOURCE_FILES := $(intermediates)/rsc/jill.properties include $(BUILD_HOST_JAVA_LIBRARY) @@ -54,8 +39,6 @@ include $(BUILD_HOST_JAVA_LIBRARY) # Include this library in the build server's output directory $(call dist-for-goals, dist_files, $(LOCAL_BUILT_MODULE):jill.jar) - - include $(CLEAR_VARS) LOCAL_MODULE := jill-jarjar-asm @@ -64,6 +47,7 @@ LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_JAVA_RESOURCE_DIRS := rsc LOCAL_JAR_MANIFEST := etc/manifest.txt LOCAL_STATIC_JAVA_LIBRARIES := \ @@ -73,11 +57,6 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ args4j-jack \ schedlib -intermediates := $(call local-intermediates-dir,COMMON) -$(intermediates)/rsc/jill.properties: - $(hide) mkdir -p $(dir $@) - $(hide) echo "jill.version=$(JILL_VERSION_NAME)" > $@ - LOCAL_JAVA_RESOURCE_FILES := $(intermediates)/rsc/jill.properties LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt diff --git a/jill/rsc/jill.properties b/jill/rsc/jill.properties new file mode 100644 index 0000000..6ce1663 --- /dev/null +++ b/jill/rsc/jill.properties @@ -0,0 +1,17 @@ +# +# Copyright (C) 2014 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +jill.version=1.1-a1 +jill.version.codename=B diff --git a/jill/src/com/android/jill/Main.java b/jill/src/com/android/jill/Main.java index 7c65d47..b7f42b2 100644 --- a/jill/src/com/android/jill/Main.java +++ b/jill/src/com/android/jill/Main.java @@ -112,7 +112,7 @@ public class Main { return options; } - public static void run(@Nonnull Options options) throws IOException { + public static void run(@Nonnull Options options) { new Jill(options, Main.getVersion()).process(options.getBinaryFile()); } @@ -124,18 +124,31 @@ public class Main { } @Nonnull - private static String getVersion() throws IOException { - String version = "Unknown (no ressource file)"; + private static final String PROPERTIES_FILE = "jill.properties"; - InputStream is = Main.class.getClassLoader().getResourceAsStream("jill.properties"); + @Nonnull + public static String getVersion() { + String version = "Unknown (problem with " + PROPERTIES_FILE + " resource file)"; + + InputStream is = Main.class.getClassLoader().getResourceAsStream(PROPERTIES_FILE); if (is != null) { Properties prop = new Properties(); - prop.load(is); - version = prop.getProperty("jill.version", "Unknown (no jill.version entry)"); - - String codeBase = prop.getProperty("jill.version.codebase"); - if (codeBase != null) { - version += " (" + codeBase + ")"; + try { + prop.load(is); + String rawVersion = prop.getProperty("jill.version"); + if (rawVersion != null) { + version = rawVersion; + + String codeName = prop.getProperty("jill.version.codename"); + if (codeName != null) { + version += " \'" + codeName + '\''; + } + + String codeBase = prop.getProperty("jill.version.codebase", "engineering"); + version += " (" + codeBase + ")"; + } + } catch (IOException e) { + // Return default version } } |