summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Haeberling <haeberling@google.com>2013-08-30 23:35:52 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-30 23:35:53 (GMT)
commit72a57ddf178b410ffb3c4532fc4e56b8b1d99706 (patch)
treee811b6476364a43dd3efd342b664a2f3d5dfcce4
parent750e73c4a4b04a5695540d3c982774662307b58e (diff)
parent30239937e7722ca376864d888cc2edaca21a496d (diff)
downloadandroid_packages_apps_Snap-72a57ddf178b410ffb3c4532fc4e56b8b1d99706.zip
android_packages_apps_Snap-72a57ddf178b410ffb3c4532fc4e56b8b1d99706.tar.gz
android_packages_apps_Snap-72a57ddf178b410ffb3c4532fc4e56b8b1d99706.tar.bz2
Merge "Automatic versioning for Camera." into gb-ub-photos-carlsbad
-rw-r--r--Android.mk9
-rw-r--r--AndroidManifest.xml4
-rw-r--r--version.mk98
3 files changed, 106 insertions, 5 deletions
diff --git a/Android.mk b/Android.mk
index 18e4e56..a3659d0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -13,7 +13,12 @@ LOCAL_SRC_FILES += $(call all-java-files-under, src_pd)
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res
-LOCAL_AAPT_FLAGS := --auto-add-overlay
+
+include $(LOCAL_PATH)/version.mk
+LOCAL_AAPT_FLAGS := \
+ --auto-add-overlay \
+ --version-name "$(version_name_package)" \
+ --version-code $(version_code_package) \
LOCAL_PACKAGE_NAME := Camera2
@@ -23,4 +28,4 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags
include $(BUILD_PACKAGE)
-include $(call all-makefiles-under, $(LOCAL_PATH)) \ No newline at end of file
+include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e34da9b..c5e1916 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.camera2"
- android:versionCode="1"
- android:versionName="2.0" >
+ package="com.android.camera2">
<uses-sdk
android:minSdkVersion="14"
diff --git a/version.mk b/version.mk
new file mode 100644
index 0000000..2b6077a
--- /dev/null
+++ b/version.mk
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2013 Google Inc.
+#
+
+# The version code scheme for the package apk is:
+# Mmbbbtad
+# where
+# M - major version (one or more digits)
+# m - minor version (exactly 1 digit)
+# bbb - manually specified build number (exactly 3 digits)
+# t - build type (exactly 1 digit). Current valid values are:
+# 0 : eng build
+# 1 : build server build
+# a - device architecture (exactly 1 digit). Current valid values are:
+# 0 : non-native
+# 1 : armv5te
+# 3 : armv7-a
+# 5 : mips
+# 7 : x86
+# d - asset density (exactly 1 digit). Current valid values are:
+# 0 : all densities
+# 2 : mdpi
+# 4 : hdpi
+# 6 : xhdpi
+# Mmbbb is specified manually. tad is automatically set during the build.
+#
+# For the client jar, the version code is agnostic to the target architecture and density: Mmbbbt00
+#
+# NOTE: arch needs to be more significant than density because x86 devices support running ARM
+# code in emulation mode, so all x86 versions must be higher than all ARM versions to ensure
+# we deliver true x86 code to those devices.
+
+# Specify the following manually. Note that base_version_minor must be exactly 1 digit and
+# base_version_build must be exactly 3 digits.
+base_version_major := 2
+base_version_minor := 0
+base_version_build := 001
+
+#####################################################
+#####################################################
+# Collect automatic version code parameters
+ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
+ # This is an eng build
+ base_version_buildtype := 0
+else
+ # This is a build server build
+ base_version_buildtype := 1
+endif
+
+ifeq "$(TARGET_ARCH)" "x86"
+ base_version_arch := 7
+else ifeq "$(TARGET_ARCH)" "mips"
+ base_version_arch := 5
+else ifeq "$(TARGET_ARCH)" "arm"
+ ifeq ($(TARGET_ARCH_VARIANT),armv5te)
+ base_version_arch := 1
+ else
+ base_version_arch := 3
+ endif
+else
+ base_version_arch := 0
+endif
+
+ifeq "$(package_dpi)" "mdpi"
+ base_version_density := 2
+else ifeq "$(package_dpi)" "hdpi"
+ base_version_density := 4
+else ifeq "$(package_dpi)" "xhdpi"
+ base_version_density := 6
+else
+ base_version_density := 0
+endif
+
+# Build the version code
+version_code_package := $(base_version_major)$(base_version_minor)$(base_version_build)$(base_version_buildtype)$(base_version_arch)$(base_version_density)
+
+# The version name scheme for the package apk is:
+# - For eng build (t=0): M.m.bbb eng.$(USER)-hh
+# - For build server (t=1): M.m.bbb (nnnnnn-hh)
+# where nnnnnn is the build number from the build server (no zero-padding)
+# On eng builds, the BUILD_NUMBER has the user and timestamp inline
+ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
+ git_hash := $(shell git --git-dir $(LOCAL_PATH)/.git log -n 1 --pretty=format:%h)
+ date_string := $(shell date +%m%d%y_%H%M%S)
+ version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) (eng.$(USER).$(git_hash).$(date_string)-$(base_version_arch)$(base_version_density))
+else
+ version_name_package := $(base_version_major).$(base_version_minor).$(base_version_build) ($(BUILD_NUMBER)-$(base_version_arch)$(base_version_density))
+endif
+
+# Cleanup the locals
+base_version_major :=
+base_version_minor :=
+base_version_build :=
+base_version_buildtype :=
+base_version_arch :=
+base_version_density :=
+git_hash :=
+date_string :=