Loading java/hiddenapi.go +9 −3 Original line number Original line Diff line number Diff line Loading @@ -59,10 +59,9 @@ type hiddenAPIIntf interface { var _ hiddenAPIIntf = (*hiddenAPI)(nil) var _ hiddenAPIIntf = (*hiddenAPI)(nil) func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOutPath, func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, name string, primary bool, dexJar android.ModuleOutPath, implementationJar android.Path, uncompressDex bool) android.ModuleOutPath { implementationJar android.Path, uncompressDex bool) android.ModuleOutPath { if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { name := ctx.ModuleName() // Modules whose names are of the format <x>-hiddenapi provide hiddenapi information // Modules whose names are of the format <x>-hiddenapi provide hiddenapi information // for the boot jar module <x>. Otherwise, the module provides information for itself. // for the boot jar module <x>. Otherwise, the module provides information for itself. Loading Loading @@ -90,7 +89,14 @@ func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOu // the gathered information in the generated dex file. // the gathered information in the generated dex file. if name == bootJarName { if name == bootJarName { hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", name+".jar") hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", name+".jar") // More than one library with the same classes can be encoded but only one can // be added to the global set of flags, otherwise it will result in duplicate // classes which is an error. Therefore, only add the dex jar of one of them // to the global set of flags. if primary { h.bootDexJarPath = dexJar h.bootDexJarPath = dexJar } hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex) hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex) dexJar = hiddenAPIJar dexJar = hiddenAPIJar } } Loading java/java.go +14 −1 Original line number Original line Diff line number Diff line Loading @@ -342,6 +342,12 @@ type CompilerDeviceProperties struct { // otherwise provides defaults libraries to add to the bootclasspath. // otherwise provides defaults libraries to add to the bootclasspath. System_modules *string 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 // set the name of the output Stem *string Stem *string Loading Loading @@ -1631,8 +1637,11 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { return return } } configurationName := j.ConfigurationName() primary := configurationName == ctx.ModuleName() // Hidden API CSV generation and dex encoding // Hidden API CSV generation and dex encoding dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile, dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, configurationName, primary, dexOutputFile, j.implementationJarFile, proptools.Bool(j.deviceProperties.Uncompress_dex)) proptools.Bool(j.deviceProperties.Uncompress_dex)) // merge dex jar with resources if necessary // merge dex jar with resources if necessary Loading Loading @@ -1909,6 +1918,10 @@ func (j *Module) Stem() string { return proptools.StringDefault(j.deviceProperties.Stem, j.Name()) return proptools.StringDefault(j.deviceProperties.Stem, j.Name()) } } func (j *Module) ConfigurationName() string { return proptools.StringDefault(j.deviceProperties.ConfigurationName, j.BaseModuleName()) } func (j *Module) JacocoReportClassesFile() android.Path { func (j *Module) JacocoReportClassesFile() android.Path { return j.jacocoReportClassesFile return j.jacocoReportClassesFile } } Loading java/sdk_library.go +10 −3 Original line number Original line Diff line number Diff line Loading @@ -1087,15 +1087,22 @@ func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope *apiScope) stri // Creates the implementation java library // Creates the implementation java library func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) { func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) { moduleNamePtr := proptools.StringPtr(module.BaseModuleName()) props := struct { props := struct { Name *string Name *string Visibility []string Visibility []string Instrument bool Instrument bool ConfigurationName *string }{ }{ Name: proptools.StringPtr(module.implLibraryModuleName()), Name: proptools.StringPtr(module.implLibraryModuleName()), Visibility: module.sdkLibraryProperties.Impl_library_visibility, Visibility: module.sdkLibraryProperties.Impl_library_visibility, // Set the instrument property to ensure it is instrumented when instrumentation is required. // Set the instrument property to ensure it is instrumented when instrumentation is required. Instrument: true, Instrument: true, // Make the created library behave as if it had the same name as this module. ConfigurationName: moduleNamePtr, } } properties := []interface{}{ properties := []interface{}{ Loading Loading
java/hiddenapi.go +9 −3 Original line number Original line Diff line number Diff line Loading @@ -59,10 +59,9 @@ type hiddenAPIIntf interface { var _ hiddenAPIIntf = (*hiddenAPI)(nil) var _ hiddenAPIIntf = (*hiddenAPI)(nil) func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOutPath, func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, name string, primary bool, dexJar android.ModuleOutPath, implementationJar android.Path, uncompressDex bool) android.ModuleOutPath { implementationJar android.Path, uncompressDex bool) android.ModuleOutPath { if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { if !ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") { name := ctx.ModuleName() // Modules whose names are of the format <x>-hiddenapi provide hiddenapi information // Modules whose names are of the format <x>-hiddenapi provide hiddenapi information // for the boot jar module <x>. Otherwise, the module provides information for itself. // for the boot jar module <x>. Otherwise, the module provides information for itself. Loading Loading @@ -90,7 +89,14 @@ func (h *hiddenAPI) hiddenAPI(ctx android.ModuleContext, dexJar android.ModuleOu // the gathered information in the generated dex file. // the gathered information in the generated dex file. if name == bootJarName { if name == bootJarName { hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", name+".jar") hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", name+".jar") // More than one library with the same classes can be encoded but only one can // be added to the global set of flags, otherwise it will result in duplicate // classes which is an error. Therefore, only add the dex jar of one of them // to the global set of flags. if primary { h.bootDexJarPath = dexJar h.bootDexJarPath = dexJar } hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex) hiddenAPIEncodeDex(ctx, hiddenAPIJar, dexJar, uncompressDex) dexJar = hiddenAPIJar dexJar = hiddenAPIJar } } Loading
java/java.go +14 −1 Original line number Original line Diff line number Diff line Loading @@ -342,6 +342,12 @@ type CompilerDeviceProperties struct { // otherwise provides defaults libraries to add to the bootclasspath. // otherwise provides defaults libraries to add to the bootclasspath. System_modules *string 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 // set the name of the output Stem *string Stem *string Loading Loading @@ -1631,8 +1637,11 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) { return return } } configurationName := j.ConfigurationName() primary := configurationName == ctx.ModuleName() // Hidden API CSV generation and dex encoding // Hidden API CSV generation and dex encoding dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, dexOutputFile, j.implementationJarFile, dexOutputFile = j.hiddenAPI.hiddenAPI(ctx, configurationName, primary, dexOutputFile, j.implementationJarFile, proptools.Bool(j.deviceProperties.Uncompress_dex)) proptools.Bool(j.deviceProperties.Uncompress_dex)) // merge dex jar with resources if necessary // merge dex jar with resources if necessary Loading Loading @@ -1909,6 +1918,10 @@ func (j *Module) Stem() string { return proptools.StringDefault(j.deviceProperties.Stem, j.Name()) return proptools.StringDefault(j.deviceProperties.Stem, j.Name()) } } func (j *Module) ConfigurationName() string { return proptools.StringDefault(j.deviceProperties.ConfigurationName, j.BaseModuleName()) } func (j *Module) JacocoReportClassesFile() android.Path { func (j *Module) JacocoReportClassesFile() android.Path { return j.jacocoReportClassesFile return j.jacocoReportClassesFile } } Loading
java/sdk_library.go +10 −3 Original line number Original line Diff line number Diff line Loading @@ -1087,15 +1087,22 @@ func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope *apiScope) stri // Creates the implementation java library // Creates the implementation java library func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) { func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) { moduleNamePtr := proptools.StringPtr(module.BaseModuleName()) props := struct { props := struct { Name *string Name *string Visibility []string Visibility []string Instrument bool Instrument bool ConfigurationName *string }{ }{ Name: proptools.StringPtr(module.implLibraryModuleName()), Name: proptools.StringPtr(module.implLibraryModuleName()), Visibility: module.sdkLibraryProperties.Impl_library_visibility, Visibility: module.sdkLibraryProperties.Impl_library_visibility, // Set the instrument property to ensure it is instrumented when instrumentation is required. // Set the instrument property to ensure it is instrumented when instrumentation is required. Instrument: true, Instrument: true, // Make the created library behave as if it had the same name as this module. ConfigurationName: moduleNamePtr, } } properties := []interface{}{ properties := []interface{}{ Loading