java_sdk_library: Allow dist artifacts to be named
Unless no_dist: true is specified the java_sdk_library will automatically copy the stubs jar and the API specification file (but not the removed API specification file) for each scope to the apistubs/ directory in the dist from which the sub-directories in prebuilts/sdk are populated. Previously, the name of those artifacts was based on the name of the module. This change adds the dist_stem property to allow the name of those artifacts to be specified separately to the module. The purpose of this is to allow the art.module.public.api, conscrypt.module.public.api and i18n.module.public.api java_sdk_library modules to use a different name when copying to the dist, e.g. conscrypt.module.public.api should use conscrypt. Additionally, as the artifacts in the dist end up being copied verbatim to prebuilts/sdk and the prebuilt_apis module uses those names to create a filegroup referencing the latest released version of the API and removed API specification files the dist_stem property is also used in constructing the name of those filegroups. Bug: 173715943 Test: lunch sdk-eng && m dist sdk Compare the results of the above before and after the change to ensure that this change does not affect the contents of the dist. See the topic's other change in external/conscrypt for testing the behavior of this new property. Change-Id: Ie81345021991ff91ca55fec15b02627135293308
This commit is contained in:
parent
b893f8766c
commit
3131025d61
|
@ -438,6 +438,21 @@ type sdkLibraryProperties struct {
|
|||
// If set to true then don't create dist rules.
|
||||
No_dist *bool
|
||||
|
||||
// The stem for the artifacts that are copied to the dist, if not specified
|
||||
// then defaults to the base module name.
|
||||
//
|
||||
// For each scope the following artifacts are copied to the apistubs/<scope>
|
||||
// directory in the dist.
|
||||
// * stubs impl jar -> <dist-stem>.jar
|
||||
// * API specification file -> api/<dist-stem>.txt
|
||||
// * Removed API specification file -> api/<dist-stem>-removed.txt
|
||||
//
|
||||
// Also used to construct the name of the filegroup (created by prebuilt_apis)
|
||||
// that references the latest released API and remove API specification files.
|
||||
// * API specification filegroup -> <dist-stem>.api.<scope>.latest
|
||||
// * Removed API specification filegroup -> <dist-stem>-removed.api.<scope>.latest
|
||||
Dist_stem *string
|
||||
|
||||
// indicates whether system and test apis should be generated.
|
||||
Generate_system_and_test_apis bool `blueprint:"mutated"`
|
||||
|
||||
|
@ -1117,12 +1132,16 @@ func (module *SdkLibrary) sdkVersionForStubsLibrary(mctx android.EarlyModuleCont
|
|||
}
|
||||
}
|
||||
|
||||
func (module *SdkLibrary) distStem() string {
|
||||
return proptools.StringDefault(module.sdkLibraryProperties.Dist_stem, module.BaseModuleName())
|
||||
}
|
||||
|
||||
func (module *SdkLibrary) latestApiFilegroupName(apiScope *apiScope) string {
|
||||
return ":" + module.BaseModuleName() + ".api." + apiScope.name + ".latest"
|
||||
return ":" + module.distStem() + ".api." + apiScope.name + ".latest"
|
||||
}
|
||||
|
||||
func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope *apiScope) string {
|
||||
return ":" + module.BaseModuleName() + "-removed.api." + apiScope.name + ".latest"
|
||||
return ":" + module.distStem() + "-removed.api." + apiScope.name + ".latest"
|
||||
}
|
||||
|
||||
func childModuleVisibility(childVisibility []string) []string {
|
||||
|
@ -1228,7 +1247,7 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.DefaultableHookContext
|
|||
// Dist the class jar artifact for sdk builds.
|
||||
if !Bool(module.sdkLibraryProperties.No_dist) {
|
||||
props.Dist.Targets = []string{"sdk", "win_sdk"}
|
||||
props.Dist.Dest = proptools.StringPtr(fmt.Sprintf("%v.jar", module.BaseModuleName()))
|
||||
props.Dist.Dest = proptools.StringPtr(fmt.Sprintf("%v.jar", module.distStem()))
|
||||
props.Dist.Dir = proptools.StringPtr(module.apiDistPath(apiScope))
|
||||
props.Dist.Tag = proptools.StringPtr(".jar")
|
||||
}
|
||||
|
@ -1377,7 +1396,7 @@ func (module *SdkLibrary) createStubsSourcesAndApi(mctx android.DefaultableHookC
|
|||
// Dist the api txt artifact for sdk builds.
|
||||
if !Bool(module.sdkLibraryProperties.No_dist) {
|
||||
props.Dist.Targets = []string{"sdk", "win_sdk"}
|
||||
props.Dist.Dest = proptools.StringPtr(fmt.Sprintf("%v.txt", module.BaseModuleName()))
|
||||
props.Dist.Dest = proptools.StringPtr(fmt.Sprintf("%v.txt", module.distStem()))
|
||||
props.Dist.Dir = proptools.StringPtr(path.Join(module.apiDistPath(apiScope), "api"))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue