Revert "Generate soong_config_module_type inline in the snapshot" am: e363782a5c am: b8132b4af7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2120162 Change-Id: I58397406391d1bec668a3fcf9c8bfc5add501501 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -85,6 +85,10 @@ class SoongConfigBoilerplateInserter(FileTransformation):
|
|||||||
# The configuration variable that will control the prefer setting.
|
# The configuration variable that will control the prefer setting.
|
||||||
configVar: ConfigVar
|
configVar: ConfigVar
|
||||||
|
|
||||||
|
# The bp file containing the definitions of the configuration module types
|
||||||
|
# to use in the sdk.
|
||||||
|
configBpDefFile: str
|
||||||
|
|
||||||
# The prefix to use for the soong config module types.
|
# The prefix to use for the soong config module types.
|
||||||
configModuleTypePrefix: str
|
configModuleTypePrefix: str
|
||||||
|
|
||||||
@@ -158,13 +162,12 @@ class SoongConfigBoilerplateInserter(FileTransformation):
|
|||||||
}},
|
}},
|
||||||
}},""")
|
}},""")
|
||||||
|
|
||||||
# Add the module type to the list of module types that need to
|
|
||||||
# have corresponding config module types.
|
|
||||||
config_module_types.add(module_type)
|
|
||||||
|
|
||||||
# Change the module type to the corresponding soong config
|
# Change the module type to the corresponding soong config
|
||||||
# module type by adding the prefix.
|
# module type by adding the prefix.
|
||||||
module_type = self.configModuleTypePrefix + module_type
|
module_type = self.configModuleTypePrefix + module_type
|
||||||
|
# Add the module type to the list of module types that need to
|
||||||
|
# be imported into the bp file.
|
||||||
|
config_module_types.add(module_type)
|
||||||
|
|
||||||
# Generate the module, possibly with the new module type and
|
# Generate the module, possibly with the new module type and
|
||||||
# containing the
|
# containing the
|
||||||
@@ -172,23 +175,20 @@ class SoongConfigBoilerplateInserter(FileTransformation):
|
|||||||
content_lines.extend(module_content)
|
content_lines.extend(module_content)
|
||||||
content_lines.append("}")
|
content_lines.append("}")
|
||||||
|
|
||||||
# Add the soong_config_module_type module definitions to the header
|
# Add the soong_config_module_type_import module definition that imports
|
||||||
# lines so that they appear before any uses.
|
# the soong config module types into this bp file to the header lines so
|
||||||
header_lines.append("")
|
# that they appear before any uses.
|
||||||
for module_type in sorted(config_module_types):
|
module_types = "\n".join(
|
||||||
# Create the corresponding soong config module type name by adding
|
[f' "{mt}",' for mt in sorted(config_module_types)])
|
||||||
# the prefix.
|
|
||||||
config_module_type = self.configModuleTypePrefix + module_type
|
|
||||||
header_lines.append(f"""
|
header_lines.append(f"""
|
||||||
// Soong config variable module type added by {producer.script}.
|
// Soong config variable stanza added by {producer.script}.
|
||||||
soong_config_module_type {{
|
soong_config_module_type_import {{
|
||||||
name: "{config_module_type}",
|
from: "{self.configBpDefFile}",
|
||||||
module_type: "{module_type}",
|
module_types: [
|
||||||
config_namespace: "{self.configVar.namespace}",
|
{module_types}
|
||||||
bool_variables: ["{self.configVar.name}"],
|
],
|
||||||
properties: ["prefer"],
|
|
||||||
}}
|
}}
|
||||||
""".lstrip())
|
""")
|
||||||
|
|
||||||
# Overwrite the file with the updated contents.
|
# Overwrite the file with the updated contents.
|
||||||
file.seek(0)
|
file.seek(0)
|
||||||
@@ -624,6 +624,10 @@ class MainlineModule:
|
|||||||
name="module_build_from_source",
|
name="module_build_from_source",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The bp file containing the definitions of the configuration module types
|
||||||
|
# to use in the sdk.
|
||||||
|
configBpDefFile: str = "packages/modules/common/Android.bp"
|
||||||
|
|
||||||
# The prefix to use for the soong config module types.
|
# The prefix to use for the soong config module types.
|
||||||
configModuleTypePrefix: str = "module_"
|
configModuleTypePrefix: str = "module_"
|
||||||
|
|
||||||
@@ -640,7 +644,8 @@ class MainlineModule:
|
|||||||
inserter = SoongConfigBoilerplateInserter(
|
inserter = SoongConfigBoilerplateInserter(
|
||||||
"Android.bp",
|
"Android.bp",
|
||||||
configVar=self.configVar,
|
configVar=self.configVar,
|
||||||
configModuleTypePrefix=self.configModuleTypePrefix)
|
configModuleTypePrefix=self.configModuleTypePrefix,
|
||||||
|
configBpDefFile=self.configBpDefFile)
|
||||||
transformations.append(inserter)
|
transformations.append(inserter)
|
||||||
return transformations
|
return transformations
|
||||||
|
|
||||||
@@ -695,6 +700,7 @@ MAINLINE_MODULES = [
|
|||||||
namespace="art_module",
|
namespace="art_module",
|
||||||
name="source_build",
|
name="source_build",
|
||||||
),
|
),
|
||||||
|
configBpDefFile="prebuilts/module_sdk/art/SoongConfig.bp",
|
||||||
configModuleTypePrefix="art_prebuilt_",
|
configModuleTypePrefix="art_prebuilt_",
|
||||||
),
|
),
|
||||||
MainlineModule(
|
MainlineModule(
|
||||||
|
|||||||
@@ -399,7 +399,8 @@ class TestSoongConfigBoilerplateInserter(unittest.TestCase):
|
|||||||
"""Tests the transformations applied to a common mainline module.
|
"""Tests the transformations applied to a common mainline module.
|
||||||
|
|
||||||
This uses ipsec as an example of a common mainline module. This checks
|
This uses ipsec as an example of a common mainline module. This checks
|
||||||
that the general Soong config module types and variables are used.
|
that the correct Soong config module types and variables are used and
|
||||||
|
that it imports the definitions from the correct location.
|
||||||
"""
|
"""
|
||||||
src = read_test_data("ipsec_Android.bp.input")
|
src = read_test_data("ipsec_Android.bp.input")
|
||||||
|
|
||||||
@@ -415,7 +416,7 @@ class TestSoongConfigBoilerplateInserter(unittest.TestCase):
|
|||||||
|
|
||||||
The ART mainline module uses a different Soong config setup to the
|
The ART mainline module uses a different Soong config setup to the
|
||||||
common mainline modules. This checks that the ART specific Soong config
|
common mainline modules. This checks that the ART specific Soong config
|
||||||
module types, and variables are used.
|
module types, variable and imports are used.
|
||||||
"""
|
"""
|
||||||
src = read_test_data("art_Android.bp.input")
|
src = read_test_data("art_Android.bp.input")
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,13 @@
|
|||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
// Soong config variable module type added by test_art.
|
// Soong config variable stanza added by test_art.
|
||||||
soong_config_module_type {
|
soong_config_module_type_import {
|
||||||
name: "art_prebuilt_java_import",
|
from: "prebuilts/module_sdk/art/SoongConfig.bp",
|
||||||
module_type: "java_import",
|
module_types: [
|
||||||
config_namespace: "art_module",
|
"art_prebuilt_java_import",
|
||||||
bool_variables: ["source_build"],
|
"art_prebuilt_prebuilt_bootclasspath_fragment",
|
||||||
properties: ["prefer"],
|
"art_prebuilt_prebuilt_platform_compat_config",
|
||||||
}
|
],
|
||||||
|
|
||||||
// Soong config variable module type added by test_art.
|
|
||||||
soong_config_module_type {
|
|
||||||
name: "art_prebuilt_prebuilt_bootclasspath_fragment",
|
|
||||||
module_type: "prebuilt_bootclasspath_fragment",
|
|
||||||
config_namespace: "art_module",
|
|
||||||
bool_variables: ["source_build"],
|
|
||||||
properties: ["prefer"],
|
|
||||||
}
|
|
||||||
|
|
||||||
// Soong config variable module type added by test_art.
|
|
||||||
soong_config_module_type {
|
|
||||||
name: "art_prebuilt_prebuilt_platform_compat_config",
|
|
||||||
module_type: "prebuilt_platform_compat_config",
|
|
||||||
config_namespace: "art_module",
|
|
||||||
bool_variables: ["source_build"],
|
|
||||||
properties: ["prefer"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package {
|
package {
|
||||||
|
|||||||
@@ -1,21 +1,12 @@
|
|||||||
// This is auto-generated. DO NOT EDIT.
|
// This is auto-generated. DO NOT EDIT.
|
||||||
|
|
||||||
// Soong config variable module type added by test_common_mainline_module.
|
// Soong config variable stanza added by test_common_mainline_module.
|
||||||
soong_config_module_type {
|
soong_config_module_type_import {
|
||||||
name: "module_java_sdk_library_import",
|
from: "packages/modules/common/Android.bp",
|
||||||
module_type: "java_sdk_library_import",
|
module_types: [
|
||||||
config_namespace: "ANDROID",
|
"module_java_sdk_library_import",
|
||||||
bool_variables: ["module_build_from_source"],
|
"module_prebuilt_bootclasspath_fragment",
|
||||||
properties: ["prefer"],
|
],
|
||||||
}
|
|
||||||
|
|
||||||
// Soong config variable module type added by test_common_mainline_module.
|
|
||||||
soong_config_module_type {
|
|
||||||
name: "module_prebuilt_bootclasspath_fragment",
|
|
||||||
module_type: "prebuilt_bootclasspath_fragment",
|
|
||||||
config_namespace: "ANDROID",
|
|
||||||
bool_variables: ["module_build_from_source"],
|
|
||||||
properties: ["prefer"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package {
|
package {
|
||||||
|
|||||||
Reference in New Issue
Block a user