From d1063c15869080e5f7c07852a512aaa12905fb11 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 17 Jul 2019 20:08:41 +0900 Subject: Introduce module type 'sdk' This change introduces a new module type named 'sdk'. It is a logical group of prebuilt modules that together provide a context (e.g. APIs) in which Mainline modules (such as APEXes) are built. A prebuilt module (e.g. java_import) can join an sdk by adding it to the sdk module as shown below: sdk { name: "mysdk#20", java_libs: ["myjavalib_mysdk_20"], } java_import { name: "myjavalib_mysdk_20", srcs: ["myjavalib-v20.jar"], sdk_member_name: "myjavalib", } sdk { name: "mysdk#21", java_libs: ["myjavalib_mysdk_21"], } java_import { name: "myjavalib_mysdk_21", srcs: ["myjavalib-v21.jar"], sdk_member_name: "myjavalib", } java_library { name: "myjavalib", srcs: ["**/*/*.java"], } An APEX can specify the SDK(s) that it wants to build with via the new 'uses_sdks' property. apex { name: "myapex", java_libs: ["libX", "libY"], uses_sdks: ["mysdk#20"], } With this, libX, libY, and their transitive dependencies are all built with the version 20 of myjavalib (the first java_import module) instead of the other one (which is for version 21) and java_library having the same name (which is for ToT). Bug: 138182343 Test: m (sdk_test.go added) Change-Id: I7e14c524a7d6a0d9f575fb20822080f39818c01e --- java/java.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index b05d7bbd5..b55e29a0b 100644 --- a/java/java.go +++ b/java/java.go @@ -290,6 +290,7 @@ type Module struct { android.ModuleBase android.DefaultableModuleBase android.ApexModuleBase + android.SdkBase properties CompilerProperties protoProperties android.ProtoProperties @@ -1632,6 +1633,7 @@ func LibraryFactory() android.Module { InitJavaModule(module, android.HostAndDeviceSupported) android.InitApexModule(module) + android.InitSdkAwareModule(module) return module } @@ -1912,6 +1914,7 @@ type Import struct { android.DefaultableModuleBase android.ApexModuleBase prebuilt android.Prebuilt + android.SdkBase properties ImportProperties @@ -2068,6 +2071,7 @@ func ImportFactory() android.Module { android.InitPrebuiltModule(module, &module.properties.Jars) InitJavaModule(module, android.HostAndDeviceSupported) android.InitApexModule(module) + android.InitSdkAwareModule(module) return module } -- cgit v1.2.3-59-g8ed1b