diff options
author | Colin Cross <ccross@android.com> | 2018-06-20 17:56:23 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-20 17:56:23 -0700 |
commit | ee4898cc40a8aa3c66b7b1c0fdf0ba09b92125f4 (patch) | |
tree | f284a5bd6ec0f4543986992cd90c2c026887afa7 | |
parent | 4e00c2c14ddf12a48242f94bd7fb5e41804da371 (diff) | |
parent | a1ce2a0071ce970b5e1c50e69e299ec3c12620e4 (diff) | |
download | build_soong-ee4898cc40a8aa3c66b7b1c0fdf0ba09b92125f4.tar.gz build_soong-ee4898cc40a8aa3c66b7b1c0fdf0ba09b92125f4.tar.bz2 build_soong-ee4898cc40a8aa3c66b7b1c0fdf0ba09b92125f4.zip |
Update soong for blueprint change to allow multiple deps
am: a1ce2a0071
Change-Id: I060f9a5b971ace92c815eb3aad67c33f3aed4d2b
-rw-r--r-- | android/defaults.go | 9 | ||||
-rw-r--r-- | java/droiddoc.go | 47 |
2 files changed, 36 insertions, 20 deletions
diff --git a/android/defaults.go b/android/defaults.go index c7045292..d4fbf487 100644 --- a/android/defaults.go +++ b/android/defaults.go @@ -131,11 +131,16 @@ func defaultsDepsMutator(ctx BottomUpMutatorContext) { func defaultsMutator(ctx TopDownMutatorContext) { if defaultable, ok := ctx.Module().(Defaultable); ok && len(defaultable.defaults().Defaults) > 0 { var defaultsList []Defaults + seen := make(map[Defaults]bool) + ctx.WalkDeps(func(module, parent Module) bool { if ctx.OtherModuleDependencyTag(module) == DefaultsDepTag { if defaults, ok := module.(Defaults); ok { - defaultsList = append(defaultsList, defaults) - return len(defaults.defaults().Defaults) > 0 + if !seen[defaults] { + seen[defaults] = true + defaultsList = append(defaultsList, defaults) + return len(defaults.defaults().Defaults) > 0 + } } else { ctx.PropertyErrorf("defaults", "module %s is not an defaults module", ctx.OtherModuleName(module)) diff --git a/java/droiddoc.go b/java/droiddoc.go index dfba17e8..3b7ead50 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -99,6 +99,10 @@ func init() { android.RegisterModuleType("javadoc_host", JavadocHostFactory) } +var ( + srcsLibTag = dependencyTag{name: "sources from javalib"} +) + type JavadocProperties struct { // list of source files used to compile the Java module. May be .java, .logtags, .proto, // or .aidl files. @@ -348,6 +352,9 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) { } ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...) + if j.properties.Srcs_lib != nil { + ctx.AddDependency(ctx.Module(), srcsLibTag, *j.properties.Srcs_lib) + } android.ExtractSourcesDeps(ctx, j.properties.Srcs) @@ -447,24 +454,6 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps { switch dep := module.(type) { case Dependency: deps.classpath = append(deps.classpath, dep.ImplementationJars()...) - if otherName == String(j.properties.Srcs_lib) { - srcs := dep.(SrcDependency).CompiledSrcs() - whitelistPathPrefixes := make(map[string]bool) - j.genWhitelistPathPrefixes(whitelistPathPrefixes) - for _, src := range srcs { - if _, ok := src.(android.WritablePath); ok { // generated sources - deps.srcs = append(deps.srcs, src) - } else { // select source path for documentation based on whitelist path prefixs. - for k, _ := range whitelistPathPrefixes { - if strings.HasPrefix(src.Rel(), k) { - deps.srcs = append(deps.srcs, src) - break - } - } - } - } - deps.srcJars = append(deps.srcJars, dep.(SrcDependency).CompiledSrcJars()...) - } case SdkLibraryDependency: sdkVersion := String(j.properties.Sdk_version) linkType := javaSdk @@ -480,6 +469,28 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps { default: ctx.ModuleErrorf("depends on non-java module %q", otherName) } + case srcsLibTag: + switch dep := module.(type) { + case Dependency: + srcs := dep.(SrcDependency).CompiledSrcs() + whitelistPathPrefixes := make(map[string]bool) + j.genWhitelistPathPrefixes(whitelistPathPrefixes) + for _, src := range srcs { + if _, ok := src.(android.WritablePath); ok { // generated sources + deps.srcs = append(deps.srcs, src) + } else { // select source path for documentation based on whitelist path prefixs. + for k, _ := range whitelistPathPrefixes { + if strings.HasPrefix(src.Rel(), k) { + deps.srcs = append(deps.srcs, src) + break + } + } + } + } + deps.srcJars = append(deps.srcJars, dep.(SrcDependency).CompiledSrcJars()...) + default: + ctx.ModuleErrorf("depends on non-java module %q", otherName) + } case systemModulesTag: if deps.systemModules != nil { panic("Found two system module dependencies") |