Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b708108b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Improve java_sdk_library handling of test_current"

parents 4136c9b9 726d23c2
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -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 {
+6 −3
Original line number Diff line number Diff line
@@ -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 {