2015-07-09 03:13:11 +02:00
|
|
|
// Copyright 2015 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package java
|
|
|
|
|
|
|
|
import (
|
2017-08-02 20:05:49 +02:00
|
|
|
"fmt"
|
|
|
|
"io"
|
2017-08-11 02:09:43 +02:00
|
|
|
"strings"
|
2017-08-02 20:05:49 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
"android/soong/android"
|
2015-07-09 03:13:11 +02:00
|
|
|
)
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
// TODO(jungjw): We'll probably want AndroidMkEntriesProvider.AndroidMkEntries to return multiple
|
|
|
|
// entries so that this can be more error-proof.
|
|
|
|
func (library *Library) AndroidMkHostDex(w io.Writer, name string, entries *android.AndroidMkEntries) {
|
2018-10-19 06:46:09 +02:00
|
|
|
if Bool(library.deviceProperties.Hostdex) && !library.Host() {
|
|
|
|
fmt.Fprintln(w, "include $(CLEAR_VARS)")
|
|
|
|
fmt.Fprintln(w, "LOCAL_MODULE := "+name+"-hostdex")
|
|
|
|
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
|
|
|
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := JAVA_LIBRARIES")
|
2019-01-14 23:13:51 +01:00
|
|
|
if library.dexJarFile != nil {
|
|
|
|
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", library.dexJarFile.String())
|
|
|
|
} else {
|
|
|
|
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", library.implementationAndResourcesJar.String())
|
|
|
|
}
|
2018-10-19 06:46:09 +02:00
|
|
|
if library.dexJarFile != nil {
|
|
|
|
fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", library.dexJarFile.String())
|
|
|
|
}
|
|
|
|
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String())
|
|
|
|
fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", library.implementationAndResourcesJar.String())
|
2019-08-29 23:56:03 +02:00
|
|
|
if len(entries.Required) > 0 {
|
|
|
|
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(entries.Required, " "))
|
2019-04-04 00:47:29 +02:00
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
if len(entries.Host_required) > 0 {
|
|
|
|
fmt.Fprintln(w, "LOCAL_HOST_REQUIRED_MODULES :=", strings.Join(entries.Host_required, " "))
|
2019-04-04 00:47:29 +02:00
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
if len(entries.Target_required) > 0 {
|
|
|
|
fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES :=", strings.Join(entries.Target_required, " "))
|
2019-04-04 00:47:29 +02:00
|
|
|
}
|
2019-04-24 22:41:45 +02:00
|
|
|
if r := library.deviceProperties.Target.Hostdex.Required; len(r) > 0 {
|
|
|
|
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(r, " "))
|
|
|
|
}
|
2018-10-19 06:46:09 +02:00
|
|
|
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func (library *Library) AndroidMkEntries() android.AndroidMkEntries {
|
2019-07-25 15:02:35 +02:00
|
|
|
if !library.IsForPlatform() {
|
2019-08-29 23:56:03 +02:00
|
|
|
return android.AndroidMkEntries{
|
2019-07-25 15:02:35 +02:00
|
|
|
Disabled: true,
|
|
|
|
}
|
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
return android.AndroidMkEntries{
|
2017-08-11 02:00:19 +02:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2018-11-12 19:13:39 +01:00
|
|
|
OutputFile: android.OptionalPathForPath(library.outputFile),
|
2017-09-07 22:20:25 +02:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-08-29 23:56:03 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
2017-12-08 00:28:59 +01:00
|
|
|
if len(library.logtagsSrcs) > 0 {
|
|
|
|
var logtags []string
|
|
|
|
for _, l := range library.logtagsSrcs {
|
|
|
|
logtags = append(logtags, l.Rel())
|
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_LOGTAGS_FILES", logtags...)
|
2017-12-08 00:28:59 +01:00
|
|
|
}
|
|
|
|
|
2018-06-27 02:59:05 +02:00
|
|
|
if library.installFile == nil {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
2017-09-01 01:45:16 +02:00
|
|
|
}
|
2017-09-15 22:00:47 +02:00
|
|
|
if library.dexJarFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile)
|
2018-11-12 19:13:39 +01:00
|
|
|
}
|
|
|
|
if len(library.dexpreopter.builtInstalled) > 0 {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", library.dexpreopter.builtInstalled)
|
2017-09-15 22:00:47 +02:00
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", library.sdkVersion())
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar)
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", library.headerJarFile)
|
2017-11-22 22:49:43 +01:00
|
|
|
|
|
|
|
if library.jacocoReportClassesFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", library.jacocoReportClassesFile)
|
2017-11-22 22:49:43 +01:00
|
|
|
}
|
2017-11-23 01:20:45 +01:00
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", library.exportedSdkLibs...)
|
2018-05-28 11:02:19 +02:00
|
|
|
|
2019-04-02 11:29:55 +02:00
|
|
|
if len(library.additionalCheckedModules) != 0 {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", library.additionalCheckedModules.Strings()...)
|
2019-04-02 11:29:55 +02:00
|
|
|
}
|
|
|
|
|
2019-04-23 22:00:09 +02:00
|
|
|
if library.proguardDictionary != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", library.proguardDictionary)
|
2019-04-23 22:00:09 +02:00
|
|
|
}
|
2017-08-11 02:00:19 +02:00
|
|
|
},
|
|
|
|
},
|
2019-08-29 23:56:03 +02:00
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
|
|
|
|
library.AndroidMkHostDex(w, name, entries)
|
|
|
|
},
|
2017-10-09 23:59:32 +02:00
|
|
|
},
|
2017-08-11 02:00:19 +02:00
|
|
|
}
|
2015-07-09 03:13:11 +02:00
|
|
|
}
|
|
|
|
|
2019-03-20 13:45:53 +01:00
|
|
|
// Called for modules that are a component of a test suite.
|
2019-08-29 23:56:03 +02:00
|
|
|
func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string) {
|
2019-08-28 00:01:50 +02:00
|
|
|
entries.SetString("LOCAL_MODULE_TAGS", "tests")
|
|
|
|
if len(test_suites) > 0 {
|
|
|
|
entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", test_suites...)
|
|
|
|
} else {
|
|
|
|
entries.SetString("LOCAL_COMPATIBILITY_SUITE", "null-suite")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func (j *Test) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
entries := j.Library.AndroidMkEntries()
|
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
|
|
|
testSuiteComponent(entries, j.testProperties.Test_suites)
|
2018-08-08 01:49:25 +02:00
|
|
|
if j.testConfig != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_FULL_TEST_CONFIG", j.testConfig)
|
2018-08-03 00:00:46 +02:00
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
androidMkWriteTestData(j.data, entries)
|
2018-04-10 03:40:24 +02:00
|
|
|
})
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
return entries
|
2018-04-10 03:40:24 +02:00
|
|
|
}
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func (j *TestHelperLibrary) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
entries := j.Library.AndroidMkEntries()
|
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
|
|
|
testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites)
|
2019-03-20 13:45:53 +01:00
|
|
|
})
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
return entries
|
2019-03-20 13:45:53 +01:00
|
|
|
}
|
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
func (prebuilt *Import) AndroidMkEntries() android.AndroidMkEntries {
|
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
2019-07-17 13:08:41 +02:00
|
|
|
if !prebuilt.IsForPlatform() || !prebuilt.ContainingSdk().IsCurrentVersion() {
|
2019-09-05 05:17:54 +02:00
|
|
|
return android.AndroidMkEntries{
|
2019-07-25 15:02:35 +02:00
|
|
|
Disabled: true,
|
|
|
|
}
|
|
|
|
}
|
2019-09-05 05:17:54 +02:00
|
|
|
return android.AndroidMkEntries{
|
2017-08-11 02:00:19 +02:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
|
2017-09-07 22:20:25 +02:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable))
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.combinedClasspathFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.combinedClasspathFile)
|
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion())
|
2017-08-11 02:00:19 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2015-07-09 03:13:11 +02:00
|
|
|
}
|
2017-08-11 02:09:43 +02:00
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
func (prebuilt *DexImport) AndroidMkEntries() android.AndroidMkEntries {
|
2019-07-25 15:02:35 +02:00
|
|
|
if !prebuilt.IsForPlatform() {
|
2019-09-05 05:17:54 +02:00
|
|
|
return android.AndroidMkEntries{
|
2019-07-25 15:02:35 +02:00
|
|
|
Disabled: true,
|
|
|
|
}
|
|
|
|
}
|
2019-09-05 05:17:54 +02:00
|
|
|
return android.AndroidMkEntries{
|
2019-02-22 03:12:14 +01:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(prebuilt.maybeStrippedDexJarFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
2019-02-22 03:12:14 +01:00
|
|
|
if prebuilt.dexJarFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
|
2019-02-22 03:12:14 +01:00
|
|
|
// TODO(b/125517186): export the dex jar as a classes jar to match some mis-uses in Make until
|
|
|
|
// boot_jars_package_check.mk can check dex jars.
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.dexJarFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.dexJarFile)
|
2019-02-22 03:12:14 +01:00
|
|
|
}
|
|
|
|
if len(prebuilt.dexpreopter.builtInstalled) > 0 {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", prebuilt.dexpreopter.builtInstalled)
|
2019-02-22 03:12:14 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
func (prebuilt *AARImport) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
return android.AndroidMkEntries{
|
2018-02-21 02:22:23 +01:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(prebuilt.classpathFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.classpathFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.classpathFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", prebuilt.exportPackage)
|
|
|
|
entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", prebuilt.proguardFlags)
|
|
|
|
entries.SetPath("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", prebuilt.extraAaptPackagesFile)
|
|
|
|
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", prebuilt.manifest)
|
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion())
|
2018-02-21 02:22:23 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
func (binary *Binary) AndroidMkEntries() android.AndroidMkEntries {
|
2017-08-11 02:09:43 +02:00
|
|
|
|
2017-12-05 22:42:45 +01:00
|
|
|
if !binary.isWrapperVariant {
|
2019-09-05 05:17:54 +02:00
|
|
|
return android.AndroidMkEntries{
|
2017-12-05 22:42:45 +01:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2018-08-16 05:40:52 +02:00
|
|
|
OutputFile: android.OptionalPathForPath(binary.outputFile),
|
2017-12-05 22:42:45 +01:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", binary.headerJarFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", binary.implementationAndResourcesJar)
|
2019-01-14 21:35:45 +01:00
|
|
|
if binary.dexJarFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", binary.dexJarFile)
|
2019-01-14 21:35:45 +01:00
|
|
|
}
|
|
|
|
if len(binary.dexpreopter.builtInstalled) > 0 {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled)
|
2019-01-14 21:35:45 +01:00
|
|
|
}
|
2018-08-16 05:40:52 +02:00
|
|
|
},
|
|
|
|
},
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
|
|
|
|
fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)")
|
|
|
|
},
|
2017-12-05 22:42:45 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
} else {
|
2019-09-05 05:17:54 +02:00
|
|
|
return android.AndroidMkEntries{
|
2017-12-05 22:42:45 +01:00
|
|
|
Class: "EXECUTABLES",
|
|
|
|
OutputFile: android.OptionalPathForPath(binary.wrapperFile),
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetBool("LOCAL_STRIP_MODULE", false)
|
2017-12-05 22:42:45 +01:00
|
|
|
},
|
|
|
|
},
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
|
|
|
|
// Ensure that the wrapper script timestamp is always updated when the jar is updated
|
|
|
|
fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): $(jar_installed_module)")
|
|
|
|
fmt.Fprintln(w, "jar_installed_module :=")
|
|
|
|
},
|
2017-12-05 22:42:45 +01:00
|
|
|
},
|
|
|
|
}
|
2017-08-11 02:09:43 +02:00
|
|
|
}
|
|
|
|
}
|
2017-11-23 01:20:45 +01:00
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func (app *AndroidApp) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
return android.AndroidMkEntries{
|
2017-11-23 01:20:45 +01:00
|
|
|
Class: "APPS",
|
|
|
|
OutputFile: android.OptionalPathForPath(app.outputFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
2019-08-29 23:56:03 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
// App module names can be overridden.
|
|
|
|
entries.SetString("LOCAL_MODULE", app.installApkName)
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", app.exportPackage)
|
2017-12-14 07:42:59 +01:00
|
|
|
if app.dexJarFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", app.dexJarFile)
|
2017-12-14 07:42:59 +01:00
|
|
|
}
|
2018-08-16 05:40:52 +02:00
|
|
|
if app.implementationAndResourcesJar != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", app.implementationAndResourcesJar)
|
2017-12-14 22:19:01 +01:00
|
|
|
}
|
|
|
|
if app.headerJarFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", app.headerJarFile)
|
2017-12-14 22:19:01 +01:00
|
|
|
}
|
2018-10-30 07:14:58 +01:00
|
|
|
if app.bundleFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_BUNDLE", app.bundleFile)
|
2018-10-30 07:14:58 +01:00
|
|
|
}
|
2017-12-14 07:42:59 +01:00
|
|
|
if app.jacocoReportClassesFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", app.jacocoReportClassesFile)
|
2017-12-14 07:42:59 +01:00
|
|
|
}
|
2017-12-28 21:23:20 +01:00
|
|
|
if app.proguardDictionary != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", app.proguardDictionary)
|
2017-12-28 21:23:20 +01:00
|
|
|
}
|
2017-11-23 01:20:45 +01:00
|
|
|
|
2017-12-14 07:42:59 +01:00
|
|
|
if app.Name() == "framework-res" {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
|
2017-12-14 07:42:59 +01:00
|
|
|
// Make base_rules.mk not put framework-res in a subdirectory called
|
|
|
|
// framework_res.
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true)
|
2017-12-14 07:42:59 +01:00
|
|
|
}
|
2017-11-23 01:20:45 +01:00
|
|
|
|
2019-03-18 16:53:16 +01:00
|
|
|
filterRRO := func(filter overlayType) android.Paths {
|
|
|
|
var paths android.Paths
|
|
|
|
for _, d := range app.rroDirs {
|
|
|
|
if d.overlayType == filter {
|
|
|
|
paths = append(paths, d.path)
|
|
|
|
}
|
|
|
|
}
|
2018-04-17 19:52:26 +02:00
|
|
|
// Reverse the order, Soong stores rroDirs in aapt2 order (low to high priority), but Make
|
|
|
|
// expects it in LOCAL_RESOURCE_DIRS order (high to low priority).
|
2019-03-18 16:53:16 +01:00
|
|
|
return android.ReversePaths(paths)
|
|
|
|
}
|
|
|
|
deviceRRODirs := filterRRO(device)
|
|
|
|
if len(deviceRRODirs) > 0 {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_SOONG_DEVICE_RRO_DIRS", deviceRRODirs.Strings()...)
|
2019-03-18 16:53:16 +01:00
|
|
|
}
|
|
|
|
productRRODirs := filterRRO(product)
|
|
|
|
if len(productRRODirs) > 0 {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_SOONG_PRODUCT_RRO_DIRS", productRRODirs.Strings()...)
|
2017-12-14 07:42:59 +01:00
|
|
|
}
|
2017-12-01 05:13:19 +01:00
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_EXPORT_PACKAGE_RESOURCES", Bool(app.appProperties.Export_package_resources))
|
2017-12-14 07:42:59 +01:00
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", app.manifestPath)
|
2017-12-14 07:42:59 +01:00
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", Bool(app.appProperties.Privileged))
|
2017-12-14 20:22:55 +01:00
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_CERTIFICATE", app.certificate.Pem)
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", app.getOverriddenPackages()...)
|
2018-10-03 07:03:40 +02:00
|
|
|
|
|
|
|
for _, jniLib := range app.installJniLibs {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_SOONG_JNI_LIBS_"+jniLib.target.Arch.ArchType.String(), jniLib.name)
|
2018-10-03 07:03:40 +02:00
|
|
|
}
|
2018-11-12 19:13:39 +01:00
|
|
|
if len(app.dexpreopter.builtInstalled) > 0 {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", app.dexpreopter.builtInstalled)
|
2018-11-12 19:13:39 +01:00
|
|
|
}
|
2019-03-20 00:03:11 +01:00
|
|
|
for _, split := range app.aapt.splits {
|
2019-09-28 02:13:15 +02:00
|
|
|
install := app.onDeviceDir + "/" +
|
|
|
|
strings.TrimSuffix(app.installApkName, ".apk") + "_" + split.suffix + ".apk"
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_SOONG_BUILT_INSTALLED", split.path.String()+":"+install)
|
2019-03-20 00:03:11 +01:00
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
|
2019-07-02 02:15:13 +02:00
|
|
|
if app.noticeOutputs.Merged.Valid() {
|
|
|
|
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n",
|
|
|
|
app.installApkName, app.noticeOutputs.Merged.String(), app.installApkName+"_NOTICE")
|
|
|
|
}
|
|
|
|
if app.noticeOutputs.TxtOutput.Valid() {
|
|
|
|
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n",
|
|
|
|
app.installApkName, app.noticeOutputs.TxtOutput.String(), app.installApkName+"_NOTICE.txt")
|
|
|
|
}
|
|
|
|
if app.noticeOutputs.HtmlOutput.Valid() {
|
|
|
|
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n",
|
|
|
|
app.installApkName, app.noticeOutputs.HtmlOutput.String(), app.installApkName+"_NOTICE.html")
|
|
|
|
}
|
2017-11-23 01:20:45 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-03-28 23:58:31 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 22:13:52 +01:00
|
|
|
func (a *AndroidApp) getOverriddenPackages() []string {
|
|
|
|
var overridden []string
|
|
|
|
if len(a.appProperties.Overrides) > 0 {
|
|
|
|
overridden = append(overridden, a.appProperties.Overrides...)
|
|
|
|
}
|
|
|
|
if a.Name() != a.installApkName {
|
|
|
|
overridden = append(overridden, a.Name())
|
|
|
|
}
|
|
|
|
return overridden
|
|
|
|
}
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func (a *AndroidTest) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
entries := a.AndroidApp.AndroidMkEntries()
|
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
|
|
|
testSuiteComponent(entries, a.testProperties.Test_suites)
|
2018-08-08 01:49:25 +02:00
|
|
|
if a.testConfig != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_FULL_TEST_CONFIG", a.testConfig)
|
2018-08-03 00:00:46 +02:00
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
androidMkWriteTestData(a.data, entries)
|
2018-05-22 20:11:52 +02:00
|
|
|
})
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
return entries
|
2018-05-22 20:11:52 +02:00
|
|
|
}
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func (a *AndroidTestHelperApp) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
entries := a.AndroidApp.AndroidMkEntries()
|
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
|
|
|
testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites)
|
2018-10-05 00:22:03 +02:00
|
|
|
})
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
return entries
|
2018-10-05 00:22:03 +02:00
|
|
|
}
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func (a *AndroidLibrary) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
entries := a.Library.AndroidMkEntries()
|
2018-03-28 23:58:31 +02:00
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
2018-10-30 07:15:37 +01:00
|
|
|
if a.aarFile != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
|
2018-10-30 07:15:37 +01:00
|
|
|
}
|
2017-11-23 01:20:45 +01:00
|
|
|
|
2018-03-28 23:58:31 +02:00
|
|
|
if a.Name() == "framework-res" {
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
|
2018-03-28 23:58:31 +02:00
|
|
|
// Make base_rules.mk not put framework-res in a subdirectory called
|
|
|
|
// framework_res.
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true)
|
2018-03-28 23:58:31 +02:00
|
|
|
}
|
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", a.exportPackage)
|
|
|
|
entries.SetPath("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", a.extraAaptPackagesFile)
|
|
|
|
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile)
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.AddStrings("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.exportedProguardFlagFiles.Strings()...)
|
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
2018-03-28 23:58:31 +02:00
|
|
|
})
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
return entries
|
2017-11-23 01:20:45 +01:00
|
|
|
}
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
func (jd *Javadoc) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
return android.AndroidMkEntries{
|
2018-01-11 01:06:12 +01:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2018-03-09 02:26:16 +01:00
|
|
|
OutputFile: android.OptionalPathForPath(jd.stubsSrcJar),
|
2018-08-09 06:44:48 +02:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
2018-04-11 01:14:46 +02:00
|
|
|
if BoolDefault(jd.properties.Installable, true) {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
2018-03-09 02:26:16 +01:00
|
|
|
if jd.stubsSrcJar != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", jd.stubsSrcJar)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
func (ddoc *Droiddoc) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
return android.AndroidMkEntries{
|
2018-01-11 01:06:12 +01:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2018-03-09 02:26:16 +01:00
|
|
|
OutputFile: android.OptionalPathForPath(ddoc.stubsSrcJar),
|
2018-08-09 06:44:48 +02:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
2018-09-05 02:14:32 +02:00
|
|
|
if BoolDefault(ddoc.Javadoc.properties.Installable, true) && ddoc.Javadoc.docZip != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", ddoc.Javadoc.docZip)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
2018-03-09 02:26:16 +01:00
|
|
|
if ddoc.Javadoc.stubsSrcJar != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", ddoc.Javadoc.stubsSrcJar)
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
2019-09-05 05:17:54 +02:00
|
|
|
apiFilePrefix := "INTERNAL_PLATFORM_"
|
|
|
|
if String(ddoc.properties.Api_tag_name) != "" {
|
|
|
|
apiFilePrefix += String(ddoc.properties.Api_tag_name) + "_"
|
|
|
|
}
|
|
|
|
if ddoc.apiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"API_FILE", ddoc.apiFile)
|
|
|
|
}
|
|
|
|
if ddoc.dexApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"DEX_API_FILE", ddoc.dexApiFile)
|
|
|
|
}
|
|
|
|
if ddoc.privateApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"PRIVATE_API_FILE", ddoc.privateApiFile)
|
|
|
|
}
|
|
|
|
if ddoc.privateDexApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"PRIVATE_DEX_API_FILE", ddoc.privateDexApiFile)
|
|
|
|
}
|
|
|
|
if ddoc.removedApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"REMOVED_API_FILE", ddoc.removedApiFile)
|
|
|
|
}
|
|
|
|
if ddoc.removedDexApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"REMOVED_DEX_API_FILE", ddoc.removedDexApiFile)
|
|
|
|
}
|
|
|
|
if ddoc.exactApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"EXACT_API_FILE", ddoc.exactApiFile)
|
|
|
|
}
|
|
|
|
if ddoc.proguardFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"PROGUARD_FILE", ddoc.proguardFile)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
|
2018-05-05 03:49:16 +02:00
|
|
|
if ddoc.checkCurrentApiTimestamp != nil {
|
|
|
|
fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-current-api")
|
|
|
|
fmt.Fprintln(w, ddoc.Name()+"-check-current-api:",
|
|
|
|
ddoc.checkCurrentApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
2018-05-12 15:21:20 +02:00
|
|
|
fmt.Fprintln(w, "checkapi:",
|
2018-05-05 03:49:16 +02:00
|
|
|
ddoc.checkCurrentApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
|
|
|
}
|
|
|
|
if ddoc.updateCurrentApiTimestamp != nil {
|
2018-07-24 22:00:52 +02:00
|
|
|
fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-update-current-api")
|
2018-05-05 03:49:16 +02:00
|
|
|
fmt.Fprintln(w, ddoc.Name()+"-update-current-api:",
|
|
|
|
ddoc.updateCurrentApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: update-api")
|
|
|
|
fmt.Fprintln(w, "update-api:",
|
|
|
|
ddoc.updateCurrentApiTimestamp.String())
|
|
|
|
}
|
|
|
|
if ddoc.checkLastReleasedApiTimestamp != nil {
|
|
|
|
fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-last-released-api")
|
|
|
|
fmt.Fprintln(w, ddoc.Name()+"-check-last-released-api:",
|
|
|
|
ddoc.checkLastReleasedApiTimestamp.String())
|
2019-01-23 14:51:55 +01:00
|
|
|
|
2019-01-30 19:51:39 +01:00
|
|
|
if ddoc.Name() == "api-stubs-docs" || ddoc.Name() == "system-api-stubs-docs" {
|
2019-01-23 14:51:55 +01:00
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
|
|
|
fmt.Fprintln(w, "checkapi:",
|
|
|
|
ddoc.checkLastReleasedApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
|
|
|
}
|
2018-05-05 03:49:16 +02:00
|
|
|
}
|
2018-01-11 01:06:12 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2018-08-11 01:06:24 +02:00
|
|
|
|
2019-09-05 05:17:54 +02:00
|
|
|
func (dstubs *Droidstubs) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
return android.AndroidMkEntries{
|
2018-09-05 02:14:32 +02:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(dstubs.stubsSrcJar),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
2018-09-05 02:14:32 +02:00
|
|
|
if dstubs.Javadoc.stubsSrcJar != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar)
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
2018-09-18 19:41:33 +02:00
|
|
|
if dstubs.apiVersionsXml != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.apiVersionsXml)
|
2018-09-18 19:41:33 +02:00
|
|
|
}
|
2018-09-05 02:14:32 +02:00
|
|
|
if dstubs.annotationsZip != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.annotationsZip)
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
2018-09-17 23:32:21 +02:00
|
|
|
if dstubs.jdiffDocZip != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_JDIFF_DOC_ZIP", dstubs.jdiffDocZip)
|
|
|
|
}
|
|
|
|
apiFilePrefix := "INTERNAL_PLATFORM_"
|
|
|
|
if String(dstubs.properties.Api_tag_name) != "" {
|
|
|
|
apiFilePrefix += String(dstubs.properties.Api_tag_name) + "_"
|
|
|
|
}
|
|
|
|
if dstubs.apiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"API_FILE", dstubs.apiFile)
|
2018-09-17 23:32:21 +02:00
|
|
|
}
|
2019-09-05 05:17:54 +02:00
|
|
|
if dstubs.dexApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"DEX_API_FILE", dstubs.dexApiFile)
|
|
|
|
}
|
|
|
|
if dstubs.privateApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"PRIVATE_API_FILE", dstubs.privateApiFile)
|
|
|
|
}
|
|
|
|
if dstubs.privateDexApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"PRIVATE_DEX_API_FILE", dstubs.privateDexApiFile)
|
|
|
|
}
|
|
|
|
if dstubs.removedApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"REMOVED_API_FILE", dstubs.removedApiFile)
|
|
|
|
}
|
|
|
|
if dstubs.removedDexApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"REMOVED_DEX_API_FILE", dstubs.removedDexApiFile)
|
|
|
|
}
|
|
|
|
if dstubs.exactApiFile != nil {
|
|
|
|
entries.SetPath(apiFilePrefix+"EXACT_API_FILE", dstubs.exactApiFile)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
|
2018-09-05 02:14:32 +02:00
|
|
|
if dstubs.checkCurrentApiTimestamp != nil {
|
|
|
|
fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-current-api")
|
|
|
|
fmt.Fprintln(w, dstubs.Name()+"-check-current-api:",
|
|
|
|
dstubs.checkCurrentApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
|
|
|
fmt.Fprintln(w, "checkapi:",
|
|
|
|
dstubs.checkCurrentApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
|
|
|
}
|
|
|
|
if dstubs.updateCurrentApiTimestamp != nil {
|
|
|
|
fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-update-current-api")
|
|
|
|
fmt.Fprintln(w, dstubs.Name()+"-update-current-api:",
|
|
|
|
dstubs.updateCurrentApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: update-api")
|
|
|
|
fmt.Fprintln(w, "update-api:",
|
|
|
|
dstubs.updateCurrentApiTimestamp.String())
|
|
|
|
}
|
|
|
|
if dstubs.checkLastReleasedApiTimestamp != nil {
|
|
|
|
fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-last-released-api")
|
|
|
|
fmt.Fprintln(w, dstubs.Name()+"-check-last-released-api:",
|
|
|
|
dstubs.checkLastReleasedApiTimestamp.String())
|
2019-01-23 14:51:55 +01:00
|
|
|
|
2019-01-30 19:51:39 +01:00
|
|
|
if dstubs.Name() == "api-stubs-docs" || dstubs.Name() == "system-api-stubs-docs" {
|
2019-01-23 14:51:55 +01:00
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
|
|
|
fmt.Fprintln(w, "checkapi:",
|
|
|
|
dstubs.checkLastReleasedApiTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
|
|
|
}
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
2018-10-22 16:55:04 +02:00
|
|
|
if dstubs.checkNullabilityWarningsTimestamp != nil {
|
|
|
|
fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-nullability-warnings")
|
|
|
|
fmt.Fprintln(w, dstubs.Name()+"-check-nullability-warnings:",
|
|
|
|
dstubs.checkNullabilityWarningsTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY:", "droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: ", dstubs.Name()+"-check-nullability-warnings")
|
|
|
|
}
|
2018-09-05 02:14:32 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-17 19:21:49 +02:00
|
|
|
func (a *AndroidAppImport) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
return android.AndroidMkEntries{
|
2019-04-15 18:48:31 +02:00
|
|
|
Class: "APPS",
|
2019-07-17 19:21:49 +02:00
|
|
|
OutputFile: android.OptionalPathForPath(a.outputFile),
|
2019-04-15 18:48:31 +02:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
2019-08-28 02:33:16 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", Bool(a.properties.Privileged))
|
|
|
|
if a.certificate != nil {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_CERTIFICATE", a.certificate.Pem)
|
2019-08-28 02:33:16 +02:00
|
|
|
} else {
|
|
|
|
entries.SetString("LOCAL_CERTIFICATE", "PRESIGNED")
|
|
|
|
}
|
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", a.properties.Overrides...)
|
|
|
|
if len(a.dexpreopter.builtInstalled) > 0 {
|
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", a.dexpreopter.builtInstalled)
|
|
|
|
}
|
|
|
|
entries.AddStrings("LOCAL_INSTALLED_MODULE_STEM", a.installPath.Rel())
|
|
|
|
},
|
2019-04-15 18:48:31 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-28 00:01:50 +02:00
|
|
|
func (a *AndroidTestImport) AndroidMkEntries() android.AndroidMkEntries {
|
|
|
|
entries := a.AndroidAppImport.AndroidMkEntries()
|
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
2019-08-29 23:56:03 +02:00
|
|
|
testSuiteComponent(entries, a.testProperties.Test_suites)
|
|
|
|
androidMkWriteTestData(a.data, entries)
|
2019-08-28 00:01:50 +02:00
|
|
|
})
|
|
|
|
return entries
|
|
|
|
}
|
|
|
|
|
2019-08-29 23:56:03 +02:00
|
|
|
func androidMkWriteTestData(data android.Paths, entries *android.AndroidMkEntries) {
|
2019-08-28 00:01:50 +02:00
|
|
|
var testFiles []string
|
|
|
|
for _, d := range data {
|
|
|
|
testFiles = append(testFiles, d.String()+":"+d.Rel())
|
|
|
|
}
|
|
|
|
entries.AddStrings("LOCAL_COMPATIBILITY_SUPPORT_FILES", testFiles...)
|
|
|
|
}
|