Remove configurationName from java library and hidden API am: 66cdbf07ef
am: c820dc29d6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1709408 Change-Id: Ic423f6a2e804a69b1cc4a2d3744dca9e3c1cf901
This commit is contained in:
15
java/base.go
15
java/base.go
@@ -229,12 +229,6 @@ type DeviceProperties struct {
|
||||
// otherwise provides defaults libraries to add to the bootclasspath.
|
||||
System_modules *string
|
||||
|
||||
// The name of the module as used in build configuration.
|
||||
//
|
||||
// Allows a library to separate its actual name from the name used in
|
||||
// build configuration, e.g.ctx.Config().BootJars().
|
||||
ConfigurationName *string `blueprint:"mutated"`
|
||||
|
||||
// set the name of the output
|
||||
Stem *string
|
||||
|
||||
@@ -1501,15 +1495,6 @@ func (j *Module) Stem() string {
|
||||
return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
|
||||
}
|
||||
|
||||
// ConfigurationName returns the name of the module as used in build configuration.
|
||||
//
|
||||
// This is usually the same as BaseModuleName() except for the <x>.impl libraries created by
|
||||
// java_sdk_library in which case this is the BaseModuleName() without the ".impl" suffix,
|
||||
// i.e. just <x>.
|
||||
func (j *Module) ConfigurationName() string {
|
||||
return proptools.StringDefault(j.deviceProperties.ConfigurationName, j.BaseModuleName())
|
||||
}
|
||||
|
||||
func (j *Module) JacocoReportClassesFile() android.Path {
|
||||
return j.jacocoReportClassesFile
|
||||
}
|
||||
|
@@ -26,11 +26,6 @@ var hiddenAPIGenerateCSVRule = pctx.AndroidStaticRule("hiddenAPIGenerateCSV", bl
|
||||
}, "outFlag", "stubAPIFlags")
|
||||
|
||||
type hiddenAPI struct {
|
||||
// The name of the module as it would be used in the boot jars configuration, e.g. without any
|
||||
// prebuilt_ prefix (if it is a prebuilt) and without any ".impl" suffix if it is a
|
||||
// java_sdk_library implementation library.
|
||||
configurationName string
|
||||
|
||||
// True if the module containing this structure contributes to the hiddenapi information or has
|
||||
// that information encoded within it.
|
||||
active bool
|
||||
@@ -84,14 +79,12 @@ type hiddenAPIIntf interface {
|
||||
var _ hiddenAPIIntf = (*hiddenAPI)(nil)
|
||||
|
||||
// Initialize the hiddenapi structure
|
||||
func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, configurationName string) {
|
||||
func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext) {
|
||||
// If hiddenapi processing is disabled treat this as inactive.
|
||||
if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
|
||||
return
|
||||
}
|
||||
|
||||
h.configurationName = configurationName
|
||||
|
||||
// If the frameworks/base directories does not exist and no prebuilt hidden API flag files have
|
||||
// been configured then it is not possible to do hidden API encoding.
|
||||
if !ctx.Config().FrameworksBaseDirExists(ctx) && ctx.Config().PrebuiltHiddenApiDir(ctx) == "" {
|
||||
@@ -119,12 +112,6 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, configurationNa
|
||||
primary = p.UsePrebuilt()
|
||||
}
|
||||
} else {
|
||||
// The only module that will pass a different configurationName to its module name to this
|
||||
// method is the implementation library of a java_sdk_library. It has a configuration name of
|
||||
// <x> the same as its parent java_sdk_library but a module name of <x>.impl. It is not the
|
||||
// primary module, the java_sdk_library with the name of <x> is.
|
||||
primary = configurationName == ctx.ModuleName()
|
||||
|
||||
// A source module that has been replaced by a prebuilt can never be the primary module.
|
||||
if module.IsReplacedByPrebuilt() {
|
||||
if ctx.HasProvider(android.ApexInfoProvider) {
|
||||
@@ -172,7 +159,7 @@ func (h *hiddenAPI) hiddenAPIEncodeDex(ctx android.ModuleContext, dexJar android
|
||||
return dexJar
|
||||
}
|
||||
|
||||
hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", h.configurationName+".jar").OutputPath
|
||||
hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", dexJar.Base()).OutputPath
|
||||
|
||||
// Create a copy of the dex jar which has been encoded with hiddenapi flags.
|
||||
hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex)
|
||||
|
@@ -481,10 +481,8 @@ func shouldUncompressDex(ctx android.ModuleContext, dexpreopter *dexpreopter) bo
|
||||
}
|
||||
|
||||
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
// Initialize the hiddenapi structure. Pass in the configuration name rather than the module name
|
||||
// so the hidden api will encode the <x>.impl java_ library created by java_sdk_library just as it
|
||||
// would the <x> library if <x> was configured as a boot jar.
|
||||
j.initHiddenAPI(ctx, j.ConfigurationName())
|
||||
// Initialize the hiddenapi structure.
|
||||
j.initHiddenAPI(ctx)
|
||||
|
||||
j.sdkVersion = j.SdkVersion(ctx)
|
||||
j.minSdkVersion = j.MinSdkVersion(ctx)
|
||||
@@ -1242,7 +1240,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
j.minSdkVersion = j.MinSdkVersion(ctx)
|
||||
|
||||
// Initialize the hiddenapi structure.
|
||||
j.initHiddenAPI(ctx, j.BaseModuleName())
|
||||
j.initHiddenAPI(ctx)
|
||||
|
||||
if !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform() {
|
||||
j.hideApexVariantFromMake = true
|
||||
|
@@ -1235,16 +1235,13 @@ func childModuleVisibility(childVisibility []string) []string {
|
||||
|
||||
// Creates the implementation java library
|
||||
func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) {
|
||||
moduleNamePtr := proptools.StringPtr(module.BaseModuleName())
|
||||
|
||||
visibility := childModuleVisibility(module.sdkLibraryProperties.Impl_library_visibility)
|
||||
|
||||
props := struct {
|
||||
Name *string
|
||||
Visibility []string
|
||||
Instrument bool
|
||||
Libs []string
|
||||
ConfigurationName *string
|
||||
Name *string
|
||||
Visibility []string
|
||||
Instrument bool
|
||||
Libs []string
|
||||
}{
|
||||
Name: proptools.StringPtr(module.implLibraryModuleName()),
|
||||
Visibility: visibility,
|
||||
@@ -1253,9 +1250,6 @@ func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext)
|
||||
// Set the impl_only libs. Note that the module's "Libs" get appended as well, via the
|
||||
// addition of &module.properties below.
|
||||
Libs: module.sdkLibraryProperties.Impl_only_libs,
|
||||
|
||||
// Make the created library behave as if it had the same name as this module.
|
||||
ConfigurationName: moduleNamePtr,
|
||||
}
|
||||
|
||||
properties := []interface{}{
|
||||
@@ -2127,7 +2121,7 @@ func (module *SdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleCo
|
||||
di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo)
|
||||
if dexOutputPath := di.PrebuiltExportPath(module.BaseModuleName(), ".dexjar"); dexOutputPath != nil {
|
||||
module.dexJarFile = dexOutputPath
|
||||
module.initHiddenAPI(ctx, module.configurationName)
|
||||
module.initHiddenAPI(ctx)
|
||||
module.hiddenAPIUpdatePaths(ctx, dexOutputPath, module.findScopePaths(apiScopePublic).stubsImplPath[0])
|
||||
} else {
|
||||
// This should never happen as a variant for a prebuilt_apex is only created if the
|
||||
|
Reference in New Issue
Block a user