diff --git a/java/aar.go b/java/aar.go index a4e6f910d..f5d7e9761 100644 --- a/java/aar.go +++ b/java/aar.go @@ -249,7 +249,8 @@ func (a *aapt) buildActions(ctx android.ModuleContext, sdkContext sdkContext, ex } packageRes := android.PathForModuleOut(ctx, "package-res.apk") - srcJar := android.PathForModuleGen(ctx, "R.jar") + // the subdir "android" is required to be filtered by package names + srcJar := android.PathForModuleGen(ctx, "android", "R.srcjar") proguardOptionsFile := android.PathForModuleGen(ctx, "proguard.options") rTxt := android.PathForModuleOut(ctx, "R.txt") // This file isn't used by Soong, but is generated for exporting @@ -620,7 +621,8 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { aapt2CompileZip(ctx, flata, aar, "res", compileFlags) a.exportPackage = android.PathForModuleOut(ctx, "package-res.apk") - srcJar := android.PathForModuleGen(ctx, "R.jar") + // the subdir "android" is required to be filtered by package names + srcJar := android.PathForModuleGen(ctx, "android", "R.srcjar") proguardOptionsFile := android.PathForModuleGen(ctx, "proguard.options") rTxt := android.PathForModuleOut(ctx, "R.txt") a.extraAaptPackagesFile = android.PathForModuleOut(ctx, "extra_packages") diff --git a/java/app.go b/java/app.go index 7df4358d7..0af89fd2a 100644 --- a/java/app.go +++ b/java/app.go @@ -539,6 +539,15 @@ func (a *AndroidApp) getCertString(ctx android.BaseModuleContext) string { return String(a.overridableAppProperties.Certificate) } +// For OutputFileProducer interface +func (a *AndroidApp) OutputFiles(tag string) (android.Paths, error) { + switch tag { + case ".aapt.srcjar": + return []android.Path{a.aaptSrcJar}, nil + } + return a.Library.OutputFiles(tag) +} + // android_app compiles sources and Android resources into an Android application package `.apk` file. func AndroidAppFactory() android.Module { module := &AndroidApp{} diff --git a/java/droiddoc.go b/java/droiddoc.go index 8b15e0fa5..63da6d275 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -61,12 +61,6 @@ type JavadocProperties struct { // list of java libraries that will be in the classpath. Libs []string `android:"arch_variant"` - // the java library (in classpath) for documentation that provides java srcs and srcjars. - Srcs_lib *string - - // List of packages to document from srcs_lib - Srcs_lib_whitelist_pkgs []string - // If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true. Installable *bool @@ -422,9 +416,6 @@ func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) { } ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...) - if j.properties.Srcs_lib != nil { - ctx.AddVariationDependencies(nil, srcsLibTag, *j.properties.Srcs_lib) - } } func (j *Javadoc) collectAidlFlags(ctx android.ModuleContext, deps deps) droiddocBuilderFlags { @@ -518,27 +509,6 @@ 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() - 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 _, pkg := range j.properties.Srcs_lib_whitelist_pkgs { - pkgAsPath := filepath.Join(strings.Split(pkg, ".")...) - if strings.HasPrefix(src.Rel(), pkgAsPath) { - 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") diff --git a/java/java.go b/java/java.go index f278d5ee0..87ee2f29c 100644 --- a/java/java.go +++ b/java/java.go @@ -404,29 +404,14 @@ type SdkLibraryDependency interface { SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths } -type SrcDependency interface { - CompiledSrcs() android.Paths - CompiledSrcJars() android.Paths -} - type xref interface { XrefJavaFiles() android.Paths } -func (j *Module) CompiledSrcs() android.Paths { - return j.compiledJavaSrcs -} - -func (j *Module) CompiledSrcJars() android.Paths { - return j.compiledSrcJars -} - func (j *Module) XrefJavaFiles() android.Paths { return j.kytheFiles } -var _ SrcDependency = (*Module)(nil) - func InitJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) { android.InitAndroidArchModule(module, hod, android.MultilibCommon) android.InitDefaultableModule(module) @@ -550,9 +535,6 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { } else if *j.deviceProperties.System_modules != "none" { ctx.AddVariationDependencies(nil, systemModulesTag, *j.deviceProperties.System_modules) } - if (ctx.ModuleName() == "framework") || (ctx.ModuleName() == "framework-annotation-proc") { - ctx.AddVariationDependencies(nil, frameworkResTag, "framework-res") - } if ctx.ModuleName() == "android_stubs_current" || ctx.ModuleName() == "android_system_stubs_current" || ctx.ModuleName() == "android_test_stubs_current" { @@ -833,12 +815,6 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { } else { ctx.PropertyErrorf("plugins", "%q is not a java_plugin module", otherName) } - case frameworkResTag: - if (ctx.ModuleName() == "framework") || (ctx.ModuleName() == "framework-annotation-proc") { - // framework.jar has a one-off dependency on the R.java and Manifest.java files - // generated by framework-res.apk - deps.srcJars = append(deps.srcJars, dep.(*AndroidApp).aaptSrcJar) - } case frameworkApkTag: if ctx.ModuleName() == "android_stubs_current" || ctx.ModuleName() == "android_system_stubs_current" || @@ -1061,8 +1037,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { srcJars = append(srcJars, aaptSrcJar) } - // Collect source files from compiledJavaSrcs, compiledSrcJars and filter out Exclude_srcs - // that IDEInfo struct will use + // Collect source files and filter out Exclude_srcs that IDEInfo struct will use j.expandIDEInfoCompiledSrcs = append(j.expandIDEInfoCompiledSrcs, srcFiles.Strings()...) if j.properties.Jarjar_rules != nil { diff --git a/java/sdk_library.go b/java/sdk_library.go index 56b30b2cf..30fd1c4e2 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -100,12 +100,6 @@ type sdkLibraryProperties struct { // $(location