Merge "Ignore license and similar dependencies of prebuilt_apex/apex_set"
diff --git a/Android.bp b/Android.bp
index 45e661e..d6260b4 100644
--- a/Android.bp
+++ b/Android.bp
@@ -116,3 +116,13 @@
dex_bootjars {
name: "dex_bootjars",
}
+
+// Pseudo-test that's run on checkbuilds to ensure that get_clang_version can
+// parse cc/config/global.go.
+genrule {
+ name: "get_clang_version_test",
+ cmd: "$(location get_clang_version) > $(out)",
+ tools: ["get_clang_version"],
+ srcs: ["cc/config/global.go"],
+ out: ["clang-prebuilts-version.txt"],
+}
diff --git a/README.md b/README.md
index b7e93f4..10ddd73 100644
--- a/README.md
+++ b/README.md
@@ -213,8 +213,8 @@
A module name's **scope** is the smallest namespace containing it. Suppose a
source tree has `device/my` and `device/my/display` namespaces. If `libfoo`
-module is defined in `device/co/display/lib/Android.bp`, its namespace is
-`device/co/display`.
+module is defined in `device/my/display/lib/Android.bp`, its namespace is
+`device/my/display`.
The name uniqueness thus means that module's name is unique within its scope. In
other words, "//_scope_:_name_" is globally unique module reference, e.g,
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 401fd6f..0a74e58 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -4046,12 +4046,12 @@
"${config.ArmToolchainClangCflags}",
"${config.ArmClangArmv7ANeonCflags}",
"${config.ArmClangGenericCflags}",
- "export_include_dirs",
- "linux_export_include_dirs",
- "android_export_include_dirs",
- "arm_export_include_dirs",
- "lib32_export_include_dirs",
"android_arm_export_include_dirs",
+ "lib32_export_include_dirs",
+ "arm_export_include_dirs",
+ "android_export_include_dirs",
+ "linux_export_include_dirs",
+ "export_include_dirs",
"android_arm_local_include_dirs",
"lib32_local_include_dirs",
"arm_local_include_dirs",
diff --git a/cc/compiler.go b/cc/compiler.go
index 78a5a5d..69ead30 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -92,7 +92,7 @@
// list of generated headers to add to the include path. These are the names
// of genrule modules.
- Generated_headers []string `android:"arch_variant"`
+ Generated_headers []string `android:"arch_variant,variant_prepend"`
// pass -frtti instead of -fno-rtti
Rtti *bool
diff --git a/cc/library.go b/cc/library.go
index 95f9b0a..684694b 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -184,11 +184,11 @@
// be added to the include path (using -I) for this module and any module that links
// against this module. Directories listed in export_include_dirs do not need to be
// listed in local_include_dirs.
- Export_include_dirs []string `android:"arch_variant"`
+ Export_include_dirs []string `android:"arch_variant,variant_prepend"`
// list of directories that will be added to the system include path
// using -isystem for this module and any module that links against this module.
- Export_system_include_dirs []string `android:"arch_variant"`
+ Export_system_include_dirs []string `android:"arch_variant,variant_prepend"`
Target struct {
Vendor, Product struct {
diff --git a/scripts/Android.bp b/scripts/Android.bp
index 1c02bd0..635be10 100644
--- a/scripts/Android.bp
+++ b/scripts/Android.bp
@@ -265,3 +265,19 @@
"linker_config_proto",
],
}
+
+python_binary_host {
+ name: "get_clang_version",
+ main: "get_clang_version.py",
+ srcs: [
+ "get_clang_version.py",
+ ],
+ version: {
+ py2: {
+ enabled: false,
+ },
+ py3: {
+ enabled: true,
+ },
+ },
+}
diff --git a/scripts/get_clang_version.py b/scripts/get_clang_version.py
new file mode 100755
index 0000000..622fca1
--- /dev/null
+++ b/scripts/get_clang_version.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2021 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.
+"""A tool to report the current clang version used during build"""
+
+import os
+import re
+import sys
+
+
+ANDROID_BUILD_TOP = os.environ.get("ANDROID_BUILD_TOP", ".")
+
+def get_clang_prebuilts_version(global_go):
+ # TODO(b/187231324): Get clang version from the json file once it is no longer
+ # hard-coded in global.go
+ if global_go is None:
+ global_go = ANDROID_BUILD_TOP + '/build/soong/cc/config/global.go'
+ with open(global_go) as infile:
+ contents = infile.read()
+
+ regex_rev = r'\tClangDefaultVersion\s+= "clang-(?P<rev>r\d+[a-z]?\d?)"'
+ match_rev = re.search(regex_rev, contents)
+ if match_rev is None:
+ raise RuntimeError('Parsing clang info failed')
+ return match_rev.group('rev')
+
+
+def main():
+ global_go = sys.argv[1] if len(sys.argv) > 1 else None
+ print(get_clang_prebuilts_version(global_go));
+
+
+if __name__ == '__main__':
+ main()
diff --git a/scripts/get_clang_version_test.py b/scripts/get_clang_version_test.py
new file mode 100644
index 0000000..e57df6c
--- /dev/null
+++ b/scripts/get_clang_version_test.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2021 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.
+#
+"""Unit tests for get_clang_version.py."""
+
+import unittest
+
+import get_clang_version
+
+class GetClangVersionTest(unittest.TestCase):
+ """Unit tests for get_clang_version."""
+
+ def test_get_clang_version(self):
+ """Test parsing of clang prebuilts version."""
+ self.assertIsNotNone(get_clang_version.get_clang_prebuilts_version())
+
+
+if __name__ == '__main__':
+ unittest.main(verbosity=2)