summaryrefslogtreecommitdiff
path: root/android/testing.go
diff options
context:
space:
mode:
author Paul Duffin <paulduffin@google.com> 2021-05-06 16:39:27 +0100
committer Paul Duffin <paulduffin@google.com> 2021-05-11 08:24:59 +0100
commite96108d797f71bd59d3296d1190246ac707d98e6 (patch)
tree0bda7d847aa62637199088633b503b005d299e88 /android/testing.go
parent05f86890eeca7c8fd412734a7b5bde396a5efb82 (diff)
Add baseline test for license with sdk
This change adds a test that includes license modules that are used by modules which are part of an sdk but which does not yet copy the license module into the snapshot. It includes the refactoring changes needed to allow license modules to be used in an sdk test and provides a baseline against which future changes can be compared. Bug: 181569894 Test: m nothing Change-Id: I60722f43cc9cc8375d97f46eb4c281e6c38987cd
Diffstat (limited to 'android/testing.go')
-rw-r--r--android/testing.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/android/testing.go b/android/testing.go
index ce27fca04..191cb8d02 100644
--- a/android/testing.go
+++ b/android/testing.go
@@ -74,6 +74,42 @@ var PrepareForTestWithOverrides = FixtureRegisterWithContext(func(ctx Registrati
ctx.PostDepsMutators(RegisterOverridePostDepsMutators)
})
+var PrepareForTestWithLicenses = GroupFixturePreparers(
+ FixtureRegisterWithContext(RegisterLicenseKindBuildComponents),
+ FixtureRegisterWithContext(RegisterLicenseBuildComponents),
+ FixtureRegisterWithContext(registerLicenseMutators),
+)
+
+func registerLicenseMutators(ctx RegistrationContext) {
+ ctx.PreArchMutators(RegisterLicensesPackageMapper)
+ ctx.PreArchMutators(RegisterLicensesPropertyGatherer)
+ ctx.PostDepsMutators(RegisterLicensesDependencyChecker)
+}
+
+var PrepareForTestWithLicenseDefaultModules = GroupFixturePreparers(
+ FixtureAddTextFile("build/soong/licenses/Android.bp", `
+ license {
+ name: "Android-Apache-2.0",
+ package_name: "Android",
+ license_kinds: ["SPDX-license-identifier-Apache-2.0"],
+ copyright_notice: "Copyright (C) The Android Open Source Project",
+ license_text: ["LICENSE"],
+ }
+
+ license_kind {
+ name: "SPDX-license-identifier-Apache-2.0",
+ conditions: ["notice"],
+ url: "https://spdx.org/licenses/Apache-2.0.html",
+ }
+
+ license_kind {
+ name: "legacy_unencumbered",
+ conditions: ["unencumbered"],
+ }
+ `),
+ FixtureAddFile("build/soong/licenses/LICENSE", nil),
+)
+
// Test fixture preparer that will register most java build components.
//
// Singletons and mutators should only be added here if they are needed for a majority of java