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,7 +711,7 @@ type ApexContents struct {
// NewApexContents creates and initializes an ApexContents that is suitable
// 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.
func NewApexContents(contents map[string]ApexMembership) *ApexContents {
return &ApexContents{

View file

@ -527,13 +527,16 @@ var DarwinUniversalVariantTag = archDepTag{name: "darwin universal binary"}
// - 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.
// - 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
// for the module, the Device OsClass is selected.
// 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
// target.host.compile_multilib).
// - The default multilib passed to InitAndroidArchModule if compile_multilib was not set.
//
// 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,
// but may be arm for a 32-bit only build.
@ -1215,11 +1218,13 @@ func (m *ModuleBase) setOSProperties(ctx BottomUpMutatorContext) {
// Returns the struct containing the properties specific to the given
// architecture type. These look like this in Blueprint files:
//
// arch: {
// arm64: {
// key: value,
// },
// },
//
// This struct will also contain sub-structs containing to the architecture/CPU
// variants and features that themselves contain properties specific to those.
func getArchTypeStruct(ctx ArchVariantContext, archProperties interface{}, archType ArchType) (reflect.Value, bool) {
@ -1231,6 +1236,7 @@ func getArchTypeStruct(ctx ArchVariantContext, archProperties interface{}, archT
// Returns the struct containing the properties specific to a given multilib
// value. These look like this in the Blueprint file:
//
// multilib: {
// lib32: {
// key: value,
@ -2010,6 +2016,7 @@ type ConfigurationAxisToArchVariantProperties map[bazel.ConfigurationAxis]ArchVa
// 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
// non-overlapping configs that correspond to the various "arch-variant" support, at this time:
//
// arches (including multilib)
// oses
// arch+os combinations
@ -2165,9 +2172,12 @@ func (m *ModuleBase) GetArchVariantProperties(ctx ArchVariantContext, propertySe
// Returns a struct matching the propertySet interface, containing properties specific to the targetName
// For example, given these arguments:
//
// propertySet = BaseCompilerProperties
// targetName = "android_arm"
//
// And given this Android.bp fragment:
//
// target:
// android_arm: {
// srcs: ["foo.c"],
@ -2176,6 +2186,7 @@ func (m *ModuleBase) GetArchVariantProperties(ctx ArchVariantContext, propertySe
// srcs: ["bar.c"],
// }
// }
//
// This would return a BaseCompilerProperties with BaseCompilerProperties.Srcs = ["foo.c"]
func getTargetStructs(ctx ArchVariantContext, archProperties []interface{}, targetName string) []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
//
// e.g. something like
//
// async_safe/include/async_safe/CHECK.h
//
// might become
//
// //bionic/libc/async_safe:include/async_safe/CHECK.h
//
// 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 //.
@ -303,20 +307,21 @@ func RootToModuleRelativePaths(ctx BazelConversionPathContext, paths Paths) []ba
// 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
// 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
// * 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
// 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
// (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.**
// * 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
// 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.
// "//path/to/dir:<target>"). If the reference to another module cannot be resolved,the function
// will panic.
//
// 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
// path_deps mutator.

View file

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

View file

@ -420,10 +420,12 @@ type FixturePreparer interface {
// instances.
//
// 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.
//
// preparers - a list of additional unflattened, undeduped preparers that will be applied after the
//
// base preparers.
//
// Returns a deduped and flattened list of the preparers starting with the ones in base with any
@ -498,10 +500,10 @@ func newSimpleFixturePreparer(preparer func(fixture *fixture)) FixturePreparer {
// FixtureErrorHandler determines how to respond to errors reported by the code under test.
//
// Some possible responses:
// * 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 any errors are reported, see FixtureExpectsNoErrors.
// - Fail the test if at least one error that matches a pattern is not reported see
// 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
// function this is defined as an interface to allow future enhancements, e.g. provide different
@ -866,9 +868,11 @@ func (r *TestResult) NormalizePathsForTesting(paths Paths) []string {
// that produced this result.
//
// e.g. assuming that this result was created by running:
//
// GroupFixturePreparers(preparer1, preparer2, preparer3).RunTest(t)
//
// Then this method will be equivalent to running:
//
// GroupFixturePreparers(preparer1, preparer2, preparer3)
//
// This is intended for use by tests whose output is Android.bp files to verify that those files

View file

@ -387,20 +387,21 @@ func ExistentPathsForSources(ctx PathContext, paths []string) 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
// * 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.
// * 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
// filepath.
//
// 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
// path_deps mutator.
// 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
// * otherwise, a ModuleError is thrown.
// - otherwise, a ModuleError is thrown.
func PathsForModuleSrc(ctx ModuleMissingDepsPathContext, paths []string) Paths {
return PathsForModuleSrcExcludes(ctx, paths, nil)
}
@ -414,21 +415,22 @@ type SourceInput struct {
// PathsForModuleSrcExcludes returns a Paths{} containing the resolved references in 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
// * 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.
// * 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
// filepath.
//
// excluding the items (similarly resolved
// 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
// path_deps mutator.
// 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
// * otherwise, a ModuleError is thrown.
// - otherwise, a ModuleError is thrown.
func PathsForModuleSrcExcludes(ctx ModuleMissingDepsPathContext, paths, excludes []string) Paths {
return PathsRelativeToModuleSourceDir(SourceInput{
Context: ctx,
@ -548,13 +550,14 @@ func GetModuleFromPathDep(ctx ModuleWithDepsPathContext, moduleName, tag string)
// PathsAndMissingDepsForModuleSrcExcludes returns a Paths{} containing the resolved references in
// 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
// * 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.
// * 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
// filepath.
//
// 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
// `android:"path"` so that dependencies on SourceFileProducer modules will have already been handled by the

View file

@ -1031,6 +1031,7 @@ func (c *RuleBuilderCommand) ImplicitTools(paths Paths) *RuleBuilderCommand {
// be also added to the dependencies returned by RuleBuilder.Tools.
//
// It is equivalent to:
//
// cmd.Tool(ctx.Config().HostToolPath(ctx, tool))
func (c *RuleBuilderCommand) BuiltTool(tool string) *RuleBuilderCommand {
if c.rule.ctx.Config().UseHostMusl() {
@ -1053,6 +1054,7 @@ func (c *RuleBuilderCommand) builtToolWithoutDeps(tool string) *RuleBuilderComma
// dependencies returned by RuleBuilder.Tools.
//
// It is equivalent to:
//
// cmd.Tool(ctx.Config().PrebuiltBuildTool(ctx, tool))
func (c *RuleBuilderCommand) PrebuiltBuildTool(ctx PathContext, tool string) *RuleBuilderCommand {
return c.Tool(ctx.Config().PrebuiltBuildTool(ctx, tool))

View file

@ -430,12 +430,12 @@ func (r *sdkRegistry) uniqueOnceKey() OnceKey {
// 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.
// 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.
// * 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
// 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).
//
// A sdk can request a module to provide no traits, one trait or a collection of traits. The exact
@ -652,7 +652,6 @@ func DependencyTagForSdkMemberType(memberType SdkMemberType, export bool) SdkMem
// }
//
// ...methods...
//
type SdkMemberType interface {
// SdkPropertyName returns the name of the member type property on an sdk module.
SdkPropertyName() string

View file

@ -190,6 +190,7 @@ type soongConfigModuleTypeModule struct {
//
// Each soong_config_variable supports an additional value `conditions_default`. The properties
// 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
// string variable: the variable is unspecified or the variable is set to a string unused in the

View file

@ -343,6 +343,7 @@ func (defs Bp2BuildSoongConfigDefinitions) String() string {
//
// For example, the acme_cc_defaults example above would
// produce a reflect.Value whose type is:
//
// *struct {
// Soong_config_variables struct {
// Board struct {
@ -351,7 +352,9 @@ func (defs Bp2BuildSoongConfigDefinitions) String() string {
// }
// }
// }
//
// And whose value is:
//
// &{
// Soong_config_variables: {
// Board: {

View file

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

View file

@ -364,14 +364,14 @@ func (p *prebuiltCommon) DepIsInSameApex(ctx android.BaseModuleContext, dep andr
// 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
// 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
// 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
// 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
// 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
// from source.
func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) {
@ -715,7 +715,9 @@ var _ prebuiltApexModuleCreator = (*Prebuilt)(nil)
//
// 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:
//
// 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`.
//
@ -724,7 +726,6 @@ var _ prebuiltApexModuleCreator = (*Prebuilt)(nil)
// / | \
// V V V
// selector <--- deapexer <--- exported java lib
//
func (p *Prebuilt) createPrebuiltApexModules(ctx android.TopDownMutatorContext) {
baseModuleName := p.BaseModuleName()

View file

@ -52,8 +52,9 @@ type KeyValuePair struct {
// AqueryDepset is a depset definition from Bazel's aquery response. This is
// akin to the `depSetOfFiles` in the response proto, except:
// * 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)
// - 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)
//
// 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
// more "child" depsets.

View file

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

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.
// This handles the statement
//
// LOCAL_SRC_FILES := $(LOCAL_MODULE)
//
// which occurs often.
func resolveLocalModule(mod *parser.Module, val parser.Expression) parser.Expression {
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:
// * changing the module type from prebuilt_etc to a different one
// * stripping the prefix of the install path based on the module type
// * appending additional boolean properties to the prebuilt module
// - changing the module type from prebuilt_etc to a different one
// - stripping the prefix of the install path based on the module type
// - appending additional boolean properties to the prebuilt module
type etcPrebuiltModuleUpdate struct {
// The prefix of the install path defined in local_module_path. The prefix is removed from local_module_path
// before setting the 'filename' attribute.

View file

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

View file

@ -283,7 +283,9 @@ func versionedNdkHeadersFactory() android.Module {
// }
//
// Will invoke the preprocessor as:
//
// $preprocessor -o $SYSROOT/usr/include/android/needs_preproc.h $src
//
// For each src in srcs.
type preprocessedHeadersProperties struct {
// The preprocessor to run. Must be a program inside the source directory

View file

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

View file

@ -348,9 +348,9 @@ type bazelPrebuiltLibraryStaticAttributes struct {
// 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:
// * 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
// * Both a prebuilt_library_static and prebuilt_library_shared if the aforementioned properties are not false across
// - 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
// - Both a prebuilt_library_static and prebuilt_library_shared if the aforementioned properties are not false across
// all variants
//
// In all cases, prebuilt_library_static target names will be appended with "_bp2build_cc_library_static".

View file

@ -370,7 +370,6 @@ func vendorSnapshotLoadHook(ctx android.LoadHookContext, p *BaseSnapshotDecorato
}
}
//
// Module definitions for snapshots of libraries (shared, static, header).
//
// 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)
//
// Module definitions for snapshots of executable binaries.
//
// 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()
}
//
// Module definitions for snapshots of object files (*.o).
//
// Modules (vendor|recovery)_snapshot_object are defined here. They have their prebuilt object

View file

@ -38,7 +38,6 @@ var (
// name: "libfoo_headers",
// export_include_dirs: ["include"],
// }
//
type vendorPublicLibraryProperties struct {
// Relative path to the symbol map.
Symbol_file *string

View file

@ -48,7 +48,6 @@ var (
// },
// },
// }
//
type vndkPrebuiltProperties struct {
// VNDK snapshot version.
Version *string

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.
// caller must ensure script is cleaned up if function succeeds.
//
func createCommandScript(rawCommand, scriptPath, scriptPathInSandbox string) (*exec.Cmd, error) {
err := os.WriteFile(scriptPath, []byte(rawCommand), 0644)
if err != nil {

View file

@ -59,6 +59,7 @@ import (
// 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;
//
// D has <uses-library> E; B and E have no <uses-library> dependencies. The CLC is:
// A
// ├── B
@ -188,7 +189,6 @@ import (
// rule generation phase.
//
// ClassLoaderContext is a structure that represents CLC.
//
type ClassLoaderContext struct {
// The name of the library.
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
// 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.
//
type ClassLoaderContextMap map[int][]*ClassLoaderContext
// 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.
//
// TODO(b/132357300): remove "android.hidl.manager" and "android.hidl.base" for non-system apps.
//
func fixClassLoaderContext(clcMap ClassLoaderContextMap) {
required, optional := clcMap.UsesLibs()
usesLibs := append(required, optional...)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,6 +49,7 @@ func (g partitionGroup) String() string {
// Get partition group of java module that can be used at inter-partition dependency check.
// We currently have three groups
//
// (system, system_ext) => system partition group
// (vendor, odm) => vendor partition group
// (product) => product partition group

View file

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

View file

@ -32,8 +32,8 @@ type context struct {
// Scans the makefile Soong uses to generate soong.variables file,
// 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 {
ctx := context{includeFileScope, registrar}
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:
// * handles proto dependencies,
// * if required, specifies launcher and adds launcher dependencies,
// * applies python version mutations to Python dependencies
// - handles proto dependencies,
// - if required, specifies launcher and adds launcher dependencies,
// - applies python version mutations to Python dependencies
func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
android.ProtoDeps(ctx, &p.protoProperties)

View file

@ -369,7 +369,9 @@ func newPropertyPrunerForStructType(structType reflect.Type, selector fieldSelec
// structure which are not supported by the specified target build release.
//
// A property is pruned if its field has a tag of the form:
//
// `supported_build_releases:"<build-release-set>"`
//
// 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.
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 reference to the member trait.
// * a getter for the corresponding field in the properties struct.
//
func createDynamicSdkMemberTraits(sdkMemberTraits []android.SdkMemberTrait) *dynamicSdkMemberTraits {
var listProperties []*sdkMemberTraitListProperty

View file

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

View file

@ -32,6 +32,7 @@ type envFileData []envFileEntry
//
// e.g. OUT_DIR = "out"
// is converted to:
//
// {
// "Key": "OUT_DIR",
// "Value": "out",

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
// problems with on-disk virus scanners or other zip processors.
//
func biggestZipBytes() []byte {
s := `
0000000 50 4b 03 04 14 00 08 00 08 00 00 00 00 00 00 00

View file

@ -37,7 +37,6 @@ import (
// 3. Wait two seconds to exit normally.
// 4. Call cleanup() to close the log/trace buffers, then panic.
// 5. If another two seconds passes (if cleanup got stuck, etc), then panic.
//
func SetupSignals(log logger.Logger, cancel, cleanup func()) {
signals := make(chan os.Signal, 5)
signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM)