diff --git a/java/base.go b/java/base.go index 03652be05..5a4898b46 100644 --- a/java/base.go +++ b/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 .impl libraries created by -// java_sdk_library in which case this is the BaseModuleName() without the ".impl" suffix, -// i.e. just . -func (j *Module) ConfigurationName() string { - return proptools.StringDefault(j.deviceProperties.ConfigurationName, j.BaseModuleName()) -} - func (j *Module) JacocoReportClassesFile() android.Path { return j.jacocoReportClassesFile } diff --git a/java/hiddenapi.go b/java/hiddenapi.go index 829c47383..fe7bd65dc 100644 --- a/java/hiddenapi.go +++ b/java/hiddenapi.go @@ -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 - // the same as its parent java_sdk_library but a module name of .impl. It is not the - // primary module, the java_sdk_library with the name of 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) diff --git a/java/java.go b/java/java.go index f85de3d77..515d20429 100644 --- a/java/java.go +++ b/java/java.go @@ -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 .impl java_ library created by java_sdk_library just as it - // would the library if 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 diff --git a/java/sdk_library.go b/java/sdk_library.go index f04f837cc..1d14d8686 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -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