Merge "java libs that isn't installable is gracefully rejected"

This commit is contained in:
Treehugger Robot
2019-12-16 09:56:13 +00:00
committed by Gerrit Code Review
2 changed files with 24 additions and 1 deletions

View File

@@ -477,7 +477,7 @@ func newApexFile(ctx android.BaseModuleContext, builtFile android.Path, moduleNa
}
func (af *apexFile) Ok() bool {
return af.builtFile != nil || af.builtFile.String() == ""
return af.builtFile != nil && af.builtFile.String() != ""
}
type apexBundle struct {

View File

@@ -3055,6 +3055,29 @@ func TestLegacyAndroid10Support(t *testing.T) {
ensureContains(t, args["opt_flags"], "--manifest_json "+module.Output("apex_manifest.json").Output.String())
}
func TestRejectNonInstallableJavaLibrary(t *testing.T) {
testApexError(t, `"myjar" is not configured to be compiled into dex`, `
apex {
name: "myapex",
key: "myapex.key",
java_libs: ["myjar"],
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
java_library {
name: "myjar",
srcs: ["foo/bar/MyClass.java"],
sdk_version: "none",
system_modules: "none",
}
`)
}
func TestMain(m *testing.M) {
run := func() int {
setUp()