Build license metadata files in Soong
Soong has enough information to build the license metadata files without resorting to the fixups required in Make. Bug: 207445310 Test: m checkbuild Change-Id: I8e74108376162b8fdb87ba098ebe94350aa1f7c4
This commit is contained in:
@@ -434,7 +434,10 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
// Avoid creating duplicate build rules for multi-installed APEXes.
|
||||
if proptools.BoolDefault(a.properties.Multi_install_skip_symbol_files, false) {
|
||||
installSymbolFiles = false
|
||||
|
||||
}
|
||||
// set of dependency module:location mappings
|
||||
installMapSet := make(map[string]bool)
|
||||
|
||||
// TODO(jiyong): use the RuleBuilder
|
||||
var copyCommands []string
|
||||
@@ -442,7 +445,6 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
pathWhenActivated := android.PathForModuleInPartitionInstall(ctx, "apex", apexName)
|
||||
for _, fi := range a.filesInfo {
|
||||
destPath := imageDir.Join(ctx, fi.path()).String()
|
||||
var installedPath android.InstallPath
|
||||
// Prepare the destination path
|
||||
destPathDir := filepath.Dir(destPath)
|
||||
if fi.class == appSet {
|
||||
@@ -450,6 +452,8 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
}
|
||||
copyCommands = append(copyCommands, "mkdir -p "+destPathDir)
|
||||
|
||||
installMapPath := fi.builtFile
|
||||
|
||||
// Copy the built file to the directory. But if the symlink optimization is turned
|
||||
// on, place a symlink to the corresponding file in /system partition instead.
|
||||
if a.linkToSystemLib && fi.transitiveDep && fi.availableToPlatform() {
|
||||
@@ -457,6 +461,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
pathOnDevice := filepath.Join("/system", fi.path())
|
||||
copyCommands = append(copyCommands, "ln -sfn "+pathOnDevice+" "+destPath)
|
||||
} else {
|
||||
var installedPath android.InstallPath
|
||||
if fi.class == appSet {
|
||||
copyCommands = append(copyCommands,
|
||||
fmt.Sprintf("unzip -qDD -d %s %s", destPathDir,
|
||||
@@ -475,17 +480,19 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
if installSymbolFiles {
|
||||
implicitInputs = append(implicitInputs, installedPath)
|
||||
}
|
||||
}
|
||||
|
||||
// Create additional symlinks pointing the file inside the APEX (if any). Note that
|
||||
// this is independent from the symlink optimization.
|
||||
for _, symlinkPath := range fi.symlinkPaths() {
|
||||
symlinkDest := imageDir.Join(ctx, symlinkPath).String()
|
||||
copyCommands = append(copyCommands, "ln -sfn "+filepath.Base(destPath)+" "+symlinkDest)
|
||||
if installSymbolFiles {
|
||||
installedSymlink := ctx.InstallSymlink(pathWhenActivated.Join(ctx, filepath.Dir(symlinkPath)), filepath.Base(symlinkPath), installedPath)
|
||||
implicitInputs = append(implicitInputs, installedSymlink)
|
||||
// Create additional symlinks pointing the file inside the APEX (if any). Note that
|
||||
// this is independent from the symlink optimization.
|
||||
for _, symlinkPath := range fi.symlinkPaths() {
|
||||
symlinkDest := imageDir.Join(ctx, symlinkPath).String()
|
||||
copyCommands = append(copyCommands, "ln -sfn "+filepath.Base(destPath)+" "+symlinkDest)
|
||||
if installSymbolFiles {
|
||||
installedSymlink := ctx.InstallSymlink(pathWhenActivated.Join(ctx, filepath.Dir(symlinkPath)), filepath.Base(symlinkPath), installedPath)
|
||||
implicitInputs = append(implicitInputs, installedSymlink)
|
||||
}
|
||||
}
|
||||
|
||||
installMapPath = installedPath
|
||||
}
|
||||
|
||||
// Copy the test files (if any)
|
||||
@@ -502,6 +509,8 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
copyCommands = append(copyCommands, "cp -f "+d.SrcPath.String()+" "+dataDest)
|
||||
implicitInputs = append(implicitInputs, d.SrcPath)
|
||||
}
|
||||
|
||||
installMapSet[installMapPath.String()+":"+fi.installDir+"/"+fi.builtFile.Base()] = true
|
||||
}
|
||||
implicitInputs = append(implicitInputs, a.manifestPbOut)
|
||||
if installSymbolFiles {
|
||||
@@ -510,6 +519,12 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
||||
implicitInputs = append(implicitInputs, installedManifest, installedKey)
|
||||
}
|
||||
|
||||
if len(installMapSet) > 0 {
|
||||
var installs []string
|
||||
installs = append(installs, android.SortedStringKeys(installMapSet)...)
|
||||
a.SetLicenseInstallMap(installs)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Step 1.a: Write the list of files in this APEX to a txt file and compare it against
|
||||
// the allowed list given via the allowed_files property. Build fails when the two lists
|
||||
|
Reference in New Issue
Block a user