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"
|
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
"android/soong/android"
|
2015-07-09 03:13:11 +02:00
|
|
|
)
|
|
|
|
|
2019-12-11 09:27:07 +01:00
|
|
|
func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries {
|
|
|
|
hostDexNeeded := Bool(library.deviceProperties.Hostdex) && !library.Host()
|
|
|
|
if !library.IsForPlatform() {
|
2019-12-02 16:43:57 +01:00
|
|
|
// Don't emit hostdex modules from the APEX variants
|
2019-12-11 09:27:07 +01:00
|
|
|
hostDexNeeded = false
|
|
|
|
}
|
|
|
|
|
|
|
|
if hostDexNeeded {
|
|
|
|
var output android.Path
|
2019-01-14 23:13:51 +01:00
|
|
|
if library.dexJarFile != nil {
|
2019-12-11 09:27:07 +01:00
|
|
|
output = library.dexJarFile
|
2019-01-14 23:13:51 +01:00
|
|
|
} else {
|
2019-12-11 09:27:07 +01:00
|
|
|
output = library.implementationAndResourcesJar
|
2019-04-04 00:47:29 +02:00
|
|
|
}
|
2019-12-11 09:27:07 +01:00
|
|
|
return android.AndroidMkEntries{
|
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
SubName: "-hostdex",
|
|
|
|
OutputFile: android.OptionalPathForPath(output),
|
|
|
|
Required: library.deviceProperties.Target.Hostdex.Required,
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetBool("LOCAL_IS_HOST_MODULE", true)
|
|
|
|
entries.SetPath("LOCAL_PREBUILT_MODULE_FILE", output)
|
|
|
|
if library.dexJarFile != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile)
|
|
|
|
}
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", library.headerJarFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar)
|
|
|
|
entries.SetString("LOCAL_MODULE_STEM", library.Stem()+"-hostdex")
|
|
|
|
},
|
|
|
|
},
|
2019-04-24 22:41:45 +02:00
|
|
|
}
|
2018-10-19 06:46:09 +02:00
|
|
|
}
|
2019-12-11 09:27:07 +01:00
|
|
|
return android.AndroidMkEntries{Disabled: true}
|
2018-10-19 06:46:09 +02:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
2019-12-11 09:27:07 +01:00
|
|
|
var entriesList []android.AndroidMkEntries
|
|
|
|
|
|
|
|
mainEntries := android.AndroidMkEntries{Disabled: true}
|
2019-12-02 16:43:57 +01:00
|
|
|
|
2019-12-11 09:27:07 +01:00
|
|
|
// For a java library built for an APEX, we don't need Make module
|
2019-12-02 16:43:57 +01:00
|
|
|
hideFromMake := !library.IsForPlatform()
|
|
|
|
// If not available for platform, don't emit to make.
|
|
|
|
if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
|
|
|
|
hideFromMake = true
|
|
|
|
}
|
2020-06-03 19:14:31 +02:00
|
|
|
if hideFromMake {
|
|
|
|
// May still need to add some additional dependencies. This will be called
|
|
|
|
// once for the platform variant (even if it is not being used) and once each
|
|
|
|
// for the APEX specific variants. In order to avoid adding the dependency
|
|
|
|
// multiple times only add it for the platform variant.
|
|
|
|
checkedModulePaths := library.additionalCheckedModules
|
|
|
|
if library.IsForPlatform() && len(checkedModulePaths) != 0 {
|
|
|
|
mainEntries = android.AndroidMkEntries{
|
|
|
|
Class: "FAKE",
|
|
|
|
// Need at least one output file in order for this to take effect.
|
|
|
|
OutputFile: android.OptionalPathForPath(checkedModulePaths[0]),
|
|
|
|
Include: "$(BUILD_PHONY_PACKAGE)",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", checkedModulePaths.Strings()...)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2019-12-11 09:27:07 +01:00
|
|
|
mainEntries = android.AndroidMkEntries{
|
|
|
|
Class: "JAVA_LIBRARIES",
|
2020-06-15 07:24:19 +02:00
|
|
|
DistFiles: library.distFiles,
|
2019-12-11 09:27:07 +01:00
|
|
|
OutputFile: android.OptionalPathForPath(library.outputFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
if len(library.logtagsSrcs) > 0 {
|
|
|
|
var logtags []string
|
|
|
|
for _, l := range library.logtagsSrcs {
|
|
|
|
logtags = append(logtags, l.Rel())
|
|
|
|
}
|
|
|
|
entries.AddStrings("LOCAL_LOGTAGS_FILES", logtags...)
|
2017-12-08 00:28:59 +01:00
|
|
|
}
|
2019-12-11 09:27:07 +01:00
|
|
|
|
|
|
|
if library.installFile == nil {
|
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
|
|
|
}
|
|
|
|
if library.dexJarFile != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile)
|
|
|
|
}
|
|
|
|
if len(library.dexpreopter.builtInstalled) > 0 {
|
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", library.dexpreopter.builtInstalled)
|
|
|
|
}
|
Abstract sdk_version string using sdkSpec type
The value format that sdk_version (and min_sdk_version, etc.) can have
has consistently evolved and is quite complicated. Furthermore, with the
Mainline module effort, we are expected to have more sdk_versions like
'module-app-current', 'module-lib-current', etc.
The goal of this change is to abstract the various sdk versions, which
are currently represented in string and is parsed in various places,
into a type called sdkSpec, so that adding new sdk veresions becomes
easier than before.
The sdk_version string is now parsed in only one place 'SdkSpecFrom', in
which it is converted into the sdkSpec struct. The struct type provides
several methods that again converts sdkSpec into context-specific
information such as the effective version number, etc.
Bug: 146757305
Bug: 147879031
Test: m
Change-Id: I252f3706544f00ea71c61c23460f07561dd28ab0
2020-01-20 18:03:43 +01:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", library.sdkVersion().raw)
|
2019-12-11 09:27:07 +01:00
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar)
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", library.headerJarFile)
|
|
|
|
|
|
|
|
if library.jacocoReportClassesFile != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", library.jacocoReportClassesFile)
|
|
|
|
}
|
|
|
|
|
|
|
|
entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", library.exportedSdkLibs...)
|
|
|
|
|
2020-06-03 19:14:31 +02:00
|
|
|
if len(library.additionalCheckedModules) != 0 {
|
|
|
|
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", library.additionalCheckedModules.Strings()...)
|
|
|
|
}
|
|
|
|
|
2019-12-11 09:27:07 +01:00
|
|
|
if library.proguardDictionary != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", library.proguardDictionary)
|
|
|
|
}
|
|
|
|
entries.SetString("LOCAL_MODULE_STEM", library.Stem())
|
|
|
|
},
|
2019-08-29 23:56:03 +02:00
|
|
|
},
|
2019-12-11 09:27:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hostDexEntries := library.AndroidMkEntriesHostDex()
|
|
|
|
|
|
|
|
entriesList = append(entriesList, mainEntries, hostDexEntries)
|
|
|
|
return entriesList
|
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-12-03 05:24:29 +01:00
|
|
|
func (j *Test) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := j.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2019-08-29 23:56:03 +02:00
|
|
|
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)
|
2020-01-07 00:47:57 +01:00
|
|
|
if !BoolDefault(j.testProperties.Auto_gen_config, true) {
|
|
|
|
entries.SetString("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", "true")
|
|
|
|
}
|
2018-04-10 03:40:24 +02:00
|
|
|
})
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
return entriesList
|
2018-04-10 03:40:24 +02:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := j.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
|
|
|
testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites)
|
2019-03-20 13:45:53 +01:00
|
|
|
})
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
return entriesList
|
2019-03-20 13:45:53 +01:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
|
2019-10-11 07:59:13 +02:00
|
|
|
if !prebuilt.IsForPlatform() || !prebuilt.ContainingSdk().Unversioned() {
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-07-25 15:02:35 +02:00
|
|
|
Disabled: true,
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2019-07-25 15:02:35 +02:00
|
|
|
}
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{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)
|
Abstract sdk_version string using sdkSpec type
The value format that sdk_version (and min_sdk_version, etc.) can have
has consistently evolved and is quite complicated. Furthermore, with the
Mainline module effort, we are expected to have more sdk_versions like
'module-app-current', 'module-lib-current', etc.
The goal of this change is to abstract the various sdk versions, which
are currently represented in string and is parsed in various places,
into a type called sdkSpec, so that adding new sdk veresions becomes
easier than before.
The sdk_version string is now parsed in only one place 'SdkSpecFrom', in
which it is converted into the sdkSpec struct. The struct type provides
several methods that again converts sdkSpec into context-specific
information such as the effective version number, etc.
Bug: 146757305
Bug: 147879031
Test: m
Change-Id: I252f3706544f00ea71c61c23460f07561dd28ab0
2020-01-20 18:03:43 +01:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion().raw)
|
2019-10-29 03:23:10 +01:00
|
|
|
entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
|
2017-08-11 02:00:19 +02:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2015-07-09 03:13:11 +02:00
|
|
|
}
|
2017-08-11 02:09:43 +02:00
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (prebuilt *DexImport) AndroidMkEntries() []android.AndroidMkEntries {
|
2019-07-25 15:02:35 +02:00
|
|
|
if !prebuilt.IsForPlatform() {
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-07-25 15:02:35 +02:00
|
|
|
Disabled: true,
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2019-07-25 15:02:35 +02:00
|
|
|
}
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{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-10-29 03:23:10 +01:00
|
|
|
entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
|
2019-02-22 03:12:14 +01:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2019-02-22 03:12:14 +01:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (prebuilt *AARImport) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-05-20 02:06:00 +02:00
|
|
|
if !prebuilt.IsForPlatform() {
|
|
|
|
return []android.AndroidMkEntries{{
|
|
|
|
Disabled: true,
|
|
|
|
}}
|
|
|
|
}
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{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)
|
Abstract sdk_version string using sdkSpec type
The value format that sdk_version (and min_sdk_version, etc.) can have
has consistently evolved and is quite complicated. Furthermore, with the
Mainline module effort, we are expected to have more sdk_versions like
'module-app-current', 'module-lib-current', etc.
The goal of this change is to abstract the various sdk versions, which
are currently represented in string and is parsed in various places,
into a type called sdkSpec, so that adding new sdk veresions becomes
easier than before.
The sdk_version string is now parsed in only one place 'SdkSpecFrom', in
which it is converted into the sdkSpec struct. The struct type provides
several methods that again converts sdkSpec into context-specific
information such as the effective version number, etc.
Bug: 146757305
Bug: 147879031
Test: m
Change-Id: I252f3706544f00ea71c61c23460f07561dd28ab0
2020-01-20 18:03:43 +01:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion().raw)
|
2018-02-21 02:22:23 +01:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2018-02-21 02:22:23 +01:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01: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-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{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
|
|
|
},
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2017-12-05 22:42:45 +01:00
|
|
|
} else {
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{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
|
|
|
},
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2017-08-11 02:09:43 +02:00
|
|
|
}
|
|
|
|
}
|
2017-11-23 01:20:45 +01:00
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-03-26 22:01:48 +01:00
|
|
|
if !app.IsForPlatform() || app.appProperties.HideFromMake {
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-11-11 02:14:32 +01:00
|
|
|
Disabled: true,
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2019-11-11 02:14:32 +01:00
|
|
|
}
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{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)
|
2020-03-26 22:01:48 +01:00
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", app.appProperties.PreventInstall)
|
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-10-17 05:54:30 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", app.Privileged())
|
2017-12-14 20:22:55 +01:00
|
|
|
|
2020-01-31 19:11:47 +01:00
|
|
|
entries.SetString("LOCAL_CERTIFICATE", app.certificate.AndroidMkString())
|
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
|
|
|
}
|
2020-03-26 22:01:48 +01:00
|
|
|
if len(app.jniCoverageOutputs) > 0 {
|
|
|
|
entries.AddStrings("LOCAL_PREBUILT_COVERAGE_ARCHIVE", app.jniCoverageOutputs.Strings()...)
|
|
|
|
}
|
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-11-07 23:14:38 +01:00
|
|
|
for _, extra := range app.extraOutputFiles {
|
|
|
|
install := app.onDeviceDir + "/" + extra.Base()
|
|
|
|
entries.AddStrings("LOCAL_SOONG_BUILT_INSTALLED", extra.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
|
|
|
},
|
|
|
|
},
|
2019-12-03 05:24:29 +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-12-03 05:24:29 +01:00
|
|
|
func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := a.AndroidApp.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2019-08-29 23:56:03 +02:00
|
|
|
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-12-03 05:24:29 +01:00
|
|
|
return entriesList
|
2018-05-22 20:11:52 +02:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := a.AndroidApp.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
|
|
|
|
testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites)
|
2018-10-05 00:22:03 +02:00
|
|
|
})
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
return entriesList
|
2018-10-05 00:22:03 +02:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-05-20 02:06:00 +02:00
|
|
|
if !a.IsForPlatform() {
|
|
|
|
return []android.AndroidMkEntries{{
|
|
|
|
Disabled: true,
|
|
|
|
}}
|
|
|
|
}
|
2019-12-03 05:24:29 +01:00
|
|
|
entriesList := a.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
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-12-03 05:24:29 +01:00
|
|
|
return entriesList
|
2017-11-23 01:20:45 +01:00
|
|
|
}
|
2018-01-11 01:06:12 +01:00
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (jd *Javadoc) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{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-12-03 05:24:29 +01:00
|
|
|
}}
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{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
|
|
|
},
|
|
|
|
},
|
|
|
|
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
|
|
|
|
2020-05-26 19:07:10 +02:00
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
|
|
|
fmt.Fprintln(w, "checkapi:",
|
|
|
|
ddoc.checkLastReleasedApiTimestamp.String())
|
2019-01-23 14:51:55 +01:00
|
|
|
|
2020-05-26 19:07:10 +02:00
|
|
|
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
|
|
|
},
|
|
|
|
},
|
2019-12-03 05:24:29 +01:00
|
|
|
}}
|
2018-01-11 01:06:12 +01:00
|
|
|
}
|
2018-08-11 01:06:24 +02:00
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-04-08 19:18:03 +02:00
|
|
|
// If the stubsSrcJar is not generated (because generate_stubs is false) then
|
|
|
|
// use the api file as the output file to ensure the relevant phony targets
|
|
|
|
// are created in make if only the api txt file is being generated. This is
|
|
|
|
// needed because an invalid output file would prevent the make entries from
|
|
|
|
// being written.
|
|
|
|
// TODO(b/146727827): Revert when we do not need to generate stubs and API separately.
|
2020-06-15 07:24:19 +02:00
|
|
|
distFile := dstubs.apiFile
|
2020-04-08 19:18:03 +02:00
|
|
|
outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar)
|
|
|
|
if !outputFile.Valid() {
|
2020-06-15 07:24:19 +02:00
|
|
|
outputFile = android.OptionalPathForPath(distFile)
|
2020-04-08 19:18:03 +02:00
|
|
|
}
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2018-09-05 02:14:32 +02:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2020-06-15 07:24:19 +02:00
|
|
|
DistFiles: android.MakeDefaultDistFiles(distFile),
|
2020-04-08 19:18:03 +02:00
|
|
|
OutputFile: outputFile,
|
2018-09-05 02:14:32 +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 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)
|
|
|
|
}
|
2019-10-10 20:29:11 +02:00
|
|
|
if dstubs.metadataZip != nil {
|
|
|
|
entries.SetPath("LOCAL_DROIDDOC_METADATA_ZIP", dstubs.metadataZip)
|
|
|
|
}
|
2019-09-05 05:17:54 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
|
2020-04-17 12:48:24 +02:00
|
|
|
if dstubs.apiFile != nil {
|
|
|
|
fmt.Fprintf(w, ".PHONY: %s %s.txt\n", dstubs.Name(), dstubs.Name())
|
|
|
|
fmt.Fprintf(w, "%s %s.txt: %s\n", dstubs.Name(), dstubs.Name(), dstubs.apiFile)
|
|
|
|
}
|
|
|
|
if dstubs.removedApiFile != nil {
|
|
|
|
fmt.Fprintf(w, ".PHONY: %s %s.txt\n", dstubs.Name(), dstubs.Name())
|
|
|
|
fmt.Fprintf(w, "%s %s.txt: %s\n", dstubs.Name(), dstubs.Name(), dstubs.removedApiFile)
|
|
|
|
}
|
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
|
|
|
|
2020-04-21 20:52:39 +02:00
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
|
|
|
fmt.Fprintln(w, "checkapi:",
|
|
|
|
dstubs.checkLastReleasedApiTimestamp.String())
|
2019-01-23 14:51:55 +01:00
|
|
|
|
2020-04-21 20:52:39 +02:00
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
2019-10-10 12:07:03 +02:00
|
|
|
if dstubs.apiLintTimestamp != nil {
|
|
|
|
fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-api-lint")
|
|
|
|
fmt.Fprintln(w, dstubs.Name()+"-api-lint:",
|
|
|
|
dstubs.apiLintTimestamp.String())
|
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
|
|
|
fmt.Fprintln(w, "checkapi:",
|
2019-11-01 13:42:39 +01:00
|
|
|
dstubs.Name()+"-api-lint")
|
2019-10-10 12:07:03 +02:00
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
2019-11-01 13:42:39 +01:00
|
|
|
|
|
|
|
if dstubs.apiLintReport != nil {
|
|
|
|
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n", dstubs.Name()+"-api-lint",
|
|
|
|
dstubs.apiLintReport.String(), "apilint/"+dstubs.Name()+"-lint-report.txt")
|
|
|
|
}
|
2019-10-10 12:07:03 +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-12-03 05:24:29 +01:00
|
|
|
}}
|
2018-09-05 02:14:32 +02:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-04-21 15:34:28 +02:00
|
|
|
if !a.IsForPlatform() {
|
|
|
|
// The non-platform variant is placed inside APEX. No reason to
|
|
|
|
// make it available to Make.
|
|
|
|
return nil
|
|
|
|
}
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{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) {
|
2019-10-17 05:54:30 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", a.Privileged())
|
2020-01-28 23:00:53 +01:00
|
|
|
entries.SetString("LOCAL_CERTIFICATE", a.certificate.AndroidMkString())
|
2019-08-28 02:33:16 +02:00
|
|
|
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-12-03 05:24:29 +01:00
|
|
|
}}
|
2019-04-15 18:48:31 +02:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (a *AndroidTestImport) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := a.AndroidAppImport.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2019-08-28 00:01:50 +02:00
|
|
|
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
|
|
|
})
|
2019-12-03 05:24:29 +01:00
|
|
|
return entriesList
|
2019-08-28 00:01:50 +02:00
|
|
|
}
|
|
|
|
|
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...)
|
|
|
|
}
|
2020-01-18 19:33:43 +01:00
|
|
|
|
|
|
|
func (r *RuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
|
|
|
Class: "ETC",
|
|
|
|
OutputFile: android.OptionalPathForPath(r.outputFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
2020-01-31 19:11:47 +01:00
|
|
|
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
|
2020-01-18 19:33:43 +01:00
|
|
|
entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
|
2020-04-25 00:22:40 +02:00
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
|
2020-01-18 19:33:43 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
}
|
2020-04-23 18:49:59 +02:00
|
|
|
|
|
|
|
func (apkSet *AndroidAppSet) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{
|
|
|
|
android.AndroidMkEntries{
|
|
|
|
Class: "APPS",
|
|
|
|
OutputFile: android.OptionalPathForPath(apkSet.packedOutput),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_android_app_set.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged())
|
|
|
|
entries.SetString("LOCAL_APK_SET_MASTER_FILE", apkSet.masterFile)
|
2020-06-30 04:18:44 +02:00
|
|
|
entries.SetPath("LOCAL_APKCERTS_FILE", apkSet.apkcertsFile)
|
2020-04-23 18:49:59 +02:00
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", apkSet.properties.Overrides...)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|