Merge changes Id806633d,I05e945f3,Ieac84040,I18eb8cc0,If11c298e
am: 17ae970a92
Change-Id: I41deccdfac6f35a477e044de1244424540b42da9
This commit is contained in:
@@ -67,6 +67,7 @@ bootstrap_go_package {
|
|||||||
"android/expand_test.go",
|
"android/expand_test.go",
|
||||||
"android/paths_test.go",
|
"android/paths_test.go",
|
||||||
"android/prebuilt_test.go",
|
"android/prebuilt_test.go",
|
||||||
|
"android/util_test.go",
|
||||||
"android/variable_test.go",
|
"android/variable_test.go",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
@@ -131,7 +131,7 @@ func defaultsDepsMutator(ctx BottomUpMutatorContext) {
|
|||||||
func defaultsMutator(ctx TopDownMutatorContext) {
|
func defaultsMutator(ctx TopDownMutatorContext) {
|
||||||
if defaultable, ok := ctx.Module().(Defaultable); ok && len(defaultable.defaults().Defaults) > 0 {
|
if defaultable, ok := ctx.Module().(Defaultable); ok && len(defaultable.defaults().Defaults) > 0 {
|
||||||
var defaultsList []Defaults
|
var defaultsList []Defaults
|
||||||
ctx.WalkDeps(func(module, parent blueprint.Module) bool {
|
ctx.WalkDeps(func(module, parent Module) bool {
|
||||||
if ctx.OtherModuleDependencyTag(module) == DefaultsDepTag {
|
if ctx.OtherModuleDependencyTag(module) == DefaultsDepTag {
|
||||||
if defaults, ok := module.(Defaults); ok {
|
if defaults, ok := module.(Defaults); ok {
|
||||||
defaultsList = append(defaultsList, defaults)
|
defaultsList = append(defaultsList, defaults)
|
||||||
|
@@ -32,7 +32,7 @@ var (
|
|||||||
HostExecutable = "host_executable"
|
HostExecutable = "host_executable"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModuleBuildParams struct {
|
type BuildParams struct {
|
||||||
Rule blueprint.Rule
|
Rule blueprint.Rule
|
||||||
Deps blueprint.Deps
|
Deps blueprint.Deps
|
||||||
Depfile WritablePath
|
Depfile WritablePath
|
||||||
@@ -50,6 +50,8 @@ type ModuleBuildParams struct {
|
|||||||
Args map[string]string
|
Args map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ModuleBuildParams BuildParams
|
||||||
|
|
||||||
type androidBaseContext interface {
|
type androidBaseContext interface {
|
||||||
Target() Target
|
Target() Target
|
||||||
TargetPrimary() bool
|
TargetPrimary() bool
|
||||||
@@ -72,11 +74,10 @@ type BaseContext interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ModuleContext interface {
|
type ModuleContext interface {
|
||||||
blueprint.ModuleContext
|
|
||||||
androidBaseContext
|
androidBaseContext
|
||||||
|
blueprint.BaseModuleContext
|
||||||
|
|
||||||
// Similar to Build, but takes Paths instead of []string,
|
// Deprecated: use ModuleContext.Build instead.
|
||||||
// and performs more verification.
|
|
||||||
ModuleBuild(pctx blueprint.PackageContext, params ModuleBuildParams)
|
ModuleBuild(pctx blueprint.PackageContext, params ModuleBuildParams)
|
||||||
|
|
||||||
ExpandSources(srcFiles, excludes []string) Paths
|
ExpandSources(srcFiles, excludes []string) Paths
|
||||||
@@ -94,6 +95,36 @@ type ModuleContext interface {
|
|||||||
InstallInSanitizerDir() bool
|
InstallInSanitizerDir() bool
|
||||||
|
|
||||||
RequiredModuleNames() []string
|
RequiredModuleNames() []string
|
||||||
|
|
||||||
|
// android.ModuleContext methods
|
||||||
|
// These are duplicated instead of embedded so that can eventually be wrapped to take an
|
||||||
|
// android.Module instead of a blueprint.Module
|
||||||
|
OtherModuleName(m blueprint.Module) string
|
||||||
|
OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{})
|
||||||
|
OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag
|
||||||
|
|
||||||
|
GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module
|
||||||
|
GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag)
|
||||||
|
|
||||||
|
ModuleSubDir() string
|
||||||
|
|
||||||
|
VisitDirectDeps(visit func(Module))
|
||||||
|
VisitDirectDepsIf(pred func(Module) bool, visit func(Module))
|
||||||
|
VisitDepsDepthFirst(visit func(Module))
|
||||||
|
VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
|
||||||
|
WalkDeps(visit func(Module, Module) bool)
|
||||||
|
|
||||||
|
Variable(pctx blueprint.PackageContext, name, value string)
|
||||||
|
Rule(pctx blueprint.PackageContext, name string, params blueprint.RuleParams, argNames ...string) blueprint.Rule
|
||||||
|
// Similar to blueprint.ModuleContext.Build, but takes Paths instead of []string,
|
||||||
|
// and performs more verification.
|
||||||
|
Build(pctx blueprint.PackageContext, params BuildParams)
|
||||||
|
|
||||||
|
PrimaryModule() blueprint.Module
|
||||||
|
FinalModule() blueprint.Module
|
||||||
|
VisitAllModuleVariants(visit func(blueprint.Module))
|
||||||
|
|
||||||
|
GetMissingDependencies() []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Module interface {
|
type Module interface {
|
||||||
@@ -116,7 +147,7 @@ type Module interface {
|
|||||||
AddProperties(props ...interface{})
|
AddProperties(props ...interface{})
|
||||||
GetProperties() []interface{}
|
GetProperties() []interface{}
|
||||||
|
|
||||||
BuildParamsForTests() []ModuleBuildParams
|
BuildParamsForTests() []BuildParams
|
||||||
}
|
}
|
||||||
|
|
||||||
type nameProperties struct {
|
type nameProperties struct {
|
||||||
@@ -302,7 +333,7 @@ type ModuleBase struct {
|
|||||||
registerProps []interface{}
|
registerProps []interface{}
|
||||||
|
|
||||||
// For tests
|
// For tests
|
||||||
buildParams []ModuleBuildParams
|
buildParams []BuildParams
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ModuleBase) AddProperties(props ...interface{}) {
|
func (a *ModuleBase) AddProperties(props ...interface{}) {
|
||||||
@@ -313,7 +344,7 @@ func (a *ModuleBase) GetProperties() []interface{} {
|
|||||||
return a.registerProps
|
return a.registerProps
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ModuleBase) BuildParamsForTests() []ModuleBuildParams {
|
func (a *ModuleBase) BuildParamsForTests() []BuildParams {
|
||||||
return a.buildParams
|
return a.buildParams
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +589,7 @@ type androidModuleContext struct {
|
|||||||
module Module
|
module Module
|
||||||
|
|
||||||
// For tests
|
// For tests
|
||||||
buildParams []ModuleBuildParams
|
buildParams []BuildParams
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) ninjaError(desc string, outputs []string, err error) {
|
func (a *androidModuleContext) ninjaError(desc string, outputs []string, err error) {
|
||||||
@@ -574,19 +605,11 @@ func (a *androidModuleContext) ninjaError(desc string, outputs []string, err err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) Build(pctx blueprint.PackageContext, params blueprint.BuildParams) {
|
|
||||||
if a.missingDeps != nil {
|
|
||||||
a.ninjaError(params.Description, params.Outputs,
|
|
||||||
fmt.Errorf("module %s missing dependencies: %s\n",
|
|
||||||
a.ModuleName(), strings.Join(a.missingDeps, ", ")))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
params.Optional = true
|
|
||||||
a.ModuleContext.Build(pctx, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *androidModuleContext) ModuleBuild(pctx blueprint.PackageContext, params ModuleBuildParams) {
|
func (a *androidModuleContext) ModuleBuild(pctx blueprint.PackageContext, params ModuleBuildParams) {
|
||||||
|
a.Build(pctx, BuildParams(params))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) Build(pctx blueprint.PackageContext, params BuildParams) {
|
||||||
if a.config.captureBuild {
|
if a.config.captureBuild {
|
||||||
a.buildParams = append(a.buildParams, params)
|
a.buildParams = append(a.buildParams, params)
|
||||||
}
|
}
|
||||||
@@ -640,9 +663,89 @@ func (a *androidModuleContext) GetMissingDependencies() []string {
|
|||||||
func (a *androidModuleContext) AddMissingDependencies(deps []string) {
|
func (a *androidModuleContext) AddMissingDependencies(deps []string) {
|
||||||
if deps != nil {
|
if deps != nil {
|
||||||
a.missingDeps = append(a.missingDeps, deps...)
|
a.missingDeps = append(a.missingDeps, deps...)
|
||||||
|
a.missingDeps = FirstUniqueStrings(a.missingDeps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) validateAndroidModule(module blueprint.Module) Module {
|
||||||
|
aModule, _ := module.(Module)
|
||||||
|
if aModule == nil {
|
||||||
|
a.ModuleErrorf("module %q not an android module", a.OtherModuleName(aModule))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if !aModule.Enabled() {
|
||||||
|
if a.AConfig().AllowMissingDependencies() {
|
||||||
|
a.AddMissingDependencies([]string{a.OtherModuleName(aModule)})
|
||||||
|
} else {
|
||||||
|
a.ModuleErrorf("depends on disabled module %q", a.OtherModuleName(aModule))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return aModule
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) VisitDirectDeps(visit func(Module)) {
|
||||||
|
a.ModuleContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||||
|
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||||
|
visit(aModule)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
|
||||||
|
a.ModuleContext.VisitDirectDepsIf(
|
||||||
|
// pred
|
||||||
|
func(module blueprint.Module) bool {
|
||||||
|
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||||
|
return pred(aModule)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// visit
|
||||||
|
func(module blueprint.Module) {
|
||||||
|
visit(module.(Module))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) VisitDepsDepthFirst(visit func(Module)) {
|
||||||
|
a.ModuleContext.VisitDepsDepthFirst(func(module blueprint.Module) {
|
||||||
|
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||||
|
visit(aModule)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) {
|
||||||
|
a.ModuleContext.VisitDepsDepthFirstIf(
|
||||||
|
// pred
|
||||||
|
func(module blueprint.Module) bool {
|
||||||
|
if aModule := a.validateAndroidModule(module); aModule != nil {
|
||||||
|
return pred(aModule)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// visit
|
||||||
|
func(module blueprint.Module) {
|
||||||
|
visit(module.(Module))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) WalkDeps(visit func(Module, Module) bool) {
|
||||||
|
a.ModuleContext.WalkDeps(func(child, parent blueprint.Module) bool {
|
||||||
|
childAndroidModule := a.validateAndroidModule(child)
|
||||||
|
parentAndroidModule := a.validateAndroidModule(parent)
|
||||||
|
if childAndroidModule != nil && parentAndroidModule != nil {
|
||||||
|
return visit(childAndroidModule, parentAndroidModule)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (a *androidBaseContextImpl) Target() Target {
|
func (a *androidBaseContextImpl) Target() Target {
|
||||||
return a.target
|
return a.target
|
||||||
}
|
}
|
||||||
@@ -754,7 +857,7 @@ func (a *androidModuleContext) installFile(installPath OutputPath, name string,
|
|||||||
orderOnlyDeps = deps
|
orderOnlyDeps = deps
|
||||||
}
|
}
|
||||||
|
|
||||||
a.ModuleBuild(pctx, ModuleBuildParams{
|
a.Build(pctx, BuildParams{
|
||||||
Rule: rule,
|
Rule: rule,
|
||||||
Description: "install " + fullInstallPath.Base(),
|
Description: "install " + fullInstallPath.Base(),
|
||||||
Output: fullInstallPath,
|
Output: fullInstallPath,
|
||||||
@@ -776,7 +879,7 @@ func (a *androidModuleContext) InstallSymlink(installPath OutputPath, name strin
|
|||||||
|
|
||||||
if !a.skipInstall(fullInstallPath) {
|
if !a.skipInstall(fullInstallPath) {
|
||||||
|
|
||||||
a.ModuleBuild(pctx, ModuleBuildParams{
|
a.Build(pctx, BuildParams{
|
||||||
Rule: Symlink,
|
Rule: Symlink,
|
||||||
Description: "install symlink " + fullInstallPath.Base(),
|
Description: "install symlink " + fullInstallPath.Base(),
|
||||||
Output: fullInstallPath,
|
Output: fullInstallPath,
|
||||||
@@ -879,6 +982,10 @@ func (ctx *androidModuleContext) ExpandSourcesSubDir(srcFiles, excludes []string
|
|||||||
for _, s := range srcFiles {
|
for _, s := range srcFiles {
|
||||||
if m := SrcIsModule(s); m != "" {
|
if m := SrcIsModule(s); m != "" {
|
||||||
module := ctx.GetDirectDepWithTag(m, SourceDepTag)
|
module := ctx.GetDirectDepWithTag(m, SourceDepTag)
|
||||||
|
if module == nil {
|
||||||
|
// Error will have been handled by ExtractSourcesDeps
|
||||||
|
continue
|
||||||
|
}
|
||||||
if srcProducer, ok := module.(SourceFileProducer); ok {
|
if srcProducer, ok := module.(SourceFileProducer); ok {
|
||||||
expandedSrcFiles = append(expandedSrcFiles, srcProducer.Srcs()...)
|
expandedSrcFiles = append(expandedSrcFiles, srcProducer.Srcs()...)
|
||||||
} else {
|
} else {
|
||||||
|
@@ -107,8 +107,27 @@ func PostDepsMutators(f RegisterMutatorFunc) {
|
|||||||
type AndroidTopDownMutator func(TopDownMutatorContext)
|
type AndroidTopDownMutator func(TopDownMutatorContext)
|
||||||
|
|
||||||
type TopDownMutatorContext interface {
|
type TopDownMutatorContext interface {
|
||||||
blueprint.TopDownMutatorContext
|
blueprint.BaseModuleContext
|
||||||
androidBaseContext
|
androidBaseContext
|
||||||
|
|
||||||
|
OtherModuleExists(name string) bool
|
||||||
|
Rename(name string)
|
||||||
|
Module() blueprint.Module
|
||||||
|
|
||||||
|
OtherModuleName(m blueprint.Module) string
|
||||||
|
OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{})
|
||||||
|
OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag
|
||||||
|
|
||||||
|
CreateModule(blueprint.ModuleFactory, ...interface{})
|
||||||
|
|
||||||
|
GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module
|
||||||
|
GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag)
|
||||||
|
|
||||||
|
VisitDirectDeps(visit func(Module))
|
||||||
|
VisitDirectDepsIf(pred func(Module) bool, visit func(Module))
|
||||||
|
VisitDepsDepthFirst(visit func(Module))
|
||||||
|
VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
|
||||||
|
WalkDeps(visit func(Module, Module) bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
type androidTopDownMutatorContext struct {
|
type androidTopDownMutatorContext struct {
|
||||||
@@ -172,3 +191,63 @@ func depsMutator(ctx BottomUpMutatorContext) {
|
|||||||
m.DepsMutator(ctx)
|
m.DepsMutator(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *androidTopDownMutatorContext) VisitDirectDeps(visit func(Module)) {
|
||||||
|
a.TopDownMutatorContext.VisitDirectDeps(func(module blueprint.Module) {
|
||||||
|
if aModule, _ := module.(Module); aModule != nil {
|
||||||
|
visit(aModule)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidTopDownMutatorContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
|
||||||
|
a.TopDownMutatorContext.VisitDirectDepsIf(
|
||||||
|
// pred
|
||||||
|
func(module blueprint.Module) bool {
|
||||||
|
if aModule, _ := module.(Module); aModule != nil {
|
||||||
|
return pred(aModule)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// visit
|
||||||
|
func(module blueprint.Module) {
|
||||||
|
visit(module.(Module))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidTopDownMutatorContext) VisitDepsDepthFirst(visit func(Module)) {
|
||||||
|
a.TopDownMutatorContext.VisitDepsDepthFirst(func(module blueprint.Module) {
|
||||||
|
if aModule, _ := module.(Module); aModule != nil {
|
||||||
|
visit(aModule)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidTopDownMutatorContext) VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module)) {
|
||||||
|
a.TopDownMutatorContext.VisitDepsDepthFirstIf(
|
||||||
|
// pred
|
||||||
|
func(module blueprint.Module) bool {
|
||||||
|
if aModule, _ := module.(Module); aModule != nil {
|
||||||
|
return pred(aModule)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// visit
|
||||||
|
func(module blueprint.Module) {
|
||||||
|
visit(module.(Module))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidTopDownMutatorContext) WalkDeps(visit func(Module, Module) bool) {
|
||||||
|
a.TopDownMutatorContext.WalkDeps(func(child, parent blueprint.Module) bool {
|
||||||
|
childAndroidModule, _ := child.(Module)
|
||||||
|
parentAndroidModule, _ := parent.(Module)
|
||||||
|
if childAndroidModule != nil && parentAndroidModule != nil {
|
||||||
|
return visit(childAndroidModule, parentAndroidModule)
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -286,8 +286,8 @@ func (p Paths) Strings() []string {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// FirstUniqueElements returns all unique elements of a slice, keeping the first copy of each
|
// FirstUniquePaths returns all unique elements of a Paths, keeping the first copy of each. It
|
||||||
// modifies the slice contents in place, and returns a subslice of the original slice
|
// modifies the Paths slice contents in place, and returns a subslice of the original slice.
|
||||||
func FirstUniquePaths(list Paths) Paths {
|
func FirstUniquePaths(list Paths) Paths {
|
||||||
k := 0
|
k := 0
|
||||||
outer:
|
outer:
|
||||||
@@ -303,6 +303,24 @@ outer:
|
|||||||
return list[:k]
|
return list[:k]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LastUniquePaths returns all unique elements of a Paths, keeping the last copy of each. It
|
||||||
|
// modifies the Paths slice contents in place, and returns a subslice of the original slice.
|
||||||
|
func LastUniquePaths(list Paths) Paths {
|
||||||
|
totalSkip := 0
|
||||||
|
for i := len(list) - 1; i >= totalSkip; i-- {
|
||||||
|
skip := 0
|
||||||
|
for j := i - 1; j >= totalSkip; j-- {
|
||||||
|
if list[i] == list[j] {
|
||||||
|
skip++
|
||||||
|
} else {
|
||||||
|
list[j+skip] = list[j]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
totalSkip += skip
|
||||||
|
}
|
||||||
|
return list[totalSkip:]
|
||||||
|
}
|
||||||
|
|
||||||
func indexPathList(s Path, list []Path) int {
|
func indexPathList(s Path, list []Path) int {
|
||||||
for i, l := range list {
|
for i, l := range list {
|
||||||
if l == s {
|
if l == s {
|
||||||
|
@@ -109,7 +109,7 @@ func PrebuiltSelectModuleMutator(ctx TopDownMutatorContext) {
|
|||||||
p.properties.UsePrebuilt = p.usePrebuilt(ctx, nil)
|
p.properties.UsePrebuilt = p.usePrebuilt(ctx, nil)
|
||||||
}
|
}
|
||||||
} else if s, ok := ctx.Module().(Module); ok {
|
} else if s, ok := ctx.Module().(Module); ok {
|
||||||
ctx.VisitDirectDeps(func(m blueprint.Module) {
|
ctx.VisitDirectDeps(func(m Module) {
|
||||||
if ctx.OtherModuleDependencyTag(m) == prebuiltDepTag {
|
if ctx.OtherModuleDependencyTag(m) == prebuiltDepTag {
|
||||||
p := m.(PrebuiltInterface).Prebuilt()
|
p := m.(PrebuiltInterface).Prebuilt()
|
||||||
if p.usePrebuilt(ctx, s) {
|
if p.usePrebuilt(ctx, s) {
|
||||||
|
@@ -86,7 +86,7 @@ func (m TestingModule) Module() Module {
|
|||||||
return m.module
|
return m.module
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m TestingModule) Rule(rule string) ModuleBuildParams {
|
func (m TestingModule) Rule(rule string) BuildParams {
|
||||||
for _, p := range m.module.BuildParamsForTests() {
|
for _, p := range m.module.BuildParamsForTests() {
|
||||||
if strings.Contains(p.Rule.String(), rule) {
|
if strings.Contains(p.Rule.String(), rule) {
|
||||||
return p
|
return p
|
||||||
@@ -95,7 +95,7 @@ func (m TestingModule) Rule(rule string) ModuleBuildParams {
|
|||||||
panic(fmt.Errorf("couldn't find rule %q", rule))
|
panic(fmt.Errorf("couldn't find rule %q", rule))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m TestingModule) Description(desc string) ModuleBuildParams {
|
func (m TestingModule) Description(desc string) BuildParams {
|
||||||
for _, p := range m.module.BuildParamsForTests() {
|
for _, p := range m.module.BuildParamsForTests() {
|
||||||
if p.Description == desc {
|
if p.Description == desc {
|
||||||
return p
|
return p
|
||||||
@@ -104,7 +104,7 @@ func (m TestingModule) Description(desc string) ModuleBuildParams {
|
|||||||
panic(fmt.Errorf("couldn't find description %q", desc))
|
panic(fmt.Errorf("couldn't find description %q", desc))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m TestingModule) Output(file string) ModuleBuildParams {
|
func (m TestingModule) Output(file string) BuildParams {
|
||||||
for _, p := range m.module.BuildParamsForTests() {
|
for _, p := range m.module.BuildParamsForTests() {
|
||||||
outputs := append(WritablePaths(nil), p.Outputs...)
|
outputs := append(WritablePaths(nil), p.Outputs...)
|
||||||
if p.Output != nil {
|
if p.Output != nil {
|
||||||
|
@@ -77,6 +77,41 @@ func prefixInList(s string, list []string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FirstUniqueStrings returns all unique elements of a slice of strings, keeping the first copy of
|
||||||
|
// each. It modifies the slice contents in place, and returns a subslice of the original slice.
|
||||||
|
func FirstUniqueStrings(list []string) []string {
|
||||||
|
k := 0
|
||||||
|
outer:
|
||||||
|
for i := 0; i < len(list); i++ {
|
||||||
|
for j := 0; j < k; j++ {
|
||||||
|
if list[i] == list[j] {
|
||||||
|
continue outer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list[k] = list[i]
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
return list[:k]
|
||||||
|
}
|
||||||
|
|
||||||
|
// LastUniqueStrings returns all unique elements of a slice of strings, keeping the last copy of
|
||||||
|
// each. It modifies the slice contents in place, and returns a subslice of the original slice.
|
||||||
|
func LastUniqueStrings(list []string) []string {
|
||||||
|
totalSkip := 0
|
||||||
|
for i := len(list) - 1; i >= totalSkip; i-- {
|
||||||
|
skip := 0
|
||||||
|
for j := i - 1; j >= totalSkip; j-- {
|
||||||
|
if list[i] == list[j] {
|
||||||
|
skip++
|
||||||
|
} else {
|
||||||
|
list[j+skip] = list[j]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
totalSkip += skip
|
||||||
|
}
|
||||||
|
return list[totalSkip:]
|
||||||
|
}
|
||||||
|
|
||||||
// checkCalledFromInit panics if a Go package's init function is not on the
|
// checkCalledFromInit panics if a Go package's init function is not on the
|
||||||
// call stack.
|
// call stack.
|
||||||
func checkCalledFromInit() {
|
func checkCalledFromInit() {
|
||||||
|
120
android/util_test.go
Normal file
120
android/util_test.go
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
// Copyright 2017 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package android
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
var firstUniqueStringsTestCases = []struct {
|
||||||
|
in []string
|
||||||
|
out []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
in: []string{"a"},
|
||||||
|
out: []string{"a"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "b"},
|
||||||
|
out: []string{"a", "b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "a"},
|
||||||
|
out: []string{"a"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "b", "a"},
|
||||||
|
out: []string{"a", "b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"b", "a", "a"},
|
||||||
|
out: []string{"b", "a"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "a", "b"},
|
||||||
|
out: []string{"a", "b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "b", "a", "b"},
|
||||||
|
out: []string{"a", "b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"liblog", "libdl", "libc++", "libdl", "libc", "libm"},
|
||||||
|
out: []string{"liblog", "libdl", "libc++", "libc", "libm"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestFirstUniqueStrings(t *testing.T) {
|
||||||
|
for _, testCase := range firstUniqueStringsTestCases {
|
||||||
|
out := FirstUniqueStrings(testCase.in)
|
||||||
|
if !reflect.DeepEqual(out, testCase.out) {
|
||||||
|
t.Errorf("incorrect output:")
|
||||||
|
t.Errorf(" input: %#v", testCase.in)
|
||||||
|
t.Errorf(" expected: %#v", testCase.out)
|
||||||
|
t.Errorf(" got: %#v", out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var lastUniqueStringsTestCases = []struct {
|
||||||
|
in []string
|
||||||
|
out []string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
in: []string{"a"},
|
||||||
|
out: []string{"a"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "b"},
|
||||||
|
out: []string{"a", "b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "a"},
|
||||||
|
out: []string{"a"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "b", "a"},
|
||||||
|
out: []string{"b", "a"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"b", "a", "a"},
|
||||||
|
out: []string{"b", "a"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "a", "b"},
|
||||||
|
out: []string{"a", "b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"a", "b", "a", "b"},
|
||||||
|
out: []string{"a", "b"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
in: []string{"liblog", "libdl", "libc++", "libdl", "libc", "libm"},
|
||||||
|
out: []string{"liblog", "libc++", "libdl", "libc", "libm"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLastUniqueStrings(t *testing.T) {
|
||||||
|
for _, testCase := range lastUniqueStringsTestCases {
|
||||||
|
out := LastUniqueStrings(testCase.in)
|
||||||
|
if !reflect.DeepEqual(out, testCase.out) {
|
||||||
|
t.Errorf("incorrect output:")
|
||||||
|
t.Errorf(" input: %#v", testCase.in)
|
||||||
|
t.Errorf(" expected: %#v", testCase.out)
|
||||||
|
t.Errorf(" got: %#v", out)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -341,7 +341,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
|
|
||||||
switch srcFile.Ext() {
|
switch srcFile.Ext() {
|
||||||
case ".asm":
|
case ".asm":
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: yasm,
|
Rule: yasm,
|
||||||
Description: "yasm " + srcFile.Rel(),
|
Description: "yasm " + srcFile.Rel(),
|
||||||
Output: objFile,
|
Output: objFile,
|
||||||
@@ -353,7 +353,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
})
|
})
|
||||||
continue
|
continue
|
||||||
case ".rc":
|
case ".rc":
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: windres,
|
Rule: windres,
|
||||||
Description: "windres " + srcFile.Rel(),
|
Description: "windres " + srcFile.Rel(),
|
||||||
Output: objFile,
|
Output: objFile,
|
||||||
@@ -420,7 +420,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
coverageFiles = append(coverageFiles, gcnoFile)
|
coverageFiles = append(coverageFiles, gcnoFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: cc,
|
Rule: cc,
|
||||||
Description: ccDesc + " " + srcFile.Rel(),
|
Description: ccDesc + " " + srcFile.Rel(),
|
||||||
Output: objFile,
|
Output: objFile,
|
||||||
@@ -437,7 +437,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
tidyFile := android.ObjPathWithExt(ctx, subdir, srcFile, "tidy")
|
tidyFile := android.ObjPathWithExt(ctx, subdir, srcFile, "tidy")
|
||||||
tidyFiles = append(tidyFiles, tidyFile)
|
tidyFiles = append(tidyFiles, tidyFile)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: clangTidy,
|
Rule: clangTidy,
|
||||||
Description: "clang-tidy " + srcFile.Rel(),
|
Description: "clang-tidy " + srcFile.Rel(),
|
||||||
Output: tidyFile,
|
Output: tidyFile,
|
||||||
@@ -456,7 +456,7 @@ func TransformSourceToObj(ctx android.ModuleContext, subdir string, srcFiles and
|
|||||||
sAbiDumpFile := android.ObjPathWithExt(ctx, subdir, srcFile, "sdump")
|
sAbiDumpFile := android.ObjPathWithExt(ctx, subdir, srcFile, "sdump")
|
||||||
sAbiDumpFiles = append(sAbiDumpFiles, sAbiDumpFile)
|
sAbiDumpFiles = append(sAbiDumpFiles, sAbiDumpFile)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: sAbiDump,
|
Rule: sAbiDump,
|
||||||
Description: "header-abi-dumper " + srcFile.Rel(),
|
Description: "header-abi-dumper " + srcFile.Rel(),
|
||||||
Output: sAbiDumpFile,
|
Output: sAbiDumpFile,
|
||||||
@@ -494,7 +494,7 @@ func TransformObjToStaticLib(ctx android.ModuleContext, objFiles android.Paths,
|
|||||||
arFlags += " " + flags.arFlags
|
arFlags += " " + flags.arFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: ar,
|
Rule: ar,
|
||||||
Description: "static link " + outputFile.Base(),
|
Description: "static link " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -520,14 +520,14 @@ func transformDarwinObjToStaticLib(ctx android.ModuleContext, objFiles android.P
|
|||||||
dummy := android.PathForModuleOut(ctx, "dummy"+objectExtension)
|
dummy := android.PathForModuleOut(ctx, "dummy"+objectExtension)
|
||||||
dummyAr := android.PathForModuleOut(ctx, "dummy"+staticLibraryExtension)
|
dummyAr := android.PathForModuleOut(ctx, "dummy"+staticLibraryExtension)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: emptyFile,
|
Rule: emptyFile,
|
||||||
Description: "empty object file",
|
Description: "empty object file",
|
||||||
Output: dummy,
|
Output: dummy,
|
||||||
Implicits: deps,
|
Implicits: deps,
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: darwinAr,
|
Rule: darwinAr,
|
||||||
Description: "empty static archive",
|
Description: "empty static archive",
|
||||||
Output: dummyAr,
|
Output: dummyAr,
|
||||||
@@ -537,7 +537,7 @@ func transformDarwinObjToStaticLib(ctx android.ModuleContext, objFiles android.P
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: darwinAppendAr,
|
Rule: darwinAppendAr,
|
||||||
Description: "static link " + outputFile.Base(),
|
Description: "static link " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -565,7 +565,7 @@ func transformDarwinObjToStaticLib(ctx android.ModuleContext, objFiles android.P
|
|||||||
out = android.PathForModuleOut(ctx, outputFile.Base()+strconv.Itoa(i))
|
out = android.PathForModuleOut(ctx, outputFile.Base()+strconv.Itoa(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
build := android.ModuleBuildParams{
|
build := android.BuildParams{
|
||||||
Rule: darwinAr,
|
Rule: darwinAr,
|
||||||
Description: "static link " + out.Base(),
|
Description: "static link " + out.Base(),
|
||||||
Output: out,
|
Output: out,
|
||||||
@@ -579,7 +579,7 @@ func transformDarwinObjToStaticLib(ctx android.ModuleContext, objFiles android.P
|
|||||||
build.Rule = darwinAppendAr
|
build.Rule = darwinAppendAr
|
||||||
build.Args["inAr"] = in.String()
|
build.Args["inAr"] = in.String()
|
||||||
}
|
}
|
||||||
ctx.ModuleBuild(pctx, build)
|
ctx.Build(pctx, build)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -639,7 +639,7 @@ func TransformObjToDynamicBinary(ctx android.ModuleContext,
|
|||||||
deps = append(deps, crtBegin.Path(), crtEnd.Path())
|
deps = append(deps, crtBegin.Path(), crtEnd.Path())
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: ld,
|
Rule: ld,
|
||||||
Description: "link " + outputFile.Base(),
|
Description: "link " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -669,7 +669,7 @@ func TransformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Path
|
|||||||
linkedDumpDep = soFile
|
linkedDumpDep = soFile
|
||||||
symbolFilterStr = "-so " + soFile.String()
|
symbolFilterStr = "-so " + soFile.String()
|
||||||
}
|
}
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: sAbiLink,
|
Rule: sAbiLink,
|
||||||
Description: "header-abi-linker " + outputFile.Base(),
|
Description: "header-abi-linker " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -687,7 +687,7 @@ func TransformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Path
|
|||||||
|
|
||||||
func UnzipRefDump(ctx android.ModuleContext, zippedRefDump android.Path, baseName string) android.Path {
|
func UnzipRefDump(ctx android.ModuleContext, zippedRefDump android.Path, baseName string) android.Path {
|
||||||
outputFile := android.PathForModuleOut(ctx, baseName+"_ref.lsdump")
|
outputFile := android.PathForModuleOut(ctx, baseName+"_ref.lsdump")
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: unzipRefSAbiDump,
|
Rule: unzipRefSAbiDump,
|
||||||
Description: "gunzip" + outputFile.Base(),
|
Description: "gunzip" + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -699,7 +699,7 @@ func UnzipRefDump(ctx android.ModuleContext, zippedRefDump android.Path, baseNam
|
|||||||
func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
|
func SourceAbiDiff(ctx android.ModuleContext, inputDump android.Path, referenceDump android.Path,
|
||||||
baseName string) android.OptionalPath {
|
baseName string) android.OptionalPath {
|
||||||
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
|
outputFile := android.PathForModuleOut(ctx, baseName+".abidiff")
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: sAbiDiff,
|
Rule: sAbiDiff,
|
||||||
Description: "header-abi-diff " + outputFile.Base(),
|
Description: "header-abi-diff " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -720,7 +720,7 @@ func TransformSharedObjectToToc(ctx android.ModuleContext, inputFile android.Pat
|
|||||||
|
|
||||||
crossCompile := gccCmd(flags.toolchain, "")
|
crossCompile := gccCmd(flags.toolchain, "")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: toc,
|
Rule: toc,
|
||||||
Description: "generate toc " + inputFile.Base(),
|
Description: "generate toc " + inputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -742,7 +742,7 @@ func TransformObjsToObj(ctx android.ModuleContext, objFiles android.Paths,
|
|||||||
ldCmd = gccCmd(flags.toolchain, "g++")
|
ldCmd = gccCmd(flags.toolchain, "g++")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: partialLd,
|
Rule: partialLd,
|
||||||
Description: "link " + outputFile.Base(),
|
Description: "link " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -760,7 +760,7 @@ func TransformBinaryPrefixSymbols(ctx android.ModuleContext, prefix string, inpu
|
|||||||
|
|
||||||
objcopyCmd := gccCmd(flags.toolchain, "objcopy")
|
objcopyCmd := gccCmd(flags.toolchain, "objcopy")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: prefixSymbols,
|
Rule: prefixSymbols,
|
||||||
Description: "prefix symbols " + outputFile.Base(),
|
Description: "prefix symbols " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -787,7 +787,7 @@ func TransformStrip(ctx android.ModuleContext, inputFile android.Path,
|
|||||||
args += " --keep-symbols"
|
args += " --keep-symbols"
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: strip,
|
Rule: strip,
|
||||||
Description: "strip " + outputFile.Base(),
|
Description: "strip " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -802,7 +802,7 @@ func TransformStrip(ctx android.ModuleContext, inputFile android.Path,
|
|||||||
func TransformDarwinStrip(ctx android.ModuleContext, inputFile android.Path,
|
func TransformDarwinStrip(ctx android.ModuleContext, inputFile android.Path,
|
||||||
outputFile android.WritablePath) {
|
outputFile android.WritablePath) {
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: darwinStrip,
|
Rule: darwinStrip,
|
||||||
Description: "strip " + outputFile.Base(),
|
Description: "strip " + outputFile.Base(),
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -827,7 +827,7 @@ func TransformCoverageFilesToLib(ctx android.ModuleContext,
|
|||||||
func CopyGccLib(ctx android.ModuleContext, libName string,
|
func CopyGccLib(ctx android.ModuleContext, libName string,
|
||||||
flags builderFlags, outputFile android.WritablePath) {
|
flags builderFlags, outputFile android.WritablePath) {
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: copyGccLib,
|
Rule: copyGccLib,
|
||||||
Description: "copy gcc library " + libName,
|
Description: "copy gcc library " + libName,
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
|
93
cc/cc.go
93
cc/cc.go
@@ -561,7 +561,7 @@ func orderDeps(directDeps []android.Path, transitiveDeps map[android.Path][]andr
|
|||||||
orderedAllDeps = append(orderedAllDeps, transitiveDeps[dep]...)
|
orderedAllDeps = append(orderedAllDeps, transitiveDeps[dep]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
orderedAllDeps = lastUniquePaths(orderedAllDeps)
|
orderedAllDeps = android.LastUniquePaths(orderedAllDeps)
|
||||||
|
|
||||||
// We don't want to add any new dependencies into directDeps (to allow the caller to
|
// We don't want to add any new dependencies into directDeps (to allow the caller to
|
||||||
// intentionally exclude or replace any unwanted transitive dependencies), so we limit the
|
// intentionally exclude or replace any unwanted transitive dependencies), so we limit the
|
||||||
@@ -763,12 +763,12 @@ func (c *Module) deps(ctx DepsContext) Deps {
|
|||||||
deps = feature.deps(ctx, deps)
|
deps = feature.deps(ctx, deps)
|
||||||
}
|
}
|
||||||
|
|
||||||
deps.WholeStaticLibs = lastUniqueElements(deps.WholeStaticLibs)
|
deps.WholeStaticLibs = android.LastUniqueStrings(deps.WholeStaticLibs)
|
||||||
deps.StaticLibs = lastUniqueElements(deps.StaticLibs)
|
deps.StaticLibs = android.LastUniqueStrings(deps.StaticLibs)
|
||||||
deps.LateStaticLibs = lastUniqueElements(deps.LateStaticLibs)
|
deps.LateStaticLibs = android.LastUniqueStrings(deps.LateStaticLibs)
|
||||||
deps.SharedLibs = lastUniqueElements(deps.SharedLibs)
|
deps.SharedLibs = android.LastUniqueStrings(deps.SharedLibs)
|
||||||
deps.LateSharedLibs = lastUniqueElements(deps.LateSharedLibs)
|
deps.LateSharedLibs = android.LastUniqueStrings(deps.LateSharedLibs)
|
||||||
deps.HeaderLibs = lastUniqueElements(deps.HeaderLibs)
|
deps.HeaderLibs = android.LastUniqueStrings(deps.HeaderLibs)
|
||||||
|
|
||||||
for _, lib := range deps.ReexportSharedLibHeaders {
|
for _, lib := range deps.ReexportSharedLibHeaders {
|
||||||
if !inList(lib, deps.SharedLibs) {
|
if !inList(lib, deps.SharedLibs) {
|
||||||
@@ -1037,16 +1037,10 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
|
|
||||||
directStaticDeps := []*Module{}
|
directStaticDeps := []*Module{}
|
||||||
|
|
||||||
ctx.VisitDirectDeps(func(dep blueprint.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
depName := ctx.OtherModuleName(dep)
|
depName := ctx.OtherModuleName(dep)
|
||||||
depTag := ctx.OtherModuleDependencyTag(dep)
|
depTag := ctx.OtherModuleDependencyTag(dep)
|
||||||
|
|
||||||
aDep, _ := dep.(android.Module)
|
|
||||||
if aDep == nil {
|
|
||||||
ctx.ModuleErrorf("module %q not an android module", depName)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ccDep, _ := dep.(*Module)
|
ccDep, _ := dep.(*Module)
|
||||||
if ccDep == nil {
|
if ccDep == nil {
|
||||||
// handling for a few module types that aren't cc Module but that are also supported
|
// handling for a few module types that aren't cc Module but that are also supported
|
||||||
@@ -1096,20 +1090,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// some validation
|
if dep.Target().Os != ctx.Os() {
|
||||||
if !aDep.Enabled() {
|
|
||||||
if ctx.AConfig().AllowMissingDependencies() {
|
|
||||||
ctx.AddMissingDependencies([]string{depName})
|
|
||||||
} else {
|
|
||||||
ctx.ModuleErrorf("depends on disabled module %q", depName)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if aDep.Target().Os != ctx.Os() {
|
|
||||||
ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName)
|
ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if aDep.Target().Arch.ArchType != ctx.Arch().ArchType {
|
if dep.Target().Arch.ArchType != ctx.Arch().ArchType {
|
||||||
ctx.ModuleErrorf("Arch mismatch between %q and %q", ctx.ModuleName(), depName)
|
ctx.ModuleErrorf("Arch mismatch between %q and %q", ctx.ModuleName(), depName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -1249,13 +1234,13 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
depPaths.StaticLibs = append(depPaths.StaticLibs, orderStaticModuleDeps(c, directStaticDeps)...)
|
depPaths.StaticLibs = append(depPaths.StaticLibs, orderStaticModuleDeps(c, directStaticDeps)...)
|
||||||
|
|
||||||
// Dedup exported flags from dependencies
|
// Dedup exported flags from dependencies
|
||||||
depPaths.Flags = firstUniqueElements(depPaths.Flags)
|
depPaths.Flags = android.FirstUniqueStrings(depPaths.Flags)
|
||||||
depPaths.GeneratedHeaders = android.FirstUniquePaths(depPaths.GeneratedHeaders)
|
depPaths.GeneratedHeaders = android.FirstUniquePaths(depPaths.GeneratedHeaders)
|
||||||
depPaths.ReexportedFlags = firstUniqueElements(depPaths.ReexportedFlags)
|
depPaths.ReexportedFlags = android.FirstUniqueStrings(depPaths.ReexportedFlags)
|
||||||
depPaths.ReexportedFlagsDeps = android.FirstUniquePaths(depPaths.ReexportedFlagsDeps)
|
depPaths.ReexportedFlagsDeps = android.FirstUniquePaths(depPaths.ReexportedFlagsDeps)
|
||||||
|
|
||||||
if c.sabi != nil {
|
if c.sabi != nil {
|
||||||
c.sabi.Properties.ReexportedIncludeFlags = firstUniqueElements(c.sabi.Properties.ReexportedIncludeFlags)
|
c.sabi.Properties.ReexportedIncludeFlags = android.FirstUniqueStrings(c.sabi.Properties.ReexportedIncludeFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
return depPaths
|
return depPaths
|
||||||
@@ -1438,58 +1423,6 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// firstUniqueElements returns all unique elements of a slice, keeping the first copy of each
|
|
||||||
// modifies the slice contents in place, and returns a subslice of the original slice
|
|
||||||
func firstUniqueElements(list []string) []string {
|
|
||||||
k := 0
|
|
||||||
outer:
|
|
||||||
for i := 0; i < len(list); i++ {
|
|
||||||
for j := 0; j < k; j++ {
|
|
||||||
if list[i] == list[j] {
|
|
||||||
continue outer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list[k] = list[i]
|
|
||||||
k++
|
|
||||||
}
|
|
||||||
return list[:k]
|
|
||||||
}
|
|
||||||
|
|
||||||
// lastUniqueElements returns all unique elements of a slice, keeping the last copy of each.
|
|
||||||
// It modifies the slice contents in place, and returns a subslice of the original slice
|
|
||||||
func lastUniqueElements(list []string) []string {
|
|
||||||
totalSkip := 0
|
|
||||||
for i := len(list) - 1; i >= totalSkip; i-- {
|
|
||||||
skip := 0
|
|
||||||
for j := i - 1; j >= totalSkip; j-- {
|
|
||||||
if list[i] == list[j] {
|
|
||||||
skip++
|
|
||||||
} else {
|
|
||||||
list[j+skip] = list[j]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
totalSkip += skip
|
|
||||||
}
|
|
||||||
return list[totalSkip:]
|
|
||||||
}
|
|
||||||
|
|
||||||
// lastUniquePaths is the same as lastUniqueElements but uses Path structs
|
|
||||||
func lastUniquePaths(list []android.Path) []android.Path {
|
|
||||||
totalSkip := 0
|
|
||||||
for i := len(list) - 1; i >= totalSkip; i-- {
|
|
||||||
skip := 0
|
|
||||||
for j := i - 1; j >= totalSkip; j-- {
|
|
||||||
if list[i] == list[j] {
|
|
||||||
skip++
|
|
||||||
} else {
|
|
||||||
list[j+skip] = list[j]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
totalSkip += skip
|
|
||||||
}
|
|
||||||
return list[totalSkip:]
|
|
||||||
}
|
|
||||||
|
|
||||||
func getCurrentNdkPrebuiltVersion(ctx DepsContext) string {
|
func getCurrentNdkPrebuiltVersion(ctx DepsContext) string {
|
||||||
if ctx.AConfig().PlatformSdkVersionInt() > config.NdkMaxPrebuiltVersionInt {
|
if ctx.AConfig().PlatformSdkVersionInt() > config.NdkMaxPrebuiltVersionInt {
|
||||||
return strconv.Itoa(config.NdkMaxPrebuiltVersionInt)
|
return strconv.Itoa(config.NdkMaxPrebuiltVersionInt)
|
||||||
|
100
cc/cc_test.go
100
cc/cc_test.go
@@ -156,106 +156,6 @@ func TestVendorSrc(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstUniqueElementsTestCases = []struct {
|
|
||||||
in []string
|
|
||||||
out []string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
in: []string{"a"},
|
|
||||||
out: []string{"a"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "b"},
|
|
||||||
out: []string{"a", "b"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "a"},
|
|
||||||
out: []string{"a"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "b", "a"},
|
|
||||||
out: []string{"a", "b"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"b", "a", "a"},
|
|
||||||
out: []string{"b", "a"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "a", "b"},
|
|
||||||
out: []string{"a", "b"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "b", "a", "b"},
|
|
||||||
out: []string{"a", "b"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"liblog", "libdl", "libc++", "libdl", "libc", "libm"},
|
|
||||||
out: []string{"liblog", "libdl", "libc++", "libc", "libm"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestFirstUniqueElements(t *testing.T) {
|
|
||||||
for _, testCase := range firstUniqueElementsTestCases {
|
|
||||||
out := firstUniqueElements(testCase.in)
|
|
||||||
if !reflect.DeepEqual(out, testCase.out) {
|
|
||||||
t.Errorf("incorrect output:")
|
|
||||||
t.Errorf(" input: %#v", testCase.in)
|
|
||||||
t.Errorf(" expected: %#v", testCase.out)
|
|
||||||
t.Errorf(" got: %#v", out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var lastUniqueElementsTestCases = []struct {
|
|
||||||
in []string
|
|
||||||
out []string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
in: []string{"a"},
|
|
||||||
out: []string{"a"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "b"},
|
|
||||||
out: []string{"a", "b"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "a"},
|
|
||||||
out: []string{"a"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "b", "a"},
|
|
||||||
out: []string{"b", "a"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"b", "a", "a"},
|
|
||||||
out: []string{"b", "a"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "a", "b"},
|
|
||||||
out: []string{"a", "b"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"a", "b", "a", "b"},
|
|
||||||
out: []string{"a", "b"},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
in: []string{"liblog", "libdl", "libc++", "libdl", "libc", "libm"},
|
|
||||||
out: []string{"liblog", "libc++", "libdl", "libc", "libm"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestLastUniqueElements(t *testing.T) {
|
|
||||||
for _, testCase := range lastUniqueElementsTestCases {
|
|
||||||
out := lastUniqueElements(testCase.in)
|
|
||||||
if !reflect.DeepEqual(out, testCase.out) {
|
|
||||||
t.Errorf("incorrect output:")
|
|
||||||
t.Errorf(" input: %#v", testCase.in)
|
|
||||||
t.Errorf(" expected: %#v", testCase.out)
|
|
||||||
t.Errorf(" got: %#v", out)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
str11 = "01234567891"
|
str11 = "01234567891"
|
||||||
str10 = str11[:10]
|
str10 = str11[:10]
|
||||||
|
@@ -16,8 +16,6 @@ package cc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CoverageProperties struct {
|
type CoverageProperties struct {
|
||||||
@@ -61,7 +59,7 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
// For static libraries, the only thing that changes our object files
|
// For static libraries, the only thing that changes our object files
|
||||||
// are included whole static libraries, so check to see if any of
|
// are included whole static libraries, so check to see if any of
|
||||||
// those have coverage enabled.
|
// those have coverage enabled.
|
||||||
ctx.VisitDirectDeps(func(m blueprint.Module) {
|
ctx.VisitDirectDeps(func(m android.Module) {
|
||||||
if ctx.OtherModuleDependencyTag(m) != wholeStaticDepTag {
|
if ctx.OtherModuleDependencyTag(m) != wholeStaticDepTag {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -75,7 +73,7 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
} else {
|
} else {
|
||||||
// For executables and shared libraries, we need to check all of
|
// For executables and shared libraries, we need to check all of
|
||||||
// our static dependencies.
|
// our static dependencies.
|
||||||
ctx.VisitDirectDeps(func(m blueprint.Module) {
|
ctx.VisitDirectDeps(func(m android.Module) {
|
||||||
cc, ok := m.(*Module)
|
cc, ok := m.(*Module)
|
||||||
if !ok || cc.coverage == nil {
|
if !ok || cc.coverage == nil {
|
||||||
return
|
return
|
||||||
|
@@ -66,7 +66,7 @@ var (
|
|||||||
func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.ModuleGenPath, yaccFlags string) (headerFile android.ModuleGenPath) {
|
func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.ModuleGenPath, yaccFlags string) (headerFile android.ModuleGenPath) {
|
||||||
headerFile = android.GenPathWithExt(ctx, "yacc", yaccFile, "h")
|
headerFile = android.GenPathWithExt(ctx, "yacc", yaccFile, "h")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: yacc,
|
Rule: yacc,
|
||||||
Description: "yacc " + yaccFile.Rel(),
|
Description: "yacc " + yaccFile.Rel(),
|
||||||
Output: outFile,
|
Output: outFile,
|
||||||
@@ -83,7 +83,7 @@ func genYacc(ctx android.ModuleContext, yaccFile android.Path, outFile android.M
|
|||||||
|
|
||||||
func genAidl(ctx android.ModuleContext, aidlFile android.Path, outFile android.ModuleGenPath, aidlFlags string) android.Paths {
|
func genAidl(ctx android.ModuleContext, aidlFile android.Path, outFile android.ModuleGenPath, aidlFlags string) android.Paths {
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: aidl,
|
Rule: aidl,
|
||||||
Description: "aidl " + aidlFile.Rel(),
|
Description: "aidl " + aidlFile.Rel(),
|
||||||
Output: outFile,
|
Output: outFile,
|
||||||
@@ -99,7 +99,7 @@ func genAidl(ctx android.ModuleContext, aidlFile android.Path, outFile android.M
|
|||||||
}
|
}
|
||||||
|
|
||||||
func genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.ModuleGenPath) {
|
func genLex(ctx android.ModuleContext, lexFile android.Path, outFile android.ModuleGenPath) {
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: lex,
|
Rule: lex,
|
||||||
Description: "lex " + lexFile.Rel(),
|
Description: "lex " + lexFile.Rel(),
|
||||||
Output: outFile,
|
Output: outFile,
|
||||||
@@ -113,7 +113,7 @@ func genWinMsg(ctx android.ModuleContext, srcFile android.Path, flags builderFla
|
|||||||
|
|
||||||
windmcCmd := gccCmd(flags.toolchain, "windmc")
|
windmcCmd := gccCmd(flags.toolchain, "windmc")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: windmc,
|
Rule: windmc,
|
||||||
Description: "windmc " + srcFile.Rel(),
|
Description: "windmc " + srcFile.Rel(),
|
||||||
Output: rcFile,
|
Output: rcFile,
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
package cc
|
package cc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -104,7 +102,7 @@ func ltoDepsMutator(mctx android.TopDownMutatorContext) {
|
|||||||
mctx.PropertyErrorf("LTO", "FullLTO and ThinLTO are mutually exclusive")
|
mctx.PropertyErrorf("LTO", "FullLTO and ThinLTO are mutually exclusive")
|
||||||
}
|
}
|
||||||
|
|
||||||
mctx.VisitDepsDepthFirst(func(m blueprint.Module) {
|
mctx.VisitDepsDepthFirst(func(m android.Module) {
|
||||||
tag := mctx.OtherModuleDependencyTag(m)
|
tag := mctx.OtherModuleDependencyTag(m)
|
||||||
switch tag {
|
switch tag {
|
||||||
case staticDepTag, staticExportDepTag, lateStaticDepTag, wholeStaticDepTag, objDepTag, reuseObjTag:
|
case staticDepTag, staticExportDepTag, lateStaticDepTag, wholeStaticDepTag, objDepTag, reuseObjTag:
|
||||||
|
@@ -237,7 +237,7 @@ func processHeadersWithVersioner(ctx android.ModuleContext, srcDir, outDir andro
|
|||||||
}
|
}
|
||||||
|
|
||||||
timestampFile := android.PathForModuleOut(ctx, "versioner.timestamp")
|
timestampFile := android.PathForModuleOut(ctx, "versioner.timestamp")
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: preprocessBionicHeaders,
|
Rule: preprocessBionicHeaders,
|
||||||
Description: "versioner preprocess " + srcDir.Rel(),
|
Description: "versioner preprocess " + srcDir.Rel(),
|
||||||
Output: timestampFile,
|
Output: timestampFile,
|
||||||
|
@@ -270,7 +270,7 @@ func compileStubLibrary(ctx ModuleContext, flags Flags, symbolFile, apiLevel, vn
|
|||||||
versionScriptPath := android.PathForModuleGen(ctx, "stub.map")
|
versionScriptPath := android.PathForModuleGen(ctx, "stub.map")
|
||||||
symbolFilePath := android.PathForModuleSrc(ctx, symbolFile)
|
symbolFilePath := android.PathForModuleSrc(ctx, symbolFile)
|
||||||
apiLevelsJson := android.GetApiLevelsJson(ctx)
|
apiLevelsJson := android.GetApiLevelsJson(ctx)
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: genStubSrc,
|
Rule: genStubSrc,
|
||||||
Description: "generate stubs " + symbolFilePath.Rel(),
|
Description: "generate stubs " + symbolFilePath.Rel(),
|
||||||
Outputs: []android.WritablePath{stubSrcPath, versionScriptPath},
|
Outputs: []android.WritablePath{stubSrcPath, versionScriptPath},
|
||||||
|
@@ -124,7 +124,7 @@ func (p *prebuiltBinaryLinker) link(ctx ModuleContext,
|
|||||||
fileName := p.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
|
fileName := p.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
|
||||||
outputFile := android.PathForModuleOut(ctx, fileName)
|
outputFile := android.PathForModuleOut(ctx, fileName)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: android.CpExecutable,
|
Rule: android.CpExecutable,
|
||||||
Description: "prebuilt",
|
Description: "prebuilt",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
|
@@ -41,7 +41,7 @@ func genProto(ctx android.ModuleContext, protoFile android.Path,
|
|||||||
ccFile = android.GenPathWithExt(ctx, "proto", protoFile, "pb.cc")
|
ccFile = android.GenPathWithExt(ctx, "proto", protoFile, "pb.cc")
|
||||||
headerFile = android.GenPathWithExt(ctx, "proto", protoFile, "pb.h")
|
headerFile = android.GenPathWithExt(ctx, "proto", protoFile, "pb.h")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: proto,
|
Rule: proto,
|
||||||
Description: "protoc " + protoFile.Rel(),
|
Description: "protoc " + protoFile.Rel(),
|
||||||
Outputs: android.WritablePaths{ccFile, headerFile},
|
Outputs: android.WritablePaths{ccFile, headerFile},
|
||||||
|
@@ -75,7 +75,7 @@ func (p *relocationPacker) needsPacking(ctx ModuleContext) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *relocationPacker) pack(ctx ModuleContext, in, out android.ModuleOutPath, flags builderFlags) {
|
func (p *relocationPacker) pack(ctx ModuleContext, in, out android.ModuleOutPath, flags builderFlags) {
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: relocationPackerRule,
|
Rule: relocationPackerRule,
|
||||||
Description: "pack relocations",
|
Description: "pack relocations",
|
||||||
Output: out,
|
Output: out,
|
||||||
|
2
cc/rs.go
2
cc/rs.go
@@ -64,7 +64,7 @@ func rsGenerateCpp(ctx android.ModuleContext, rsFiles android.Paths, rsFlags str
|
|||||||
cppFiles[i] = rsGeneratedCppFile(ctx, rsFile)
|
cppFiles[i] = rsGeneratedCppFile(ctx, rsFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: rsCpp,
|
Rule: rsCpp,
|
||||||
Description: "llvm-rs-cc",
|
Description: "llvm-rs-cc",
|
||||||
Output: stampFile,
|
Output: stampFile,
|
||||||
|
@@ -17,8 +17,6 @@ package cc
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/cc/config"
|
"android/soong/cc/config"
|
||||||
)
|
)
|
||||||
@@ -81,7 +79,7 @@ func sabiDepsMutator(mctx android.TopDownMutatorContext) {
|
|||||||
if c, ok := mctx.Module().(*Module); ok &&
|
if c, ok := mctx.Module().(*Module); ok &&
|
||||||
((c.isVndk() && c.useVndk()) || inList(c.Name(), llndkLibraries) ||
|
((c.isVndk() && c.useVndk()) || inList(c.Name(), llndkLibraries) ||
|
||||||
(c.sabi != nil && c.sabi.Properties.CreateSAbiDumps)) {
|
(c.sabi != nil && c.sabi.Properties.CreateSAbiDumps)) {
|
||||||
mctx.VisitDirectDeps(func(m blueprint.Module) {
|
mctx.VisitDirectDeps(func(m android.Module) {
|
||||||
tag := mctx.OtherModuleDependencyTag(m)
|
tag := mctx.OtherModuleDependencyTag(m)
|
||||||
switch tag {
|
switch tag {
|
||||||
case staticDepTag, staticExportDepTag, lateStaticDepTag, wholeStaticDepTag:
|
case staticDepTag, staticExportDepTag, lateStaticDepTag, wholeStaticDepTag:
|
||||||
|
@@ -19,8 +19,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/cc/config"
|
"android/soong/cc/config"
|
||||||
)
|
)
|
||||||
@@ -493,7 +491,7 @@ func (sanitize *sanitize) SetSanitizer(t sanitizerType, b bool) {
|
|||||||
func sanitizerDepsMutator(t sanitizerType) func(android.TopDownMutatorContext) {
|
func sanitizerDepsMutator(t sanitizerType) func(android.TopDownMutatorContext) {
|
||||||
return func(mctx android.TopDownMutatorContext) {
|
return func(mctx android.TopDownMutatorContext) {
|
||||||
if c, ok := mctx.Module().(*Module); ok && c.sanitize.Sanitizer(t) {
|
if c, ok := mctx.Module().(*Module); ok && c.sanitize.Sanitizer(t) {
|
||||||
mctx.VisitDepsDepthFirst(func(module blueprint.Module) {
|
mctx.VisitDepsDepthFirst(func(module android.Module) {
|
||||||
if d, ok := mctx.Module().(*Module); ok && c.sanitize != nil &&
|
if d, ok := mctx.Module().(*Module); ok && c.sanitize != nil &&
|
||||||
!c.sanitize.Properties.Sanitize.Never {
|
!c.sanitize.Properties.Sanitize.Never {
|
||||||
d.sanitize.Properties.SanitizeDep = true
|
d.sanitize.Properties.SanitizeDep = true
|
||||||
|
@@ -157,7 +157,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
tools := map[string]android.Path{}
|
tools := map[string]android.Path{}
|
||||||
|
|
||||||
if len(g.properties.Tools) > 0 {
|
if len(g.properties.Tools) > 0 {
|
||||||
ctx.VisitDirectDeps(func(module blueprint.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
switch ctx.OtherModuleDependencyTag(module) {
|
switch ctx.OtherModuleDependencyTag(module) {
|
||||||
case android.SourceDepTag:
|
case android.SourceDepTag:
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
@@ -289,7 +289,7 @@ func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask
|
|||||||
desc += " " + task.out[0].Base()
|
desc += " " + task.out[0].Base()
|
||||||
}
|
}
|
||||||
|
|
||||||
params := android.ModuleBuildParams{
|
params := android.BuildParams{
|
||||||
Rule: g.rule,
|
Rule: g.rule,
|
||||||
Description: "generate",
|
Description: "generate",
|
||||||
Output: task.out[0],
|
Output: task.out[0],
|
||||||
@@ -304,7 +304,7 @@ func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask
|
|||||||
depfile := android.GenPathWithExt(ctx, "", task.out[0], task.out[0].Ext()+".d")
|
depfile := android.GenPathWithExt(ctx, "", task.out[0], task.out[0].Ext()+".d")
|
||||||
params.Depfile = depfile
|
params.Depfile = depfile
|
||||||
}
|
}
|
||||||
ctx.ModuleBuild(pctx, params)
|
ctx.Build(pctx, params)
|
||||||
|
|
||||||
for _, outputFile := range task.out {
|
for _, outputFile := range task.out {
|
||||||
g.outputFiles = append(g.outputFiles, outputFile)
|
g.outputFiles = append(g.outputFiles, outputFile)
|
||||||
|
@@ -20,7 +20,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
@@ -231,7 +230,7 @@ func (a *AndroidApp) aaptFlags(ctx android.ModuleContext) ([]string, android.Pat
|
|||||||
aaptFlags = append(aaptFlags, android.JoinWithPrefix(assetDirs.Strings(), "-A "))
|
aaptFlags = append(aaptFlags, android.JoinWithPrefix(assetDirs.Strings(), "-A "))
|
||||||
aaptFlags = append(aaptFlags, android.JoinWithPrefix(resourceDirs.Strings(), "-S "))
|
aaptFlags = append(aaptFlags, android.JoinWithPrefix(resourceDirs.Strings(), "-S "))
|
||||||
|
|
||||||
ctx.VisitDirectDeps(func(module blueprint.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
var depFiles android.Paths
|
var depFiles android.Paths
|
||||||
if javaDep, ok := module.(Dependency); ok {
|
if javaDep, ok := module.(Dependency); ok {
|
||||||
if ctx.OtherModuleName(module) == "framework-res" {
|
if ctx.OtherModuleName(module) == "framework-res" {
|
||||||
|
@@ -82,7 +82,7 @@ func CreateResourceJavaFiles(ctx android.ModuleContext, flags []string,
|
|||||||
publicResourcesFile := android.PathForModuleOut(ctx, "public_resources.xml")
|
publicResourcesFile := android.PathForModuleOut(ctx, "public_resources.xml")
|
||||||
proguardOptionsFile := android.PathForModuleOut(ctx, "proguard.options")
|
proguardOptionsFile := android.PathForModuleOut(ctx, "proguard.options")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: aaptCreateResourceJavaFile,
|
Rule: aaptCreateResourceJavaFile,
|
||||||
Description: "aapt create R.java",
|
Description: "aapt create R.java",
|
||||||
Outputs: android.WritablePaths{publicResourcesFile, proguardOptionsFile, javaFileList},
|
Outputs: android.WritablePaths{publicResourcesFile, proguardOptionsFile, javaFileList},
|
||||||
@@ -102,7 +102,7 @@ func CreateResourceJavaFiles(ctx android.ModuleContext, flags []string,
|
|||||||
func CreateExportPackage(ctx android.ModuleContext, flags []string, deps android.Paths) android.ModuleOutPath {
|
func CreateExportPackage(ctx android.ModuleContext, flags []string, deps android.Paths) android.ModuleOutPath {
|
||||||
outputFile := android.PathForModuleOut(ctx, "package-export.apk")
|
outputFile := android.PathForModuleOut(ctx, "package-export.apk")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: aaptCreateAssetsPackage,
|
Rule: aaptCreateAssetsPackage,
|
||||||
Description: "aapt export package",
|
Description: "aapt export package",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -120,7 +120,7 @@ func CreateAppPackage(ctx android.ModuleContext, flags []string, jarFile android
|
|||||||
|
|
||||||
resourceApk := android.PathForModuleOut(ctx, "resources.apk")
|
resourceApk := android.PathForModuleOut(ctx, "resources.apk")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: aaptAddResources,
|
Rule: aaptAddResources,
|
||||||
Description: "aapt package",
|
Description: "aapt package",
|
||||||
Output: resourceApk,
|
Output: resourceApk,
|
||||||
@@ -137,7 +137,7 @@ func CreateAppPackage(ctx android.ModuleContext, flags []string, jarFile android
|
|||||||
certificateArgs = append(certificateArgs, c+".x509.pem", c+".pk8")
|
certificateArgs = append(certificateArgs, c+".x509.pem", c+".pk8")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: signapk,
|
Rule: signapk,
|
||||||
Description: "signapk",
|
Description: "signapk",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
|
@@ -181,7 +181,7 @@ func TransformKotlinToClasses(ctx android.ModuleContext, outputFile android.Writ
|
|||||||
inputs := append(android.Paths(nil), srcFiles...)
|
inputs := append(android.Paths(nil), srcFiles...)
|
||||||
inputs = append(inputs, srcJars...)
|
inputs = append(inputs, srcJars...)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: kotlinc,
|
Rule: kotlinc,
|
||||||
Description: "kotlinc",
|
Description: "kotlinc",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -236,7 +236,7 @@ func TransformJavaToHeaderClasses(ctx android.ModuleContext, outputFile android.
|
|||||||
} else {
|
} else {
|
||||||
sourcepath = ""
|
sourcepath = ""
|
||||||
}
|
}
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: turbine,
|
Rule: turbine,
|
||||||
Description: "turbine",
|
Description: "turbine",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -286,7 +286,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
|
|||||||
|
|
||||||
deps = append(deps, flags.classpath...)
|
deps = append(deps, flags.classpath...)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: rule,
|
Rule: rule,
|
||||||
Description: desc,
|
Description: desc,
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -309,7 +309,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
|
|||||||
func TransformResourcesToJar(ctx android.ModuleContext, outputFile android.WritablePath,
|
func TransformResourcesToJar(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||||
jarArgs []string, deps android.Paths) {
|
jarArgs []string, deps android.Paths) {
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: jar,
|
Rule: jar,
|
||||||
Description: "jar",
|
Description: "jar",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -341,7 +341,7 @@ func TransformJarsToJar(ctx android.ModuleContext, outputFile android.WritablePa
|
|||||||
jarArgs = append(jarArgs, "-D")
|
jarArgs = append(jarArgs, "-D")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: combineJar,
|
Rule: combineJar,
|
||||||
Description: desc,
|
Description: desc,
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -371,7 +371,7 @@ func TransformDesugar(ctx android.ModuleContext, outputFile android.WritablePath
|
|||||||
deps = append(deps, flags.bootClasspath...)
|
deps = append(deps, flags.bootClasspath...)
|
||||||
deps = append(deps, flags.classpath...)
|
deps = append(deps, flags.classpath...)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: desugar,
|
Rule: desugar,
|
||||||
Description: "desugar",
|
Description: "desugar",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -393,7 +393,7 @@ func TransformClassesJarToDexJar(ctx android.ModuleContext, outputFile android.W
|
|||||||
|
|
||||||
outDir := android.PathForModuleOut(ctx, "dex")
|
outDir := android.PathForModuleOut(ctx, "dex")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: dx,
|
Rule: dx,
|
||||||
Description: "dx",
|
Description: "dx",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
@@ -407,7 +407,7 @@ func TransformClassesJarToDexJar(ctx android.ModuleContext, outputFile android.W
|
|||||||
|
|
||||||
func TransformJarJar(ctx android.ModuleContext, outputFile android.WritablePath,
|
func TransformJarJar(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||||
classesJar android.Path, rulesFile android.Path) {
|
classesJar android.Path, rulesFile android.Path) {
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: jarjar,
|
Rule: jarjar,
|
||||||
Description: "jarjar",
|
Description: "jarjar",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
|
@@ -57,7 +57,7 @@ func genAidl(ctx android.ModuleContext, aidlFile android.Path, aidlFlags string)
|
|||||||
javaFile := android.GenPathWithExt(ctx, "aidl", aidlFile, "java")
|
javaFile := android.GenPathWithExt(ctx, "aidl", aidlFile, "java")
|
||||||
depFile := javaFile.String() + ".d"
|
depFile := javaFile.String() + ".d"
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: aidl,
|
Rule: aidl,
|
||||||
Description: "aidl " + aidlFile.Rel(),
|
Description: "aidl " + aidlFile.Rel(),
|
||||||
Output: javaFile,
|
Output: javaFile,
|
||||||
@@ -74,7 +74,7 @@ func genAidl(ctx android.ModuleContext, aidlFile android.Path, aidlFlags string)
|
|||||||
func genLogtags(ctx android.ModuleContext, logtagsFile android.Path) android.Path {
|
func genLogtags(ctx android.ModuleContext, logtagsFile android.Path) android.Path {
|
||||||
javaFile := android.GenPathWithExt(ctx, "logtags", logtagsFile, "java")
|
javaFile := android.GenPathWithExt(ctx, "logtags", logtagsFile, "java")
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: logtags,
|
Rule: logtags,
|
||||||
Description: "logtags " + logtagsFile.Rel(),
|
Description: "logtags " + logtagsFile.Rel(),
|
||||||
Output: javaFile,
|
Output: javaFile,
|
||||||
|
17
java/java.go
17
java/java.go
@@ -406,25 +406,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, sdkDep.aidl)
|
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, sdkDep.aidl)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.VisitDirectDeps(func(module blueprint.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
otherName := ctx.OtherModuleName(module)
|
otherName := ctx.OtherModuleName(module)
|
||||||
tag := ctx.OtherModuleDependencyTag(module)
|
tag := ctx.OtherModuleDependencyTag(module)
|
||||||
|
|
||||||
aDep, _ := module.(android.Module)
|
|
||||||
if aDep == nil {
|
|
||||||
ctx.ModuleErrorf("module %q not an android module", ctx.OtherModuleName(aDep))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !aDep.Enabled() {
|
|
||||||
if ctx.AConfig().AllowMissingDependencies() {
|
|
||||||
ctx.AddMissingDependencies([]string{ctx.OtherModuleName(aDep)})
|
|
||||||
} else {
|
|
||||||
ctx.ModuleErrorf("depends on disabled module %q", ctx.OtherModuleName(aDep))
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
dep, _ := module.(Dependency)
|
dep, _ := module.(Dependency)
|
||||||
if dep == nil {
|
if dep == nil {
|
||||||
switch tag {
|
switch tag {
|
||||||
|
@@ -41,7 +41,7 @@ var (
|
|||||||
func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath,
|
func genProto(ctx android.ModuleContext, outputSrcJar android.WritablePath,
|
||||||
protoFiles android.Paths, protoFlags string, protoOut, protoOutFlags string) {
|
protoFiles android.Paths, protoFlags string, protoOut, protoOutFlags string) {
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: proto,
|
Rule: proto,
|
||||||
Description: "protoc " + protoFiles[0].Rel(),
|
Description: "protoc " + protoFiles[0].Rel(),
|
||||||
Output: outputSrcJar,
|
Output: outputSrcJar,
|
||||||
|
@@ -67,7 +67,7 @@ func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string,
|
|||||||
android.PathForModuleOut(ctx, "system/release"),
|
android.PathForModuleOut(ctx, "system/release"),
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: jarsTosystemModules,
|
Rule: jarsTosystemModules,
|
||||||
Description: "system modules",
|
Description: "system modules",
|
||||||
Outputs: outputs,
|
Outputs: outputs,
|
||||||
@@ -112,7 +112,7 @@ type SystemModulesProperties struct {
|
|||||||
func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
var jars android.Paths
|
var jars android.Paths
|
||||||
|
|
||||||
ctx.VisitDirectDeps(func(module blueprint.Module) {
|
ctx.VisitDirectDeps(func(module android.Module) {
|
||||||
if ctx.OtherModuleDependencyTag(module) == libTag {
|
if ctx.OtherModuleDependencyTag(module) == libTag {
|
||||||
dep, _ := module.(Dependency)
|
dep, _ := module.(Dependency)
|
||||||
jars = append(jars, dep.HeaderJars()...)
|
jars = append(jars, dep.HeaderJars()...)
|
||||||
|
@@ -21,8 +21,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -135,7 +133,7 @@ func (binary *binaryDecorator) bootstrap(ctx android.ModuleContext, actual_versi
|
|||||||
|
|
||||||
var launcher_path android.Path
|
var launcher_path android.Path
|
||||||
if embedded_launcher {
|
if embedded_launcher {
|
||||||
ctx.VisitDirectDeps(func(m blueprint.Module) {
|
ctx.VisitDirectDeps(func(m android.Module) {
|
||||||
if ctx.OtherModuleDependencyTag(m) != launcherTag {
|
if ctx.OtherModuleDependencyTag(m) != launcherTag {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@ func registerBuildActionForModuleFileList(ctx android.ModuleContext,
|
|||||||
content = append(content, file.String())
|
content = append(content, file.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: android.WriteFile,
|
Rule: android.WriteFile,
|
||||||
Description: "generate " + fileList.Rel(),
|
Description: "generate " + fileList.Rel(),
|
||||||
Output: fileList,
|
Output: fileList,
|
||||||
@@ -140,7 +140,7 @@ func registerBuildActionForParFile(ctx android.ModuleContext, embedded_launcher
|
|||||||
// added stub file to the soong_zip args.
|
// added stub file to the soong_zip args.
|
||||||
parArgs = append(parArgs, `-P "" `+`-C `+strings.TrimSuffix(stub, mainFileName)+` -f `+stub)
|
parArgs = append(parArgs, `-P "" `+`-C `+strings.TrimSuffix(stub, mainFileName)+` -f `+stub)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: host_par,
|
Rule: host_par,
|
||||||
Description: "host python archive",
|
Description: "host python archive",
|
||||||
Output: binFile,
|
Output: binFile,
|
||||||
@@ -169,7 +169,7 @@ func registerBuildActionForParFile(ctx android.ModuleContext, embedded_launcher
|
|||||||
parArgs = append(parArgs, `-P "" `+`-C `+fmt.Sprintf(
|
parArgs = append(parArgs, `-P "" `+`-C `+fmt.Sprintf(
|
||||||
"%q", strings.TrimSuffix(entryPoint, entryPointFile))+` -f `+entryPoint)
|
"%q", strings.TrimSuffix(entryPoint, entryPointFile))+` -f `+entryPoint)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.Build(pctx, android.BuildParams{
|
||||||
Rule: embedded_par,
|
Rule: embedded_par,
|
||||||
Description: "embedded python archive",
|
Description: "embedded python archive",
|
||||||
Output: binFile,
|
Output: binFile,
|
||||||
|
@@ -508,7 +508,7 @@ func (p *Module) uniqWholeRunfilesTree(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// visit all its dependencies in depth first.
|
// visit all its dependencies in depth first.
|
||||||
ctx.VisitDepsDepthFirst(func(module blueprint.Module) {
|
ctx.VisitDepsDepthFirst(func(module android.Module) {
|
||||||
if ctx.OtherModuleDependencyTag(module) != pythonLibTag {
|
if ctx.OtherModuleDependencyTag(module) != pythonLibTag {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user