Merge "Revert "Always run package check"" am: 3747336d23
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1323293 Change-Id: I4c17b88a3e2cd6d089ed2f8ea9e2592b9713ad1c
This commit is contained in:
commit
2f0963ecd3
3 changed files with 34 additions and 11 deletions
|
@ -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),
|
||||
|
@ -104,6 +123,10 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
|||
|
||||
entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", library.exportedSdkLibs...)
|
||||
|
||||
if len(library.additionalCheckedModules) != 0 {
|
||||
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", library.additionalCheckedModules.Strings()...)
|
||||
}
|
||||
|
||||
if library.proguardDictionary != nil {
|
||||
entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", library.proguardDictionary)
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ var (
|
|||
blueprint.RuleParams{
|
||||
Command: "rm -f $out && " +
|
||||
"${config.PackageCheckCmd} $in $packages && " +
|
||||
"cp $in $out",
|
||||
"touch $out",
|
||||
CommandDeps: []string{"${config.PackageCheckCmd}"},
|
||||
},
|
||||
"packages")
|
||||
|
@ -547,9 +547,8 @@ func TransformJarJar(ctx android.ModuleContext, outputFile android.WritablePath,
|
|||
})
|
||||
}
|
||||
|
||||
func CheckJarPackages(ctx android.ModuleContext, classesJar android.Path, permittedPackages []string) android.ModuleOutPath {
|
||||
outputFile := android.PathForModuleOut(ctx, "package-check", classesJar.Base())
|
||||
|
||||
func CheckJarPackages(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||
classesJar android.Path, permittedPackages []string) {
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: packageCheck,
|
||||
Description: "packageCheck",
|
||||
|
@ -559,8 +558,6 @@ func CheckJarPackages(ctx android.ModuleContext, classesJar android.Path, permit
|
|||
"packages": strings.Join(permittedPackages, " "),
|
||||
},
|
||||
})
|
||||
|
||||
return outputFile
|
||||
}
|
||||
|
||||
func TransformJetifier(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||
|
|
11
java/java.go
11
java/java.go
|
@ -463,6 +463,9 @@ type Module struct {
|
|||
// expanded Jarjar_rules
|
||||
expandJarjarRules android.Path
|
||||
|
||||
// list of additional targets for checkbuild
|
||||
additionalCheckedModules android.Paths
|
||||
|
||||
// Extra files generated by the module type to be added as java resources.
|
||||
extraResources android.Paths
|
||||
|
||||
|
@ -1518,10 +1521,10 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
|
|||
|
||||
// Check package restrictions if necessary.
|
||||
if len(j.properties.Permitted_packages) > 0 {
|
||||
// Check packages and copy input to package-checked file.
|
||||
// Use the file copied after a successful package check as the output file for this
|
||||
// module so that any dependencies on this module will trigger the package check.
|
||||
outputFile = CheckJarPackages(ctx, outputFile, j.properties.Permitted_packages)
|
||||
// Check packages and copy to package-checked file.
|
||||
pkgckFile := android.PathForModuleOut(ctx, "package-check.stamp")
|
||||
CheckJarPackages(ctx, pkgckFile, outputFile, j.properties.Permitted_packages)
|
||||
j.additionalCheckedModules = append(j.additionalCheckedModules, pkgckFile)
|
||||
|
||||
if ctx.Failed() {
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue