Merge "Add module dir to includes for cc_preprocess_no_configuration" into main
diff --git a/cc/compiler.go b/cc/compiler.go
index 022b712..7bba962 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -695,7 +695,9 @@
if ctx.optimizeForSize() {
flags.Local.CFlags = append(flags.Local.CFlags, "-Oz")
- flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-enable-ml-inliner=release")
+ if !ctx.Config().IsEnvFalse("THINLTO_USE_MLGO") {
+ flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,-enable-ml-inliner=release")
+ }
}
// Exclude directories from manual binder interface allowed list.
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index c94df09..3cee7e4 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -339,23 +339,58 @@
// Creates a soong module to build the given partition. Returns false if we can't support building
// it.
func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partitionType string) bool {
- baseProps := &struct {
- Name *string
- Compile_multilib *string
- }{
- Name: proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)),
- Compile_multilib: proptools.StringPtr("both"),
+ baseProps := generateBaseProps(proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)))
+
+ fsProps, supported := generateFsProps(ctx, partitionType)
+ if !supported {
+ return false
}
+ var module android.Module
+ if partitionType == "system" {
+ module = ctx.CreateModule(filesystem.SystemImageFactory, baseProps, fsProps)
+ } else {
+ // Explicitly set the partition.
+ fsProps.Partition_type = proptools.StringPtr(partitionType)
+ module = ctx.CreateModule(filesystem.FilesystemFactory, baseProps, fsProps)
+ }
+ module.HideFromMake()
+ return true
+}
+
+type filesystemBaseProperty struct {
+ Name *string
+ Compile_multilib *string
+}
+
+func generateBaseProps(namePtr *string) *filesystemBaseProperty {
+ return &filesystemBaseProperty{
+ Name: namePtr,
+ Compile_multilib: proptools.StringPtr("both"),
+ }
+}
+
+func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*filesystem.FilesystemProperties, bool) {
fsProps := &filesystem.FilesystemProperties{}
+ partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
+ specificPartitionVars := partitionVars.PartitionQualifiedVariables[partitionType]
+
+ // BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE
+ fsType := specificPartitionVars.BoardFileSystemType
+ if fsType == "" {
+ fsType = "ext4" //default
+ }
+ fsProps.Type = proptools.StringPtr(fsType)
+ if filesystem.GetFsTypeFromString(ctx, *fsProps.Type).IsUnknown() {
+ // Currently the android_filesystem module type only supports a handful of FS types like ext4, erofs
+ return nil, false
+ }
+
// Don't build this module on checkbuilds, the soong-built partitions are still in-progress
// and sometimes don't build.
fsProps.Unchecked_module = proptools.BoolPtr(true)
- partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
- specificPartitionVars := partitionVars.PartitionQualifiedVariables[partitionType]
-
// BOARD_AVB_ENABLE
fsProps.Use_avb = proptools.BoolPtr(partitionVars.BoardAvbEnable)
// BOARD_AVB_KEY_PATH
@@ -368,16 +403,6 @@
}
fsProps.Partition_name = proptools.StringPtr(partitionType)
- // BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE
- fsType := specificPartitionVars.BoardFileSystemType
- if fsType == "" {
- fsType = "ext4" //default
- }
- fsProps.Type = proptools.StringPtr(fsType)
- if filesystem.GetFsTypeFromString(ctx, *fsProps.Type).IsUnknown() {
- // Currently the android_filesystem module type only supports a handful of FS types like ext4, erofs
- return false
- }
fsProps.Base_dir = proptools.StringPtr(partitionType)
@@ -408,16 +433,8 @@
// - filesystemProperties.Build_logtags
// - filesystemProperties.Fsverity.Libs
// - systemImageProperties.Linker_config_src
- var module android.Module
- if partitionType == "system" {
- module = ctx.CreateModule(filesystem.SystemImageFactory, baseProps, fsProps)
- } else {
- // Explicitly set the partition.
- fsProps.Partition_type = proptools.StringPtr(partitionType)
- module = ctx.CreateModule(filesystem.FilesystemFactory, baseProps, fsProps)
- }
- module.HideFromMake()
- return true
+
+ return fsProps, true
}
func (f *filesystemCreator) createDiffTest(ctx android.ModuleContext, partitionType string) android.Path {
@@ -482,27 +499,33 @@
var diffTestFiles []android.Path
for _, partitionType := range f.properties.Generated_partition_types {
- diffTestFiles = append(diffTestFiles, f.createDiffTest(ctx, partitionType))
+ diffTestFile := f.createDiffTest(ctx, partitionType)
+ diffTestFiles = append(diffTestFiles, diffTestFile)
+ ctx.Phony(fmt.Sprintf("soong_generated_%s_filesystem_test", partitionType), diffTestFile)
}
for _, partitionType := range f.properties.Unsupported_partition_types {
- diffTestFiles = append(diffTestFiles, createFailingCommand(ctx, fmt.Sprintf("Couldn't build %s partition", partitionType)))
+ diffTestFile := createFailingCommand(ctx, fmt.Sprintf("Couldn't build %s partition", partitionType))
+ diffTestFiles = append(diffTestFiles, diffTestFile)
+ ctx.Phony(fmt.Sprintf("soong_generated_%s_filesystem_test", partitionType), diffTestFile)
}
ctx.Phony("soong_generated_filesystem_tests", diffTestFiles...)
}
-// TODO: assemble baseProps and fsProps here
func generateBpContent(ctx android.EarlyModuleContext, partitionType string) string {
// Currently only system partition is supported
if partitionType != "system" {
return ""
}
+ baseProps := generateBaseProps(proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), partitionType)))
+ fsProps, _ := generateFsProps(ctx, partitionType)
+
deps := ctx.Config().Get(fsGenStateOnceKey).(*FsGenState).fsDeps
depProps := &android.PackagingProperties{
Deps: android.NewSimpleConfigurable(fullyQualifiedModuleNames(deps[partitionType])),
}
- result, err := proptools.RepackProperties([]interface{}{depProps})
+ result, err := proptools.RepackProperties([]interface{}{baseProps, fsProps, depProps})
if err != nil {
ctx.ModuleErrorf(err.Error())
}
diff --git a/java/app.go b/java/app.go
index dd99675..e112e93 100644
--- a/java/app.go
+++ b/java/app.go
@@ -30,7 +30,6 @@
"android/soong/android"
"android/soong/cc"
"android/soong/dexpreopt"
- "android/soong/genrule"
"android/soong/tradefed"
)
@@ -1333,7 +1332,7 @@
Srcs: []string{":" + a.Name() + "{.apk}"},
Cmd: proptools.StringPtr("$(location characteristics_rro_generator) $$($(location aapt2) dump packagename $(in)) $(out)"),
}
- ctx.CreateModule(genrule.GenRuleFactory, &rroManifestProperties)
+ ctx.CreateModule(GenRuleFactory, &rroManifestProperties)
rroProperties := struct {
Name *string
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index 637da36..5928446 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -562,7 +562,7 @@
// TODO(b/346662300): Let dexpreopter generate the installPath for dexpreopt files instead of
// using the dex location to generate the installPath.
if isApexSystemServerJar {
- dexpreoptPartition = "system"
+ dexpreoptPartition = dexpreoptConfig.ApexPartition
}
for _, install := range dexpreoptRule.Installs() {
// Remove the "/" prefix because the path should be relative to $ANDROID_PRODUCT_OUT.