Merge "Improve java_sdk_library handling of test_current"
This commit is contained in:
commit
b708108b60
|
@ -1043,6 +1043,12 @@ func TestJavaSdkLibrary(t *testing.T) {
|
|||
libs: ["baz"],
|
||||
sdk_version: "system_current",
|
||||
}
|
||||
java_library {
|
||||
name: "baz-test",
|
||||
srcs: ["c.java"],
|
||||
libs: ["foo"],
|
||||
sdk_version: "test_current",
|
||||
}
|
||||
`)
|
||||
|
||||
// check the existence of the internal modules
|
||||
|
@ -1075,6 +1081,13 @@ func TestJavaSdkLibrary(t *testing.T) {
|
|||
"foo.stubs.jar")
|
||||
}
|
||||
|
||||
bazTestJavac := ctx.ModuleForTests("baz-test", "android_common").Rule("javac")
|
||||
// tests if baz-test is actually linked to the test stubs lib
|
||||
if !strings.Contains(bazTestJavac.Args["classpath"], "foo.stubs.test.jar") {
|
||||
t.Errorf("baz-test javac classpath %v does not contain %q", bazTestJavac.Args["classpath"],
|
||||
"foo.stubs.test.jar")
|
||||
}
|
||||
|
||||
// test if baz has exported SDK lib names foo and bar to qux
|
||||
qux := ctx.ModuleForTests("qux", "android_common")
|
||||
if quxLib, ok := qux.Module().(*Library); ok {
|
||||
|
|
|
@ -689,16 +689,19 @@ func (module *SdkLibrary) sdkJars(
|
|||
return module.Library.ImplementationJars()
|
||||
}
|
||||
}
|
||||
var paths *scopePaths
|
||||
var apiScope *apiScope
|
||||
switch sdkVersion.kind {
|
||||
case sdkSystem:
|
||||
paths = module.getScopePaths(apiScopeSystem)
|
||||
apiScope = apiScopeSystem
|
||||
case sdkTest:
|
||||
apiScope = apiScopeTest
|
||||
case sdkPrivate:
|
||||
return module.Library.HeaderJars()
|
||||
default:
|
||||
paths = module.getScopePaths(apiScopePublic)
|
||||
apiScope = apiScopePublic
|
||||
}
|
||||
|
||||
paths := module.getScopePaths(apiScope)
|
||||
if headerJars {
|
||||
return paths.stubsHeaderPath
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue