Merge "Delete check for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9."
diff --git a/android/module.go b/android/module.go
index 6b659d2..8be00b2 100644
--- a/android/module.go
+++ b/android/module.go
@@ -2578,6 +2578,15 @@
return nil, fmt.Errorf("failed to get output files from module %q", pathContextName(ctx, module))
}
return paths, nil
+ } else if sourceFileProducer, ok := module.(SourceFileProducer); ok {
+ if tag != "" {
+ return nil, fmt.Errorf("module %q is a SourceFileProducer, not an OutputFileProducer, and so does not support tag %q", pathContextName(ctx, module), tag)
+ }
+ paths := sourceFileProducer.Srcs()
+ if len(paths) == 0 {
+ return nil, fmt.Errorf("failed to get output files from module %q", pathContextName(ctx, module))
+ }
+ return paths, nil
} else {
return nil, fmt.Errorf("module %q is not an OutputFileProducer", pathContextName(ctx, module))
}
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index a6d1fcf..850c8f9 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -56,16 +56,19 @@
// Source file of this prebuilt. Can reference a genrule type module with the ":module" syntax.
Src *string `android:"path,arch_variant"`
- // optional subdirectory under which this file is installed into, cannot be specified with relative_install_path, prefer relative_install_path
+ // Optional subdirectory under which this file is installed into, cannot be specified with
+ // relative_install_path, prefer relative_install_path.
Sub_dir *string `android:"arch_variant"`
- // optional subdirectory under which this file is installed into, cannot be specified with sub_dir
+ // Optional subdirectory under which this file is installed into, cannot be specified with
+ // sub_dir.
Relative_install_path *string `android:"arch_variant"`
- // optional name for the installed file. If unspecified, name of the module is used as the file name
+ // Optional name for the installed file. If unspecified, name of the module is used as the file
+ // name.
Filename *string `android:"arch_variant"`
- // when set to true, and filename property is not set, the name for the installed file
+ // When set to true, and filename property is not set, the name for the installed file
// is the same as the file name of the source file.
Filename_from_src *bool `android:"arch_variant"`
@@ -95,8 +98,15 @@
type PrebuiltEtcModule interface {
android.Module
+
+ // Returns the base install directory, such as "etc", "usr/share".
BaseDir() string
+
+ // Returns the sub install directory relative to BaseDir().
SubDir() string
+
+ // Returns an android.OutputPath to the intermeidate file, which is the renamed prebuilt source
+ // file.
OutputFile() android.OutputPath
}
@@ -109,7 +119,8 @@
outputFilePath android.OutputPath
// The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
installDirBase string
- // The base install location when soc_specific property is set to true, e.g. "firmware" for prebuilt_firmware.
+ // The base install location when soc_specific property is set to true, e.g. "firmware" for
+ // prebuilt_firmware.
socInstallDirBase string
installDirPath android.InstallPath
additionalDependencies *android.Paths
@@ -179,14 +190,8 @@
func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
}
-func (p *PrebuiltEtc) DepsMutator(ctx android.BottomUpMutatorContext) {
- if p.properties.Src == nil {
- ctx.PropertyErrorf("src", "missing prebuilt source file")
- }
-}
-
func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
- return android.PathForModuleSrc(ctx, android.String(p.properties.Src))
+ return android.PathForModuleSrc(ctx, proptools.String(p.properties.Src))
}
func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
@@ -215,36 +220,41 @@
}
func (p *PrebuiltEtc) Installable() bool {
- return p.properties.Installable == nil || android.Bool(p.properties.Installable)
+ return p.properties.Installable == nil || proptools.Bool(p.properties.Installable)
}
func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- p.sourceFilePath = android.PathForModuleSrc(ctx, android.String(p.properties.Src))
+ if p.properties.Src == nil {
+ ctx.PropertyErrorf("src", "missing prebuilt source file")
+ return
+ }
+ p.sourceFilePath = android.PathForModuleSrc(ctx, proptools.String(p.properties.Src))
// Determine the output file basename.
// If Filename is set, use the name specified by the property.
// If Filename_from_src is set, use the source file name.
// Otherwise use the module name.
- filename := android.String(p.properties.Filename)
- filename_from_src := android.Bool(p.properties.Filename_from_src)
- if filename == "" {
- if filename_from_src {
- filename = p.sourceFilePath.Base()
- } else {
- filename = ctx.ModuleName()
+ filename := proptools.String(p.properties.Filename)
+ filenameFromSrc := proptools.Bool(p.properties.Filename_from_src)
+ if filename != "" {
+ if filenameFromSrc {
+ ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
+ return
}
- } else if filename_from_src {
- ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
- return
+ } else if filenameFromSrc {
+ filename = p.sourceFilePath.Base()
+ } else {
+ filename = ctx.ModuleName()
}
p.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
+ // Check that `sub_dir` and `relative_install_path` are not set at the same time.
if p.properties.Sub_dir != nil && p.properties.Relative_install_path != nil {
ctx.PropertyErrorf("sub_dir", "relative_install_path is set. Cannot set sub_dir")
}
- // If soc install dir was specified and SOC specific is set, set the installDirPath to the specified
- // socInstallDirBase.
+ // If soc install dir was specified and SOC specific is set, set the installDirPath to the
+ // specified socInstallDirBase.
installBaseDir := p.installDirBase
if p.SocSpecific() && p.socInstallDirBase != "" {
installBaseDir = p.socInstallDirBase
@@ -353,9 +363,10 @@
return module
}
-// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system image.
-// If soc_specific property is set to true, the firmware file is installed to the vendor <partition>/firmware
-// directory for vendor image.
+// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system
+// image.
+// If soc_specific property is set to true, the firmware file is installed to the
+// vendor <partition>/firmware directory for vendor image.
func PrebuiltFirmwareFactory() android.Module {
module := &PrebuiltEtc{}
module.socInstallDirBase = "firmware"
@@ -366,8 +377,8 @@
}
// prebuilt_dsp installs a DSP related file to <partition>/etc/dsp directory for system image.
-// If soc_specific property is set to true, the DSP related file is installed to the vendor <partition>/dsp
-// directory for vendor image.
+// If soc_specific property is set to true, the DSP related file is installed to the
+// vendor <partition>/dsp directory for vendor image.
func PrebuiltDSPFactory() android.Module {
module := &PrebuiltEtc{}
module.socInstallDirBase = "dsp"
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 1f80e77..e57f323 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -255,7 +255,7 @@
FlagWithInput("--max-target-p ",
android.PathForSource(ctx, "frameworks/base/config/hiddenapi-max-target-p.txt")).
FlagWithInput("--max-target-o ", android.PathForSource(
- ctx, "frameworks/base/config/hiddenapi-max-target-o.txt")).Flag("--ignore-conflicts ").
+ ctx, "frameworks/base/config/hiddenapi-max-target-o.txt")).Flag("--ignore-conflicts ").FlagWithArg("--tag ", "lo-prio").
FlagWithInput("--blocked ",
android.PathForSource(ctx, "frameworks/base/config/hiddenapi-force-blocked.txt")).
FlagWithInput("--blocked ",
diff --git a/java/sdk_library.go b/java/sdk_library.go
index ebf867d..603c808 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -438,6 +438,21 @@
// 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) 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 @@
// 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 @@
// 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"))
}
diff --git a/python/python.go b/python/python.go
index e4c8e94..d7b1bba 100644
--- a/python/python.go
+++ b/python/python.go
@@ -34,7 +34,7 @@
}
func RegisterPythonPreDepsMutators(ctx android.RegisterMutatorsContext) {
- ctx.BottomUp("version_split", versionSplitMutator()).Parallel()
+ ctx.BottomUp("python_version", versionSplitMutator()).Parallel()
}
// the version properties that apply to python libraries and binaries.
@@ -86,6 +86,9 @@
// the test. the file extension can be arbitrary except for (.py).
Data []string `android:"path,arch_variant"`
+ // list of java modules that provide data that should be installed alongside the test.
+ Java_data []string
+
// list of the Python libraries compatible both with Python2 and Python3.
Libs []string `android:"arch_variant"`
@@ -216,6 +219,7 @@
var (
pythonLibTag = dependencyTag{name: "pythonLib"}
+ javaDataTag = dependencyTag{name: "javaData"}
launcherTag = dependencyTag{name: "launcher"}
launcherSharedLibTag = dependencyTag{name: "launcherSharedLib"}
pyIdentifierRegexp = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_-]*$`)
@@ -248,7 +252,7 @@
versionNames = append(versionNames, pyVersion2)
versionProps = append(versionProps, base.properties.Version.Py2)
}
- modules := mctx.CreateVariations(versionNames...)
+ modules := mctx.CreateLocalVariations(versionNames...)
if len(versionNames) > 0 {
mctx.AliasVariation(versionNames[0])
}
@@ -306,16 +310,20 @@
func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
android.ProtoDeps(ctx, &p.protoProperties)
- if p.hasSrcExt(ctx, protoExt) && p.Name() != "libprotobuf-python" {
- ctx.AddVariationDependencies(nil, pythonLibTag, "libprotobuf-python")
+ versionVariation := []blueprint.Variation{
+ {"python_version", p.properties.Actual_version},
}
- ctx.AddVariationDependencies(nil, pythonLibTag, android.LastUniqueStrings(p.properties.Libs)...)
+
+ if p.hasSrcExt(ctx, protoExt) && p.Name() != "libprotobuf-python" {
+ ctx.AddVariationDependencies(versionVariation, pythonLibTag, "libprotobuf-python")
+ }
+ ctx.AddVariationDependencies(versionVariation, pythonLibTag, android.LastUniqueStrings(p.properties.Libs)...)
switch p.properties.Actual_version {
case pyVersion2:
if p.bootstrapper != nil && p.isEmbeddedLauncherEnabled() {
- ctx.AddVariationDependencies(nil, pythonLibTag, "py2-stdlib")
+ ctx.AddVariationDependencies(versionVariation, pythonLibTag, "py2-stdlib")
launcherModule := "py2-launcher"
if p.bootstrapper.autorun() {
@@ -338,7 +346,7 @@
case pyVersion3:
if p.bootstrapper != nil && p.isEmbeddedLauncherEnabled() {
- ctx.AddVariationDependencies(nil, pythonLibTag, "py3-stdlib")
+ ctx.AddVariationDependencies(versionVariation, pythonLibTag, "py3-stdlib")
launcherModule := "py3-launcher"
if p.bootstrapper.autorun() {
@@ -366,6 +374,11 @@
panic(fmt.Errorf("unknown Python Actual_version: %q for module: %q.",
p.properties.Actual_version, ctx.ModuleName()))
}
+
+ // Emulate the data property for java_data but with the arch variation overridden to "common"
+ // so that it can point to java modules.
+ javaDataVariation := []blueprint.Variation{{"arch", android.Common.String()}}
+ ctx.AddVariationDependencies(javaDataVariation, javaDataTag, p.properties.Java_data...)
}
func (p *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -412,6 +425,11 @@
// expand data files from "data" property.
expandedData := android.PathsForModuleSrc(ctx, p.properties.Data)
+ // Emulate the data property for java_data dependencies.
+ for _, javaData := range ctx.GetDirectDepsWithTag(javaDataTag) {
+ expandedData = append(expandedData, android.OutputFilesForModule(ctx, javaData, "")...)
+ }
+
// sanitize pkg_path.
pkgPath := String(p.properties.Pkg_path)
if pkgPath != "" {
diff --git a/python/test.go b/python/test.go
index f9baa46..4df71c1 100644
--- a/python/test.go
+++ b/python/test.go
@@ -45,6 +45,9 @@
// the test
Data []string `android:"path,arch_variant"`
+ // list of java modules that provide data that should be installed alongside the test.
+ Java_data []string
+
// Test options.
Test_options TestOptions
}
@@ -80,6 +83,13 @@
for _, dataSrcPath := range dataSrcPaths {
test.data = append(test.data, android.DataPath{SrcPath: dataSrcPath})
}
+
+ // Emulate the data property for java_data dependencies.
+ for _, javaData := range ctx.GetDirectDepsWithTag(javaDataTag) {
+ for _, javaDataSrcPath := range android.OutputFilesForModule(ctx, javaData, "") {
+ test.data = append(test.data, android.DataPath{SrcPath: javaDataSrcPath})
+ }
+ }
}
func NewTest(hod android.HostOrDeviceSupported) *Module {