2015-07-09 09:13:11 +08: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-03 02:05:49 +08:00
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
|
2016-05-19 06:37:25 +08:00
|
|
|
"android/soong/android"
|
2015-07-09 09:13:11 +08:00
|
|
|
)
|
|
|
|
|
2019-12-11 16:27:07 +08:00
|
|
|
func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries {
|
|
|
|
hostDexNeeded := Bool(library.deviceProperties.Hostdex) && !library.Host()
|
2020-09-16 09:30:11 +08:00
|
|
|
if library.hideApexVariantFromMake {
|
2019-12-11 16:27:07 +08:00
|
|
|
hostDexNeeded = false
|
|
|
|
}
|
|
|
|
|
|
|
|
if hostDexNeeded {
|
|
|
|
var output android.Path
|
2019-01-15 06:13:51 +08:00
|
|
|
if library.dexJarFile != nil {
|
2019-12-11 16:27:07 +08:00
|
|
|
output = library.dexJarFile
|
2019-01-15 06:13:51 +08:00
|
|
|
} else {
|
2019-12-11 16:27:07 +08:00
|
|
|
output = library.implementationAndResourcesJar
|
2019-04-04 06:47:29 +08:00
|
|
|
}
|
2019-12-11 16:27:07 +08: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{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-12-11 16:27:07 +08:00
|
|
|
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-25 04:41:45 +08:00
|
|
|
}
|
2018-10-19 12:46:09 +08:00
|
|
|
}
|
2019-12-11 16:27:07 +08:00
|
|
|
return android.AndroidMkEntries{Disabled: true}
|
2018-10-19 12:46:09 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
2019-12-11 16:27:07 +08:00
|
|
|
var entriesList []android.AndroidMkEntries
|
|
|
|
|
2020-09-16 09:30:11 +08:00
|
|
|
if library.hideApexVariantFromMake {
|
|
|
|
// For a java library built for an APEX we don't need Make module
|
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
|
|
|
} else if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
|
|
|
|
// Platform variant. If not available for the platform, we don't need Make module.
|
|
|
|
// May still need to add some additional dependencies.
|
2020-06-04 01:14:31 +08:00
|
|
|
checkedModulePaths := library.additionalCheckedModules
|
2020-09-16 09:30:11 +08:00
|
|
|
if len(checkedModulePaths) != 0 {
|
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{
|
2020-06-04 01:14:31 +08:00
|
|
|
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{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2020-06-04 01:14:31 +08:00
|
|
|
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", checkedModulePaths.Strings()...)
|
|
|
|
},
|
|
|
|
},
|
2020-09-16 09:30:11 +08:00
|
|
|
})
|
|
|
|
} else {
|
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
2020-06-04 01:14:31 +08:00
|
|
|
}
|
|
|
|
} else {
|
2020-09-16 09:30:11 +08:00
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{
|
2019-12-11 16:27:07 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(library.outputFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-12-11 16:27:07 +08:00
|
|
|
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 07:28:59 +08:00
|
|
|
}
|
2019-12-11 16:27:07 +08: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)
|
|
|
|
}
|
2021-04-02 07:45:46 +08:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", library.sdkVersion.String())
|
2019-12-11 16:27:07 +08: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)
|
|
|
|
}
|
|
|
|
|
2020-10-08 19:53:58 +08:00
|
|
|
entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", library.classLoaderContexts.UsesLibs()...)
|
2019-12-11 16:27:07 +08:00
|
|
|
|
2020-06-04 01:14:31 +08:00
|
|
|
if len(library.additionalCheckedModules) != 0 {
|
|
|
|
entries.AddStrings("LOCAL_ADDITIONAL_CHECKED_MODULE", library.additionalCheckedModules.Strings()...)
|
|
|
|
}
|
|
|
|
|
2020-08-15 08:39:29 +08:00
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", library.dexer.proguardDictionary)
|
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", library.dexer.proguardUsageZip)
|
2019-12-11 16:27:07 +08:00
|
|
|
entries.SetString("LOCAL_MODULE_STEM", library.Stem())
|
2020-07-04 02:56:24 +08:00
|
|
|
|
2020-07-22 11:31:17 +08:00
|
|
|
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", library.linter.reports)
|
2021-01-15 01:52:43 +08:00
|
|
|
|
|
|
|
if library.dexpreopter.configPath != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath)
|
|
|
|
}
|
2019-12-11 16:27:07 +08:00
|
|
|
},
|
2019-08-30 05:56:03 +08:00
|
|
|
},
|
2020-09-16 09:30:11 +08:00
|
|
|
})
|
2019-12-11 16:27:07 +08:00
|
|
|
}
|
|
|
|
|
2020-09-16 09:30:11 +08:00
|
|
|
entriesList = append(entriesList, library.AndroidMkEntriesHostDex())
|
2019-12-11 16:27:07 +08:00
|
|
|
|
|
|
|
return entriesList
|
2015-07-09 09:13:11 +08:00
|
|
|
}
|
|
|
|
|
2019-03-20 20:45:53 +08:00
|
|
|
// Called for modules that are a component of a test suite.
|
2019-08-30 05:56:03 +08:00
|
|
|
func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string) {
|
2019-08-28 06:01:50 +08:00
|
|
|
entries.SetString("LOCAL_MODULE_TAGS", "tests")
|
|
|
|
if len(test_suites) > 0 {
|
2020-11-25 04:42:58 +08:00
|
|
|
entries.AddCompatibilityTestSuites(test_suites...)
|
2019-08-28 06:01:50 +08:00
|
|
|
} else {
|
2020-11-25 04:42:58 +08:00
|
|
|
entries.AddCompatibilityTestSuites("null-suite")
|
2019-08-28 06:01:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (j *Test) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := j.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-04 04:18:24 +08:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-08-30 05:56:03 +08:00
|
|
|
testSuiteComponent(entries, j.testProperties.Test_suites)
|
2018-08-08 07:49:25 +08:00
|
|
|
if j.testConfig != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_FULL_TEST_CONFIG", j.testConfig)
|
2018-08-03 06:00:46 +08:00
|
|
|
}
|
2020-08-16 03:24:26 +08:00
|
|
|
androidMkWriteExtraTestConfigs(j.extraTestConfigs, entries)
|
2019-08-30 05:56:03 +08:00
|
|
|
androidMkWriteTestData(j.data, entries)
|
2020-01-07 07:47:57 +08:00
|
|
|
if !BoolDefault(j.testProperties.Auto_gen_config, true) {
|
|
|
|
entries.SetString("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", "true")
|
|
|
|
}
|
2020-08-17 18:46:00 +08:00
|
|
|
entries.AddStrings("LOCAL_TEST_MAINLINE_MODULES", j.testProperties.Test_mainline_modules...)
|
2020-11-14 06:33:46 +08:00
|
|
|
if Bool(j.testProperties.Test_options.Unit_test) {
|
|
|
|
entries.SetBool("LOCAL_IS_UNIT_TEST", true)
|
|
|
|
}
|
2018-04-10 09:40:24 +08:00
|
|
|
})
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
return entriesList
|
2018-04-10 09:40:24 +08:00
|
|
|
}
|
|
|
|
|
2020-08-16 03:24:26 +08:00
|
|
|
func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *android.AndroidMkEntries) {
|
|
|
|
if len(extraTestConfigs) > 0 {
|
|
|
|
entries.AddStrings("LOCAL_EXTRA_FULL_TEST_CONFIGS", extraTestConfigs.Strings()...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := j.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-04 04:18:24 +08:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-08-30 05:56:03 +08:00
|
|
|
testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites)
|
2019-03-20 20:45:53 +08:00
|
|
|
})
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
return entriesList
|
2019-03-20 20:45:53 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-09-16 09:30:11 +08:00
|
|
|
if prebuilt.hideApexVariantFromMake || !prebuilt.ContainingSdk().Unversioned() {
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-07-25 21:02:35 +08:00
|
|
|
Disabled: true,
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2019-07-25 21:02:35 +08:00
|
|
|
}
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2017-08-11 08:00:19 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
|
2017-09-08 04:20:25 +08:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable))
|
2021-01-12 04:27:24 +08:00
|
|
|
if prebuilt.dexJarFile != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
|
|
|
|
}
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.combinedClasspathFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.combinedClasspathFile)
|
2021-04-02 07:45:46 +08:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion.String())
|
2019-10-29 10:23:10 +08:00
|
|
|
entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
|
2017-08-11 08:00:19 +08:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2015-07-09 09:13:11 +08:00
|
|
|
}
|
2017-08-11 08:09:43 +08:00
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (prebuilt *DexImport) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-09-16 09:30:11 +08:00
|
|
|
if prebuilt.hideApexVariantFromMake {
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-07-25 21:02:35 +08:00
|
|
|
Disabled: true,
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2019-07-25 21:02:35 +08:00
|
|
|
}
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-02-22 10:12:14 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2021-02-27 06:54:36 +08:00
|
|
|
OutputFile: android.OptionalPathForPath(prebuilt.dexJarFile),
|
2019-02-22 10:12:14 +08:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-02-22 10:12:14 +08:00
|
|
|
if prebuilt.dexJarFile != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
|
2019-02-22 10:12:14 +08:00
|
|
|
}
|
|
|
|
if len(prebuilt.dexpreopter.builtInstalled) > 0 {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", prebuilt.dexpreopter.builtInstalled)
|
2019-02-22 10:12:14 +08:00
|
|
|
}
|
2019-10-29 10:23:10 +08:00
|
|
|
entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
|
2019-02-22 10:12:14 +08:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2019-02-22 10:12:14 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (prebuilt *AARImport) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-09-16 09:30:11 +08:00
|
|
|
if prebuilt.hideApexVariantFromMake {
|
2020-05-20 08:06:00 +08:00
|
|
|
return []android.AndroidMkEntries{{
|
|
|
|
Disabled: true,
|
|
|
|
}}
|
|
|
|
}
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2018-02-21 09:22:23 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(prebuilt.classpathFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 11:17:54 +08:00
|
|
|
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)
|
2021-04-02 07:45:46 +08:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion.String())
|
2018-02-21 09:22:23 +08:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2018-02-21 09:22:23 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
|
2017-08-11 08:09:43 +08:00
|
|
|
|
2017-12-06 05:42:45 +08:00
|
|
|
if !binary.isWrapperVariant {
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2017-12-06 05:42:45 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2018-08-16 11:40:52 +08:00
|
|
|
OutputFile: android.OptionalPathForPath(binary.outputFile),
|
2017-12-06 05:42:45 +08:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", binary.headerJarFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", binary.implementationAndResourcesJar)
|
2019-01-15 04:35:45 +08:00
|
|
|
if binary.dexJarFile != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", binary.dexJarFile)
|
2019-01-15 04:35:45 +08:00
|
|
|
}
|
|
|
|
if len(binary.dexpreopter.builtInstalled) > 0 {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled)
|
2019-01-15 04:35:45 +08:00
|
|
|
}
|
2018-08-16 11:40:52 +08:00
|
|
|
},
|
|
|
|
},
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
2020-12-08 02:23:54 +08:00
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
2019-09-05 11:17:54 +08:00
|
|
|
fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)")
|
|
|
|
},
|
2017-12-06 05:42:45 +08:00
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2017-12-06 05:42:45 +08:00
|
|
|
} else {
|
2021-02-20 09:37:04 +08:00
|
|
|
outputFile := binary.wrapperFile
|
|
|
|
// Have Make installation trigger Soong installation by using Soong's install path as
|
|
|
|
// the output file.
|
|
|
|
if binary.Host() {
|
|
|
|
outputFile = binary.binaryFile
|
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2017-12-06 05:42:45 +08:00
|
|
|
Class: "EXECUTABLES",
|
2021-02-20 09:37:04 +08:00
|
|
|
OutputFile: android.OptionalPathForPath(outputFile),
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetBool("LOCAL_STRIP_MODULE", false)
|
2017-12-06 05:42:45 +08:00
|
|
|
},
|
|
|
|
},
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
2020-12-08 02:23:54 +08:00
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
2019-09-05 11:17:54 +08:00
|
|
|
// 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-06 05:42:45 +08:00
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2017-08-11 08:09:43 +08:00
|
|
|
}
|
|
|
|
}
|
2017-11-23 08:20:45 +08:00
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-09-16 09:30:11 +08:00
|
|
|
if app.hideApexVariantFromMake || app.appProperties.HideFromMake {
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-11-11 09:14:32 +08:00
|
|
|
Disabled: true,
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2019-11-11 09:14:32 +08:00
|
|
|
}
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2017-11-23 08:20:45 +08:00
|
|
|
Class: "APPS",
|
|
|
|
OutputFile: android.OptionalPathForPath(app.outputFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
2019-08-30 05:56:03 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-08-30 05:56:03 +08:00
|
|
|
// App module names can be overridden.
|
|
|
|
entries.SetString("LOCAL_MODULE", app.installApkName)
|
2020-03-27 05:01:48 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", app.appProperties.PreventInstall)
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", app.exportPackage)
|
2017-12-14 14:42:59 +08:00
|
|
|
if app.dexJarFile != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", app.dexJarFile)
|
2017-12-14 14:42:59 +08:00
|
|
|
}
|
2018-08-16 11:40:52 +08:00
|
|
|
if app.implementationAndResourcesJar != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", app.implementationAndResourcesJar)
|
2017-12-15 05:19:01 +08:00
|
|
|
}
|
|
|
|
if app.headerJarFile != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", app.headerJarFile)
|
2017-12-15 05:19:01 +08:00
|
|
|
}
|
2018-10-30 14:14:58 +08:00
|
|
|
if app.bundleFile != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_BUNDLE", app.bundleFile)
|
2018-10-30 14:14:58 +08:00
|
|
|
}
|
2017-12-14 14:42:59 +08:00
|
|
|
if app.jacocoReportClassesFile != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", app.jacocoReportClassesFile)
|
2017-12-14 14:42:59 +08:00
|
|
|
}
|
2020-08-15 08:39:29 +08:00
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", app.dexer.proguardDictionary)
|
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", app.dexer.proguardUsageZip)
|
2017-11-23 08:20:45 +08:00
|
|
|
|
2017-12-14 14:42:59 +08:00
|
|
|
if app.Name() == "framework-res" {
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
|
2017-12-14 14:42:59 +08:00
|
|
|
// Make base_rules.mk not put framework-res in a subdirectory called
|
|
|
|
// framework_res.
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true)
|
2017-12-14 14:42:59 +08:00
|
|
|
}
|
2017-11-23 08:20:45 +08:00
|
|
|
|
2019-03-18 23:53:16 +08: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-18 01:52:26 +08: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 23:53:16 +08:00
|
|
|
return android.ReversePaths(paths)
|
|
|
|
}
|
|
|
|
deviceRRODirs := filterRRO(device)
|
|
|
|
if len(deviceRRODirs) > 0 {
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.AddStrings("LOCAL_SOONG_DEVICE_RRO_DIRS", deviceRRODirs.Strings()...)
|
2019-03-18 23:53:16 +08:00
|
|
|
}
|
|
|
|
productRRODirs := filterRRO(product)
|
|
|
|
if len(productRRODirs) > 0 {
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.AddStrings("LOCAL_SOONG_PRODUCT_RRO_DIRS", productRRODirs.Strings()...)
|
2017-12-14 14:42:59 +08:00
|
|
|
}
|
2017-12-01 12:13:19 +08:00
|
|
|
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_EXPORT_PACKAGE_RESOURCES", Bool(app.appProperties.Export_package_resources))
|
2017-12-14 14:42:59 +08:00
|
|
|
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", app.manifestPath)
|
2017-12-14 14:42:59 +08:00
|
|
|
|
2019-10-17 11:54:30 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", app.Privileged())
|
2017-12-15 03:22:55 +08:00
|
|
|
|
2020-02-01 02:11:47 +08:00
|
|
|
entries.SetString("LOCAL_CERTIFICATE", app.certificate.AndroidMkString())
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", app.getOverriddenPackages()...)
|
2018-10-03 13:03:40 +08:00
|
|
|
|
2020-07-07 05:15:24 +08:00
|
|
|
if app.embeddedJniLibs {
|
|
|
|
jniSymbols := app.JNISymbolsInstalls(app.installPathForJNISymbols.String())
|
|
|
|
entries.SetString("LOCAL_SOONG_JNI_LIBS_SYMBOLS", jniSymbols.String())
|
|
|
|
} else {
|
|
|
|
for _, jniLib := range app.jniLibs {
|
|
|
|
entries.AddStrings("LOCAL_SOONG_JNI_LIBS_"+jniLib.target.Arch.ArchType.String(), jniLib.name)
|
|
|
|
}
|
2018-10-03 13:03:40 +08:00
|
|
|
}
|
2020-07-07 05:15:24 +08:00
|
|
|
|
2020-03-27 05:01:48 +08:00
|
|
|
if len(app.jniCoverageOutputs) > 0 {
|
|
|
|
entries.AddStrings("LOCAL_PREBUILT_COVERAGE_ARCHIVE", app.jniCoverageOutputs.Strings()...)
|
|
|
|
}
|
2018-11-13 02:13:39 +08:00
|
|
|
if len(app.dexpreopter.builtInstalled) > 0 {
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", app.dexpreopter.builtInstalled)
|
2018-11-13 02:13:39 +08:00
|
|
|
}
|
2021-04-07 23:00:19 +08:00
|
|
|
if app.dexpreopter.configPath != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", app.dexpreopter.configPath)
|
|
|
|
}
|
2019-11-08 06:14:38 +08:00
|
|
|
for _, extra := range app.extraOutputFiles {
|
|
|
|
install := app.onDeviceDir + "/" + extra.Base()
|
|
|
|
entries.AddStrings("LOCAL_SOONG_BUILT_INSTALLED", extra.String()+":"+install)
|
2019-03-20 07:03:11 +08:00
|
|
|
}
|
2020-07-04 02:56:24 +08:00
|
|
|
|
2020-07-22 11:31:17 +08:00
|
|
|
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
|
2019-08-30 05:56:03 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
2020-12-08 02:23:54 +08:00
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
2019-07-02 08:15:13 +08: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 08:20:45 +08:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2018-03-29 05:58:31 +08:00
|
|
|
}
|
|
|
|
|
2019-01-31 05:13:52 +08: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 12:24:29 +08:00
|
|
|
func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := a.AndroidApp.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-04 04:18:24 +08:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-08-30 05:56:03 +08:00
|
|
|
testSuiteComponent(entries, a.testProperties.Test_suites)
|
2018-08-08 07:49:25 +08:00
|
|
|
if a.testConfig != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_FULL_TEST_CONFIG", a.testConfig)
|
2018-08-03 06:00:46 +08:00
|
|
|
}
|
2020-08-16 03:24:26 +08:00
|
|
|
androidMkWriteExtraTestConfigs(a.extraTestConfigs, entries)
|
2019-08-30 05:56:03 +08:00
|
|
|
androidMkWriteTestData(a.data, entries)
|
2020-08-17 18:46:00 +08:00
|
|
|
entries.AddStrings("LOCAL_TEST_MAINLINE_MODULES", a.testProperties.Test_mainline_modules...)
|
2018-05-23 02:11:52 +08:00
|
|
|
})
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
return entriesList
|
2018-05-23 02:11:52 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := a.AndroidApp.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-04 04:18:24 +08:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-08-30 05:56:03 +08:00
|
|
|
testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites)
|
2021-05-28 01:30:26 +08:00
|
|
|
// introduce a flag variable to control the generation of the .config file
|
|
|
|
entries.SetString("LOCAL_DISABLE_TEST_CONFIG", "true")
|
2018-10-05 06:22:03 +08:00
|
|
|
})
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
return entriesList
|
2018-10-05 06:22:03 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-09-16 09:30:11 +08:00
|
|
|
if a.hideApexVariantFromMake {
|
2020-05-20 08:06:00 +08:00
|
|
|
return []android.AndroidMkEntries{{
|
|
|
|
Disabled: true,
|
|
|
|
}}
|
|
|
|
}
|
2019-12-03 12:24:29 +08:00
|
|
|
entriesList := a.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2018-03-29 05:58:31 +08:00
|
|
|
|
2020-07-04 04:18:24 +08:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2018-10-30 14:15:37 +08:00
|
|
|
if a.aarFile != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
|
2018-10-30 14:15:37 +08:00
|
|
|
}
|
2017-11-23 08:20:45 +08:00
|
|
|
|
2018-03-29 05:58:31 +08:00
|
|
|
if a.Name() == "framework-res" {
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
|
2018-03-29 05:58:31 +08:00
|
|
|
// Make base_rules.mk not put framework-res in a subdirectory called
|
|
|
|
// framework_res.
|
2019-08-30 05:56:03 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true)
|
2018-03-29 05:58:31 +08:00
|
|
|
}
|
|
|
|
|
2019-09-05 11:17:54 +08: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-30 05:56:03 +08:00
|
|
|
entries.AddStrings("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.exportedProguardFlagFiles.Strings()...)
|
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
2018-03-29 05:58:31 +08:00
|
|
|
})
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
return entriesList
|
2017-11-23 08:20:45 +08:00
|
|
|
}
|
2018-01-11 08:06:12 +08:00
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (jd *Javadoc) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2018-01-11 08:06:12 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2018-03-09 09:26:16 +08:00
|
|
|
OutputFile: android.OptionalPathForPath(jd.stubsSrcJar),
|
2018-08-09 12:44:48 +08:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2018-04-11 07:14:46 +08:00
|
|
|
if BoolDefault(jd.properties.Installable, true) {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip)
|
2018-01-11 08:06:12 +08:00
|
|
|
}
|
2018-03-09 09:26:16 +08:00
|
|
|
if jd.stubsSrcJar != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", jd.stubsSrcJar)
|
2018-01-11 08:06:12 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2018-01-11 08:06:12 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2018-01-11 08:06:12 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2020-09-10 23:29:25 +08:00
|
|
|
OutputFile: android.OptionalPathForPath(ddoc.Javadoc.docZip),
|
2018-08-09 12:44:48 +08:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2020-09-10 23:29:25 +08:00
|
|
|
if ddoc.Javadoc.docZip != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", ddoc.Javadoc.docZip)
|
2018-01-11 08:06:12 +08:00
|
|
|
}
|
2020-09-10 23:29:25 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !BoolDefault(ddoc.Javadoc.properties.Installable, true))
|
2018-01-11 08:06:12 +08:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2018-01-11 08:06:12 +08:00
|
|
|
}
|
2018-08-11 07:06:24 +08:00
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-04-09 01:18:03 +08: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.
|
2020-07-24 17:13:49 +08:00
|
|
|
//
|
|
|
|
// Note that dstubs.apiFile can be also be nil if WITHOUT_CHECKS_API is true.
|
2020-04-09 01:18:03 +08:00
|
|
|
// TODO(b/146727827): Revert when we do not need to generate stubs and API separately.
|
2020-07-24 17:13:49 +08:00
|
|
|
|
2020-04-09 01:18:03 +08:00
|
|
|
outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar)
|
|
|
|
if !outputFile.Valid() {
|
2020-07-24 17:13:49 +08:00
|
|
|
outputFile = android.OptionalPathForPath(dstubs.apiFile)
|
2020-04-09 01:18:03 +08:00
|
|
|
}
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2018-09-05 08:14:32 +08:00
|
|
|
Class: "JAVA_LIBRARIES",
|
2020-04-09 01:18:03 +08:00
|
|
|
OutputFile: outputFile,
|
2018-09-05 08:14:32 +08:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
|
2019-09-05 11:17:54 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2018-09-05 08:14:32 +08:00
|
|
|
if dstubs.Javadoc.stubsSrcJar != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar)
|
2018-09-05 08:14:32 +08:00
|
|
|
}
|
2018-09-19 01:41:33 +08:00
|
|
|
if dstubs.apiVersionsXml != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.apiVersionsXml)
|
2018-09-19 01:41:33 +08:00
|
|
|
}
|
2018-09-05 08:14:32 +08:00
|
|
|
if dstubs.annotationsZip != nil {
|
2019-09-05 11:17:54 +08:00
|
|
|
entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.annotationsZip)
|
2018-09-05 08:14:32 +08:00
|
|
|
}
|
2019-10-11 02:29:11 +08:00
|
|
|
if dstubs.metadataZip != nil {
|
|
|
|
entries.SetPath("LOCAL_DROIDDOC_METADATA_ZIP", dstubs.metadataZip)
|
|
|
|
}
|
2019-09-05 11:17:54 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
2020-12-08 02:23:54 +08:00
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
2020-04-17 18:48:24 +08: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 08:14:32 +08: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 21:51:55 +08:00
|
|
|
|
2020-04-22 02:52:39 +08:00
|
|
|
fmt.Fprintln(w, ".PHONY: checkapi")
|
|
|
|
fmt.Fprintln(w, "checkapi:",
|
|
|
|
dstubs.checkLastReleasedApiTimestamp.String())
|
2019-01-23 21:51:55 +08:00
|
|
|
|
2020-04-22 02:52:39 +08:00
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
2018-09-05 08:14:32 +08:00
|
|
|
}
|
2019-10-10 18:07:03 +08: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 20:42:39 +08:00
|
|
|
dstubs.Name()+"-api-lint")
|
2019-10-10 18:07:03 +08:00
|
|
|
|
|
|
|
fmt.Fprintln(w, ".PHONY: droidcore")
|
|
|
|
fmt.Fprintln(w, "droidcore: checkapi")
|
2019-11-01 20:42:39 +08: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 18:07:03 +08:00
|
|
|
}
|
2018-10-22 22:55:04 +08: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 08:14:32 +08:00
|
|
|
},
|
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2018-09-05 08:14:32 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries {
|
2020-09-16 09:30:11 +08:00
|
|
|
if a.hideApexVariantFromMake {
|
2020-04-21 21:34:28 +08:00
|
|
|
// The non-platform variant is placed inside APEX. No reason to
|
|
|
|
// make it available to Make.
|
|
|
|
return nil
|
|
|
|
}
|
2019-12-03 12:24:29 +08:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2019-04-16 00:48:31 +08:00
|
|
|
Class: "APPS",
|
2019-07-18 01:21:49 +08:00
|
|
|
OutputFile: android.OptionalPathForPath(a.outputFile),
|
2019-04-16 00:48:31 +08:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
|
2019-08-28 08:33:16 +08:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-10-17 11:54:30 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", a.Privileged())
|
2020-01-29 06:00:53 +08:00
|
|
|
entries.SetString("LOCAL_CERTIFICATE", a.certificate.AndroidMkString())
|
2019-08-28 08:33:16 +08: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())
|
2021-01-09 08:09:09 +08:00
|
|
|
if Bool(a.properties.Export_package_resources) {
|
|
|
|
entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", a.outputFile)
|
|
|
|
}
|
2019-08-28 08:33:16 +08:00
|
|
|
},
|
2019-04-16 00:48:31 +08:00
|
|
|
},
|
2019-12-03 12:24:29 +08:00
|
|
|
}}
|
2019-04-16 00:48:31 +08:00
|
|
|
}
|
|
|
|
|
2019-12-03 12:24:29 +08:00
|
|
|
func (a *AndroidTestImport) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := a.AndroidAppImport.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-04 04:18:24 +08:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-08-30 05:56:03 +08:00
|
|
|
testSuiteComponent(entries, a.testProperties.Test_suites)
|
|
|
|
androidMkWriteTestData(a.data, entries)
|
2019-08-28 06:01:50 +08:00
|
|
|
})
|
2019-12-03 12:24:29 +08:00
|
|
|
return entriesList
|
2019-08-28 06:01:50 +08:00
|
|
|
}
|
|
|
|
|
2019-08-30 05:56:03 +08:00
|
|
|
func androidMkWriteTestData(data android.Paths, entries *android.AndroidMkEntries) {
|
2019-08-28 06:01:50 +08:00
|
|
|
var testFiles []string
|
|
|
|
for _, d := range data {
|
|
|
|
testFiles = append(testFiles, d.String()+":"+d.Rel())
|
|
|
|
}
|
|
|
|
entries.AddStrings("LOCAL_COMPATIBILITY_SUPPORT_FILES", testFiles...)
|
|
|
|
}
|
2020-01-19 02:33:43 +08: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{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2020-02-01 02:11:47 +08:00
|
|
|
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
|
2020-01-19 02:33:43 +08:00
|
|
|
entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
|
2020-04-25 06:22:40 +08:00
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
|
2020-01-19 02:33:43 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
}
|
2020-04-24 00:49:59 +08: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{
|
2020-07-04 04:18:24 +08:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2020-04-24 00:49:59 +08:00
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged())
|
2020-07-29 06:47:38 +08:00
|
|
|
entries.SetString("LOCAL_APK_SET_INSTALL_FILE", apkSet.InstallFile())
|
2020-06-30 10:18:44 +08:00
|
|
|
entries.SetPath("LOCAL_APKCERTS_FILE", apkSet.apkcertsFile)
|
2020-04-24 00:49:59 +08:00
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", apkSet.properties.Overrides...)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|