summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Lesinski <adamlesinski@google.com> 2014-08-18 14:06:38 -0700
committer Adam Lesinski <adamlesinski@google.com> 2014-08-18 23:42:21 +0000
commitad751224401564dcc8338df3d5c4c5de7722be8f (patch)
tree823f29de0c71927f2f957a57736ee77205035042
parent90aefa2030b346d8e819157d83edf97733d8592b (diff)
Include build number in aapt version
Teams are constantly confused over which version of aapt they are running. Include the build number from the Android build system in the binary. Can be retrieved by executing 'aapt version'. Change-Id: I9165c7d01f977344e143c2cb4dd963310ab28b72
-rw-r--r--tools/aapt/Android.mk8
-rw-r--r--tools/aapt/Command.cpp6
2 files changed, 13 insertions, 1 deletions
diff --git a/tools/aapt/Android.mk b/tools/aapt/Android.mk
index 700afa1d570d..4ce504544b91 100644
--- a/tools/aapt/Android.mk
+++ b/tools/aapt/Android.mk
@@ -66,6 +66,8 @@ aaptHostStaticLibs := \
libexpat \
libziparchive-host
+aaptCFlags := -DAAPT_VERSION=\"$(BUILD_NUMBER)\"
+
ifeq ($(HOST_OS),linux)
aaptHostLdLibs += -lrt -ldl -lpthread
endif
@@ -91,6 +93,7 @@ LOCAL_C_INCLUDES += $(aaptCIncludes)
LOCAL_CFLAGS += -Wno-format-y2k
LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS
+LOCAL_CFLAGS += $(aaptCFlags)
ifeq (darwin,$(HOST_OS))
LOCAL_CFLAGS += -D_DARWIN_UNLIMITED_STREAMS
endif
@@ -110,7 +113,9 @@ LOCAL_SRC_FILES := $(aaptMain)
LOCAL_STATIC_LIBRARIES += \
libaapt \
$(aaptHostStaticLibs)
+
LOCAL_LDLIBS += $(aaptHostLdLibs)
+LOCAL_CFLAGS += $(aaptCFlags)
include $(BUILD_HOST_EXECUTABLE)
@@ -128,7 +133,9 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_STATIC_LIBRARIES += \
libaapt \
$(aaptHostStaticLibs)
+
LOCAL_LDLIBS += $(aaptHostLdLibs)
+LOCAL_CFLAGS += $(aaptCFlags)
include $(BUILD_HOST_NATIVE_TEST)
@@ -159,6 +166,7 @@ LOCAL_STATIC_LIBRARIES := \
libstlport_static \
libexpat_static
+LOCAL_CFLAGS += $(aaptCFlags)
LOCAL_CPPFLAGS += -Wno-non-virtual-dtor
include $(BUILD_EXECUTABLE)
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 5d146d65bded..bdbf47b2611c 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -24,6 +24,10 @@
using namespace android;
+#ifndef AAPT_VERSION
+ #define AAPT_VERSION ""
+#endif
+
/*
* Show version info. All the cool kids do it.
*/
@@ -32,7 +36,7 @@ int doVersion(Bundle* bundle)
if (bundle->getFileSpecCount() != 0) {
printf("(ignoring extra arguments)\n");
}
- printf("Android Asset Packaging Tool, v0.2\n");
+ printf("Android Asset Packaging Tool, v0.2-" AAPT_VERSION "\n");
return 0;
}