diff options
Diffstat (limited to 'java/base.go')
-rw-r--r-- | java/base.go | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/java/base.go b/java/base.go index 44bc75946..ba4a72912 100644 --- a/java/base.go +++ b/java/base.go @@ -91,6 +91,10 @@ type CommonProperties struct { // if not blank, run jarjar using the specified rules file Jarjar_rules *string `android:"path,arch_variant"` + // java class names to rename with jarjar when a reverse dependency has a jarjar_prefix + // property. + Jarjar_rename []string + // if not blank, used as prefix to generate repackage rule Jarjar_prefix *string @@ -550,6 +554,10 @@ type Module struct { // java_aconfig_library or java_library modules that are statically linked // to this module. Does not contain cache files from all transitive dependencies. aconfigCacheFiles android.Paths + + // List of soong module dependencies required to compile the current module. + // This information is printed out to `Dependencies` field in module_bp_java_deps.json + compileDepNames []string } var _ android.InstallableModule = (*Module)(nil) @@ -2054,10 +2062,7 @@ func (j *Module) IDEInfo(dpInfo *android.IdeInfo) { } func (j *Module) CompilerDeps() []string { - jdeps := []string{} - jdeps = append(jdeps, j.properties.Libs...) - jdeps = append(jdeps, j.properties.Static_libs...) - return jdeps + return j.compileDepNames } func (j *Module) hasCode(ctx android.ModuleContext) bool { @@ -2401,6 +2406,11 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { } } + if android.InList(tag, compileDependencyTags) { + // Add the dependency name to compileDepNames so that it can be recorded in module_bp_java_deps.json + j.compileDepNames = append(j.compileDepNames, otherName) + } + addCLCFromDep(ctx, module, j.classLoaderContexts) addMissingOptionalUsesLibsFromDep(ctx, module, &j.usesLibrary) }) @@ -2642,8 +2652,7 @@ func (module *Module) collectJarJarRules(ctx android.ModuleContext) *JarJarProvi // Gather repackage information from deps result := collectDirectDepsProviders(ctx) - // Update that with entries we've stored for ourself - for orig, renamed := range module.jarjarRenameRules { + add := func(orig string, renamed string) { if result == nil { result = &JarJarProviderData{ Rename: make(map[string]string), @@ -2652,12 +2661,22 @@ func (module *Module) collectJarJarRules(ctx android.ModuleContext) *JarJarProvi if renamed != "" { if preexisting, exists := (*result).Rename[orig]; exists && preexisting != renamed { ctx.ModuleErrorf("Conflicting jarjar rules inherited for class: %s (%s and %s)", orig, renamed, preexisting) - continue + return } } (*result).Rename[orig] = renamed } + // Update that with entries we've stored for ourself + for orig, renamed := range module.jarjarRenameRules { + add(orig, renamed) + } + + // Update that with entries given in the jarjar_rename property. + for _, orig := range module.properties.Jarjar_rename { + add(orig, "") + } + // If there are no renamings, then jarjar_prefix does nothing, so skip the extra work. if result == nil { return nil |