Revert "Revert "Add min_sdk_version to java_import.""

This reverts commit 5ab6508008.

Reason for revert: Resubmitting Ie255f74d40432f4bdd0092d618705a7d17235e58 after fixing the broken targets.

Bug: 183695497
Test: https://android-build.googleplex.com/builds/forrest/run/L58600000849810513
Change-Id: I5f072f396002ca3a45bd530ad9be987efa732833
This commit is contained in:
Jaewoong Jung
2021-04-02 00:38:25 +00:00
parent 4aa7faf487
commit 56e12dbbaf
3 changed files with 125 additions and 56 deletions

View File

@@ -1808,6 +1808,30 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) {
min_sdk_version: "30",
}
`)
testApexError(t, `module "libfoo".*: should support min_sdk_version\(29\)`, `
apex {
name: "myapex",
key: "myapex.key",
java_libs: ["libfoo"],
min_sdk_version: "29",
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
java_import {
name: "libfoo",
jars: ["libfoo.jar"],
apex_available: [
"myapex",
],
min_sdk_version: "30",
}
`)
}
func TestApexMinSdkVersion_Okay(t *testing.T) {
@@ -1845,7 +1869,10 @@ func TestApexMinSdkVersion_Okay(t *testing.T) {
name: "libbar",
sdk_version: "current",
srcs: ["a.java"],
static_libs: ["libbar_dep"],
static_libs: [
"libbar_dep",
"libbar_import_dep",
],
apex_available: ["myapex"],
min_sdk_version: "29",
}
@@ -1857,6 +1884,13 @@ func TestApexMinSdkVersion_Okay(t *testing.T) {
apex_available: ["myapex"],
min_sdk_version: "29",
}
java_import {
name: "libbar_import_dep",
jars: ["libbar.jar"],
apex_available: ["myapex"],
min_sdk_version: "29",
}
`)
}