Merge changes from topic "drop_circular_dep" into stage-aosp-master

* changes:
  Remove srcs_lib and srcs_lib_whitelist_pkgs
  Remove the automatic dependency to framework-res.apk for R/Manifest
  Prepare to be able to put framework-res in srcs
This commit is contained in:
Jiyong Park 2019-08-30 05:14:21 +00:00 committed by Android (Google) Code Review
commit 2867f766d4
5 changed files with 14 additions and 68 deletions

View File

@ -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")

View File

@ -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{}

View File

@ -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")

View File

@ -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 {

View File

@ -100,12 +100,6 @@ type sdkLibraryProperties struct {
// $(location <label>): the path to the droiddoc_option_files with name <label>
Droiddoc_options []string
// the java library (in classpath) for documentation that provides java srcs and srcjars.
Srcs_lib *string
// list of packages to document from srcs_lib. Defaults to "android.annotation".
Srcs_lib_whitelist_pkgs []string
// a list of top-level directories containing files to merge qualifier annotations
// (i.e. those intended to be included in the stubs written) from.
Merge_annotations_dirs []string
@ -438,8 +432,6 @@ func (module *SdkLibrary) createDocs(mctx android.LoadHookContext, apiScope apiS
Name *string
Srcs []string
Installable *bool
Srcs_lib *string
Srcs_lib_whitelist_pkgs []string
Sdk_version *string
Libs []string
Arg_files []string
@ -529,8 +521,6 @@ func (module *SdkLibrary) createDocs(mctx android.LoadHookContext, apiScope apiS
props.Check_api.Last_released.Removed_api_file = proptools.StringPtr(
module.latestRemovedApiFilegroupName(apiScope))
props.Check_api.Ignore_missing_latest_api = proptools.BoolPtr(true)
props.Srcs_lib = module.sdkLibraryProperties.Srcs_lib
props.Srcs_lib_whitelist_pkgs = module.sdkLibraryProperties.Srcs_lib_whitelist_pkgs
mctx.CreateModule(android.ModuleFactoryAdaptor(DroidstubsFactory), &props)
}