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
This commit is contained in:
Paul Duffin
2021-05-06 16:39:27 +01:00
parent 05f86890ee
commit e96108d797
5 changed files with 133 additions and 13 deletions

View File

@@ -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