Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529 Merged-In: I763b033f0f5f275091db45ab62df6af48dcddc66 Change-Id: I65077e51b4a073f2628fb0995e80ad64368def26
This commit is contained in:
@@ -67,6 +67,7 @@ bootstrap_go_package {
|
||||
"plugin.go",
|
||||
"prebuilt_apis.go",
|
||||
"proto.go",
|
||||
"ravenwood.go",
|
||||
"robolectric.go",
|
||||
"rro.go",
|
||||
"sdk.go",
|
||||
@@ -107,6 +108,7 @@ bootstrap_go_package {
|
||||
"plugin_test.go",
|
||||
"prebuilt_apis_test.go",
|
||||
"proto_test.go",
|
||||
"ravenwood_test.go",
|
||||
"rro_test.go",
|
||||
"sdk_library_test.go",
|
||||
"sdk_test.go",
|
||||
|
@@ -309,7 +309,8 @@ func aapt2ExtractExtraPackages(ctx android.ModuleContext, out android.WritablePa
|
||||
|
||||
var aapt2ConvertRule = pctx.AndroidStaticRule("aapt2Convert",
|
||||
blueprint.RuleParams{
|
||||
Command: `${config.Aapt2Cmd} convert --output-format $format $in -o $out`,
|
||||
Command: `${config.Aapt2Cmd} convert --enable-compact-entries ` +
|
||||
`--output-format $format $in -o $out`,
|
||||
CommandDeps: []string{"${config.Aapt2Cmd}"},
|
||||
}, "format",
|
||||
)
|
||||
|
@@ -203,6 +203,8 @@ func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext android.SdkConte
|
||||
// Flags specified in Android.bp
|
||||
linkFlags = append(linkFlags, a.aaptProperties.Aaptflags...)
|
||||
|
||||
linkFlags = append(linkFlags, "--enable-compact-entries")
|
||||
|
||||
// Find implicit or explicit asset and resource dirs
|
||||
assets := android.PathsRelativeToModuleSourceDir(android.SourceInput{
|
||||
Context: ctx,
|
||||
|
@@ -23,7 +23,6 @@ var (
|
||||
"--format=v2",
|
||||
"--repeat-errors-max 10",
|
||||
"--hide UnresolvedImport",
|
||||
"--hide InvalidNullabilityOverride",
|
||||
|
||||
// Force metalava to ignore classes on the classpath when an API file contains missing classes.
|
||||
// See b/285140653 for more information.
|
||||
@@ -49,9 +48,6 @@ var (
|
||||
// TODO(tnorbye): find owners to fix these warnings when annotation was enabled.
|
||||
"--hide HiddenTypedefConstant",
|
||||
"--hide SuperfluousPrefix",
|
||||
"--hide AnnotationExtraction",
|
||||
// b/222738070
|
||||
"--hide BannedThrow",
|
||||
}
|
||||
|
||||
MetalavaAnnotationsWarningsFlags = strings.Join(metalavaAnnotationsWarningsFlags, " ")
|
||||
|
191
java/ravenwood.go
Normal file
191
java/ravenwood.go
Normal file
@@ -0,0 +1,191 @@
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
package java
|
||||
|
||||
import (
|
||||
"android/soong/android"
|
||||
"android/soong/tradefed"
|
||||
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
func init() {
|
||||
RegisterRavenwoodBuildComponents(android.InitRegistrationContext)
|
||||
}
|
||||
|
||||
func RegisterRavenwoodBuildComponents(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("android_ravenwood_test", ravenwoodTestFactory)
|
||||
ctx.RegisterModuleType("android_ravenwood_libgroup", ravenwoodLibgroupFactory)
|
||||
}
|
||||
|
||||
var ravenwoodTag = dependencyTag{name: "ravenwood"}
|
||||
|
||||
const ravenwoodUtilsName = "ravenwood-utils"
|
||||
const ravenwoodRuntimeName = "ravenwood-runtime"
|
||||
|
||||
type ravenwoodTest struct {
|
||||
Library
|
||||
|
||||
testProperties testProperties
|
||||
testConfig android.Path
|
||||
|
||||
forceOSType android.OsType
|
||||
forceArchType android.ArchType
|
||||
}
|
||||
|
||||
func ravenwoodTestFactory() android.Module {
|
||||
module := &ravenwoodTest{}
|
||||
|
||||
module.addHostAndDeviceProperties()
|
||||
module.AddProperties(&module.testProperties)
|
||||
|
||||
module.Module.dexpreopter.isTest = true
|
||||
module.Module.linter.properties.Lint.Test = proptools.BoolPtr(true)
|
||||
|
||||
module.testProperties.Test_suites = []string{
|
||||
"general-tests",
|
||||
"ravenwood-tests",
|
||||
}
|
||||
module.testProperties.Test_options.Unit_test = proptools.BoolPtr(false)
|
||||
|
||||
InitJavaModule(module, android.DeviceSupported)
|
||||
android.InitDefaultableModule(module)
|
||||
|
||||
return module
|
||||
}
|
||||
|
||||
func (r *ravenwoodTest) InstallInTestcases() bool { return true }
|
||||
func (r *ravenwoodTest) InstallForceOS() (*android.OsType, *android.ArchType) {
|
||||
return &r.forceOSType, &r.forceArchType
|
||||
}
|
||||
func (r *ravenwoodTest) TestSuites() []string {
|
||||
return r.testProperties.Test_suites
|
||||
}
|
||||
|
||||
func (r *ravenwoodTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
r.Library.DepsMutator(ctx)
|
||||
|
||||
// Generically depend on the runtime so that it's installed together with us
|
||||
ctx.AddVariationDependencies(nil, ravenwoodTag, ravenwoodRuntimeName)
|
||||
|
||||
// Directly depend on any utils so that we link against them
|
||||
utils := ctx.AddVariationDependencies(nil, ravenwoodTag, ravenwoodUtilsName)[0]
|
||||
if utils != nil {
|
||||
for _, lib := range utils.(*ravenwoodLibgroup).ravenwoodLibgroupProperties.Libs {
|
||||
ctx.AddVariationDependencies(nil, libTag, lib)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
r.forceOSType = ctx.Config().BuildOS
|
||||
r.forceArchType = ctx.Config().BuildArch
|
||||
|
||||
r.testConfig = tradefed.AutoGenTestConfig(ctx, tradefed.AutoGenTestConfigOptions{
|
||||
TestConfigProp: r.testProperties.Test_config,
|
||||
TestConfigTemplateProp: r.testProperties.Test_config_template,
|
||||
TestSuites: r.testProperties.Test_suites,
|
||||
AutoGenConfig: r.testProperties.Auto_gen_config,
|
||||
DeviceTemplate: "${RavenwoodTestConfigTemplate}",
|
||||
HostTemplate: "${RavenwoodTestConfigTemplate}",
|
||||
})
|
||||
|
||||
r.Library.GenerateAndroidBuildActions(ctx)
|
||||
|
||||
// Start by depending on all files installed by dependancies
|
||||
var installDeps android.InstallPaths
|
||||
for _, dep := range ctx.GetDirectDepsWithTag(ravenwoodTag) {
|
||||
for _, installFile := range dep.FilesToInstall() {
|
||||
installDeps = append(installDeps, installFile)
|
||||
}
|
||||
}
|
||||
|
||||
// Also depend on our config
|
||||
installPath := android.PathForModuleInstall(ctx, r.BaseModuleName())
|
||||
installConfig := ctx.InstallFile(installPath, ctx.ModuleName()+".config", r.testConfig)
|
||||
installDeps = append(installDeps, installConfig)
|
||||
|
||||
// Finally install our JAR with all dependencies
|
||||
ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...)
|
||||
}
|
||||
|
||||
func (r *ravenwoodTest) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entriesList := r.Library.AndroidMkEntries()
|
||||
entries := &entriesList[0]
|
||||
entries.ExtraEntries = append(entries.ExtraEntries,
|
||||
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
||||
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
|
||||
entries.AddStrings("LOCAL_COMPATIBILITY_SUITE",
|
||||
"general-tests", "ravenwood-tests")
|
||||
if r.testConfig != nil {
|
||||
entries.SetPath("LOCAL_FULL_TEST_CONFIG", r.testConfig)
|
||||
}
|
||||
})
|
||||
return entriesList
|
||||
}
|
||||
|
||||
type ravenwoodLibgroupProperties struct {
|
||||
Libs []string
|
||||
}
|
||||
|
||||
type ravenwoodLibgroup struct {
|
||||
android.ModuleBase
|
||||
|
||||
ravenwoodLibgroupProperties ravenwoodLibgroupProperties
|
||||
|
||||
forceOSType android.OsType
|
||||
forceArchType android.ArchType
|
||||
}
|
||||
|
||||
func ravenwoodLibgroupFactory() android.Module {
|
||||
module := &ravenwoodLibgroup{}
|
||||
module.AddProperties(&module.ravenwoodLibgroupProperties)
|
||||
|
||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||
return module
|
||||
}
|
||||
|
||||
func (r *ravenwoodLibgroup) InstallInTestcases() bool { return true }
|
||||
func (r *ravenwoodLibgroup) InstallForceOS() (*android.OsType, *android.ArchType) {
|
||||
return &r.forceOSType, &r.forceArchType
|
||||
}
|
||||
func (r *ravenwoodLibgroup) TestSuites() []string {
|
||||
return []string{
|
||||
"general-tests",
|
||||
"ravenwood-tests",
|
||||
}
|
||||
}
|
||||
|
||||
func (r *ravenwoodLibgroup) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
// Always depends on our underlying libs
|
||||
for _, lib := range r.ravenwoodLibgroupProperties.Libs {
|
||||
ctx.AddVariationDependencies(nil, ravenwoodTag, lib)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
r.forceOSType = ctx.Config().BuildOS
|
||||
r.forceArchType = ctx.Config().BuildArch
|
||||
|
||||
// Install our runtime into expected location for packaging
|
||||
installPath := android.PathForModuleInstall(ctx, r.BaseModuleName())
|
||||
for _, lib := range r.ravenwoodLibgroupProperties.Libs {
|
||||
libModule := ctx.GetDirectDepWithTag(lib, ravenwoodTag)
|
||||
libJar := android.OutputFileForModule(ctx, libModule, "")
|
||||
ctx.InstallFile(installPath, lib+".jar", libJar)
|
||||
}
|
||||
|
||||
// Normal build should perform install steps
|
||||
ctx.Phony(r.BaseModuleName(), android.PathForPhony(ctx, r.BaseModuleName()+"-install"))
|
||||
}
|
122
java/ravenwood_test.go
Normal file
122
java/ravenwood_test.go
Normal file
@@ -0,0 +1,122 @@
|
||||
// Copyright 2022 Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package java
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"android/soong/android"
|
||||
)
|
||||
|
||||
var prepareRavenwoodRuntime = android.GroupFixturePreparers(
|
||||
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
|
||||
RegisterRavenwoodBuildComponents(ctx)
|
||||
}),
|
||||
android.FixtureAddTextFile("ravenwood/Android.bp", `
|
||||
java_library_static {
|
||||
name: "framework-minus-apex.ravenwood",
|
||||
srcs: ["Framework.java"],
|
||||
}
|
||||
java_library_static {
|
||||
name: "framework-services.ravenwood",
|
||||
srcs: ["Services.java"],
|
||||
}
|
||||
java_library_static {
|
||||
name: "framework-rules.ravenwood",
|
||||
srcs: ["Rules.java"],
|
||||
}
|
||||
android_ravenwood_libgroup {
|
||||
name: "ravenwood-runtime",
|
||||
libs: [
|
||||
"framework-minus-apex.ravenwood",
|
||||
"framework-services.ravenwood",
|
||||
],
|
||||
}
|
||||
android_ravenwood_libgroup {
|
||||
name: "ravenwood-utils",
|
||||
libs: [
|
||||
"framework-rules.ravenwood",
|
||||
],
|
||||
}
|
||||
`),
|
||||
)
|
||||
|
||||
var installPathPrefix = "out/soong/host/linux-x86/testcases"
|
||||
|
||||
func TestRavenwoodRuntime(t *testing.T) {
|
||||
if runtime.GOOS != "linux" {
|
||||
t.Skip("requires linux")
|
||||
}
|
||||
|
||||
ctx := android.GroupFixturePreparers(
|
||||
PrepareForIntegrationTestWithJava,
|
||||
prepareRavenwoodRuntime,
|
||||
).RunTest(t)
|
||||
|
||||
// Verify that our runtime depends on underlying libs
|
||||
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-runtime", "android_common", "framework-minus-apex.ravenwood")
|
||||
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-runtime", "android_common", "framework-services.ravenwood")
|
||||
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-utils", "android_common", "framework-rules.ravenwood")
|
||||
|
||||
// Verify that we've emitted artifacts in expected location
|
||||
runtime := ctx.ModuleForTests("ravenwood-runtime", "android_common")
|
||||
runtime.Output(installPathPrefix + "/ravenwood-runtime/framework-minus-apex.ravenwood.jar")
|
||||
runtime.Output(installPathPrefix + "/ravenwood-runtime/framework-services.ravenwood.jar")
|
||||
utils := ctx.ModuleForTests("ravenwood-utils", "android_common")
|
||||
utils.Output(installPathPrefix + "/ravenwood-utils/framework-rules.ravenwood.jar")
|
||||
}
|
||||
|
||||
func TestRavenwoodTest(t *testing.T) {
|
||||
if runtime.GOOS != "linux" {
|
||||
t.Skip("requires linux")
|
||||
}
|
||||
|
||||
ctx := android.GroupFixturePreparers(
|
||||
PrepareForIntegrationTestWithJava,
|
||||
prepareRavenwoodRuntime,
|
||||
).RunTestWithBp(t, `
|
||||
android_ravenwood_test {
|
||||
name: "ravenwood-test",
|
||||
srcs: ["Test.java"],
|
||||
sdk_version: "test_current",
|
||||
}
|
||||
`)
|
||||
|
||||
// Verify that our test depends on underlying libs
|
||||
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-test", "android_common", "ravenwood-buildtime")
|
||||
CheckModuleHasDependency(t, ctx.TestContext, "ravenwood-test", "android_common", "ravenwood-utils")
|
||||
|
||||
module := ctx.ModuleForTests("ravenwood-test", "android_common")
|
||||
classpath := module.Rule("javac").Args["classpath"]
|
||||
|
||||
// Verify that we're linking against test_current
|
||||
android.AssertStringDoesContain(t, "classpath", classpath, "android_test_stubs_current.jar")
|
||||
// Verify that we're linking against utils
|
||||
android.AssertStringDoesContain(t, "classpath", classpath, "framework-rules.ravenwood.jar")
|
||||
// Verify that we're *NOT* linking against runtime
|
||||
android.AssertStringDoesNotContain(t, "classpath", classpath, "framework-minus-apex.ravenwood.jar")
|
||||
android.AssertStringDoesNotContain(t, "classpath", classpath, "framework-services.ravenwood.jar")
|
||||
|
||||
// Verify that we've emitted test artifacts in expected location
|
||||
outputJar := module.Output(installPathPrefix + "/ravenwood-test/ravenwood-test.jar")
|
||||
module.Output(installPathPrefix + "/ravenwood-test/ravenwood-test.config")
|
||||
|
||||
// Verify that we're going to install underlying libs
|
||||
orderOnly := outputJar.OrderOnly.Strings()
|
||||
android.AssertStringListContains(t, "orderOnly", orderOnly, installPathPrefix+"/ravenwood-runtime/framework-minus-apex.ravenwood.jar")
|
||||
android.AssertStringListContains(t, "orderOnly", orderOnly, installPathPrefix+"/ravenwood-runtime/framework-services.ravenwood.jar")
|
||||
android.AssertStringListContains(t, "orderOnly", orderOnly, installPathPrefix+"/ravenwood-utils/framework-rules.ravenwood.jar")
|
||||
}
|
Reference in New Issue
Block a user