java_sdk_library: Allow no_dist to be explicitly set in .bp file

Currently, the no_dist property cannot be set in a .bp file and
defaults to true if the sdk_version property is set to none. That
behavior was added to prevent the output files from the libcore,
conscrypt and icu java_sdk_library modules from being copied to the
dist. It worked because they were the only java_sdk_library modules to
set "sdk_version: none".

Unfortunately, that default behavior is no longer required because
we want to be able to convert "conscrypt" module to a java_sdk_library
and have its public API output files be copied to the dist
automatically. This change allows the no_dist property to be explicitly
set in the .bp file so that those modules that rely on the implicit
behavior can explicitly specify it and allow the default behavior to
be removed.

This change:
* Removes the `blueprint:"mutated"` tag from the No_dist property which
  allows it to be specified in a .bp file.
* Only sets the default if the property has not been explicitly
  specified in a .bp file.

Test: lunch sdk-eng && m dist sdk
      compare out/dist/apistubs directories before and after this
      change to make sure that they have not changed.
Bug: 173715943
Change-Id: I8a1c97b690ae05bfe71ea72acc0831fa51aca7e9
This commit is contained in:
Paul Duffin 2020-11-19 14:53:43 +00:00
parent e3ecd6c7a8
commit 4f5c1ef229
1 changed files with 9 additions and 5 deletions

View File

@ -435,8 +435,8 @@ type sdkLibraryProperties struct {
// If set to true, the path of dist files is apistubs/core. Defaults to false.
Core_lib *bool
// don't create dist rules.
No_dist *bool `blueprint:"mutated"`
// If set to true then don't create dist rules.
No_dist *bool
// indicates whether system and test apis should be generated.
Generate_system_and_test_apis bool `blueprint:"mutated"`
@ -1509,12 +1509,16 @@ func (module *SdkLibrary) CreateInternalModules(mctx android.DefaultableHookCont
}
// If this builds against standard libraries (i.e. is not part of the core libraries)
// then assume it provides both system and test apis. Otherwise, assume it does not and
// also assume it does not contribute to the dist build.
// then assume it provides both system and test apis.
sdkDep := decodeSdkDep(mctx, sdkContext(&module.Library))
hasSystemAndTestApis := sdkDep.hasStandardLibs()
module.sdkLibraryProperties.Generate_system_and_test_apis = hasSystemAndTestApis
module.sdkLibraryProperties.No_dist = proptools.BoolPtr(!hasSystemAndTestApis)
// Unless explicitly specified assume that any module that does not provide system
// and test APIs should not contribute to the dist build.
if module.sdkLibraryProperties.No_dist == nil {
module.sdkLibraryProperties.No_dist = proptools.BoolPtr(!hasSystemAndTestApis)
}
missing_current_api := false