Merge "Add objectLinker to cmake_snapshot supported module types" into main
diff --git a/android/image.go b/android/image.go
index e8b6352..78343db 100644
--- a/android/image.go
+++ b/android/image.go
@@ -125,6 +125,12 @@
return e.kind == systemExtSpecificModule
}
+// imageMutatorBeginMutator calls ImageMutatorBegin on all modules that may have image variants.
+// This happens right before the imageTransitionMutator runs. It's needed to initialize these
+// modules so that they return the correct results for all the other ImageInterface methods,
+// which the imageTransitionMutator will call. Transition mutators should also not mutate modules
+// (except in their Mutate() function), which this method does, so we run it in a separate mutator
+// first.
func imageMutatorBeginMutator(ctx BottomUpMutatorContext) {
if m, ok := ctx.Module().(ImageInterface); ok && ctx.Os() == Android {
m.ImageMutatorBegin(ctx)
diff --git a/android/module_context.go b/android/module_context.go
index 9fa3a62..d71992d 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -16,13 +16,14 @@
import (
"fmt"
- "github.com/google/blueprint/depset"
"path"
"path/filepath"
"strings"
"github.com/google/blueprint"
+ "github.com/google/blueprint/depset"
"github.com/google/blueprint/proptools"
+ "github.com/google/blueprint/uniquelist"
)
// BuildParameters describes the set of potential parameters to build a Ninja rule.
@@ -554,8 +555,8 @@
return m.packageFile(fullInstallPath, srcPath, false)
}
-func (m *moduleContext) getAconfigPaths() *Paths {
- return &m.aconfigFilePaths
+func (m *moduleContext) getAconfigPaths() Paths {
+ return m.aconfigFilePaths
}
func (m *moduleContext) setAconfigPaths(paths Paths) {
@@ -570,12 +571,12 @@
srcPath: srcPath,
symlinkTarget: "",
executable: executable,
- effectiveLicenseFiles: &licenseFiles,
+ effectiveLicenseFiles: uniquelist.Make(licenseFiles),
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
- aconfigPaths: m.getAconfigPaths(),
+ aconfigPaths: uniquelist.Make(m.getAconfigPaths()),
archType: m.target.Arch.ArchType,
- overrides: &overrides,
+ overrides: uniquelist.Make(overrides),
owner: m.ModuleName(),
}
m.packagingSpecs = append(m.packagingSpecs, spec)
@@ -703,9 +704,9 @@
executable: false,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
- aconfigPaths: m.getAconfigPaths(),
+ aconfigPaths: uniquelist.Make(m.getAconfigPaths()),
archType: m.target.Arch.ArchType,
- overrides: &overrides,
+ overrides: uniquelist.Make(overrides),
owner: m.ModuleName(),
})
@@ -750,9 +751,9 @@
executable: false,
partition: fullInstallPath.partition,
skipInstall: m.skipInstall(),
- aconfigPaths: m.getAconfigPaths(),
+ aconfigPaths: uniquelist.Make(m.getAconfigPaths()),
archType: m.target.Arch.ArchType,
- overrides: &overrides,
+ overrides: uniquelist.Make(overrides),
owner: m.ModuleName(),
})
diff --git a/android/packaging.go b/android/packaging.go
index acafcd4..d455788 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -23,6 +23,7 @@
"github.com/google/blueprint"
"github.com/google/blueprint/gobtools"
"github.com/google/blueprint/proptools"
+ "github.com/google/blueprint/uniquelist"
)
// PackagingSpec abstracts a request to place a built artifact at a certain path in a package. A
@@ -43,7 +44,7 @@
// Whether relPathInPackage should be marked as executable or not
executable bool
- effectiveLicenseFiles *Paths
+ effectiveLicenseFiles uniquelist.UniqueList[Path]
partition string
@@ -53,13 +54,13 @@
skipInstall bool
// Paths of aconfig files for the built artifact
- aconfigPaths *Paths
+ aconfigPaths uniquelist.UniqueList[Path]
// ArchType of the module which produced this packaging spec
archType ArchType
// List of module names that this packaging spec overrides
- overrides *[]string
+ overrides uniquelist.UniqueList[string]
// Name of the module where this packaging spec is output of
owner string
@@ -70,12 +71,12 @@
SrcPath Path
SymlinkTarget string
Executable bool
- EffectiveLicenseFiles *Paths
+ EffectiveLicenseFiles Paths
Partition string
SkipInstall bool
- AconfigPaths *Paths
+ AconfigPaths Paths
ArchType ArchType
- Overrides *[]string
+ Overrides []string
Owner string
}
@@ -85,12 +86,12 @@
SrcPath: p.srcPath,
SymlinkTarget: p.symlinkTarget,
Executable: p.executable,
- EffectiveLicenseFiles: p.effectiveLicenseFiles,
+ EffectiveLicenseFiles: p.effectiveLicenseFiles.ToSlice(),
Partition: p.partition,
SkipInstall: p.skipInstall,
- AconfigPaths: p.aconfigPaths,
+ AconfigPaths: p.aconfigPaths.ToSlice(),
ArchType: p.archType,
- Overrides: p.overrides,
+ Overrides: p.overrides.ToSlice(),
Owner: p.owner,
}
}
@@ -100,12 +101,12 @@
p.srcPath = data.SrcPath
p.symlinkTarget = data.SymlinkTarget
p.executable = data.Executable
- p.effectiveLicenseFiles = data.EffectiveLicenseFiles
+ p.effectiveLicenseFiles = uniquelist.Make(data.EffectiveLicenseFiles)
p.partition = data.Partition
p.skipInstall = data.SkipInstall
- p.aconfigPaths = data.AconfigPaths
+ p.aconfigPaths = uniquelist.Make(data.AconfigPaths)
p.archType = data.ArchType
- p.overrides = data.Overrides
+ p.overrides = uniquelist.Make(data.Overrides)
p.owner = data.Owner
}
@@ -155,10 +156,7 @@
}
func (p *PackagingSpec) EffectiveLicenseFiles() Paths {
- if p.effectiveLicenseFiles == nil {
- return Paths{}
- }
- return *p.effectiveLicenseFiles
+ return p.effectiveLicenseFiles.ToSlice()
}
func (p *PackagingSpec) Partition() string {
@@ -171,7 +169,7 @@
// Paths of aconfig files for the built artifact
func (p *PackagingSpec) GetAconfigPaths() Paths {
- return *p.aconfigPaths
+ return p.aconfigPaths.ToSlice()
}
type PackageModule interface {
@@ -436,9 +434,7 @@
}
all = append(all, ps)
depNames = append(depNames, child.Name())
- if ps.overrides != nil {
- overridden = append(overridden, *ps.overrides...)
- }
+ overridden = append(overridden, ps.overrides.ToSlice()...)
}
})
diff --git a/cc/linker.go b/cc/linker.go
index 1efacad..f9d58ea 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -85,7 +85,7 @@
// list of header libraries to re-export include directories from. Entries must be
// present in header_libs.
- Export_header_lib_headers []string `android:"arch_variant"`
+ Export_header_lib_headers proptools.Configurable[[]string] `android:"arch_variant,variant_prepend"`
// list of generated headers to re-export include directories from. Entries must be
// present in generated_headers.
@@ -302,7 +302,7 @@
deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs.GetOrDefault(ctx, nil)...)
deps.RuntimeLibs = append(deps.RuntimeLibs, linker.Properties.Runtime_libs...)
- deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders, linker.Properties.Export_header_lib_headers...)
+ deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders, linker.Properties.Export_header_lib_headers.GetOrDefault(ctx, nil)...)
deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, linker.Properties.Export_static_lib_headers...)
deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, linker.Properties.Export_shared_lib_headers...)
deps.ReexportGeneratedHeaders = append(deps.ReexportGeneratedHeaders, linker.Properties.Export_generated_headers...)
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index ce72fed..743bfd4 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -725,7 +725,7 @@
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "fonts")
// This module is device-only
- android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
return module
}
diff --git a/etc/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go
index 676a096..4a0312f 100644
--- a/etc/prebuilt_etc_test.go
+++ b/etc/prebuilt_etc_test.go
@@ -469,7 +469,7 @@
}
`)
- p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
+ p := result.Module("foo.conf", "android_common").(*PrebuiltEtc)
expected := "out/soong/target/product/test_device/system/fonts"
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPaths[0])
}
diff --git a/java/base.go b/java/base.go
index 07899d1..8dad2d9 100644
--- a/java/base.go
+++ b/java/base.go
@@ -67,19 +67,19 @@
Exclude_java_resource_dirs []string `android:"arch_variant"`
// list of files to use as Java resources
- Java_resources []string `android:"path,arch_variant"`
+ Java_resources proptools.Configurable[[]string] `android:"path,arch_variant"`
// list of files that should be excluded from java_resources and java_resource_dirs
Exclude_java_resources []string `android:"path,arch_variant"`
// Same as java_resources, but modules added here will use the device variant. Can be useful
// for making a host test that tests the contents of a device built app.
- Device_common_java_resources []string `android:"path_device_common"`
+ Device_common_java_resources proptools.Configurable[[]string] `android:"path_device_common"`
// Same as java_resources, but modules added here will use the device's os variant and the
// device's first architecture variant. Can be useful for making a host test that tests the
// contents of a native device built app.
- Device_first_java_resources []string `android:"path_device_first"`
+ Device_first_java_resources proptools.Configurable[[]string] `android:"path_device_first"`
// list of module-specific flags that will be used for javac compiles
Javacflags []string `android:"arch_variant"`
@@ -1495,9 +1495,9 @@
dirArgs, dirDeps := ResourceDirsToJarArgs(ctx, j.properties.Java_resource_dirs,
j.properties.Exclude_java_resource_dirs, j.properties.Exclude_java_resources)
- fileArgs, fileDeps := ResourceFilesToJarArgs(ctx, j.properties.Java_resources, j.properties.Exclude_java_resources)
- fileArgs2, fileDeps2 := ResourceFilesToJarArgs(ctx, j.properties.Device_common_java_resources, nil)
- fileArgs3, fileDeps3 := ResourceFilesToJarArgs(ctx, j.properties.Device_first_java_resources, nil)
+ fileArgs, fileDeps := ResourceFilesToJarArgs(ctx, j.properties.Java_resources.GetOrDefault(ctx, nil), j.properties.Exclude_java_resources)
+ fileArgs2, fileDeps2 := ResourceFilesToJarArgs(ctx, j.properties.Device_common_java_resources.GetOrDefault(ctx, nil), nil)
+ fileArgs3, fileDeps3 := ResourceFilesToJarArgs(ctx, j.properties.Device_first_java_resources.GetOrDefault(ctx, nil), nil)
fileArgs = slices.Concat(fileArgs, fileArgs2, fileArgs3)
fileDeps = slices.Concat(fileDeps, fileDeps2, fileDeps3)
extraArgs, extraDeps := resourcePathsToJarArgs(j.extraResources), j.extraResources