Add "contents" property to systemserverclasspath_fragment.
Similar to bcp_fragment's contents, this property lists all java library contributions made by this fragment. Bug: 180105615 Test: m nothing Change-Id: Ifb1f54d5db290fffaa31933d15207014bb72d2fb
This commit is contained in:
@@ -17,6 +17,7 @@ package java
|
|||||||
import (
|
import (
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/dexpreopt"
|
"android/soong/dexpreopt"
|
||||||
|
"github.com/google/blueprint"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -70,16 +71,30 @@ type systemServerClasspathModule struct {
|
|||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
|
|
||||||
ClasspathFragmentBase
|
ClasspathFragmentBase
|
||||||
|
|
||||||
|
properties systemServerClasspathFragmentProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
type systemServerClasspathFragmentProperties struct {
|
||||||
|
// The contents of this systemserverclasspath_fragment, could be either java_library, or java_sdk_library.
|
||||||
|
//
|
||||||
|
// The order of this list matters as it is the order that is used in the SYSTEMSERVERCLASSPATH.
|
||||||
|
Contents []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func systemServerClasspathFactory() android.Module {
|
func systemServerClasspathFactory() android.Module {
|
||||||
m := &systemServerClasspathModule{}
|
m := &systemServerClasspathModule{}
|
||||||
|
m.AddProperties(&m.properties)
|
||||||
initClasspathFragment(m, SYSTEMSERVERCLASSPATH)
|
initClasspathFragment(m, SYSTEMSERVERCLASSPATH)
|
||||||
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
|
android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *systemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (s *systemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
|
if len(s.properties.Contents) == 0 {
|
||||||
|
ctx.PropertyErrorf("contents", "empty contents are not allowed")
|
||||||
|
}
|
||||||
|
|
||||||
s.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJarListToClasspathJars(ctx, s.ClasspathFragmentToConfiguredJarList(ctx)))
|
s.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJarListToClasspathJars(ctx, s.ClasspathFragmentToConfiguredJarList(ctx)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,3 +102,22 @@ func (s *systemServerClasspathModule) ClasspathFragmentToConfiguredJarList(ctx a
|
|||||||
// TODO(satayev): populate with actual content
|
// TODO(satayev): populate with actual content
|
||||||
return android.EmptyConfiguredJarList()
|
return android.EmptyConfiguredJarList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type systemServerClasspathFragmentContentDependencyTag struct {
|
||||||
|
blueprint.BaseDependencyTag
|
||||||
|
}
|
||||||
|
|
||||||
|
// The tag used for the dependency between the systemserverclasspath_fragment module and its contents.
|
||||||
|
var systemServerClasspathFragmentContentDepTag = systemServerClasspathFragmentContentDependencyTag{}
|
||||||
|
|
||||||
|
func IsSystemServerClasspathFragmentContentDepTag(tag blueprint.DependencyTag) bool {
|
||||||
|
return tag == systemServerClasspathFragmentContentDepTag
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *systemServerClasspathModule) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
|
module := ctx.Module()
|
||||||
|
|
||||||
|
for _, name := range s.properties.Contents {
|
||||||
|
ctx.AddDependency(module, systemServerClasspathFragmentContentDepTag, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -20,13 +20,13 @@ import (
|
|||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
var prepareForTestWithSystemserverClasspath = android.GroupFixturePreparers(
|
var prepareForTestWithSystemServerClasspath = android.GroupFixturePreparers(
|
||||||
PrepareForTestWithJavaDefaultModules,
|
PrepareForTestWithJavaDefaultModules,
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSystemserverClasspathVariant(t *testing.T) {
|
func TestPlatformSystemserverClasspathVariant(t *testing.T) {
|
||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForTestWithSystemserverClasspath,
|
prepareForTestWithSystemServerClasspath,
|
||||||
android.FixtureWithRootAndroidBp(`
|
android.FixtureWithRootAndroidBp(`
|
||||||
platform_systemserverclasspath {
|
platform_systemserverclasspath {
|
||||||
name: "platform-systemserverclasspath",
|
name: "platform-systemserverclasspath",
|
||||||
@@ -38,9 +38,9 @@ func TestSystemserverClasspathVariant(t *testing.T) {
|
|||||||
android.AssertIntEquals(t, "expect 1 variant", 1, len(variants))
|
android.AssertIntEquals(t, "expect 1 variant", 1, len(variants))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSystemserverClasspath_ClasspathFragmentPaths(t *testing.T) {
|
func TestPlatformSystemserverClasspath_ClasspathFragmentPaths(t *testing.T) {
|
||||||
result := android.GroupFixturePreparers(
|
result := android.GroupFixturePreparers(
|
||||||
prepareForTestWithSystemserverClasspath,
|
prepareForTestWithSystemServerClasspath,
|
||||||
android.FixtureWithRootAndroidBp(`
|
android.FixtureWithRootAndroidBp(`
|
||||||
platform_systemserverclasspath {
|
platform_systemserverclasspath {
|
||||||
name: "platform-systemserverclasspath",
|
name: "platform-systemserverclasspath",
|
||||||
@@ -53,9 +53,9 @@ func TestSystemserverClasspath_ClasspathFragmentPaths(t *testing.T) {
|
|||||||
android.AssertPathRelativeToTopEquals(t, "install filepath", "out/soong/target/product/test_device/system/etc/classpaths", p.ClasspathFragmentBase.installDirPath)
|
android.AssertPathRelativeToTopEquals(t, "install filepath", "out/soong/target/product/test_device/system/etc/classpaths", p.ClasspathFragmentBase.installDirPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSystemserverClasspathModule_AndroidMkEntries(t *testing.T) {
|
func TestPlatformSystemserverClasspathModule_AndroidMkEntries(t *testing.T) {
|
||||||
preparer := android.GroupFixturePreparers(
|
preparer := android.GroupFixturePreparers(
|
||||||
prepareForTestWithSystemserverClasspath,
|
prepareForTestWithSystemServerClasspath,
|
||||||
android.FixtureWithRootAndroidBp(`
|
android.FixtureWithRootAndroidBp(`
|
||||||
platform_systemserverclasspath {
|
platform_systemserverclasspath {
|
||||||
name: "platform-systemserverclasspath",
|
name: "platform-systemserverclasspath",
|
||||||
@@ -95,3 +95,14 @@ func TestSystemserverClasspathModule_AndroidMkEntries(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSystemserverclasspathFragmentWithoutContents(t *testing.T) {
|
||||||
|
prepareForTestWithSystemServerClasspath.
|
||||||
|
ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(
|
||||||
|
`\Qempty contents are not allowed\E`)).
|
||||||
|
RunTestWithBp(t, `
|
||||||
|
systemserverclasspath_fragment {
|
||||||
|
name: "systemserverclasspath-fragment",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user