From 454839dd2b219612aad391f9f955fb5390c8ddf4 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 20 Aug 2021 16:45:40 +0200 Subject: [PATCH 1/5] add spatializer aidl interfaces ISpatializer is a new AIDL interface exposed by native audio service. Test-Info: presubmit Apex-Size-Increase: spatializer-aidl-cpp.so size is 64672 Previous-Platform-Support: No Aosp-First: No Ignore-AOSP-First: Part of a feature not ready to be made public yet Bug: 188502620 Test: make Change-Id: I1b5f34f28ecc7d8fafcc3adbc46a0dbdf28381f3 Merged-In: I1b5f34f28ecc7d8fafcc3adbc46a0dbdf28381f3 --- build/allowed_deps.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/build/allowed_deps.txt b/build/allowed_deps.txt index 4567dee..be4e2bb 100644 --- a/build/allowed_deps.txt +++ b/build/allowed_deps.txt @@ -711,6 +711,7 @@ SettingsLibSettingsTheme(minSdkVersion:21) SettingsLibSettingsTransition(minSdkVersion:29) SettingsLibTwoTargetPreference(minSdkVersion:21) SettingsLibUtils(minSdkVersion:21) +spatializer-aidl-cpp(minSdkVersion:29) statsd-aidl-ndk_platform(minSdkVersion:(no version)) statsd-aidl-ndk_platform(minSdkVersion:30) statsprotos(minSdkVersion:29) From 21374961595e5bb02691b0fa592afdade8776810 Mon Sep 17 00:00:00 2001 From: Mathew Inwood Date: Thu, 29 Jul 2021 15:29:35 +0100 Subject: [PATCH 2/5] Add commit hook to require extra info in allowed_deps.txt additions. For any CL that adds a new dependency to allowed_deps.txt, this will require that extra information is provided in the commit message: Apex-Size-Increase: Previous-Platform-Support: Aosp-First: Test-Info: Any CL that does not modify allowed_deps.txt, or that doesn't add new dependency names to it, will be ignored. Also open up ownership of allowed_deps.txt to allow anyone to make changes there. We will use the information provided in the commit message to verify additions periodically, rather than doing this in code review. Test: for sha in $(git log --format=%H build/allowed_deps.txt); do ./tools/check_allowed_deps.py $sha; done Bug: 195303213 Merged-In: Ief9125d1eb51b29a7d3f05e5485ff41841d1d494 Change-Id: Ief9125d1eb51b29a7d3f05e5485ff41841d1d494 --- PREUPLOAD.cfg | 1 + build/OWNERS | 1 + tools/check_allowed_deps.py | 88 +++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 build/OWNERS create mode 100755 tools/check_allowed_deps.py diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg index ce75150..ec00245 100644 --- a/PREUPLOAD.cfg +++ b/PREUPLOAD.cfg @@ -1,2 +1,3 @@ [Hook Scripts] do_not_use_DO_NOT_MERGE = ${REPO_ROOT}/build/soong/scripts/check_do_not_merge.sh ${PREUPLOAD_COMMIT} +check_allowed_deps_commit = ${REPO_ROOT}/packages/modules/common/tools/check_allowed_deps.py ${PREUPLOAD_COMMIT} \ No newline at end of file diff --git a/build/OWNERS b/build/OWNERS new file mode 100644 index 0000000..9e76654 --- /dev/null +++ b/build/OWNERS @@ -0,0 +1 @@ +per-file allowed_deps.txt = * \ No newline at end of file diff --git a/tools/check_allowed_deps.py b/tools/check_allowed_deps.py new file mode 100755 index 0000000..12ea30d --- /dev/null +++ b/tools/check_allowed_deps.py @@ -0,0 +1,88 @@ +#!/usr/bin/python3 +""" Script to enforce certain requirements on commits that modify allowed_deps.txt + +For more info, go/apex-allowed-deps-error +""" + +import re +import subprocess +import sys + +sha = sys.argv[1] + +AllowedDepsTxt = "build/allowed_deps.txt" + +DisableAllowedDepsCheckKey = "No-Allowed-Deps-Check" +ExpectedKeys = set(["Apex-Size-Increase", "Previous-Platform-Support", "Aosp-First", "Test-Info"]) + +def get_deps(allowed_deps): + """ Parse allowed_deps.txt contents returning just dependency names """ + deps = set() + for line in allowed_deps: + if line.startswith('#'): + continue + if len(line.strip()) == 0: + continue + dep = line[:line.find("(")] + deps.add(dep) + return deps + + +commit_msg = subprocess.run(["git", "show", "--no-patch", "--format=%B", sha], + capture_output=True, check=True, text=True).stdout.splitlines() + +commit_msg_keys = set() +for line in commit_msg: + key_match = re.match(r'(\S+):', line) + if key_match: + commit_msg_keys.add(key_match.group(1)) +if DisableAllowedDepsCheckKey in commit_msg_keys: + # we are disabled + sys.exit(0) + +missing_keys = ExpectedKeys - commit_msg_keys + +if not missing_keys: + # Nothing to verify + sys.exit(0) + + +git_show = subprocess.run(["git", "show", "--name-only", "--format=", sha], + capture_output=True, check=True, text=True) +files = set(git_show.stdout.split("\n")) +if AllowedDepsTxt not in files: + # nothing to check + sys.exit(0) + +before = subprocess.run(["git", "show", "%s^:%s" % (sha, AllowedDepsTxt)], + capture_output=True, check=True, text=True).stdout.splitlines() +after = subprocess.run(["git", "show", "%s:%s" % (sha, AllowedDepsTxt)], + capture_output=True, check=True, text=True).stdout.splitlines() + + +before_deps = get_deps(before) +after_deps = get_deps(after) +added = after_deps - before_deps +if len(added) == 0: + # no new deps added, all good. Maybe just some minSdkVersion changed. + sys.exit(0) + +sys.stderr.write( +""" +\033[91m\033[1mError:\033[0m\033[1m You have added to allowed_deps.txt without providing necessary extra information\033[0m + +Added deps: +%s + +Missing information from the commit message: +%s + +See go/apex-allowed-deps-error for more details. + +To disable this check, please add "%s: " to your commit message. +""" % ( + "\n".join([(" %s" % a) for a in added]), + "\n".join([(" %s:" % k) for k in missing_keys]), + DisableAllowedDepsCheckKey + )) +sys.exit(1) From 58aad7b81a74df75656da6eeacafb47bd3f7c630 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Fri, 20 Aug 2021 16:45:40 +0200 Subject: [PATCH 3/5] add spatializer aidl interfaces ISpatializer is a new AIDL interface exposed by native audio service. Test-Info: presubmit Apex-Size-Increase: spatializer-aidl-cpp.so size is 64672 Previous-Platform-Support: No Aosp-First: No Ignore-AOSP-First: Part of a feature not ready to be made public yet Bug: 188502620 Test: make Merged-In: I1b5f34f28ecc7d8fafcc3adbc46a0dbdf28381f3 Change-Id: I1b5f34f28ecc7d8fafcc3adbc46a0dbdf28381f3 (cherry picked from commit 88483e1fc4f9f595575bab4ff7a021ebaa47bfae) --- build/allowed_deps.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/build/allowed_deps.txt b/build/allowed_deps.txt index 47e7515..f1a3348 100644 --- a/build/allowed_deps.txt +++ b/build/allowed_deps.txt @@ -820,6 +820,7 @@ SettingsLibSettingsTheme(minSdkVersion:21) SettingsLibSettingsTransition(minSdkVersion:29) SettingsLibTwoTargetPreference(minSdkVersion:21) SettingsLibUtils(minSdkVersion:21) +spatializer-aidl-cpp(minSdkVersion:29) statsd-aidl-ndk(minSdkVersion:30) statsd-aidl-ndk_platform(minSdkVersion:(no version)) statsd-aidl-ndk_platform(minSdkVersion:30) From e3e1e3cd9f0bb15ce768cd6768058e3d9b3c19e9 Mon Sep 17 00:00:00 2001 From: Ram Parameswaran Date: Thu, 23 Sep 2021 05:28:39 +0000 Subject: [PATCH 4/5] Add resource only targets for Car UI lib and Car Rotary lib Bug: 200886550 Apex-Size-Increase: None. Resource only target for existing dep. Previous-Platform-Support: Yes Aosp-First: Internal first Test-Info: No tests required for resource only libs Test: make Ignore-AOSP-First: changes in topics with internal-first projects Change-Id: Ib7eaf1b596ba1d8154cfd53ab8836cbfe6a05838 --- build/allowed_deps.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/allowed_deps.txt b/build/allowed_deps.txt index be4e2bb..3da6bbb 100644 --- a/build/allowed_deps.txt +++ b/build/allowed_deps.txt @@ -160,7 +160,9 @@ bpf_syscall_wrappers(minSdkVersion:30) brotli-java(minSdkVersion:current) captiveportal-lib(minSdkVersion:29) car-rotary-lib(minSdkVersion:28) +car-rotary-lib-resources(minSdkVersion:28) car-ui-lib(minSdkVersion:28) +car-ui-lib-resources(minSdkVersion:28) codecs_g711dec(minSdkVersion:29) com.google.android.material_material(minSdkVersion:14) conscrypt(minSdkVersion:29) From 3395d79757ea92b1a47acc68c5a8947cf143d5bf Mon Sep 17 00:00:00 2001 From: Hungming Chen Date: Fri, 7 Jan 2022 19:06:55 +0800 Subject: [PATCH 5/5] Add clatd to allow_deps.txt Needed because clatd is going to be modularized. Apex-Size-Increase: 32768B before: out/target/product/raven/system/apex/com.android.tethering.apex -rw-r--r-- 1 nuccachen primarygroup 2965504 Jan 7 18:56 out/target/product/raven/system/apex/com.android.tethering.apex after: -rw-r--r-- 1 nuccachen primarygroup 2998272 Jan 7 19:02 out/target/product/raven/system/apex/com.android.tethering.apex clatd binary size: 24408B $ deapexer extract out/target/product/raven/system/apex/com.android.tethering.apex apex $ ls -all apex/bin/clatd -rwxr-xr-x 1 nuccachen primarygroup 24408 Jan 1 1970 apex/bin/clatd Previous-Platform-Support: no Aosp-First: yes Ignore-AOSP-First: merge conflict resolutions Test-Info: atest clatd_test Test: TH Bug: 212345928 Change-Id: I1998f83ffcecf20bc9af9e860f9d21fdf4573515 Merged-In: I1998f83ffcecf20bc9af9e860f9d21fdf4573515 --- build/allowed_deps.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/build/allowed_deps.txt b/build/allowed_deps.txt index 9ed4f2a..ace3505 100644 --- a/build/allowed_deps.txt +++ b/build/allowed_deps.txt @@ -184,6 +184,7 @@ brotli-java(minSdkVersion:current) captiveportal-lib(minSdkVersion:29) car-rotary-lib(minSdkVersion:28) car-ui-lib(minSdkVersion:28) +clatd(minSdkVersion:30) codecs_g711dec(minSdkVersion:29) com.google.android.material_material(minSdkVersion:14) conscrypt(minSdkVersion:29)