Reformat build/soong for go 1.19

Test: none
Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
This commit is contained in:
Colin Cross
2022-08-16 10:27:33 -07:00
parent 852d0c4859
commit d079e0b270
67 changed files with 541 additions and 524 deletions

View File

@@ -461,19 +461,19 @@ func createVariantGroupType(variants []string, variantGroupName string) reflect.
// android_app_import imports a prebuilt apk with additional processing specified in the module.
// DPI-specific apk source files can be specified using dpi_variants. Example:
//
// android_app_import {
// name: "example_import",
// apk: "prebuilts/example.apk",
// dpi_variants: {
// mdpi: {
// apk: "prebuilts/example_mdpi.apk",
// },
// xhdpi: {
// apk: "prebuilts/example_xhdpi.apk",
// },
// },
// presigned: true,
// }
// android_app_import {
// name: "example_import",
// apk: "prebuilts/example.apk",
// dpi_variants: {
// mdpi: {
// apk: "prebuilts/example_mdpi.apk",
// },
// xhdpi: {
// apk: "prebuilts/example_xhdpi.apk",
// },
// },
// presigned: true,
// }
func AndroidAppImportFactory() android.Module {
module := &AndroidAppImport{}
module.AddProperties(&module.properties)

View File

@@ -97,11 +97,11 @@ type ClasspathElementContext interface {
// the list with its Contents field.
//
// Requirements/Assumptions:
// * A fragment can be associated with more than one apex but each apex must only be associated with
// a single fragment from the fragments list.
// * All of a fragment's contents must appear as a contiguous block in the same order in the
// libraries list.
// * Each library must only appear in a single fragment.
// - A fragment can be associated with more than one apex but each apex must only be associated with
// a single fragment from the fragments list.
// - All of a fragment's contents must appear as a contiguous block in the same order in the
// libraries list.
// - Each library must only appear in a single fragment.
//
// The apex is used to identify which libraries belong to which fragment. First a mapping is created
// from apex to fragment. Then the libraries are iterated over and any library in an apex is
@@ -109,13 +109,15 @@ type ClasspathElementContext interface {
// standalone and have their own element.
//
// e.g. Given the following input:
// libraries: com.android.art:core-oj, com.android.art:core-libart, framework, ext
// fragments: com.android.art:art-bootclasspath-fragment
//
// libraries: com.android.art:core-oj, com.android.art:core-libart, framework, ext
// fragments: com.android.art:art-bootclasspath-fragment
//
// Then this will return:
// ClasspathFragmentElement(art-bootclasspath-fragment, [core-oj, core-libart]),
// ClasspathLibraryElement(framework),
// ClasspathLibraryElement(ext),
//
// ClasspathFragmentElement(art-bootclasspath-fragment, [core-oj, core-libart]),
// ClasspathLibraryElement(framework),
// ClasspathLibraryElement(ext),
func CreateClasspathElements(ctx ClasspathElementContext, libraries []android.Module, fragments []android.Module) ClasspathElements {
// Create a map from apex name to the fragment module. This makes it easy to find the fragment
// associated with a particular apex.

View File

@@ -418,7 +418,6 @@ func (image *bootImageConfig) shouldInstallInApex() bool {
//
// The location is passed as an argument to the ART tools like dex2oat instead of the real path.
// ART tools will then reconstruct the architecture-specific real path.
//
func (image *bootImageVariant) imageLocations() (imageLocationsOnHost []string, imageLocationsOnDevice []string) {
if image.extends != nil {
imageLocationsOnHost, imageLocationsOnDevice = image.extends.getVariant(image.target).imageLocations()

View File

@@ -158,9 +158,7 @@ type DroiddocProperties struct {
Compat_config *string `android:"path"`
}
//
// Common flags passed down to build rule
//
type droiddocBuilderFlags struct {
bootClasspathArgs string
classpathArgs string
@@ -193,9 +191,7 @@ func apiCheckEnabled(ctx android.ModuleContext, apiToCheck ApiToCheck, apiVersio
return false
}
//
// Javadoc
//
type Javadoc struct {
android.ModuleBase
android.DefaultableModuleBase
@@ -548,9 +544,7 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
rule.Build("javadoc", "javadoc")
}
//
// Droiddoc
//
type Droiddoc struct {
Javadoc
@@ -827,9 +821,7 @@ func (d *Droiddoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
rule.Build("javadoc", desc)
}
//
// Exported Droiddoc Directory
//
var droiddocTemplateTag = dependencyTag{name: "droiddoc-template"}
type ExportedDroiddocDirProperties struct {
@@ -862,9 +854,7 @@ func (d *ExportedDroiddocDir) GenerateAndroidBuildActions(ctx android.ModuleCont
d.deps = android.PathsForModuleSrc(ctx, []string{filepath.Join(path, "**/*")})
}
//
// Defaults
//
type DocDefaults struct {
android.ModuleBase
android.DefaultsModuleBase

View File

@@ -42,9 +42,7 @@ func RegisterStubsBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("prebuilt_stubs_sources", PrebuiltStubsSourcesFactory)
}
//
// Droidstubs
//
type Droidstubs struct {
Javadoc
android.SdkBase

View File

@@ -43,23 +43,23 @@ func RegisterGenRuleBuildComponents(ctx android.RegistrationContext) {
//
// Use a java_genrule to package generated java resources:
//
// java_genrule {
// name: "generated_resources",
// tools: [
// "generator",
// "soong_zip",
// ],
// srcs: ["generator_inputs/**/*"],
// out: ["generated_android_icu4j_resources.jar"],
// cmd: "$(location generator) $(in) -o $(genDir) " +
// "&& $(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res",
// }
// java_genrule {
// name: "generated_resources",
// tools: [
// "generator",
// "soong_zip",
// ],
// srcs: ["generator_inputs/**/*"],
// out: ["generated_android_icu4j_resources.jar"],
// cmd: "$(location generator) $(in) -o $(genDir) " +
// "&& $(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res",
// }
//
// java_library {
// name: "lib_with_generated_resources",
// srcs: ["src/**/*.java"],
// static_libs: ["generated_resources"],
// }
// java_library {
// name: "lib_with_generated_resources",
// srcs: ["src/**/*.java"],
// static_libs: ["generated_resources"],
// }
func GenRuleFactory() android.Module {
module := genrule.NewGenRule()

View File

@@ -280,7 +280,7 @@ func platformCompatConfigSingletonFactory() android.Singleton {
return &platformCompatConfigSingleton{}
}
//============== merged_compat_config =================
// ============== merged_compat_config =================
type globalCompatConfigProperties struct {
// name of the file into which the metadata will be copied.
Filename *string

View File

@@ -2129,11 +2129,12 @@ var _ SdkLibraryDependency = (*SdkLibraryImport)(nil)
// The type of a structure that contains a field of type sdkLibraryScopeProperties
// for each apiscope in allApiScopes, e.g. something like:
// struct {
// Public sdkLibraryScopeProperties
// System sdkLibraryScopeProperties
// ...
// }
//
// struct {
// Public sdkLibraryScopeProperties
// System sdkLibraryScopeProperties
// ...
// }
var allScopeStructType = createAllScopePropertiesStructType()
// Dynamically create a structure type for each apiscope in allApiScopes.
@@ -2556,9 +2557,7 @@ func (module *SdkLibraryImport) RequiredFilesFromPrebuiltApex(ctx android.BaseMo
return requiredFilesFromPrebuiltApexForImport(name)
}
//
// java_sdk_library_xml
//
type sdkLibraryXml struct {
android.ModuleBase
android.DefaultableModuleBase

View File

@@ -49,9 +49,10 @@ func (g partitionGroup) String() string {
// Get partition group of java module that can be used at inter-partition dependency check.
// We currently have three groups
// (system, system_ext) => system partition group
// (vendor, odm) => vendor partition group
// (product) => product partition group
//
// (system, system_ext) => system partition group
// (vendor, odm) => vendor partition group
// (product) => product partition group
func (j *Module) partitionGroup(ctx android.EarlyModuleContext) partitionGroup {
// system and system_ext partition can be treated as the same in terms of inter-partition dependency.
if j.Platform() || j.SystemExtSpecific() {