Loading java/aar.go +12 −4 Original line number Diff line number Diff line Loading @@ -188,8 +188,7 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, mani return linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resourceZips } func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkContext sdkContext) { sdkDep := decodeSdkDep(ctx, sdkContext) func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkDep sdkDep) { if sdkDep.frameworkResModule != "" { ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule) } Loading Loading @@ -401,8 +400,9 @@ var _ AndroidLibraryDependency = (*AndroidLibrary)(nil) func (a *AndroidLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { a.Module.deps(ctx) if !Bool(a.properties.No_framework_libs) && !Bool(a.properties.No_standard_libs) { a.aapt.deps(ctx, sdkContext(a)) sdkDep := decodeSdkDep(ctx, sdkContext(a)) if sdkDep.hasFrameworkLibs() { a.aapt.deps(ctx, sdkDep) } } Loading Loading @@ -513,6 +513,14 @@ func (a *AARImport) targetSdkVersion() string { return a.sdkVersion() } func (a *AARImport) noFrameworkLibs() bool { return false } func (a *AARImport) noStandardLibs() bool { return false } var _ AndroidLibraryDependency = (*AARImport)(nil) func (a *AARImport) ExportPackage() android.Path { Loading java/app.go +10 −6 Original line number Diff line number Diff line Loading @@ -159,8 +159,9 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) { ctx.PropertyErrorf("stl", "sdk_version must be set in order to use c++_shared") } if !Bool(a.properties.No_framework_libs) && !Bool(a.properties.No_standard_libs) { a.aapt.deps(ctx, sdkContext(a)) sdkDep := decodeSdkDep(ctx, sdkContext(a)) if sdkDep.hasFrameworkLibs() { a.aapt.deps(ctx, sdkDep) } embedJni := a.shouldEmbedJnis(ctx) Loading @@ -180,7 +181,7 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) { } } a.usesLibrary.deps(ctx, Bool(a.properties.No_framework_libs)) a.usesLibrary.deps(ctx, sdkDep.hasFrameworkLibs()) } func (a *AndroidApp) OverridablePropertiesDepsMutator(ctx android.BottomUpMutatorContext) { Loading Loading @@ -783,7 +784,7 @@ func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) { ctx.AddDependency(ctx.Module(), certificateTag, cert) } a.usesLibrary.deps(ctx, false) a.usesLibrary.deps(ctx, true) } func (a *AndroidAppImport) uncompressEmbeddedJniLibs( Loading Loading @@ -937,11 +938,14 @@ type usesLibrary struct { usesLibraryProperties UsesLibraryProperties } func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, noFrameworkLibs bool) { func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs bool) { if !ctx.Config().UnbundledBuild() { ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...) ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...) if !noFrameworkLibs { // Only add these extra dependencies if the module depends on framework libs. This avoids // creating a cyclic dependency: // e.g. framework-res -> org.apache.http.legacy -> ... -> framework-res. if hasFrameworkLibs { // dexpreopt/dexpreopt.go needs the paths to the dex jars of these libraries in case construct_context.sh needs // to pass them to dex2oat. Add them as a dependency so we can determine the path to the dex jar of each // library to dexpreopt. Loading java/droiddoc.go +11 −3 Original line number Diff line number Diff line Loading @@ -538,16 +538,24 @@ func (j *Javadoc) targetSdkVersion() string { return j.sdkVersion() } func (j *Javadoc) noFrameworkLibs() bool { return Bool(j.properties.No_framework_libs) } func (j *Javadoc) noStandardLibs() bool { return Bool(j.properties.No_standard_libs) } func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) { if ctx.Device() { if !Bool(j.properties.No_standard_libs) { sdkDep := decodeSdkDep(ctx, sdkContext(j)) if sdkDep.hasStandardLibs() { if sdkDep.useDefaultLibs { ctx.AddVariationDependencies(nil, bootClasspathTag, config.DefaultBootclasspathLibraries...) if ctx.Config().TargetOpenJDK9() { ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules) } if !Bool(j.properties.No_framework_libs) { if sdkDep.hasFrameworkLibs() { ctx.AddVariationDependencies(nil, libTag, config.DefaultLibraries...) } } else if sdkDep.useModule { Loading java/java.go +22 −4 Original line number Diff line number Diff line Loading @@ -440,6 +440,16 @@ type sdkDep struct { jars android.Paths aidl android.OptionalPath noStandardLibs, noFrameworksLibs bool } func (s sdkDep) hasStandardLibs() bool { return !s.noStandardLibs } func (s sdkDep) hasFrameworkLibs() bool { return !s.noStandardLibs && !s.noFrameworksLibs } type jniLib struct { Loading Loading @@ -476,14 +486,22 @@ func (j *Module) targetSdkVersion() string { return j.sdkVersion() } func (j *Module) noFrameworkLibs() bool { return Bool(j.properties.No_framework_libs) } func (j *Module) noStandardLibs() bool { return Bool(j.properties.No_standard_libs) } func (j *Module) deps(ctx android.BottomUpMutatorContext) { if ctx.Device() { if !Bool(j.properties.No_standard_libs) { sdkDep := decodeSdkDep(ctx, sdkContext(j)) if sdkDep.hasStandardLibs() { if sdkDep.useDefaultLibs { ctx.AddVariationDependencies(nil, bootClasspathTag, config.DefaultBootclasspathLibraries...) ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules) if !Bool(j.properties.No_framework_libs) { if sdkDep.hasFrameworkLibs() { ctx.AddVariationDependencies(nil, libTag, config.DefaultLibraries...) } } else if sdkDep.useModule { Loading Loading @@ -913,7 +931,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB flags.processor = strings.Join(deps.processorClasses, ",") if len(flags.bootClasspath) == 0 && ctx.Host() && flags.javaVersion != "1.9" && !Bool(j.properties.No_standard_libs) && decodeSdkDep(ctx, sdkContext(j)).hasStandardLibs() && inList(flags.javaVersion, []string{"1.6", "1.7", "1.8"}) { // Give host-side tools a version of OpenJDK's standard libraries // close to what they're targeting. As of Dec 2017, AOSP is only Loading java/sdk.go +19 −1 Original line number Diff line number Diff line Loading @@ -38,12 +38,18 @@ var sdkFrameworkAidlPathKey = android.NewOnceKey("sdkFrameworkAidlPathKey") var apiFingerprintPathKey = android.NewOnceKey("apiFingerprintPathKey") type sdkContext interface { // sdkVersion eturns the sdk_version property of the current module, or an empty string if it is not set. // sdkVersion returns the sdk_version property of the current module, or an empty string if it is not set. sdkVersion() string // minSdkVersion returns the min_sdk_version property of the current module, or sdkVersion() if it is not set. minSdkVersion() string // targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set. targetSdkVersion() string // Temporarily provide access to the no_standard_libs property (where present). noStandardLibs() bool // Temporarily provide access to the no_frameworks_libs property (where present). noFrameworkLibs() bool } func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string { Loading Loading @@ -138,6 +144,10 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep { useFiles: true, jars: android.Paths{jarPath.Path(), lambdaStubsPath}, aidl: android.OptionalPathForPath(aidlPath.Path()), // Pass values straight through for now to match previous behavior. noStandardLibs: sdkContext.noStandardLibs(), noFrameworksLibs: sdkContext.noFrameworkLibs(), } } Loading @@ -148,6 +158,10 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep { systemModules: m + "_system_modules", frameworkResModule: r, aidl: android.OptionalPathForPath(aidl), // Pass values straight through for now to match previous behavior. noStandardLibs: sdkContext.noStandardLibs(), noFrameworksLibs: sdkContext.noFrameworkLibs(), } if m == "core.current.stubs" { Loading Loading @@ -182,6 +196,10 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep { return sdkDep{ useDefaultLibs: true, frameworkResModule: "framework-res", // Pass values straight through for now to match previous behavior. noStandardLibs: sdkContext.noStandardLibs(), noFrameworksLibs: sdkContext.noFrameworkLibs(), } case "current": return toModule("android_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx)) Loading Loading
java/aar.go +12 −4 Original line number Diff line number Diff line Loading @@ -188,8 +188,7 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext, mani return linkFlags, linkDeps, resDirs, overlayDirs, rroDirs, resourceZips } func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkContext sdkContext) { sdkDep := decodeSdkDep(ctx, sdkContext) func (a *aapt) deps(ctx android.BottomUpMutatorContext, sdkDep sdkDep) { if sdkDep.frameworkResModule != "" { ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule) } Loading Loading @@ -401,8 +400,9 @@ var _ AndroidLibraryDependency = (*AndroidLibrary)(nil) func (a *AndroidLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { a.Module.deps(ctx) if !Bool(a.properties.No_framework_libs) && !Bool(a.properties.No_standard_libs) { a.aapt.deps(ctx, sdkContext(a)) sdkDep := decodeSdkDep(ctx, sdkContext(a)) if sdkDep.hasFrameworkLibs() { a.aapt.deps(ctx, sdkDep) } } Loading Loading @@ -513,6 +513,14 @@ func (a *AARImport) targetSdkVersion() string { return a.sdkVersion() } func (a *AARImport) noFrameworkLibs() bool { return false } func (a *AARImport) noStandardLibs() bool { return false } var _ AndroidLibraryDependency = (*AARImport)(nil) func (a *AARImport) ExportPackage() android.Path { Loading
java/app.go +10 −6 Original line number Diff line number Diff line Loading @@ -159,8 +159,9 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) { ctx.PropertyErrorf("stl", "sdk_version must be set in order to use c++_shared") } if !Bool(a.properties.No_framework_libs) && !Bool(a.properties.No_standard_libs) { a.aapt.deps(ctx, sdkContext(a)) sdkDep := decodeSdkDep(ctx, sdkContext(a)) if sdkDep.hasFrameworkLibs() { a.aapt.deps(ctx, sdkDep) } embedJni := a.shouldEmbedJnis(ctx) Loading @@ -180,7 +181,7 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) { } } a.usesLibrary.deps(ctx, Bool(a.properties.No_framework_libs)) a.usesLibrary.deps(ctx, sdkDep.hasFrameworkLibs()) } func (a *AndroidApp) OverridablePropertiesDepsMutator(ctx android.BottomUpMutatorContext) { Loading Loading @@ -783,7 +784,7 @@ func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) { ctx.AddDependency(ctx.Module(), certificateTag, cert) } a.usesLibrary.deps(ctx, false) a.usesLibrary.deps(ctx, true) } func (a *AndroidAppImport) uncompressEmbeddedJniLibs( Loading Loading @@ -937,11 +938,14 @@ type usesLibrary struct { usesLibraryProperties UsesLibraryProperties } func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, noFrameworkLibs bool) { func (u *usesLibrary) deps(ctx android.BottomUpMutatorContext, hasFrameworkLibs bool) { if !ctx.Config().UnbundledBuild() { ctx.AddVariationDependencies(nil, usesLibTag, u.usesLibraryProperties.Uses_libs...) ctx.AddVariationDependencies(nil, usesLibTag, u.presentOptionalUsesLibs(ctx)...) if !noFrameworkLibs { // Only add these extra dependencies if the module depends on framework libs. This avoids // creating a cyclic dependency: // e.g. framework-res -> org.apache.http.legacy -> ... -> framework-res. if hasFrameworkLibs { // dexpreopt/dexpreopt.go needs the paths to the dex jars of these libraries in case construct_context.sh needs // to pass them to dex2oat. Add them as a dependency so we can determine the path to the dex jar of each // library to dexpreopt. Loading
java/droiddoc.go +11 −3 Original line number Diff line number Diff line Loading @@ -538,16 +538,24 @@ func (j *Javadoc) targetSdkVersion() string { return j.sdkVersion() } func (j *Javadoc) noFrameworkLibs() bool { return Bool(j.properties.No_framework_libs) } func (j *Javadoc) noStandardLibs() bool { return Bool(j.properties.No_standard_libs) } func (j *Javadoc) addDeps(ctx android.BottomUpMutatorContext) { if ctx.Device() { if !Bool(j.properties.No_standard_libs) { sdkDep := decodeSdkDep(ctx, sdkContext(j)) if sdkDep.hasStandardLibs() { if sdkDep.useDefaultLibs { ctx.AddVariationDependencies(nil, bootClasspathTag, config.DefaultBootclasspathLibraries...) if ctx.Config().TargetOpenJDK9() { ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules) } if !Bool(j.properties.No_framework_libs) { if sdkDep.hasFrameworkLibs() { ctx.AddVariationDependencies(nil, libTag, config.DefaultLibraries...) } } else if sdkDep.useModule { Loading
java/java.go +22 −4 Original line number Diff line number Diff line Loading @@ -440,6 +440,16 @@ type sdkDep struct { jars android.Paths aidl android.OptionalPath noStandardLibs, noFrameworksLibs bool } func (s sdkDep) hasStandardLibs() bool { return !s.noStandardLibs } func (s sdkDep) hasFrameworkLibs() bool { return !s.noStandardLibs && !s.noFrameworksLibs } type jniLib struct { Loading Loading @@ -476,14 +486,22 @@ func (j *Module) targetSdkVersion() string { return j.sdkVersion() } func (j *Module) noFrameworkLibs() bool { return Bool(j.properties.No_framework_libs) } func (j *Module) noStandardLibs() bool { return Bool(j.properties.No_standard_libs) } func (j *Module) deps(ctx android.BottomUpMutatorContext) { if ctx.Device() { if !Bool(j.properties.No_standard_libs) { sdkDep := decodeSdkDep(ctx, sdkContext(j)) if sdkDep.hasStandardLibs() { if sdkDep.useDefaultLibs { ctx.AddVariationDependencies(nil, bootClasspathTag, config.DefaultBootclasspathLibraries...) ctx.AddVariationDependencies(nil, systemModulesTag, config.DefaultSystemModules) if !Bool(j.properties.No_framework_libs) { if sdkDep.hasFrameworkLibs() { ctx.AddVariationDependencies(nil, libTag, config.DefaultLibraries...) } } else if sdkDep.useModule { Loading Loading @@ -913,7 +931,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB flags.processor = strings.Join(deps.processorClasses, ",") if len(flags.bootClasspath) == 0 && ctx.Host() && flags.javaVersion != "1.9" && !Bool(j.properties.No_standard_libs) && decodeSdkDep(ctx, sdkContext(j)).hasStandardLibs() && inList(flags.javaVersion, []string{"1.6", "1.7", "1.8"}) { // Give host-side tools a version of OpenJDK's standard libraries // close to what they're targeting. As of Dec 2017, AOSP is only Loading
java/sdk.go +19 −1 Original line number Diff line number Diff line Loading @@ -38,12 +38,18 @@ var sdkFrameworkAidlPathKey = android.NewOnceKey("sdkFrameworkAidlPathKey") var apiFingerprintPathKey = android.NewOnceKey("apiFingerprintPathKey") type sdkContext interface { // sdkVersion eturns the sdk_version property of the current module, or an empty string if it is not set. // sdkVersion returns the sdk_version property of the current module, or an empty string if it is not set. sdkVersion() string // minSdkVersion returns the min_sdk_version property of the current module, or sdkVersion() if it is not set. minSdkVersion() string // targetSdkVersion returns the target_sdk_version property of the current module, or sdkVersion() if it is not set. targetSdkVersion() string // Temporarily provide access to the no_standard_libs property (where present). noStandardLibs() bool // Temporarily provide access to the no_frameworks_libs property (where present). noFrameworkLibs() bool } func sdkVersionOrDefault(ctx android.BaseModuleContext, v string) string { Loading Loading @@ -138,6 +144,10 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep { useFiles: true, jars: android.Paths{jarPath.Path(), lambdaStubsPath}, aidl: android.OptionalPathForPath(aidlPath.Path()), // Pass values straight through for now to match previous behavior. noStandardLibs: sdkContext.noStandardLibs(), noFrameworksLibs: sdkContext.noFrameworkLibs(), } } Loading @@ -148,6 +158,10 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep { systemModules: m + "_system_modules", frameworkResModule: r, aidl: android.OptionalPathForPath(aidl), // Pass values straight through for now to match previous behavior. noStandardLibs: sdkContext.noStandardLibs(), noFrameworksLibs: sdkContext.noFrameworkLibs(), } if m == "core.current.stubs" { Loading Loading @@ -182,6 +196,10 @@ func decodeSdkDep(ctx android.BaseModuleContext, sdkContext sdkContext) sdkDep { return sdkDep{ useDefaultLibs: true, frameworkResModule: "framework-res", // Pass values straight through for now to match previous behavior. noStandardLibs: sdkContext.noStandardLibs(), noFrameworksLibs: sdkContext.noFrameworkLibs(), } case "current": return toModule("android_stubs_current", "framework-res", sdkFrameworkAidlPath(ctx)) Loading