Better handling of default jack version

Bug: 24564814

Change-Id: Ie8120c97e0fa10953d4d015afd27aacfac80e5b6
diff --git a/tools/Android.mk b/tools/Android.mk
index 589bf02..cd99598 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -67,7 +67,7 @@
 # dex build targets.
 #
 LOCAL_MODULE := jack
-LOCAL_SRC_FILES := jacks/jack-2.23.RELEASE.jar
+LOCAL_SRC_FILES := jacks/jack-$(JACK_STABLE_VERSION).jar
 LOCAL_MODULE_CLASS := JAVA_LIBRARIES
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
diff --git a/tools/jack_for_module.mk b/tools/jack_for_module.mk
new file mode 100644
index 0000000..6623a48
--- /dev/null
+++ b/tools/jack_for_module.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2015 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.
+#
+
+#
+# Define version of Jack used to compile one module by defining the var <module name>.JACK_VERSION
+# with value, the Jack version code. See possible values in prebuilts/sdk/tools/jack_versions.mk.
diff --git a/tools/jack_versions.mk b/tools/jack_versions.mk
new file mode 100644
index 0000000..ffff813
--- /dev/null
+++ b/tools/jack_versions.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2015 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.
+#
+
+JACK_STABLE_VERSION := 2.23.RELEASE
+JACK_DOGFOOD_VERSION := 3.2.ALPHA
+JACK_CANARY_VERSION := 3.2.ALPHA
+
+ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
+# Unbundled branches
+JACK_DEFAULT_VERSION := $(JACK_STABLE_VERSION)
+else
+# Complete android tree
+JACK_DEFAULT_VERSION := $(JACK_STABLE_VERSION)
+endif
\ No newline at end of file