Merge "Ensure that BOARD_VNDK_VERSION is current"
diff --git a/core/Makefile b/core/Makefile
index 7de340f..9667485 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1187,11 +1187,11 @@
# so that we can get the size stat even if the build fails due to too large
# system image.
INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
-$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS)
+$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
- $(hide) build/tools/fileslist.py $(TARGET_OUT) > $(@:.txt=.json)
+ $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
$(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
.PHONY: installed-file-list
@@ -1634,11 +1634,11 @@
$(ALL_PDK_FUSION_FILES))
INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
-$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES)
+$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
- $(hide) build/tools/fileslist.py $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
+ $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
$(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
systemotherimage_intermediates := \
@@ -1681,11 +1681,11 @@
$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
-$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES)
+$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
- $(hide) build/tools/fileslist.py $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
+ $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
$(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
vendorimage_intermediates := \
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 063fe19..ed79bfc 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -2,7 +2,8 @@
## Clear out values of all variables used by rule templates.
###########################################################
-LOCAL_32_BIT_ONLY:= # '',true
+# '',true
+LOCAL_32_BIT_ONLY:=
LOCAL_AAPT_FLAGS:=
LOCAL_AAPT_INCLUDE_ALL_RESOURCES:=
LOCAL_ADDITIONAL_CERTIFICATES:=
@@ -99,7 +100,8 @@
LOCAL_JACK_CLASSPATH:=
LOCAL_JACK_COVERAGE_EXCLUDE_FILTER:=
LOCAL_JACK_COVERAGE_INCLUDE_FILTER:=
-LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED) # '' (ie disabled), disabled, full, incremental
+# '' (ie disabled), disabled, full, incremental
+LOCAL_JACK_ENABLED:=$(DEFAULT_JACK_ENABLED)
LOCAL_JACK_FLAGS:=
LOCAL_JACK_PLUGIN:=
LOCAL_JACK_PLUGIN_PATH:=
@@ -178,12 +180,14 @@
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
LOCAL_PREBUILT_STRIP_COMMENTS:=
LOCAL_PRIVILEGED_MODULE:=
-LOCAL_PROGUARD_ENABLED:= # '',full,custom,nosystem,disabled,obfuscation,optimization
+# '',full,custom,nosystem,disabled,obfuscation,optimization
+LOCAL_PROGUARD_ENABLED:=
LOCAL_PROGUARD_FLAG_FILES:=
LOCAL_PROGUARD_FLAGS:=
LOCAL_PROPRIETARY_MODULE:=
LOCAL_PROTOC_FLAGS:=
-LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full,nanopb-c,nanopb-c-enable_malloc
+# lite(default),micro,nano,full,nanopb-c,nanopb-c-enable_malloc
+LOCAL_PROTOC_OPTIMIZE_TYPE:=
LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
LOCAL_RECORDED_MODULE_TYPE:=
LOCAL_RENDERSCRIPT_CC:=
@@ -208,7 +212,8 @@
LOCAL_SDK_VERSION:=
LOCAL_SHARED_ANDROID_LIBRARIES:=
LOCAL_SHARED_LIBRARIES:=
-LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true
+# '',true
+LOCAL_SOURCE_FILES_ALL_GENERATED:=
LOCAL_SRC_FILES:=
LOCAL_SRC_FILES_EXCLUDE:=
LOCAL_STATIC_ANDROID_LIBRARIES:=
diff --git a/core/config.mk b/core/config.mk
index 319a069..9c93240 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -497,6 +497,7 @@
SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip
ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip
+FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist
JAVAC_FILTER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_filter
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 443f26f..a5411d8 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -11,9 +11,65 @@
# This can be useful if you set OUT_DIR to be a different directory
# than other outputs of your build system.
+# Returns all words in $1 up to and including $2
+define find_and_earlier
+ $(strip $(if $(1),
+ $(firstword $(1))
+ $(if $(filter $(firstword $(1)),$(2)),,
+ $(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2)))))
+endef
+
+#$(warning $(call find_and_earlier,A B C,A))
+#$(warning $(call find_and_earlier,A B C,B))
+#$(warning $(call find_and_earlier,A B C,C))
+#$(warning $(call find_and_earlier,A B C,D))
+
+define version-list
+$(1)PR1 $(1)PD1 $(1)PD2 $(1)PM1 $(1)PM2
+endef
+
+ALL_VERSIONS := O P Q R S T U V W X Y Z
+ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
+
+# Filters ALL_VERSIONS down to the range [$1, $2], and errors if $1 > $2 or $3 is
+# not in [$1, $2]
+# $(1): min platform version
+# $(2): max platform version
+# $(3): default platform version
+define allowed-platform-versions
+$(strip \
+ $(if $(filter $(ALL_VERSIONS),$(1)),,
+ $(error Invalid MIN_PLATFORM_VERSION '$(1)'))
+ $(if $(filter $(ALL_VERSIONS),$(2)),,
+ $(error Invalid MAX_PLATFORM_VERSION '$(2)'))
+ $(if $(filter $(ALL_VERSIONS),$(3)),,
+ $(error Invalid DEFAULT_PLATFORM_VERSION '$(3)'))
+
+ $(eval allowed_versions_ := $(call find_and_earlier,$(ALL_VERSIONS),$(2)))
+
+ $(if $(filter $(allowed_versions_),$(1)),,
+ $(error MIN_PLATFORM_VERSION '$(1)' must be before MAX_PLATFORM_VERSION '$(2)'))
+
+ $(eval allowed_versions_ := $(1) \
+ $(filter-out $(call find_and_earlier,$(allowed_versions_),$(1)),$(allowed_versions_)))
+
+ $(if $(filter $(allowed_versions_),$(3)),,
+ $(error DEFAULT_PLATFORM_VERSION '$(3)' must be between MIN_PLATFORM_VERSION '$(1)' and MAX_PLATFORM_VERSION '$(2)'))
+
+ $(allowed_versions_))
+endef
+
+#$(warning $(call allowed-platform-versions,OPR1,PPR1,OPR1))
+#$(warning $(call allowed-platform-versions,OPM1,PPR1,OPR1))
+
# Set up version information.
include $(BUILD_SYSTEM)/version_defaults.mk
+ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
+
+$(foreach v,$(ENABLED_VERSIONS), \
+ $(eval IS_AT_LEAST_$(v) := true))
+
# ---------------------------------------------------------------
# If you update the build system such that the environment setup
# or buildspec.mk need to be updated, increment this number, and
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 62e5499..e11e8b3 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -38,52 +38,27 @@
include $(INTERNAL_BUILD_ID_MAKEFILE)
endif
-# Returns all words in $1 up to and including $2
-define find_and_earlier
- $(strip $(if $(1),
- $(firstword $(1))
- $(if $(filter $(firstword $(1)),$(2)),,
- $(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2)))))
-endef
-
-#$(warning $(call find_and_earlier,A B C,A))
-#$(warning $(call find_and_earlier,A B C,B))
-#$(warning $(call find_and_earlier,A B C,C))
-#$(warning $(call find_and_earlier,A B C,D))
-
-define version-list
-$(1)PR1 $(1)PD1 $(1)PD2 $(1)PM1 $(1)PM2
-endef
-
-ALL_VERSIONS := O P
-ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
-
DEFAULT_PLATFORM_VERSION := OPR1
+MIN_PLATFORM_VERSION := OPR1
+MAX_PLATFORM_VERSION := PPR1
-# HACK: forward P to PPR1 until the build server config is updated
-ifeq (P,$(TARGET_PLATFORM_VERSION))
- TARGET_PLATFORM_VERSION := PPR1
-endif
+ALLOWED_VERSIONS := $(call allowed-platform-versions,\
+ $(MIN_PLATFORM_VERSION),\
+ $(MAX_PLATFORM_VERSION),\
+ $(DEFAULT_PLATFORM_VERSION))
-ifeq (,$(TARGET_PLATFORM_VERSION))
- # Default targeted platform version
- # TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
- # on this
+ifndef TARGET_PLATFORM_VERSION
TARGET_PLATFORM_VERSION := $(DEFAULT_PLATFORM_VERSION)
endif
-ifeq (,$(filter $(ALL_VERSIONS), $(TARGET_PLATFORM_VERSION)))
-$(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of)
-$(warning $(ALL_VERSIONS))
-$(error Stopping...)
+ifeq (,$(filter $(ALLOWED_VERSIONS), $(TARGET_PLATFORM_VERSION)))
+ $(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of)
+ $(error $(ALLOWED_VERSIONS))
endif
-ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
-
-$(foreach v,$(ENABLED_VERSIONS), \
- $(eval IS_AT_LEAST_$(v) := true))
-
# Default versions for each TARGET_PLATFORM_VERSION
+# TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional
+# on this
# This is the canonical definition of the platform version,
# which is the version that we reveal to the end user.
diff --git a/tools/fileslist.py b/tools/fileslist.py
deleted file mode 100755
index b9e7350..0000000
--- a/tools/fileslist.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2009 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.
-#
-
-import json, hashlib, operator, os, sys
-
-def get_file_size(path):
- st = os.lstat(path)
- return st.st_size;
-
-def get_file_digest(path):
- if os.path.isfile(path) == False:
- return "----------------------------------------------------------------"
- digest = hashlib.sha256()
- with open(path, 'rb') as f:
- while True:
- buf = f.read(1024*1024)
- if not buf:
- break
- digest.update(buf)
- return digest.hexdigest();
-
-def main(argv):
- output = []
- roots = argv[1:]
- for root in roots:
- base = len(root[:root.rfind(os.path.sep)])
- for dir, dirs, files in os.walk(root):
- relative = dir[base:]
- for f in files:
- try:
- path = os.path.sep.join((dir, f))
- row = {
- "Size": get_file_size(path),
- "Name": os.path.sep.join((relative, f)),
- "SHA256": get_file_digest(path),
- }
- output.append(row)
- except os.error:
- pass
- output.sort(key=operator.itemgetter("Size", "Name"), reverse=True)
- print json.dumps(output, indent=2, separators=(',',': '))
-
-if __name__ == '__main__':
- main(sys.argv)