summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2020-05-29 06:53:46 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-05-29 06:53:46 +0000
commitb719d60d2013859ea6e2f75c26afd45f12c3c8cd (patch)
treefad485896f294693a356a64fde85c9c130eb9e38
parentcb240bc9c1a1e83d71edd125301b403ed8cd0caf (diff)
parent63d8febd3508e9174ebfe443fe1f58029bd0f574 (diff)
Merge "Ensure package check is run for java_library in APEX"
-rw-r--r--java/androidmk.go21
-rwxr-xr-xscripts/package-check.sh6
2 files changed, 25 insertions, 2 deletions
diff --git a/java/androidmk.go b/java/androidmk.go
index 5e3b7d2cb..62cf169fa 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -69,7 +69,26 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
hideFromMake = true
}
- if !hideFromMake {
+ if hideFromMake {
+ // May still need to add some additional dependencies. This will be called
+ // once for the platform variant (even if it is not being used) and once each
+ // for the APEX specific variants. In order to avoid adding the dependency
+ // multiple times only add it for the platform variant.
+ checkedModulePaths := library.additionalCheckedModules
+ if library.IsForPlatform() && len(checkedModulePaths) != 0 {
+ mainEntries = android.AndroidMkEntries{
+ Class: "FAKE",
+ // Need at least one output file in order for this to take effect.
+ OutputFile: android.OptionalPathForPath(checkedModulePaths[0]),
+ Include: "$(BUILD_PHONY_PACKAGE)",
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
+ entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", checkedModulePaths.Strings()...)
+ },
+ },
+ }
+ }
+ } else {
mainEntries = android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
DistFile: android.OptionalPathForPath(library.distFile),
diff --git a/scripts/package-check.sh b/scripts/package-check.sh
index f982e8244..d7e602f31 100755
--- a/scripts/package-check.sh
+++ b/scripts/package-check.sh
@@ -52,6 +52,7 @@ zip_contents=`zipinfo -1 $jar_file`
# Check all class file names against the expected prefixes.
old_ifs=${IFS}
IFS=$'\n'
+failed=false
for zip_entry in ${zip_contents}; do
# Check the suffix.
if [[ "${zip_entry}" = *.class ]]; then
@@ -65,8 +66,11 @@ for zip_entry in ${zip_contents}; do
done
if [[ "${found}" == "false" ]]; then
echo "Class file ${zip_entry} is outside specified packages."
- exit 1
+ failed=true
fi
fi
done
+if [[ "${failed}" == "true" ]]; then
+ exit 1
+fi
IFS=${old_ifs}