Merge changes If54d9c69,Ibc253514
* changes: Fix PathForPhony Allow java manifest property to reference filegroups
This commit is contained in:
commit
ae6bd3d758
|
@ -106,6 +106,7 @@ type ModuleContext interface {
|
|||
ModuleBuild(pctx PackageContext, params ModuleBuildParams)
|
||||
|
||||
ExpandSources(srcFiles, excludes []string) Paths
|
||||
ExpandSource(srcFile, prop string) Path
|
||||
ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths
|
||||
Glob(globPattern string, excludes []string) Paths
|
||||
|
||||
|
@ -1005,8 +1006,8 @@ type sourceDependencyTag struct {
|
|||
|
||||
var SourceDepTag sourceDependencyTag
|
||||
|
||||
// Returns a list of modules that must be depended on to satisfy filegroup or generated sources
|
||||
// modules listed in srcFiles using ":module" syntax
|
||||
// Adds necessary dependencies to satisfy filegroup or generated sources modules listed in srcFiles
|
||||
// using ":module" syntax, if any.
|
||||
func ExtractSourcesDeps(ctx BottomUpMutatorContext, srcFiles []string) {
|
||||
var deps []string
|
||||
set := make(map[string]bool)
|
||||
|
@ -1025,6 +1026,16 @@ func ExtractSourcesDeps(ctx BottomUpMutatorContext, srcFiles []string) {
|
|||
ctx.AddDependency(ctx.Module(), SourceDepTag, deps...)
|
||||
}
|
||||
|
||||
// Adds necessary dependencies to satisfy filegroup or generated sources modules specified in s
|
||||
// using ":module" syntax, if any.
|
||||
func ExtractSourceDeps(ctx BottomUpMutatorContext, s *string) {
|
||||
if s != nil {
|
||||
if m := SrcIsModule(*s); m != "" {
|
||||
ctx.AddDependency(ctx.Module(), SourceDepTag, m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type SourceFileProducer interface {
|
||||
Srcs() Paths
|
||||
}
|
||||
|
@ -1035,6 +1046,18 @@ func (ctx *androidModuleContext) ExpandSources(srcFiles, excludes []string) Path
|
|||
return ctx.ExpandSourcesSubDir(srcFiles, excludes, "")
|
||||
}
|
||||
|
||||
// Returns a single path expanded from globs and modules referenced using ":module" syntax.
|
||||
// ExtractSourceDeps must have already been called during the dependency resolution phase.
|
||||
func (ctx *androidModuleContext) ExpandSource(srcFile, prop string) Path {
|
||||
srcFiles := ctx.ExpandSourcesSubDir([]string{srcFile}, nil, "")
|
||||
if len(srcFiles) == 1 {
|
||||
return srcFiles[0]
|
||||
} else {
|
||||
ctx.PropertyErrorf(prop, "module providing %s must produce exactly one file", prop)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (ctx *androidModuleContext) ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths {
|
||||
prefix := PathForModuleSrc(ctx).String()
|
||||
|
||||
|
|
|
@ -906,9 +906,18 @@ func PathForPhony(ctx PathContext, phony string) WritablePath {
|
|||
if strings.ContainsAny(phony, "$/") {
|
||||
reportPathError(ctx, "Phony target contains invalid character ($ or /): %s", phony)
|
||||
}
|
||||
return OutputPath{basePath{phony, ctx.Config(), ""}}
|
||||
return PhonyPath{basePath{phony, ctx.Config(), ""}}
|
||||
}
|
||||
|
||||
type PhonyPath struct {
|
||||
basePath
|
||||
}
|
||||
|
||||
func (p PhonyPath) writablePath() {}
|
||||
|
||||
var _ Path = PhonyPath{}
|
||||
var _ WritablePath = PhonyPath{}
|
||||
|
||||
type testPath struct {
|
||||
basePath
|
||||
}
|
||||
|
|
18
java/java.go
18
java/java.go
|
@ -390,6 +390,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
|||
|
||||
android.ExtractSourcesDeps(ctx, j.properties.Srcs)
|
||||
android.ExtractSourcesDeps(ctx, j.properties.Java_resources)
|
||||
android.ExtractSourceDeps(ctx, j.properties.Manifest)
|
||||
|
||||
if j.hasSrcExt(".proto") {
|
||||
protoDeps(ctx, &j.protoProperties)
|
||||
|
@ -764,7 +765,10 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
|
|||
// static classpath jars have the resources in them, so the resource jars aren't necessary here
|
||||
jars = append(jars, deps.staticJars...)
|
||||
|
||||
manifest := android.OptionalPathForModuleSrc(ctx, j.properties.Manifest)
|
||||
var manifest android.OptionalPath
|
||||
if j.properties.Manifest != nil {
|
||||
manifest = android.OptionalPathForPath(ctx.ExpandSource(*j.properties.Manifest, "manifest"))
|
||||
}
|
||||
|
||||
// Combine the classes built from sources, any manifests, and any static libraries into
|
||||
// classes.jar. If there is only one input jar this step will be skipped.
|
||||
|
@ -1088,14 +1092,8 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
// Handle the binary wrapper
|
||||
j.isWrapperVariant = true
|
||||
|
||||
if String(j.binaryProperties.Wrapper) != "" {
|
||||
wrapperSrcs := ctx.ExpandSources([]string{String(j.binaryProperties.Wrapper)}, nil)
|
||||
if len(wrapperSrcs) == 1 {
|
||||
j.wrapperFile = wrapperSrcs[0]
|
||||
} else {
|
||||
ctx.PropertyErrorf("wrapper", "module providing wrapper must produce exactly one file")
|
||||
return
|
||||
}
|
||||
if j.binaryProperties.Wrapper != nil {
|
||||
j.wrapperFile = ctx.ExpandSource(*j.binaryProperties.Wrapper, "wrapper")
|
||||
} else {
|
||||
j.wrapperFile = android.PathForSource(ctx, "build/soong/scripts/jar-wrapper.sh")
|
||||
}
|
||||
|
@ -1113,7 +1111,7 @@ func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
if ctx.Arch().ArchType == android.Common {
|
||||
j.deps(ctx)
|
||||
} else {
|
||||
android.ExtractSourcesDeps(ctx, []string{String(j.binaryProperties.Wrapper)})
|
||||
android.ExtractSourceDeps(ctx, j.binaryProperties.Wrapper)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue