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

@ -711,8 +711,8 @@ type ApexContents struct {
// NewApexContents creates and initializes an ApexContents that is suitable // NewApexContents creates and initializes an ApexContents that is suitable
// for use with an apex module. // for use with an apex module.
// * contents is a map from a module name to information about its membership within // - contents is a map from a module name to information about its membership within
// the apex. // the apex.
func NewApexContents(contents map[string]ApexMembership) *ApexContents { func NewApexContents(contents map[string]ApexMembership) *ApexContents {
return &ApexContents{ return &ApexContents{
contents: contents, contents: contents,

View file

@ -524,26 +524,29 @@ var DarwinUniversalVariantTag = archDepTag{name: "darwin universal binary"}
// archMutator splits a module into a variant for each Target requested by the module. Target selection // archMutator splits a module into a variant for each Target requested by the module. Target selection
// for a module is in three levels, OsClass, multilib, and then Target. // for a module is in three levels, OsClass, multilib, and then Target.
// OsClass selection is determined by: // OsClass selection is determined by:
// - The HostOrDeviceSupported value passed in to InitAndroidArchModule by the module type factory, which selects // - The HostOrDeviceSupported value passed in to InitAndroidArchModule by the module type factory, which selects
// whether the module type can compile for host, device or both. // whether the module type can compile for host, device or both.
// - The host_supported and device_supported properties on the module. // - The host_supported and device_supported properties on the module.
//
// If host is supported for the module, the Host and HostCross OsClasses are selected. If device is supported // If host is supported for the module, the Host and HostCross OsClasses are selected. If device is supported
// for the module, the Device OsClass is selected. // for the module, the Device OsClass is selected.
// Within each selected OsClass, the multilib selection is determined by: // Within each selected OsClass, the multilib selection is determined by:
// - The compile_multilib property if it set (which may be overridden by target.android.compile_multilib or // - The compile_multilib property if it set (which may be overridden by target.android.compile_multilib or
// target.host.compile_multilib). // target.host.compile_multilib).
// - The default multilib passed to InitAndroidArchModule if compile_multilib was not set. // - The default multilib passed to InitAndroidArchModule if compile_multilib was not set.
//
// Valid multilib values include: // Valid multilib values include:
// "both": compile for all Targets supported by the OsClass (generally x86_64 and x86, or arm64 and arm). //
// "first": compile for only a single preferred Target supported by the OsClass. This is generally x86_64 or arm64, // "both": compile for all Targets supported by the OsClass (generally x86_64 and x86, or arm64 and arm).
// but may be arm for a 32-bit only build. // "first": compile for only a single preferred Target supported by the OsClass. This is generally x86_64 or arm64,
// "32": compile for only a single 32-bit Target supported by the OsClass. // but may be arm for a 32-bit only build.
// "64": compile for only a single 64-bit Target supported by the OsClass. // "32": compile for only a single 32-bit Target supported by the OsClass.
// "common": compile a for a single Target that will work on all Targets supported by the OsClass (for example Java). // "64": compile for only a single 64-bit Target supported by the OsClass.
// "common_first": compile a for a Target that will work on all Targets supported by the OsClass // "common": compile a for a single Target that will work on all Targets supported by the OsClass (for example Java).
// (same as "common"), plus a second Target for the preferred Target supported by the OsClass // "common_first": compile a for a Target that will work on all Targets supported by the OsClass
// (same as "first"). This is used for java_binary that produces a common .jar and a wrapper // (same as "common"), plus a second Target for the preferred Target supported by the OsClass
// executable script. // (same as "first"). This is used for java_binary that produces a common .jar and a wrapper
// executable script.
// //
// Once the list of Targets is determined, the module is split into a variant for each Target. // Once the list of Targets is determined, the module is split into a variant for each Target.
// //
@ -1215,11 +1218,13 @@ func (m *ModuleBase) setOSProperties(ctx BottomUpMutatorContext) {
// Returns the struct containing the properties specific to the given // Returns the struct containing the properties specific to the given
// architecture type. These look like this in Blueprint files: // architecture type. These look like this in Blueprint files:
// arch: { //
// arm64: { // arch: {
// key: value, // arm64: {
// }, // key: value,
// }, // },
// },
//
// This struct will also contain sub-structs containing to the architecture/CPU // This struct will also contain sub-structs containing to the architecture/CPU
// variants and features that themselves contain properties specific to those. // variants and features that themselves contain properties specific to those.
func getArchTypeStruct(ctx ArchVariantContext, archProperties interface{}, archType ArchType) (reflect.Value, bool) { func getArchTypeStruct(ctx ArchVariantContext, archProperties interface{}, archType ArchType) (reflect.Value, bool) {
@ -1231,11 +1236,12 @@ func getArchTypeStruct(ctx ArchVariantContext, archProperties interface{}, archT
// Returns the struct containing the properties specific to a given multilib // Returns the struct containing the properties specific to a given multilib
// value. These look like this in the Blueprint file: // value. These look like this in the Blueprint file:
// multilib: { //
// lib32: { // multilib: {
// key: value, // lib32: {
// }, // key: value,
// }, // },
// },
func getMultilibStruct(ctx ArchVariantContext, archProperties interface{}, archType ArchType) (reflect.Value, bool) { func getMultilibStruct(ctx ArchVariantContext, archProperties interface{}, archType ArchType) (reflect.Value, bool) {
archPropValues := reflect.ValueOf(archProperties).Elem() archPropValues := reflect.ValueOf(archProperties).Elem()
multilibProp := archPropValues.FieldByName("Multilib").Elem() multilibProp := archPropValues.FieldByName("Multilib").Elem()
@ -2010,9 +2016,10 @@ type ConfigurationAxisToArchVariantProperties map[bazel.ConfigurationAxis]ArchVa
// arch-variant properties correspond to the values of the properties of the 'propertySet' struct // arch-variant properties correspond to the values of the properties of the 'propertySet' struct
// that are specific to that axis/configuration. Each axis is independent, containing // that are specific to that axis/configuration. Each axis is independent, containing
// non-overlapping configs that correspond to the various "arch-variant" support, at this time: // non-overlapping configs that correspond to the various "arch-variant" support, at this time:
// arches (including multilib) //
// oses // arches (including multilib)
// arch+os combinations // oses
// arch+os combinations
// //
// For example, passing a struct { Foo bool, Bar string } will return an interface{} that can be // For example, passing a struct { Foo bool, Bar string } will return an interface{} that can be
// type asserted back into the same struct, containing the config-specific property value specified // type asserted back into the same struct, containing the config-specific property value specified
@ -2165,17 +2172,21 @@ func (m *ModuleBase) GetArchVariantProperties(ctx ArchVariantContext, propertySe
// Returns a struct matching the propertySet interface, containing properties specific to the targetName // Returns a struct matching the propertySet interface, containing properties specific to the targetName
// For example, given these arguments: // For example, given these arguments:
// propertySet = BaseCompilerProperties //
// targetName = "android_arm" // propertySet = BaseCompilerProperties
// targetName = "android_arm"
//
// And given this Android.bp fragment: // And given this Android.bp fragment:
// target: //
// android_arm: { // target:
// srcs: ["foo.c"], // android_arm: {
// } // srcs: ["foo.c"],
// android_arm64: { // }
// srcs: ["bar.c"], // android_arm64: {
// } // srcs: ["bar.c"],
// } // }
// }
//
// This would return a BaseCompilerProperties with BaseCompilerProperties.Srcs = ["foo.c"] // This would return a BaseCompilerProperties with BaseCompilerProperties.Srcs = ["foo.c"]
func getTargetStructs(ctx ArchVariantContext, archProperties []interface{}, targetName string) []reflect.Value { func getTargetStructs(ctx ArchVariantContext, archProperties []interface{}, targetName string) []reflect.Value {
var propertyStructs []reflect.Value var propertyStructs []reflect.Value

View file

@ -221,9 +221,13 @@ func directoryHasBlueprint(fs pathtools.FileSystem, prefix string, components []
// Transform a path (if necessary) to acknowledge package boundaries // Transform a path (if necessary) to acknowledge package boundaries
// //
// e.g. something like // e.g. something like
// async_safe/include/async_safe/CHECK.h //
// async_safe/include/async_safe/CHECK.h
//
// might become // might become
// //bionic/libc/async_safe:include/async_safe/CHECK.h //
// //bionic/libc/async_safe:include/async_safe/CHECK.h
//
// if the "async_safe" directory is actually a package and not just a directory. // if the "async_safe" directory is actually a package and not just a directory.
// //
// In particular, paths that extend into packages are transformed into absolute labels beginning with //. // In particular, paths that extend into packages are transformed into absolute labels beginning with //.
@ -303,20 +307,21 @@ func RootToModuleRelativePaths(ctx BazelConversionPathContext, paths Paths) []ba
// directory and Bazel target labels, excluding those included in the excludes argument (which // directory and Bazel target labels, excluding those included in the excludes argument (which
// should already be expanded to resolve references to Soong-modules). Valid elements of paths // should already be expanded to resolve references to Soong-modules). Valid elements of paths
// include: // include:
// * filepath, relative to local module directory, resolves as a filepath relative to the local // - filepath, relative to local module directory, resolves as a filepath relative to the local
// source directory // source directory
// * glob, relative to the local module directory, resolves as filepath(s), relative to the local // - glob, relative to the local module directory, resolves as filepath(s), relative to the local
// module directory. Because Soong does not have a concept of crossing package boundaries, the // module directory. Because Soong does not have a concept of crossing package boundaries, the
// glob as computed by Soong may contain paths that cross package-boundaries that would be // glob as computed by Soong may contain paths that cross package-boundaries that would be
// unknowingly omitted if the glob were handled by Bazel. To allow identification and detect // unknowingly omitted if the glob were handled by Bazel. To allow identification and detect
// (within Bazel) use of paths that cross package boundaries, we expand globs within Soong rather // (within Bazel) use of paths that cross package boundaries, we expand globs within Soong rather
// than converting Soong glob syntax to Bazel glob syntax. **Invalid for excludes.** // than converting Soong glob syntax to Bazel glob syntax. **Invalid for excludes.**
// * other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer // - other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer
// or OutputFileProducer. These resolve as a Bazel label for a target. If the Bazel target is in // or OutputFileProducer. These resolve as a Bazel label for a target. If the Bazel target is in
// the local module directory, it will be returned relative to the current package (e.g. // the local module directory, it will be returned relative to the current package (e.g.
// ":<target>"). Otherwise, it will be returned as an absolute Bazel label (e.g. // ":<target>"). Otherwise, it will be returned as an absolute Bazel label (e.g.
// "//path/to/dir:<target>"). If the reference to another module cannot be resolved,the function // "//path/to/dir:<target>"). If the reference to another module cannot be resolved,the function
// will panic. // will panic.
//
// Properties passed as the paths or excludes argument must have been annotated with struct tag // Properties passed as the paths or excludes argument must have been annotated with struct tag
// `android:"path"` so that dependencies on other modules will have already been handled by the // `android:"path"` so that dependencies on other modules will have already been handled by the
// path_deps mutator. // path_deps mutator.

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -240,10 +240,12 @@ func (m ExportedStringListDictVariables) asBazel(_ Config, _ ExportedStringVaria
// ExportedVariableReferenceDictVariables is a mapping from variable names to a // ExportedVariableReferenceDictVariables is a mapping from variable names to a
// dictionary which references previously defined variables. This is used to // dictionary which references previously defined variables. This is used to
// create a Starlark output such as: // create a Starlark output such as:
// string_var1 = "string1 //
// var_ref_dict_var1 = { // string_var1 = "string1
// "key1": string_var1 // var_ref_dict_var1 = {
// } // "key1": string_var1
// }
//
// This type of variable collection must be expanded last so that it recognizes // This type of variable collection must be expanded last so that it recognizes
// previously defined variables. // previously defined variables.
type ExportedVariableReferenceDictVariables map[string]map[string]string type ExportedVariableReferenceDictVariables map[string]map[string]string

View file

@ -151,12 +151,12 @@ type DefaultsModuleBase struct {
// retrieve the values it is necessary to iterate over properties(). E.g. to get // retrieve the values it is necessary to iterate over properties(). E.g. to get
// the commonProperties instance that have the real values: // the commonProperties instance that have the real values:
// //
// d := myModule.(Defaults) // d := myModule.(Defaults)
// for _, props := range d.properties() { // for _, props := range d.properties() {
// if cp, ok := props.(*commonProperties); ok { // if cp, ok := props.(*commonProperties); ok {
// ... access property values in cp ... // ... access property values in cp ...
// } // }
// } // }
// //
// The rationale is that the properties on a defaults module apply to the // The rationale is that the properties on a defaults module apply to the
// defaultable modules using it, not to the defaults module itself. E.g. setting // defaultable modules using it, not to the defaults module itself. E.g. setting

View file

@ -420,11 +420,13 @@ type FixturePreparer interface {
// instances. // instances.
// //
// base - a list of already flattened and deduped preparers that will be applied first before // base - a list of already flattened and deduped preparers that will be applied first before
// the list of additional preparers. Any duplicates of these in the additional preparers //
// will be ignored. // the list of additional preparers. Any duplicates of these in the additional preparers
// will be ignored.
// //
// preparers - a list of additional unflattened, undeduped preparers that will be applied after the // preparers - a list of additional unflattened, undeduped preparers that will be applied after the
// base preparers. //
// base preparers.
// //
// Returns a deduped and flattened list of the preparers starting with the ones in base with any // Returns a deduped and flattened list of the preparers starting with the ones in base with any
// additional ones from the preparers list added afterwards. // additional ones from the preparers list added afterwards.
@ -498,10 +500,10 @@ func newSimpleFixturePreparer(preparer func(fixture *fixture)) FixturePreparer {
// FixtureErrorHandler determines how to respond to errors reported by the code under test. // FixtureErrorHandler determines how to respond to errors reported by the code under test.
// //
// Some possible responses: // Some possible responses:
// * Fail the test if any errors are reported, see FixtureExpectsNoErrors. // - Fail the test if any errors are reported, see FixtureExpectsNoErrors.
// * Fail the test if at least one error that matches a pattern is not reported see // - Fail the test if at least one error that matches a pattern is not reported see
// FixtureExpectsAtLeastOneErrorMatchingPattern // FixtureExpectsAtLeastOneErrorMatchingPattern
// * Fail the test if any unexpected errors are reported. // - Fail the test if any unexpected errors are reported.
// //
// Although at the moment all the error handlers are implemented as simply a wrapper around a // Although at the moment all the error handlers are implemented as simply a wrapper around a
// function this is defined as an interface to allow future enhancements, e.g. provide different // function this is defined as an interface to allow future enhancements, e.g. provide different
@ -866,10 +868,12 @@ func (r *TestResult) NormalizePathsForTesting(paths Paths) []string {
// that produced this result. // that produced this result.
// //
// e.g. assuming that this result was created by running: // e.g. assuming that this result was created by running:
// GroupFixturePreparers(preparer1, preparer2, preparer3).RunTest(t) //
// GroupFixturePreparers(preparer1, preparer2, preparer3).RunTest(t)
// //
// Then this method will be equivalent to running: // Then this method will be equivalent to running:
// GroupFixturePreparers(preparer1, preparer2, preparer3) //
// GroupFixturePreparers(preparer1, preparer2, preparer3)
// //
// This is intended for use by tests whose output is Android.bp files to verify that those files // This is intended for use by tests whose output is Android.bp files to verify that those files
// are valid, e.g. tests of the snapshots produced by the sdk module type. // are valid, e.g. tests of the snapshots produced by the sdk module type.

View file

@ -1109,7 +1109,7 @@ func InitAndroidModule(m Module) {
// property structs for architecture-specific versions of generic properties tagged with // property structs for architecture-specific versions of generic properties tagged with
// `android:"arch_variant"`. // `android:"arch_variant"`.
// //
// InitAndroidModule should not be called if InitAndroidArchModule was called. // InitAndroidModule should not be called if InitAndroidArchModule was called.
func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) { func InitAndroidArchModule(m Module, hod HostOrDeviceSupported, defaultMultilib Multilib) {
InitAndroidModule(m) InitAndroidModule(m)

View file

@ -387,20 +387,21 @@ func ExistentPathsForSources(ctx PathContext, paths []string) Paths {
} }
// PathsForModuleSrc returns a Paths{} containing the resolved references in paths: // PathsForModuleSrc returns a Paths{} containing the resolved references in paths:
// * filepath, relative to local module directory, resolves as a filepath relative to the local // - filepath, relative to local module directory, resolves as a filepath relative to the local
// source directory // source directory
// * glob, relative to the local module directory, resolves as filepath(s), relative to the local // - glob, relative to the local module directory, resolves as filepath(s), relative to the local
// source directory. // source directory.
// * other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer // - other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer
// or OutputFileProducer. These resolve as a filepath to an output filepath or generated source // or OutputFileProducer. These resolve as a filepath to an output filepath or generated source
// filepath. // filepath.
//
// Properties passed as the paths argument must have been annotated with struct tag // Properties passed as the paths argument must have been annotated with struct tag
// `android:"path"` so that dependencies on SourceFileProducer modules will have already been handled by the // `android:"path"` so that dependencies on SourceFileProducer modules will have already been handled by the
// path_deps mutator. // path_deps mutator.
// If a requested module is not found as a dependency: // If a requested module is not found as a dependency:
// * if ctx.Config().AllowMissingDependencies() is true, this module to be marked as having // - if ctx.Config().AllowMissingDependencies() is true, this module to be marked as having
// missing dependencies // missing dependencies
// * otherwise, a ModuleError is thrown. // - otherwise, a ModuleError is thrown.
func PathsForModuleSrc(ctx ModuleMissingDepsPathContext, paths []string) Paths { func PathsForModuleSrc(ctx ModuleMissingDepsPathContext, paths []string) Paths {
return PathsForModuleSrcExcludes(ctx, paths, nil) return PathsForModuleSrcExcludes(ctx, paths, nil)
} }
@ -414,21 +415,22 @@ type SourceInput struct {
// PathsForModuleSrcExcludes returns a Paths{} containing the resolved references in paths, minus // PathsForModuleSrcExcludes returns a Paths{} containing the resolved references in paths, minus
// those listed in excludes. Elements of paths and excludes are resolved as: // those listed in excludes. Elements of paths and excludes are resolved as:
// * filepath, relative to local module directory, resolves as a filepath relative to the local // - filepath, relative to local module directory, resolves as a filepath relative to the local
// source directory // source directory
// * glob, relative to the local module directory, resolves as filepath(s), relative to the local // - glob, relative to the local module directory, resolves as filepath(s), relative to the local
// source directory. Not valid in excludes. // source directory. Not valid in excludes.
// * other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer // - other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer
// or OutputFileProducer. These resolve as a filepath to an output filepath or generated source // or OutputFileProducer. These resolve as a filepath to an output filepath or generated source
// filepath. // filepath.
//
// excluding the items (similarly resolved // excluding the items (similarly resolved
// Properties passed as the paths argument must have been annotated with struct tag // Properties passed as the paths argument must have been annotated with struct tag
// `android:"path"` so that dependencies on SourceFileProducer modules will have already been handled by the // `android:"path"` so that dependencies on SourceFileProducer modules will have already been handled by the
// path_deps mutator. // path_deps mutator.
// If a requested module is not found as a dependency: // If a requested module is not found as a dependency:
// * if ctx.Config().AllowMissingDependencies() is true, this module to be marked as having // - if ctx.Config().AllowMissingDependencies() is true, this module to be marked as having
// missing dependencies // missing dependencies
// * otherwise, a ModuleError is thrown. // - otherwise, a ModuleError is thrown.
func PathsForModuleSrcExcludes(ctx ModuleMissingDepsPathContext, paths, excludes []string) Paths { func PathsForModuleSrcExcludes(ctx ModuleMissingDepsPathContext, paths, excludes []string) Paths {
return PathsRelativeToModuleSourceDir(SourceInput{ return PathsRelativeToModuleSourceDir(SourceInput{
Context: ctx, Context: ctx,
@ -548,13 +550,14 @@ func GetModuleFromPathDep(ctx ModuleWithDepsPathContext, moduleName, tag string)
// PathsAndMissingDepsForModuleSrcExcludes returns a Paths{} containing the resolved references in // PathsAndMissingDepsForModuleSrcExcludes returns a Paths{} containing the resolved references in
// paths, minus those listed in excludes. Elements of paths and excludes are resolved as: // paths, minus those listed in excludes. Elements of paths and excludes are resolved as:
// * filepath, relative to local module directory, resolves as a filepath relative to the local // - filepath, relative to local module directory, resolves as a filepath relative to the local
// source directory // source directory
// * glob, relative to the local module directory, resolves as filepath(s), relative to the local // - glob, relative to the local module directory, resolves as filepath(s), relative to the local
// source directory. Not valid in excludes. // source directory. Not valid in excludes.
// * other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer // - other modules using the ":name{.tag}" syntax. These modules must implement SourceFileProducer
// or OutputFileProducer. These resolve as a filepath to an output filepath or generated source // or OutputFileProducer. These resolve as a filepath to an output filepath or generated source
// filepath. // filepath.
//
// and a list of the module names of missing module dependencies are returned as the second return. // and a list of the module names of missing module dependencies are returned as the second return.
// Properties passed as the paths argument must have been annotated with struct tag // Properties passed as the paths argument must have been annotated with struct tag
// `android:"path"` so that dependencies on SourceFileProducer modules will have already been handled by the // `android:"path"` so that dependencies on SourceFileProducer modules will have already been handled by the

View file

@ -258,20 +258,20 @@ type RegistrationContext interface {
// Used to register build components from an init() method, e.g. // Used to register build components from an init() method, e.g.
// //
// init() { // init() {
// RegisterBuildComponents(android.InitRegistrationContext) // RegisterBuildComponents(android.InitRegistrationContext)
// } // }
// //
// func RegisterBuildComponents(ctx android.RegistrationContext) { // func RegisterBuildComponents(ctx android.RegistrationContext) {
// ctx.RegisterModuleType(...) // ctx.RegisterModuleType(...)
// ... // ...
// } // }
// //
// Extracting the actual registration into a separate RegisterBuildComponents(ctx) function // Extracting the actual registration into a separate RegisterBuildComponents(ctx) function
// allows it to be used to initialize test context, e.g. // allows it to be used to initialize test context, e.g.
// //
// ctx := android.NewTestContext(config) // ctx := android.NewTestContext(config)
// RegisterBuildComponents(ctx) // RegisterBuildComponents(ctx)
var InitRegistrationContext RegistrationContext = &initRegistrationContext{ var InitRegistrationContext RegistrationContext = &initRegistrationContext{
moduleTypes: make(map[string]ModuleFactory), moduleTypes: make(map[string]ModuleFactory),
singletonTypes: make(map[string]SingletonFactory), singletonTypes: make(map[string]SingletonFactory),

View file

@ -1031,7 +1031,8 @@ func (c *RuleBuilderCommand) ImplicitTools(paths Paths) *RuleBuilderCommand {
// be also added to the dependencies returned by RuleBuilder.Tools. // be also added to the dependencies returned by RuleBuilder.Tools.
// //
// It is equivalent to: // It is equivalent to:
// cmd.Tool(ctx.Config().HostToolPath(ctx, tool)) //
// cmd.Tool(ctx.Config().HostToolPath(ctx, tool))
func (c *RuleBuilderCommand) BuiltTool(tool string) *RuleBuilderCommand { func (c *RuleBuilderCommand) BuiltTool(tool string) *RuleBuilderCommand {
if c.rule.ctx.Config().UseHostMusl() { if c.rule.ctx.Config().UseHostMusl() {
// If the host is using musl, assume that the tool was built against musl libc and include // If the host is using musl, assume that the tool was built against musl libc and include
@ -1053,7 +1054,8 @@ func (c *RuleBuilderCommand) builtToolWithoutDeps(tool string) *RuleBuilderComma
// dependencies returned by RuleBuilder.Tools. // dependencies returned by RuleBuilder.Tools.
// //
// It is equivalent to: // It is equivalent to:
// cmd.Tool(ctx.Config().PrebuiltBuildTool(ctx, tool)) //
// cmd.Tool(ctx.Config().PrebuiltBuildTool(ctx, tool))
func (c *RuleBuilderCommand) PrebuiltBuildTool(ctx PathContext, tool string) *RuleBuilderCommand { func (c *RuleBuilderCommand) PrebuiltBuildTool(ctx PathContext, tool string) *RuleBuilderCommand {
return c.Tool(ctx.Config().PrebuiltBuildTool(ctx, tool)) return c.Tool(ctx.Config().PrebuiltBuildTool(ctx, tool))
} }

View file

@ -430,13 +430,13 @@ func (r *sdkRegistry) uniqueOnceKey() OnceKey {
// required for some members but not others. Traits can cause additional information to be output // required for some members but not others. Traits can cause additional information to be output
// to the sdk snapshot or replace the default information exported for a member with something else. // to the sdk snapshot or replace the default information exported for a member with something else.
// e.g. // e.g.
// * By default cc libraries only export the default image variants to the SDK. However, for some // - By default cc libraries only export the default image variants to the SDK. However, for some
// members it may be necessary to export specific image variants, e.g. vendor, or recovery. // members it may be necessary to export specific image variants, e.g. vendor, or recovery.
// * By default cc libraries export all the configured architecture variants except for the native // - By default cc libraries export all the configured architecture variants except for the native
// bridge architecture variants. However, for some members it may be necessary to export the // bridge architecture variants. However, for some members it may be necessary to export the
// native bridge architecture variants as well. // native bridge architecture variants as well.
// * By default cc libraries export the platform variant (i.e. sdk:). However, for some members it // - By default cc libraries export the platform variant (i.e. sdk:). However, for some members it
// may be necessary to export the sdk variant (i.e. sdk:sdk). // may be necessary to export the sdk variant (i.e. sdk:sdk).
// //
// A sdk can request a module to provide no traits, one trait or a collection of traits. The exact // A sdk can request a module to provide no traits, one trait or a collection of traits. The exact
// behavior of a trait is determined by how SdkMemberType implementations handle the traits. A trait // behavior of a trait is determined by how SdkMemberType implementations handle the traits. A trait
@ -447,17 +447,17 @@ func (r *sdkRegistry) uniqueOnceKey() OnceKey {
// SdkPropertyName(). Each property contains a list of modules that are required to have that trait. // SdkPropertyName(). Each property contains a list of modules that are required to have that trait.
// e.g. something like this: // e.g. something like this:
// //
// sdk { // sdk {
// name: "sdk", // name: "sdk",
// ... // ...
// traits: { // traits: {
// recovery_image: ["module1", "module4", "module5"], // recovery_image: ["module1", "module4", "module5"],
// native_bridge: ["module1", "module2"], // native_bridge: ["module1", "module2"],
// native_sdk: ["module1", "module3"], // native_sdk: ["module1", "module3"],
// ... // ...
// }, // },
// ... // ...
// } // }
type SdkMemberTrait interface { type SdkMemberTrait interface {
// SdkPropertyName returns the name of the traits property on an sdk module. // SdkPropertyName returns the name of the traits property on an sdk module.
SdkPropertyName() string SdkPropertyName() string
@ -639,20 +639,19 @@ func DependencyTagForSdkMemberType(memberType SdkMemberType, export bool) SdkMem
// The basic implementation should look something like this, where ModuleType is // The basic implementation should look something like this, where ModuleType is
// the name of the module type being supported. // the name of the module type being supported.
// //
// type moduleTypeSdkMemberType struct { // type moduleTypeSdkMemberType struct {
// android.SdkMemberTypeBase // android.SdkMemberTypeBase
// } // }
// //
// func init() { // func init() {
// android.RegisterSdkMemberType(&moduleTypeSdkMemberType{ // android.RegisterSdkMemberType(&moduleTypeSdkMemberType{
// SdkMemberTypeBase: android.SdkMemberTypeBase{ // SdkMemberTypeBase: android.SdkMemberTypeBase{
// PropertyName: "module_types", // PropertyName: "module_types",
// }, // },
// } // }
// } // }
//
// ...methods...
// //
// ...methods...
type SdkMemberType interface { type SdkMemberType interface {
// SdkPropertyName returns the name of the member type property on an sdk module. // SdkPropertyName returns the name of the member type property on an sdk module.
SdkPropertyName() string SdkPropertyName() string

View file

@ -190,77 +190,78 @@ type soongConfigModuleTypeModule struct {
// //
// Each soong_config_variable supports an additional value `conditions_default`. The properties // Each soong_config_variable supports an additional value `conditions_default`. The properties
// specified in `conditions_default` will only be used under the following conditions: // specified in `conditions_default` will only be used under the following conditions:
// bool variable: the variable is unspecified or not set to a true value //
// value variable: the variable is unspecified // bool variable: the variable is unspecified or not set to a true value
// string variable: the variable is unspecified or the variable is set to a string unused in the // value variable: the variable is unspecified
// given module. For example, string variable `test` takes values: "a" and "b", // string variable: the variable is unspecified or the variable is set to a string unused in the
// if the module contains a property `a` and `conditions_default`, when test=b, // given module. For example, string variable `test` takes values: "a" and "b",
// the properties under `conditions_default` will be used. To specify that no // if the module contains a property `a` and `conditions_default`, when test=b,
// properties should be amended for `b`, you can set `b: {},`. // the properties under `conditions_default` will be used. To specify that no
// properties should be amended for `b`, you can set `b: {},`.
// //
// For example, an Android.bp file could have: // For example, an Android.bp file could have:
// //
// soong_config_module_type { // soong_config_module_type {
// name: "acme_cc_defaults", // name: "acme_cc_defaults",
// module_type: "cc_defaults", // module_type: "cc_defaults",
// config_namespace: "acme", // config_namespace: "acme",
// variables: ["board"], // variables: ["board"],
// bool_variables: ["feature"], // bool_variables: ["feature"],
// value_variables: ["width"], // value_variables: ["width"],
// properties: ["cflags", "srcs"], // properties: ["cflags", "srcs"],
// } // }
// //
// soong_config_string_variable { // soong_config_string_variable {
// name: "board", // name: "board",
// values: ["soc_a", "soc_b"], // values: ["soc_a", "soc_b"],
// } // }
// //
// acme_cc_defaults { // acme_cc_defaults {
// name: "acme_defaults", // name: "acme_defaults",
// cflags: ["-DGENERIC"], // cflags: ["-DGENERIC"],
// soong_config_variables: { // soong_config_variables: {
// board: { // board: {
// soc_a: { // soc_a: {
// cflags: ["-DSOC_A"], // cflags: ["-DSOC_A"],
// }, // },
// soc_b: { // soc_b: {
// cflags: ["-DSOC_B"], // cflags: ["-DSOC_B"],
// }, // },
// conditions_default: { // conditions_default: {
// cflags: ["-DSOC_DEFAULT"], // cflags: ["-DSOC_DEFAULT"],
// }, // },
// }, // },
// feature: { // feature: {
// cflags: ["-DFEATURE"], // cflags: ["-DFEATURE"],
// conditions_default: { // conditions_default: {
// cflags: ["-DFEATURE_DEFAULT"], // cflags: ["-DFEATURE_DEFAULT"],
// }, // },
// }, // },
// width: { // width: {
// cflags: ["-DWIDTH=%s"], // cflags: ["-DWIDTH=%s"],
// conditions_default: { // conditions_default: {
// cflags: ["-DWIDTH=DEFAULT"], // cflags: ["-DWIDTH=DEFAULT"],
// }, // },
// }, // },
// }, // },
// } // }
// //
// cc_library { // cc_library {
// name: "libacme_foo", // name: "libacme_foo",
// defaults: ["acme_defaults"], // defaults: ["acme_defaults"],
// srcs: ["*.cpp"], // srcs: ["*.cpp"],
// } // }
// //
// If an acme BoardConfig.mk file contained: // If an acme BoardConfig.mk file contained:
// //
// SOONG_CONFIG_NAMESPACES += acme // SOONG_CONFIG_NAMESPACES += acme
// SOONG_CONFIG_acme += \ // SOONG_CONFIG_acme += \
// board \ // board \
// feature \ // feature \
// //
// SOONG_CONFIG_acme_board := soc_a // SOONG_CONFIG_acme_board := soc_a
// SOONG_CONFIG_acme_feature := true // SOONG_CONFIG_acme_feature := true
// SOONG_CONFIG_acme_width := 200 // SOONG_CONFIG_acme_width := 200
// //
// Then libacme_foo would build with cflags "-DGENERIC -DSOC_A -DFEATURE". // Then libacme_foo would build with cflags "-DGENERIC -DSOC_A -DFEATURE".
func SoongConfigModuleTypeFactory() Module { func SoongConfigModuleTypeFactory() Module {

View file

@ -343,23 +343,26 @@ func (defs Bp2BuildSoongConfigDefinitions) String() string {
// //
// For example, the acme_cc_defaults example above would // For example, the acme_cc_defaults example above would
// produce a reflect.Value whose type is: // produce a reflect.Value whose type is:
// *struct { //
// Soong_config_variables struct { // *struct {
// Board struct { // Soong_config_variables struct {
// Soc_a interface{} // Board struct {
// Soc_b interface{} // Soc_a interface{}
// } // Soc_b interface{}
// } // }
// } // }
// }
//
// And whose value is: // And whose value is:
// &{ //
// Soong_config_variables: { // &{
// Board: { // Soong_config_variables: {
// Soc_a: (*struct{ Cflags []string })(nil), // Board: {
// Soc_b: (*struct{ Cflags []string })(nil), // Soc_a: (*struct{ Cflags []string })(nil),
// }, // Soc_b: (*struct{ Cflags []string })(nil),
// }, // },
// } // },
// }
func CreateProperties(factory blueprint.ModuleFactory, moduleType *ModuleType) reflect.Value { func CreateProperties(factory blueprint.ModuleFactory, moduleType *ModuleType) reflect.Value {
var fields []reflect.StructField var fields []reflect.StructField

View file

@ -688,17 +688,17 @@ type TestingBuildParams struct {
// //
// The parts of this structure which are changed are: // The parts of this structure which are changed are:
// * BuildParams // * BuildParams
// * Args // - Args
// * All Path, Paths, WritablePath and WritablePaths fields. // - All Path, Paths, WritablePath and WritablePaths fields.
// //
// * RuleParams // * RuleParams
// * Command // - Command
// * Depfile // - Depfile
// * Rspfile // - Rspfile
// * RspfileContent // - RspfileContent
// * SymlinkOutputs // - SymlinkOutputs
// * CommandDeps // - CommandDeps
// * CommandOrderOnly // - CommandOrderOnly
// //
// See PathRelativeToTop for more details. // See PathRelativeToTop for more details.
// //

View file

@ -702,20 +702,20 @@ func ProductVariableProperties(ctx BazelConversionPathContext) ProductConfigProp
// //
// If the ProductConfigProperties map contains these items, as parsed from the .bp file: // If the ProductConfigProperties map contains these items, as parsed from the .bp file:
// //
// library_linking_strategy: { // library_linking_strategy: {
// prefer_static: { // prefer_static: {
// static_libs: [ // static_libs: [
// "lib_a", // "lib_a",
// "lib_b", // "lib_b",
// ], // ],
// }, // },
// conditions_default: { // conditions_default: {
// shared_libs: [ // shared_libs: [
// "lib_a", // "lib_a",
// "lib_b", // "lib_b",
// ], // ],
// }, // },
// }, // },
// //
// Static_libs {Library_linking_strategy ANDROID prefer_static} [lib_a lib_b] // Static_libs {Library_linking_strategy ANDROID prefer_static} [lib_a lib_b]
// Shared_libs {Library_linking_strategy ANDROID conditions_default} [lib_a lib_b] // Shared_libs {Library_linking_strategy ANDROID conditions_default} [lib_a lib_b]
@ -728,13 +728,13 @@ func ProductVariableProperties(ctx BazelConversionPathContext) ProductConfigProp
// instead of putting lib_a and lib_b directly into dynamic_deps without a // instead of putting lib_a and lib_b directly into dynamic_deps without a
// select: // select:
// //
// dynamic_deps = select({ // dynamic_deps = select({
// "//build/bazel/product_variables:android__library_linking_strategy__prefer_static": [], // "//build/bazel/product_variables:android__library_linking_strategy__prefer_static": [],
// "//conditions:default": [ // "//conditions:default": [
// "//foo/bar:lib_a", // "//foo/bar:lib_a",
// "//foo/bar:lib_b", // "//foo/bar:lib_b",
// ], // ],
// }), // }),
func (props *ProductConfigProperties) zeroValuesForNamespacedVariables() { func (props *ProductConfigProperties) zeroValuesForNamespacedVariables() {
// A map of product config properties to the zero values of their respective // A map of product config properties to the zero values of their respective
// property value. // property value.

View file

@ -421,9 +421,9 @@ func makeVariableToBlueprint(file *bpFile, val *mkparser.MakeString,
// For example, if prefix is "foo" and name is "bar" with a value of "baz", then // For example, if prefix is "foo" and name is "bar" with a value of "baz", then
// the following variable will be generated: // the following variable will be generated:
// //
// foo { // foo {
// bar: "baz" // bar: "baz"
// } // }
// //
// If prefix is the empty string and name is "foo" with a value of "bar", the // If prefix is the empty string and name is "foo" with a value of "bar", the
// following variable will be generated (if it is a property): // following variable will be generated (if it is a property):

View file

@ -38,10 +38,10 @@ import (
// For example, "$(FOO)/bar/baz" will be represented as the // For example, "$(FOO)/bar/baz" will be represented as the
// following lists: // following lists:
// //
// { // {
// Strings: ["", "/bar/baz"], // Strings: ["", "/bar/baz"],
// Variables: ["FOO"] // Variables: ["FOO"]
// } // }
type MakeString struct { type MakeString struct {
StringPos Pos StringPos Pos
Strings []string Strings []string

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -105,7 +105,7 @@ func (m *apexKey) GenerateAndroidBuildActions(ctx android.ModuleContext) {
m.keyName = pubKeyName m.keyName = pubKeyName
} }
//////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////
// apex_keys_text // apex_keys_text
type apexKeysText struct { type apexKeysText struct {
output android.OutputPath output android.OutputPath

View file

@ -364,16 +364,16 @@ func (p *prebuiltCommon) DepIsInSameApex(ctx android.BaseModuleContext, dep andr
// While it may be possible to provide sufficient information to determine whether two prebuilt_apex // While it may be possible to provide sufficient information to determine whether two prebuilt_apex
// modules were compatible it would be a lot of work and would not provide much benefit for a couple // modules were compatible it would be a lot of work and would not provide much benefit for a couple
// of reasons: // of reasons:
// * The number of prebuilt_apex modules that will be exporting files for the same module will be // - The number of prebuilt_apex modules that will be exporting files for the same module will be
// low as the prebuilt_apex only exports files for the direct dependencies that require it and // low as the prebuilt_apex only exports files for the direct dependencies that require it and
// very few modules are direct dependencies of multiple prebuilt_apex modules, e.g. there are a // very few modules are direct dependencies of multiple prebuilt_apex modules, e.g. there are a
// few com.android.art* apex files that contain the same contents and could export files for the // few com.android.art* apex files that contain the same contents and could export files for the
// same modules but only one of them needs to do so. Contrast that with source apex modules which // same modules but only one of them needs to do so. Contrast that with source apex modules which
// need apex specific variants for every module that contributes code to the apex, whether direct // need apex specific variants for every module that contributes code to the apex, whether direct
// or indirect. // or indirect.
// * The build cost of a prebuilt_apex variant is generally low as at worst it will involve some // - The build cost of a prebuilt_apex variant is generally low as at worst it will involve some
// extra copying of files. Contrast that with source apex modules that has to build each variant // extra copying of files. Contrast that with source apex modules that has to build each variant
// from source. // from source.
func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) { func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) {
// Collect direct dependencies into contents. // Collect direct dependencies into contents.
@ -703,28 +703,29 @@ var _ prebuiltApexModuleCreator = (*Prebuilt)(nil)
// e.g. make dex implementation jars available for java_import modules listed in exported_java_libs, // e.g. make dex implementation jars available for java_import modules listed in exported_java_libs,
// it does so as follows: // it does so as follows:
// //
// 1. It creates a `deapexer` module that actually extracts the files from the `.apex` file and // 1. It creates a `deapexer` module that actually extracts the files from the `.apex` file and
// makes them available for use by other modules, at both Soong and ninja levels. // makes them available for use by other modules, at both Soong and ninja levels.
// //
// 2. It adds a dependency onto those modules and creates an apex specific variant similar to what // 2. It adds a dependency onto those modules and creates an apex specific variant similar to what
// an `apex` module does. That ensures that code which looks for specific apex variant, e.g. // an `apex` module does. That ensures that code which looks for specific apex variant, e.g.
// dexpreopt, will work the same way from source and prebuilt. // dexpreopt, will work the same way from source and prebuilt.
// //
// 3. The `deapexer` module adds a dependency from the modules that require the exported files onto // 3. The `deapexer` module adds a dependency from the modules that require the exported files onto
// itself so that they can retrieve the file paths to those files. // itself so that they can retrieve the file paths to those files.
// //
// It also creates a child module `selector` that is responsible for selecting the appropriate // It also creates a child module `selector` that is responsible for selecting the appropriate
// input apex for both the prebuilt_apex and the deapexer. That is needed for a couple of reasons: // input apex for both the prebuilt_apex and the deapexer. That is needed for a couple of reasons:
// 1. To dedup the selection logic so it only runs in one module.
// 2. To allow the deapexer to be wired up to a different source for the input apex, e.g. an
// `apex_set`.
// //
// prebuilt_apex // 1. To dedup the selection logic so it only runs in one module.
// / | \
// / | \
// V V V
// selector <--- deapexer <--- exported java lib
// //
// 2. To allow the deapexer to be wired up to a different source for the input apex, e.g. an
// `apex_set`.
//
// prebuilt_apex
// / | \
// / | \
// V V V
// selector <--- deapexer <--- exported java lib
func (p *Prebuilt) createPrebuiltApexModules(ctx android.TopDownMutatorContext) { func (p *Prebuilt) createPrebuiltApexModules(ctx android.TopDownMutatorContext) {
baseModuleName := p.BaseModuleName() baseModuleName := p.BaseModuleName()

View file

@ -52,8 +52,9 @@ type KeyValuePair struct {
// AqueryDepset is a depset definition from Bazel's aquery response. This is // AqueryDepset is a depset definition from Bazel's aquery response. This is
// akin to the `depSetOfFiles` in the response proto, except: // akin to the `depSetOfFiles` in the response proto, except:
// * direct artifacts are enumerated by full path instead of by ID // - direct artifacts are enumerated by full path instead of by ID
// * it has a hash of the depset contents, instead of an int ID (for determinism) // - it has a hash of the depset contents, instead of an int ID (for determinism)
//
// A depset is a data structure for efficient transitive handling of artifact // A depset is a data structure for efficient transitive handling of artifact
// paths. A single depset consists of one or more artifact paths and one or // paths. A single depset consists of one or more artifact paths and one or
// more "child" depsets. // more "child" depsets.

View file

@ -1225,15 +1225,18 @@ func (sla *StringListAttribute) SortedConfigurationAxes() []ConfigurationAxis {
// DeduplicateAxesFromBase ensures no duplication of items between the no-configuration value and // DeduplicateAxesFromBase ensures no duplication of items between the no-configuration value and
// configuration-specific values. For example, if we would convert this StringListAttribute as: // configuration-specific values. For example, if we would convert this StringListAttribute as:
// ["a", "b", "c"] + select({ //
// "//condition:one": ["a", "d"], // ["a", "b", "c"] + select({
// "//conditions:default": [], // "//condition:one": ["a", "d"],
// }) // "//conditions:default": [],
// })
//
// after this function, we would convert this StringListAttribute as: // after this function, we would convert this StringListAttribute as:
// ["a", "b", "c"] + select({ //
// "//condition:one": ["d"], // ["a", "b", "c"] + select({
// "//conditions:default": [], // "//condition:one": ["d"],
// }) // "//conditions:default": [],
// })
func (sla *StringListAttribute) DeduplicateAxesFromBase() { func (sla *StringListAttribute) DeduplicateAxesFromBase() {
base := sla.Value base := sla.Value
for axis, configToList := range sla.ConfigurableValues { for axis, configToList := range sla.ConfigurableValues {

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -553,7 +553,9 @@ func indicateAttributeError(mod *parser.Module, attributeName string, format str
// If a variable is LOCAL_MODULE, get its value from the 'name' attribute. // If a variable is LOCAL_MODULE, get its value from the 'name' attribute.
// This handles the statement // This handles the statement
// LOCAL_SRC_FILES := $(LOCAL_MODULE) //
// LOCAL_SRC_FILES := $(LOCAL_MODULE)
//
// which occurs often. // which occurs often.
func resolveLocalModule(mod *parser.Module, val parser.Expression) parser.Expression { func resolveLocalModule(mod *parser.Module, val parser.Expression) parser.Expression {
if varLocalName, ok := val.(*parser.Variable); ok { if varLocalName, ok := val.(*parser.Variable); ok {
@ -567,9 +569,9 @@ func resolveLocalModule(mod *parser.Module, val parser.Expression) parser.Expres
} }
// etcPrebuiltModuleUpdate contains information on updating certain parts of a defined module such as: // etcPrebuiltModuleUpdate contains information on updating certain parts of a defined module such as:
// * changing the module type from prebuilt_etc to a different one // - changing the module type from prebuilt_etc to a different one
// * stripping the prefix of the install path based on the module type // - stripping the prefix of the install path based on the module type
// * appending additional boolean properties to the prebuilt module // - appending additional boolean properties to the prebuilt module
type etcPrebuiltModuleUpdate struct { type etcPrebuiltModuleUpdate struct {
// The prefix of the install path defined in local_module_path. The prefix is removed from local_module_path // The prefix of the install path defined in local_module_path. The prefix is removed from local_module_path
// before setting the 'filename' attribute. // before setting the 'filename' attribute.

View file

@ -66,8 +66,9 @@ func (afdo *afdo) AfdoEnabled() bool {
} }
// Get list of profile file names, ordered by level of specialisation. For example: // Get list of profile file names, ordered by level of specialisation. For example:
// 1. libfoo_arm64.afdo // 1. libfoo_arm64.afdo
// 2. libfoo.afdo // 2. libfoo.afdo
//
// Add more specialisation as needed. // Add more specialisation as needed.
func getProfileFiles(ctx android.BaseModuleContext, moduleName string) []string { func getProfileFiles(ctx android.BaseModuleContext, moduleName string) []string {
var files []string var files []string

View file

@ -152,10 +152,10 @@ func UnstrippedOutputFile(module android.Module) android.Path {
// IsValidSharedDependency takes a module and determines if it is a unique shared library // IsValidSharedDependency takes a module and determines if it is a unique shared library
// that should be installed in the fuzz target output directories. This function // that should be installed in the fuzz target output directories. This function
// returns true, unless: // returns true, unless:
// - The module is not an installable shared library, or // - The module is not an installable shared library, or
// - The module is a header or stub, or // - The module is a header or stub, or
// - The module is a prebuilt and its source is available, or // - The module is a prebuilt and its source is available, or
// - The module is a versioned member of an SDK snapshot. // - The module is a versioned member of an SDK snapshot.
func IsValidSharedDependency(dependency android.Module) bool { func IsValidSharedDependency(dependency android.Module) bool {
// TODO(b/144090547): We should be parsing these modules using // TODO(b/144090547): We should be parsing these modules using
// ModuleDependencyTag instead of the current brute-force checking. // ModuleDependencyTag instead of the current brute-force checking.

View file

@ -41,13 +41,13 @@ type GenruleExtraProperties struct {
// variations. The following environment variables will be set when the command // variations. The following environment variables will be set when the command
// execute: // execute:
// //
// CC_ARCH the name of the architecture the command is being executed for // CC_ARCH the name of the architecture the command is being executed for
// //
// CC_MULTILIB "lib32" if the architecture the command is being executed for is 32-bit, // CC_MULTILIB "lib32" if the architecture the command is being executed for is 32-bit,
// "lib64" if it is 64-bit. // "lib64" if it is 64-bit.
// //
// CC_NATIVE_BRIDGE the name of the subdirectory that native bridge libraries are stored in if // CC_NATIVE_BRIDGE the name of the subdirectory that native bridge libraries are stored in if
// the architecture has native bridge enabled, empty if it is disabled. // the architecture has native bridge enabled, empty if it is disabled.
func GenRuleFactory() android.Module { func GenRuleFactory() android.Module {
module := genrule.NewGenRule() module := genrule.NewGenRule()

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -148,12 +148,12 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// to the sysroot base + "usr/include" + to directory + directory component. // to the sysroot base + "usr/include" + to directory + directory component.
// ndk_headers requires the license file to be specified. Example: // ndk_headers requires the license file to be specified. Example:
// //
// Given: // Given:
// sysroot base = "ndk/sysroot" // sysroot base = "ndk/sysroot"
// from = "include/foo" // from = "include/foo"
// to = "bar" // to = "bar"
// header = "include/foo/woodly/doodly.h" // header = "include/foo/woodly/doodly.h"
// output path = "ndk/sysroot/usr/include/bar/woodly/doodly.h" // output path = "ndk/sysroot/usr/include/bar/woodly/doodly.h"
func ndkHeadersFactory() android.Module { func ndkHeadersFactory() android.Module {
module := &headerModule{} module := &headerModule{}
module.AddProperties(&module.properties) module.AddProperties(&module.properties)
@ -275,15 +275,17 @@ func versionedNdkHeadersFactory() android.Module {
return module return module
} }
// preprocessed_ndk_header { // preprocessed_ndk_header {
// name: "foo", // name: "foo",
// preprocessor: "foo.sh", // preprocessor: "foo.sh",
// srcs: [...], // srcs: [...],
// to: "android", // to: "android",
// } // }
// //
// Will invoke the preprocessor as: // Will invoke the preprocessor as:
// $preprocessor -o $SYSROOT/usr/include/android/needs_preproc.h $src //
// $preprocessor -o $SYSROOT/usr/include/android/needs_preproc.h $src
//
// For each src in srcs. // For each src in srcs.
type preprocessedHeadersProperties struct { type preprocessedHeadersProperties struct {
// The preprocessor to run. Must be a program inside the source directory // The preprocessor to run. Must be a program inside the source directory

View file

@ -84,12 +84,11 @@ var (
// //
// Example: // Example:
// //
// ndk_library { // ndk_library {
// name: "libfoo", // name: "libfoo",
// symbol_file: "libfoo.map.txt", // symbol_file: "libfoo.map.txt",
// first_version: "9", // first_version: "9",
// } // }
//
type libraryProperties struct { type libraryProperties struct {
// Relative path to the symbol map. // Relative path to the symbol map.
// An example file can be seen here: TODO(danalbert): Make an example. // An example file can be seen here: TODO(danalbert): Make an example.

View file

@ -348,10 +348,10 @@ type bazelPrebuiltLibraryStaticAttributes struct {
// TODO(b/228623543): The below is not entirely true until the bug is fixed. For now, both targets are always generated // TODO(b/228623543): The below is not entirely true until the bug is fixed. For now, both targets are always generated
// Implements bp2build for cc_prebuilt_library modules. This will generate: // Implements bp2build for cc_prebuilt_library modules. This will generate:
// * Only a prebuilt_library_static if the shared.enabled property is set to false across all variants. // - Only a prebuilt_library_static if the shared.enabled property is set to false across all variants.
// * Only a prebuilt_library_shared if the static.enabled property is set to false across all variants // - Only a prebuilt_library_shared if the static.enabled property is set to false across all variants
// * Both a prebuilt_library_static and prebuilt_library_shared if the aforementioned properties are not false across // - Both a prebuilt_library_static and prebuilt_library_shared if the aforementioned properties are not false across
// all variants // all variants
// //
// In all cases, prebuilt_library_static target names will be appended with "_bp2build_cc_library_static". // In all cases, prebuilt_library_static target names will be appended with "_bp2build_cc_library_static".
func prebuiltLibraryBp2Build(ctx android.TopDownMutatorContext, module *Module) { func prebuiltLibraryBp2Build(ctx android.TopDownMutatorContext, module *Module) {

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
@ -263,12 +263,12 @@ type BaseSnapshotDecoratorProperties struct {
// version, snapshot arch, etc. It also adds a special suffix to Soong module name, so it doesn't // version, snapshot arch, etc. It also adds a special suffix to Soong module name, so it doesn't
// collide with source modules. e.g. the following example module, // collide with source modules. e.g. the following example module,
// //
// vendor_snapshot_static { // vendor_snapshot_static {
// name: "libbase", // name: "libbase",
// arch: "arm64", // arch: "arm64",
// version: 30, // version: 30,
// ... // ...
// } // }
// //
// will be seen as "libbase.vendor_static.30.arm64" by Soong. // will be seen as "libbase.vendor_static.30.arm64" by Soong.
type BaseSnapshotDecorator struct { type BaseSnapshotDecorator struct {
@ -370,7 +370,6 @@ func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *BaseSnapshotDecorato
} }
} }
//
// Module definitions for snapshots of libraries (shared, static, header). // Module definitions for snapshots of libraries (shared, static, header).
// //
// Modules (vendor|recovery)_snapshot_(shared|static|header) are defined here. Shared libraries and // Modules (vendor|recovery)_snapshot_(shared|static|header) are defined here. Shared libraries and
@ -630,7 +629,6 @@ func RecoverySnapshotHeaderFactory() android.Module {
var _ snapshotSanitizer = (*snapshotLibraryDecorator)(nil) var _ snapshotSanitizer = (*snapshotLibraryDecorator)(nil)
//
// Module definitions for snapshots of executable binaries. // Module definitions for snapshots of executable binaries.
// //
// Modules (vendor|recovery)_snapshot_binary are defined here. They have their prebuilt executable // Modules (vendor|recovery)_snapshot_binary are defined here. They have their prebuilt executable
@ -728,7 +726,6 @@ func snapshotBinaryFactory(image SnapshotImage, moduleSuffix string) android.Mod
return module.Init() return module.Init()
} }
//
// Module definitions for snapshots of object files (*.o). // Module definitions for snapshots of object files (*.o).
// //
// Modules (vendor|recovery)_snapshot_object are defined here. They have their prebuilt object // Modules (vendor|recovery)_snapshot_object are defined here. They have their prebuilt object

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -28,17 +28,16 @@ var (
// //
// Example: // Example:
// //
// vendor_public_library { // vendor_public_library {
// name: "libfoo", // name: "libfoo",
// symbol_file: "libfoo.map.txt", // symbol_file: "libfoo.map.txt",
// export_public_headers: ["libfoo_headers"], // export_public_headers: ["libfoo_headers"],
// } // }
//
// cc_headers {
// name: "libfoo_headers",
// export_include_dirs: ["include"],
// }
// //
// cc_headers {
// name: "libfoo_headers",
// export_include_dirs: ["include"],
// }
type vendorPublicLibraryProperties struct { type vendorPublicLibraryProperties struct {
// Relative path to the symbol map. // Relative path to the symbol map.
Symbol_file *string Symbol_file *string

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -29,26 +29,25 @@ var (
// //
// Example: // Example:
// //
// vndk_prebuilt_shared { // vndk_prebuilt_shared {
// name: "libfoo", // name: "libfoo",
// version: "27", // version: "27",
// target_arch: "arm64", // target_arch: "arm64",
// vendor_available: true, // vendor_available: true,
// product_available: true, // product_available: true,
// vndk: { // vndk: {
// enabled: true, // enabled: true,
// }, // },
// export_include_dirs: ["include/external/libfoo/vndk_include"], // export_include_dirs: ["include/external/libfoo/vndk_include"],
// arch: { // arch: {
// arm64: { // arm64: {
// srcs: ["arm/lib64/libfoo.so"], // srcs: ["arm/lib64/libfoo.so"],
// }, // },
// arm: { // arm: {
// srcs: ["arm/lib/libfoo.so"], // srcs: ["arm/lib/libfoo.so"],
// }, // },
// }, // },
// } // }
//
type vndkPrebuiltProperties struct { type vndkPrebuiltProperties struct {
// VNDK snapshot version. // VNDK snapshot version.
Version *string Version *string
@ -250,25 +249,25 @@ func vndkPrebuiltSharedLibrary() *Module {
// vndk_prebuilt_shared installs Vendor Native Development kit (VNDK) snapshot // vndk_prebuilt_shared installs Vendor Native Development kit (VNDK) snapshot
// shared libraries for system build. Example: // shared libraries for system build. Example:
// //
// vndk_prebuilt_shared { // vndk_prebuilt_shared {
// name: "libfoo", // name: "libfoo",
// version: "27", // version: "27",
// target_arch: "arm64", // target_arch: "arm64",
// vendor_available: true, // vendor_available: true,
// product_available: true, // product_available: true,
// vndk: { // vndk: {
// enabled: true, // enabled: true,
// }, // },
// export_include_dirs: ["include/external/libfoo/vndk_include"], // export_include_dirs: ["include/external/libfoo/vndk_include"],
// arch: { // arch: {
// arm64: { // arm64: {
// srcs: ["arm/lib64/libfoo.so"], // srcs: ["arm/lib64/libfoo.so"],
// }, // },
// arm: { // arm: {
// srcs: ["arm/lib/libfoo.so"], // srcs: ["arm/lib/libfoo.so"],
// }, // },
// }, // },
// } // }
func VndkPrebuiltSharedFactory() android.Module { func VndkPrebuiltSharedFactory() android.Module {
module := vndkPrebuiltSharedLibrary() module := vndkPrebuiltSharedLibrary()
return module.Init() return module.Init()

View file

@ -208,7 +208,6 @@ func run() error {
// //
// returns an exec.Cmd that can be ran from within sbox context if no error, or nil if error. // returns an exec.Cmd that can be ran from within sbox context if no error, or nil if error.
// caller must ensure script is cleaned up if function succeeds. // caller must ensure script is cleaned up if function succeeds.
//
func createCommandScript(rawCommand, scriptPath, scriptPathInSandbox string) (*exec.Cmd, error) { func createCommandScript(rawCommand, scriptPath, scriptPathInSandbox string) (*exec.Cmd, error) {
err := os.WriteFile(scriptPath, []byte(rawCommand), 0644) err := os.WriteFile(scriptPath, []byte(rawCommand), 0644)
if err != nil { if err != nil {

View file

@ -25,11 +25,11 @@ import (
) )
// This comment describes the following: // This comment describes the following:
// 1. the concept of class loader context (CLC) and its relation to classpath // 1. the concept of class loader context (CLC) and its relation to classpath
// 2. how PackageManager constructs CLC from shared libraries and their dependencies // 2. how PackageManager constructs CLC from shared libraries and their dependencies
// 3. build-time vs. run-time CLC and why this matters for dexpreopt // 3. build-time vs. run-time CLC and why this matters for dexpreopt
// 4. manifest fixer: a tool that adds missing <uses-library> tags to the manifests // 4. manifest fixer: a tool that adds missing <uses-library> tags to the manifests
// 5. build system support for CLC // 5. build system support for CLC
// //
// 1. Class loader context // 1. Class loader context
// ----------------------- // -----------------------
@ -59,15 +59,16 @@ import (
// loaders are not duplicated (at runtime there is a single class loader instance for each library). // loaders are not duplicated (at runtime there is a single class loader instance for each library).
// //
// Example: A has <uses-library> tags B, C and D; C has <uses-library tags> B and D; // Example: A has <uses-library> tags B, C and D; C has <uses-library tags> B and D;
// D has <uses-library> E; B and E have no <uses-library> dependencies. The CLC is: //
// A // D has <uses-library> E; B and E have no <uses-library> dependencies. The CLC is:
// ├── B // A
// ├── C // ├── B
// │ ├── B // ├── C
// │ └── D // │ ├── B
// │ └── E // │ └── D
// └── D // │ └── E
// └── E // └── D
// └── E
// //
// CLC defines the lookup order of libraries when resolving Java classes used by the library/app. // CLC defines the lookup order of libraries when resolving Java classes used by the library/app.
// The lookup order is important because libraries may contain duplicate classes, and the class is // The lookup order is important because libraries may contain duplicate classes, and the class is
@ -188,7 +189,6 @@ import (
// rule generation phase. // rule generation phase.
// //
// ClassLoaderContext is a structure that represents CLC. // ClassLoaderContext is a structure that represents CLC.
//
type ClassLoaderContext struct { type ClassLoaderContext struct {
// The name of the library. // The name of the library.
Name string Name string
@ -249,7 +249,6 @@ func (c *ClassLoaderContext) excludeLibs(excludedLibs []string) (*ClassLoaderCon
// generates a build rule that includes conditional CLC for all versions, extracts the target SDK // generates a build rule that includes conditional CLC for all versions, extracts the target SDK
// version from the manifest, and filters the CLCs based on that version. Exact final CLC that is // version from the manifest, and filters the CLCs based on that version. Exact final CLC that is
// passed to dex2oat is unknown to the build system, and gets known only at Ninja stage. // passed to dex2oat is unknown to the build system, and gets known only at Ninja stage.
//
type ClassLoaderContextMap map[int][]*ClassLoaderContext type ClassLoaderContextMap map[int][]*ClassLoaderContext
// Compatibility libraries. Some are optional, and some are required: this is the default that // Compatibility libraries. Some are optional, and some are required: this is the default that
@ -485,7 +484,6 @@ func (clcMap ClassLoaderContextMap) ExcludeLibs(excludedLibs []string) ClassLoad
// constructs class loader context on device. // constructs class loader context on device.
// //
// TODO(b/132357300): remove "android.hidl.manager" and "android.hidl.base" for non-system apps. // TODO(b/132357300): remove "android.hidl.manager" and "android.hidl.base" for non-system apps.
//
func fixClassLoaderContext(clcMap ClassLoaderContextMap) { func fixClassLoaderContext(clcMap ClassLoaderContextMap) {
required, optional := clcMap.UsesLibs() required, optional := clcMap.UsesLibs()
usesLibs := append(required, optional...) usesLibs := append(required, optional...)

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -736,15 +736,15 @@ func (f *Finder) parseCacheEntry(bytes []byte) ([]dirFullInfo, error) {
// because we know this separator won't appear in the json that we're parsing. // because we know this separator won't appear in the json that we're parsing.
// //
// The newline byte can only appear in a UTF-8 stream if the newline character appears, because: // The newline byte can only appear in a UTF-8 stream if the newline character appears, because:
// - The newline character is encoded as "0000 1010" in binary ("0a" in hex) // - The newline character is encoded as "0000 1010" in binary ("0a" in hex)
// - UTF-8 dictates that bytes beginning with a "0" bit are never emitted as part of a multibyte // - UTF-8 dictates that bytes beginning with a "0" bit are never emitted as part of a multibyte
// character. // character.
// //
// We know that the newline character will never appear in our json string, because: // We know that the newline character will never appear in our json string, because:
// - If a newline character appears as part of a data string, then json encoding will // - If a newline character appears as part of a data string, then json encoding will
// emit two characters instead: '\' and 'n'. // emit two characters instead: '\' and 'n'.
// - The json encoder that we use doesn't emit the optional newlines between any of its // - The json encoder that we use doesn't emit the optional newlines between any of its
// other outputs. // other outputs.
const lineSeparator = byte('\n') const lineSeparator = byte('\n')
func (f *Finder) readLine(reader *bufio.Reader) ([]byte, error) { func (f *Finder) readLine(reader *bufio.Reader) ([]byte, error) {

View file

@ -976,9 +976,7 @@ func (m *Module) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
var Bool = proptools.Bool var Bool = proptools.Bool
var String = proptools.String var String = proptools.String
//
// Defaults // Defaults
//
type Defaults struct { type Defaults struct {
android.ModuleBase android.ModuleBase
android.DefaultsModuleBase android.DefaultsModuleBase

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. // 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: // DPI-specific apk source files can be specified using dpi_variants. Example:
// //
// android_app_import { // android_app_import {
// name: "example_import", // name: "example_import",
// apk: "prebuilts/example.apk", // apk: "prebuilts/example.apk",
// dpi_variants: { // dpi_variants: {
// mdpi: { // mdpi: {
// apk: "prebuilts/example_mdpi.apk", // apk: "prebuilts/example_mdpi.apk",
// }, // },
// xhdpi: { // xhdpi: {
// apk: "prebuilts/example_xhdpi.apk", // apk: "prebuilts/example_xhdpi.apk",
// }, // },
// }, // },
// presigned: true, // presigned: true,
// } // }
func AndroidAppImportFactory() android.Module { func AndroidAppImportFactory() android.Module {
module := &AndroidAppImport{} module := &AndroidAppImport{}
module.AddProperties(&module.properties) module.AddProperties(&module.properties)

View file

@ -97,11 +97,11 @@ type ClasspathElementContext interface {
// the list with its Contents field. // the list with its Contents field.
// //
// Requirements/Assumptions: // Requirements/Assumptions:
// * A fragment can be associated with more than one apex but each apex must only be associated with // - 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. // 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 // - All of a fragment's contents must appear as a contiguous block in the same order in the
// libraries list. // libraries list.
// * Each library must only appear in a single fragment. // - 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 // 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 // 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. // standalone and have their own element.
// //
// e.g. Given the following input: // 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: // Then this will return:
// ClasspathFragmentElement(art-bootclasspath-fragment, [core-oj, core-libart]), //
// ClasspathLibraryElement(framework), // ClasspathFragmentElement(art-bootclasspath-fragment, [core-oj, core-libart]),
// ClasspathLibraryElement(ext), // ClasspathLibraryElement(framework),
// ClasspathLibraryElement(ext),
func CreateClasspathElements(ctx ClasspathElementContext, libraries []android.Module, fragments []android.Module) ClasspathElements { 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 // Create a map from apex name to the fragment module. This makes it easy to find the fragment
// associated with a particular apex. // 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. // 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. // ART tools will then reconstruct the architecture-specific real path.
//
func (image *bootImageVariant) imageLocations() (imageLocationsOnHost []string, imageLocationsOnDevice []string) { func (image *bootImageVariant) imageLocations() (imageLocationsOnHost []string, imageLocationsOnDevice []string) {
if image.extends != nil { if image.extends != nil {
imageLocationsOnHost, imageLocationsOnDevice = image.extends.getVariant(image.target).imageLocations() imageLocationsOnHost, imageLocationsOnDevice = image.extends.getVariant(image.target).imageLocations()

View file

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

View file

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

View file

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

View file

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

View file

@ -2129,11 +2129,12 @@ var _ SdkLibraryDependency = (*SdkLibraryImport)(nil)
// The type of a structure that contains a field of type sdkLibraryScopeProperties // The type of a structure that contains a field of type sdkLibraryScopeProperties
// for each apiscope in allApiScopes, e.g. something like: // for each apiscope in allApiScopes, e.g. something like:
// struct { //
// Public sdkLibraryScopeProperties // struct {
// System sdkLibraryScopeProperties // Public sdkLibraryScopeProperties
// ... // System sdkLibraryScopeProperties
// } // ...
// }
var allScopeStructType = createAllScopePropertiesStructType() var allScopeStructType = createAllScopePropertiesStructType()
// Dynamically create a structure type for each apiscope in allApiScopes. // Dynamically create a structure type for each apiscope in allApiScopes.
@ -2556,9 +2557,7 @@ func (module *SdkLibraryImport) RequiredFilesFromPrebuiltApex(ctx android.BaseMo
return requiredFilesFromPrebuiltApexForImport(name) return requiredFilesFromPrebuiltApexForImport(name)
} }
//
// java_sdk_library_xml // java_sdk_library_xml
//
type sdkLibraryXml struct { type sdkLibraryXml struct {
android.ModuleBase android.ModuleBase
android.DefaultableModuleBase 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. // Get partition group of java module that can be used at inter-partition dependency check.
// We currently have three groups // We currently have three groups
// (system, system_ext) => system partition group //
// (vendor, odm) => vendor partition group // (system, system_ext) => system partition group
// (product) => product partition group // (vendor, odm) => vendor partition group
// (product) => product partition group
func (j *Module) partitionGroup(ctx android.EarlyModuleContext) partitionGroup { 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. // system and system_ext partition can be treated as the same in terms of inter-partition dependency.
if j.Platform() || j.SystemExtSpecific() { if j.Platform() || j.SystemExtSpecific() {

View file

@ -14,13 +14,13 @@
// Convert makefile containing device configuration to Starlark file // Convert makefile containing device configuration to Starlark file
// The conversion can handle the following constructs in a makefile: // The conversion can handle the following constructs in a makefile:
// * comments // - comments
// * simple variable assignments // - simple variable assignments
// * $(call init-product,<file>) // - $(call init-product,<file>)
// * $(call inherit-product-if-exists // - $(call inherit-product-if-exists
// * if directives // - if directives
// All other constructs are carried over to the output starlark file as comments.
// //
// All other constructs are carried over to the output starlark file as comments.
package mk2rbc package mk2rbc
import ( import (

View file

@ -32,8 +32,8 @@ type context struct {
// Scans the makefile Soong uses to generate soong.variables file, // Scans the makefile Soong uses to generate soong.variables file,
// collecting variable names and types from the lines that look like this: // collecting variable names and types from the lines that look like this:
// $(call add_json_XXX, <...>, $(VAR))
// //
// $(call add_json_XXX, <...>, $(VAR))
func FindSoongVariables(mkFile string, includeFileScope mkparser.Scope, registrar variableRegistrar) error { func FindSoongVariables(mkFile string, includeFileScope mkparser.Scope, registrar variableRegistrar) error {
ctx := context{includeFileScope, registrar} ctx := context{includeFileScope, registrar}
return ctx.doFind(mkFile) return ctx.doFind(mkFile)

View file

@ -438,9 +438,9 @@ func (p *Module) anySrcHasExt(ctx android.BottomUpMutatorContext, ext string) bo
} }
// DepsMutator mutates dependencies for this module: // DepsMutator mutates dependencies for this module:
// * handles proto dependencies, // - handles proto dependencies,
// * if required, specifies launcher and adds launcher dependencies, // - if required, specifies launcher and adds launcher dependencies,
// * applies python version mutations to Python dependencies // - applies python version mutations to Python dependencies
func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) { func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
android.ProtoDeps(ctx, &p.protoProperties) android.ProtoDeps(ctx, &p.protoProperties)

View file

@ -19,12 +19,12 @@
// To use, download the logs.zip from one or more branches, and extract them // To use, download the logs.zip from one or more branches, and extract them
// into subdirectories of the current directory. So for example, I have: // into subdirectories of the current directory. So for example, I have:
// //
// ./aosp-master/aosp_arm/std_full.log // ./aosp-master/aosp_arm/std_full.log
// ./aosp-master/aosp_arm64/std_full.log // ./aosp-master/aosp_arm64/std_full.log
// ./aosp-master/... // ./aosp-master/...
// ./internal-master/aosp_arm/std_full.log // ./internal-master/aosp_arm/std_full.log
// ./internal-master/aosp_arm64/std_full.log // ./internal-master/aosp_arm64/std_full.log
// ./internal-master/... // ./internal-master/...
// //
// Then I use `go run path/to/build_broken_logs.go *` // Then I use `go run path/to/build_broken_logs.go *`
package main package main

View file

@ -369,7 +369,9 @@ func newPropertyPrunerForStructType(structType reflect.Type, selector fieldSelec
// structure which are not supported by the specified target build release. // structure which are not supported by the specified target build release.
// //
// A property is pruned if its field has a tag of the form: // A property is pruned if its field has a tag of the form:
// `supported_build_releases:"<build-release-set>"` //
// `supported_build_releases:"<build-release-set>"`
//
// and the resulting build release set does not contain the target build release. Properties that // and the resulting build release set does not contain the target build release. Properties that
// have no such tag are assumed to be supported by all releases. // have no such tag are assumed to be supported by all releases.
func newPropertyPrunerByBuildRelease(propertiesStruct interface{}, targetBuildRelease *buildRelease) *propertyPruner { func newPropertyPrunerByBuildRelease(propertiesStruct interface{}, targetBuildRelease *buildRelease) *propertyPruner {

View file

@ -68,7 +68,6 @@ func getDynamicSdkMemberTraits(key android.OnceKey, registeredTraits []android.S
// A list of sdkMemberTraitListProperty instances is created, one per member trait that provides: // A list of sdkMemberTraitListProperty instances is created, one per member trait that provides:
// * a reference to the member trait. // * a reference to the member trait.
// * a getter for the corresponding field in the properties struct. // * a getter for the corresponding field in the properties struct.
//
func createDynamicSdkMemberTraits(sdkMemberTraits []android.SdkMemberTrait) *dynamicSdkMemberTraits { func createDynamicSdkMemberTraits(sdkMemberTraits []android.SdkMemberTrait) *dynamicSdkMemberTraits {
var listProperties []*sdkMemberTraitListProperty var listProperties []*sdkMemberTraitListProperty

View file

@ -80,7 +80,6 @@ func getDynamicSdkMemberTypes(key android.OnceKey, registeredTypes []android.Sdk
// * a reference to the member type. // * a reference to the member type.
// * a getter for the corresponding field in the properties struct. // * a getter for the corresponding field in the properties struct.
// * a dependency tag that identifies the member type of a resolved dependency. // * a dependency tag that identifies the member type of a resolved dependency.
//
func createDynamicSdkMemberTypes(sdkMemberTypes []android.SdkMemberType) *dynamicSdkMemberTypes { func createDynamicSdkMemberTypes(sdkMemberTypes []android.SdkMemberType) *dynamicSdkMemberTypes {
var listProperties []*sdkMemberTypeListProperty var listProperties []*sdkMemberTypeListProperty

View file

@ -32,10 +32,11 @@ type envFileData []envFileEntry
// //
// e.g. OUT_DIR = "out" // e.g. OUT_DIR = "out"
// is converted to: // is converted to:
// { //
// "Key": "OUT_DIR", // {
// "Value": "out", // "Key": "OUT_DIR",
// }, // "Value": "out",
// },
func EnvFileContents(envDeps map[string]string) ([]byte, error) { func EnvFileContents(envDeps map[string]string) ([]byte, error) {
contents := make(envFileData, 0, len(envDeps)) contents := make(envFileData, 0, len(envDeps))
for key, value := range envDeps { for key, value := range envDeps {

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
// You may obtain a copy of the License at // You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -615,7 +615,6 @@ func returnRecursiveZip() (r io.ReaderAt, size int64) {
// //
// It's here in hex for the same reason as rZipBytes above: to avoid // It's here in hex for the same reason as rZipBytes above: to avoid
// problems with on-disk virus scanners or other zip processors. // problems with on-disk virus scanners or other zip processors.
//
func biggestZipBytes() []byte { func biggestZipBytes() []byte {
s := ` s := `
0000000 50 4b 03 04 14 00 08 00 08 00 00 00 00 00 00 00 0000000 50 4b 03 04 14 00 08 00 08 00 00 00 00 00 00 00

View file

@ -31,13 +31,12 @@ import (
// same time we do. Most of the time this means we just need to ignore the signal and we'll // same time we do. Most of the time this means we just need to ignore the signal and we'll
// just see errors from all of our subprocesses. But in case that fails, when we get a signal: // just see errors from all of our subprocesses. But in case that fails, when we get a signal:
// //
// 1. Wait two seconds to exit normally. // 1. Wait two seconds to exit normally.
// 2. Call cancel() which is normally the cancellation of a Context. This will send a SIGKILL // 2. Call cancel() which is normally the cancellation of a Context. This will send a SIGKILL
// to any subprocesses attached to that context. // to any subprocesses attached to that context.
// 3. Wait two seconds to exit normally. // 3. Wait two seconds to exit normally.
// 4. Call cleanup() to close the log/trace buffers, then panic. // 4. Call cleanup() to close the log/trace buffers, then panic.
// 5. If another two seconds passes (if cleanup got stuck, etc), then panic. // 5. If another two seconds passes (if cleanup got stuck, etc), then panic.
//
func SetupSignals(log logger.Logger, cancel, cleanup func()) { func SetupSignals(log logger.Logger, cancel, cleanup func()) {
signals := make(chan os.Signal, 5) signals := make(chan os.Signal, 5)
signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM) signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM)