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"
|
2022-09-02 00:47:07 +02:00
|
|
|
"strings"
|
2017-08-02 20:05:49 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
"android/soong/android"
|
2023-10-05 23:18:44 +02:00
|
|
|
|
|
|
|
"github.com/google/blueprint/proptools"
|
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()
|
2020-09-16 03:30:11 +02:00
|
|
|
if library.hideApexVariantFromMake {
|
2019-12-11 09:27:07 +01:00
|
|
|
hostDexNeeded = false
|
|
|
|
}
|
|
|
|
|
|
|
|
if hostDexNeeded {
|
|
|
|
var output android.Path
|
2021-09-15 04:34:04 +02:00
|
|
|
if library.dexJarFile.IsSet() {
|
|
|
|
output = library.dexJarFile.Path()
|
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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-12-11 09:27:07 +01:00
|
|
|
entries.SetBool("LOCAL_IS_HOST_MODULE", true)
|
|
|
|
entries.SetPath("LOCAL_PREBUILT_MODULE_FILE", output)
|
2021-09-15 04:34:04 +02:00
|
|
|
if library.dexJarFile.IsSet() {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile.Path())
|
2019-12-11 09:27:07 +01:00
|
|
|
}
|
2021-11-10 23:38:50 +01:00
|
|
|
entries.SetPath("LOCAL_SOONG_INSTALLED_MODULE", library.hostdexInstallFile)
|
2019-12-11 09:27:07 +01:00
|
|
|
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
|
|
|
|
|
2021-07-14 06:52:04 +02:00
|
|
|
if library.Os() == android.Windows {
|
|
|
|
// Make does not support Windows Java modules
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-09-16 03:30:11 +02:00
|
|
|
if library.hideApexVariantFromMake {
|
2021-09-16 08:15:39 +02:00
|
|
|
// For a java library built for an APEX, we don't need a Make module for itself. Otherwise, it
|
|
|
|
// will conflict with the platform variant because they have the same module name in the
|
|
|
|
// makefile. However, we need to add its dexpreopt outputs as sub-modules, if it is preopted.
|
|
|
|
dexpreoptEntries := library.dexpreopter.AndroidMkEntriesForApex()
|
|
|
|
if len(dexpreoptEntries) > 0 {
|
|
|
|
entriesList = append(entriesList, dexpreoptEntries...)
|
|
|
|
}
|
2020-09-16 03:30:11 +02:00
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
2023-03-20 12:05:16 +01:00
|
|
|
} else if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
|
|
|
|
// Platform variant. If not available for the platform, we don't need Make module.
|
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
2023-10-05 23:18:44 +02:00
|
|
|
} else if proptools.Bool(library.properties.Headers_only) {
|
2023-08-22 23:28:11 +02:00
|
|
|
// If generating headers only then don't expose to Make.
|
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
|
2020-06-03 19:14:31 +02:00
|
|
|
} else {
|
2020-09-16 03:30:11 +02:00
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{
|
2019-12-11 09:27:07 +01:00
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(library.outputFile),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-12-11 09:27:07 +01: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 00:28:59 +01:00
|
|
|
}
|
2019-12-11 09:27:07 +01:00
|
|
|
|
2023-03-20 12:05:16 +01:00
|
|
|
if library.installFile == nil {
|
2019-12-11 09:27:07 +01:00
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
|
|
|
}
|
2021-09-15 04:34:04 +02:00
|
|
|
if library.dexJarFile.IsSet() {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile.Path())
|
2019-12-11 09:27:07 +01:00
|
|
|
}
|
|
|
|
if len(library.dexpreopter.builtInstalled) > 0 {
|
|
|
|
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", library.dexpreopter.builtInstalled)
|
|
|
|
}
|
2021-04-02 01:45:46 +02:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", library.sdkVersion.String())
|
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)
|
|
|
|
}
|
|
|
|
|
2021-08-12 17:16:11 +02:00
|
|
|
requiredUsesLibs, optionalUsesLibs := library.classLoaderContexts.UsesLibs()
|
|
|
|
entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", append(requiredUsesLibs, optionalUsesLibs...)...)
|
2019-12-11 09:27:07 +01:00
|
|
|
|
2020-08-15 02:39:29 +02:00
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", library.dexer.proguardDictionary)
|
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", library.dexer.proguardUsageZip)
|
2019-12-11 09:27:07 +01:00
|
|
|
entries.SetString("LOCAL_MODULE_STEM", library.Stem())
|
2020-07-03 20:56:24 +02:00
|
|
|
|
2020-07-22 05:31:17 +02:00
|
|
|
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", library.linter.reports)
|
2021-01-14 18:52:43 +01:00
|
|
|
|
|
|
|
if library.dexpreopter.configPath != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath)
|
|
|
|
}
|
2023-11-17 02:05:47 +01:00
|
|
|
// TODO(b/311155208): The container here should be system.
|
2023-11-28 22:14:56 +01:00
|
|
|
|
|
|
|
entries.SetPaths("LOCAL_ACONFIG_FILES", library.mergedAconfigFiles[""])
|
2019-12-11 09:27:07 +01:00
|
|
|
},
|
2019-08-29 23:56:03 +02:00
|
|
|
},
|
2020-09-16 03:30:11 +02:00
|
|
|
})
|
2019-12-11 09:27:07 +01:00
|
|
|
}
|
|
|
|
|
2020-09-16 03:30:11 +02:00
|
|
|
entriesList = append(entriesList, library.AndroidMkEntriesHostDex())
|
2019-12-11 09:27:07 +01:00
|
|
|
|
|
|
|
return entriesList
|
2015-07-09 03:13:11 +02:00
|
|
|
}
|
|
|
|
|
2023-02-03 01:20:52 +01:00
|
|
|
func (j *JavaFuzzTest) AndroidMkEntries() []android.AndroidMkEntries {
|
2022-03-25 23:50:53 +01:00
|
|
|
entriesList := j.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
|
|
|
entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", "null-suite")
|
2022-09-28 19:53:11 +02:00
|
|
|
androidMkWriteTestData(android.Paths{j.implementationJarFile}, entries)
|
2023-02-03 01:20:52 +01:00
|
|
|
androidMkWriteTestData(j.jniFilePaths, entries)
|
|
|
|
if j.fuzzPackagedModule.Corpus != nil {
|
|
|
|
androidMkWriteTestData(j.fuzzPackagedModule.Corpus, entries)
|
|
|
|
}
|
|
|
|
if j.fuzzPackagedModule.Dictionary != nil {
|
|
|
|
androidMkWriteTestData(android.Paths{j.fuzzPackagedModule.Dictionary}, entries)
|
|
|
|
}
|
2022-03-25 23:50:53 +01:00
|
|
|
})
|
|
|
|
return entriesList
|
|
|
|
}
|
|
|
|
|
2019-03-20 13:45:53 +01:00
|
|
|
// Called for modules that are a component of a test suite.
|
2021-09-25 00:47:17 +02:00
|
|
|
func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string, perTestcaseDirectory bool) {
|
2019-08-28 00:01:50 +02:00
|
|
|
entries.SetString("LOCAL_MODULE_TAGS", "tests")
|
|
|
|
if len(test_suites) > 0 {
|
2020-11-24 21:42:58 +01:00
|
|
|
entries.AddCompatibilityTestSuites(test_suites...)
|
2019-08-28 00:01:50 +02:00
|
|
|
} else {
|
2020-11-24 21:42:58 +01:00
|
|
|
entries.AddCompatibilityTestSuites("null-suite")
|
2019-08-28 00:01:50 +02:00
|
|
|
}
|
2021-09-25 00:47:17 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_COMPATIBILITY_PER_TESTCASE_DIRECTORY", perTestcaseDirectory)
|
2019-08-28 00:01:50 +02:00
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (j *Test) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := j.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-03 22:18:24 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2021-09-25 00:47:17 +02:00
|
|
|
testSuiteComponent(entries, j.testProperties.Test_suites, Bool(j.testProperties.Per_testcase_directory))
|
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
|
|
|
}
|
2020-08-15 21:24:26 +02:00
|
|
|
androidMkWriteExtraTestConfigs(j.extraTestConfigs, entries)
|
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")
|
|
|
|
}
|
2020-08-17 12:46:00 +02:00
|
|
|
entries.AddStrings("LOCAL_TEST_MAINLINE_MODULES", j.testProperties.Test_mainline_modules...)
|
2022-08-12 12:49:20 +02:00
|
|
|
|
|
|
|
j.testProperties.Test_options.CommonTestOptions.SetAndroidMkEntries(entries)
|
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
|
|
|
}
|
|
|
|
|
2020-08-15 21:24:26 +02: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 05:24:29 +01:00
|
|
|
func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := j.Library.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-03 22:18:24 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2021-09-25 00:47:17 +02:00
|
|
|
testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites, Bool(j.testHelperLibraryProperties.Per_testcase_directory))
|
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 {
|
2021-12-20 16:08:57 +01:00
|
|
|
if prebuilt.hideApexVariantFromMake {
|
|
|
|
// For a library imported from a prebuilt APEX, we don't need a Make module for itself, as we
|
|
|
|
// don't need to install it. However, we need to add its dexpreopt outputs as sub-modules, if it
|
|
|
|
// is preopted.
|
|
|
|
dexpreoptEntries := prebuilt.dexpreopter.AndroidMkEntriesForApex()
|
|
|
|
return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true})
|
|
|
|
}
|
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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable))
|
2021-09-15 04:34:04 +02:00
|
|
|
if prebuilt.dexJarFile.IsSet() {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile.Path())
|
2021-01-11 21:27:24 +01:00
|
|
|
}
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.combinedClasspathFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.combinedClasspathFile)
|
2021-04-02 01:45:46 +02:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion.String())
|
2019-10-29 03:23:10 +01:00
|
|
|
entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem())
|
2023-07-16 22:20:33 +02:00
|
|
|
// TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts
|
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 {
|
2020-09-16 03:30:11 +02:00
|
|
|
if prebuilt.hideApexVariantFromMake {
|
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",
|
2021-09-15 04:34:04 +02:00
|
|
|
OutputFile: android.OptionalPathForPath(prebuilt.dexJarFile.Path()),
|
2019-02-22 03:12:14 +01:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2021-09-15 04:34:04 +02:00
|
|
|
if prebuilt.dexJarFile.IsSet() {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile.Path())
|
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())
|
2023-07-16 22:20:33 +02:00
|
|
|
// TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts
|
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-09-16 03:30:11 +02:00
|
|
|
if prebuilt.hideApexVariantFromMake {
|
2020-05-20 02:06:00 +02:00
|
|
|
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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 05:17:54 +02: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)
|
2023-11-22 00:13:56 +01:00
|
|
|
entries.SetPath("LOCAL_SOONG_TRANSITIVE_RES_PACKAGES", prebuilt.transitiveAaptResourcePackagesFile)
|
2019-09-05 05:17:54 +02:00
|
|
|
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 01:45:46 +02:00
|
|
|
entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion.String())
|
2023-07-16 22:20:33 +02:00
|
|
|
// TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts
|
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 {
|
2021-07-14 06:52:04 +02:00
|
|
|
if binary.Os() == android.Windows {
|
|
|
|
// Make does not support Windows Java modules
|
|
|
|
return nil
|
|
|
|
}
|
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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", binary.headerJarFile)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", binary.implementationAndResourcesJar)
|
2021-09-15 04:34:04 +02:00
|
|
|
if binary.dexJarFile.IsSet() {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", binary.dexJarFile.Path())
|
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
|
|
|
}
|
2023-11-17 02:05:47 +01:00
|
|
|
// TODO(b/311155208): The container here should be system.
|
2023-11-28 22:14:56 +01:00
|
|
|
entries.SetPaths("LOCAL_ACONFIG_FILES", binary.mergedAconfigFiles[""])
|
2018-08-16 05:40:52 +02:00
|
|
|
},
|
|
|
|
},
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
2020-12-07 19:23:54 +01:00
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
2019-09-05 05:17:54 +02:00
|
|
|
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 {
|
2021-02-20 02:37:04 +01:00
|
|
|
outputFile := binary.wrapperFile
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
return []android.AndroidMkEntries{android.AndroidMkEntries{
|
2017-12-05 22:42:45 +01:00
|
|
|
Class: "EXECUTABLES",
|
2021-02-20 02:37:04 +01:00
|
|
|
OutputFile: android.OptionalPathForPath(outputFile),
|
2019-09-05 05:17:54 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-09-05 05:17:54 +02:00
|
|
|
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{
|
2020-12-07 19:23:54 +01:00
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
2019-09-05 05:17:54 +02: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-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 {
|
2022-05-17 01:19:54 +02:00
|
|
|
if app.hideApexVariantFromMake || app.IsHideFromMake() {
|
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
|
|
|
}
|
2023-11-07 05:37:14 +01:00
|
|
|
var required []string
|
|
|
|
if proptools.Bool(app.appProperties.Generate_product_characteristics_rro) {
|
|
|
|
required = []string{app.productCharacteristicsRROPackageName()}
|
|
|
|
}
|
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",
|
2023-11-07 05:37:14 +01:00
|
|
|
Required: required,
|
2019-08-29 23:56:03 +02:00
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2019-08-29 23:56:03 +02:00
|
|
|
// 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)
|
2023-07-19 07:11:07 +02:00
|
|
|
if app.headerJarFile != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", app.headerJarFile)
|
|
|
|
}
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", app.exportPackage)
|
2021-09-15 04:34:04 +02:00
|
|
|
if app.dexJarFile.IsSet() {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEX_JAR", app.dexJarFile.Path())
|
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
|
|
|
}
|
2020-08-15 02:39:29 +02:00
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", app.dexer.proguardDictionary)
|
|
|
|
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", app.dexer.proguardUsageZip)
|
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
|
2023-06-14 01:44:58 +02:00
|
|
|
seen := make(map[android.Path]bool)
|
|
|
|
for _, d := range app.rroDirsDepSet.ToList() {
|
2019-03-18 16:53:16 +01:00
|
|
|
if d.overlayType == filter {
|
2023-06-14 01:44:58 +02:00
|
|
|
if seen[d.path] {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
seen[d.path] = true
|
2019-03-18 16:53:16 +01:00
|
|
|
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
|
|
|
|
2020-07-06 23:15:24 +02: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)
|
2022-09-02 00:47:07 +02:00
|
|
|
var partitionTag string
|
|
|
|
|
|
|
|
// Mimic the creation of partition_tag in build/make,
|
|
|
|
// which defaults to an empty string when the partition is system.
|
|
|
|
// Otherwise, capitalize with a leading _
|
|
|
|
if jniLib.partition == "system" {
|
|
|
|
partitionTag = ""
|
|
|
|
} else {
|
|
|
|
split := strings.Split(jniLib.partition, "/")
|
|
|
|
partitionTag = "_" + strings.ToUpper(split[len(split)-1])
|
|
|
|
}
|
|
|
|
entries.AddStrings("LOCAL_SOONG_JNI_LIBS_PARTITION_"+jniLib.target.Arch.ArchType.String(),
|
|
|
|
jniLib.name+":"+partitionTag)
|
2020-07-06 23:15:24 +02:00
|
|
|
}
|
2018-10-03 07:03:40 +02:00
|
|
|
}
|
2020-07-06 23:15:24 +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
|
|
|
}
|
2021-04-07 17:00:19 +02:00
|
|
|
if app.dexpreopter.configPath != nil {
|
|
|
|
entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", app.dexpreopter.configPath)
|
|
|
|
}
|
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
|
|
|
}
|
2020-07-03 20:56:24 +02:00
|
|
|
|
2020-07-22 05:31:17 +02:00
|
|
|
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
|
2023-07-16 22:20:33 +02:00
|
|
|
|
|
|
|
if app.Name() != "framework-res" {
|
2023-11-17 02:05:47 +01:00
|
|
|
// TODO(b/311155208): The container here should be system.
|
2023-11-28 22:14:56 +01:00
|
|
|
entries.SetPaths("LOCAL_ACONFIG_FILES", app.mergedAconfigFiles[""])
|
2023-07-16 22:20:33 +02:00
|
|
|
}
|
2019-08-29 23:56:03 +02:00
|
|
|
},
|
|
|
|
},
|
2022-04-01 19:48:31 +02:00
|
|
|
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
|
|
|
if app.javaApiUsedByOutputFile.String() != "" {
|
|
|
|
fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s/$(notdir %s))\n",
|
|
|
|
app.installApkName, app.javaApiUsedByOutputFile.String(), "java_apis_used_by_apex", app.javaApiUsedByOutputFile.String())
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}},
|
|
|
|
}
|
2018-03-28 23:58:31 +02:00
|
|
|
}
|
|
|
|
|
2019-01-30 22:13:52 +01:00
|
|
|
func (a *AndroidApp) getOverriddenPackages() []string {
|
|
|
|
var overridden []string
|
2022-02-17 03:33:12 +01:00
|
|
|
if len(a.overridableAppProperties.Overrides) > 0 {
|
|
|
|
overridden = append(overridden, a.overridableAppProperties.Overrides...)
|
2019-01-30 22:13:52 +01:00
|
|
|
}
|
|
|
|
return overridden
|
|
|
|
}
|
|
|
|
|
2019-12-03 05:24:29 +01:00
|
|
|
func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
entriesList := a.AndroidApp.AndroidMkEntries()
|
|
|
|
entries := &entriesList[0]
|
2020-07-03 22:18:24 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2021-09-25 00:47:17 +02:00
|
|
|
testSuiteComponent(entries, a.testProperties.Test_suites, Bool(a.testProperties.Per_testcase_directory))
|
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
|
|
|
}
|
2020-08-15 21:24:26 +02:00
|
|
|
androidMkWriteExtraTestConfigs(a.extraTestConfigs, entries)
|
2019-08-29 23:56:03 +02:00
|
|
|
androidMkWriteTestData(a.data, entries)
|
2020-08-17 12:46:00 +02:00
|
|
|
entries.AddStrings("LOCAL_TEST_MAINLINE_MODULES", a.testProperties.Test_mainline_modules...)
|
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]
|
2020-07-03 22:18:24 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2021-09-25 00:47:17 +02:00
|
|
|
testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites, Bool(a.appTestHelperAppProperties.Per_testcase_directory))
|
2021-05-27 19:30:26 +02:00
|
|
|
// introduce a flag variable to control the generation of the .config file
|
|
|
|
entries.SetString("LOCAL_DISABLE_TEST_CONFIG", "true")
|
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-09-16 03:30:11 +02:00
|
|
|
if a.hideApexVariantFromMake {
|
2020-05-20 02:06:00 +02:00
|
|
|
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
|
|
|
|
2020-07-03 22:18:24 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, 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)
|
2023-11-22 00:13:56 +01:00
|
|
|
entries.SetPath("LOCAL_SOONG_TRANSITIVE_RES_PACKAGES", a.transitiveAaptResourcePackagesFile)
|
2019-09-05 05:17:54 +02:00
|
|
|
entries.SetPath("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", a.extraAaptPackagesFile)
|
|
|
|
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile)
|
2023-11-22 00:13:56 +01:00
|
|
|
entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.combinedExportedProguardFlagsFile)
|
2019-08-29 23:56:03 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
2023-11-17 02:05:47 +01:00
|
|
|
// TODO(b/311155208): The container here should be system.
|
2023-11-28 22:14:56 +01:00
|
|
|
entries.SetPaths("LOCAL_ACONFIG_FILES", a.mergedAconfigFiles[""])
|
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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, 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",
|
2020-09-10 17:29:25 +02:00
|
|
|
OutputFile: android.OptionalPathForPath(ddoc.Javadoc.docZip),
|
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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2020-09-10 17:29:25 +02:00
|
|
|
if 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
|
|
|
}
|
2020-09-10 17:29:25 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !BoolDefault(ddoc.Javadoc.properties.Installable, true))
|
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.
|
2020-07-24 11:13:49 +02:00
|
|
|
//
|
|
|
|
// Note that dstubs.apiFile can be also be nil if WITHOUT_CHECKS_API is true.
|
2020-04-08 19:18:03 +02:00
|
|
|
// TODO(b/146727827): Revert when we do not need to generate stubs and API separately.
|
2020-07-24 11:13:49 +02:00
|
|
|
|
2020-04-08 19:18:03 +02:00
|
|
|
outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar)
|
|
|
|
if !outputFile.Valid() {
|
2020-07-24 11:13:49 +02:00
|
|
|
outputFile = android.OptionalPathForPath(dstubs.apiFile)
|
2020-04-08 19:18:03 +02:00
|
|
|
}
|
2022-05-09 12:23:59 +02:00
|
|
|
if !outputFile.Valid() {
|
|
|
|
outputFile = android.OptionalPathForPath(dstubs.apiVersionsXml)
|
|
|
|
}
|
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-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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, 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
|
|
|
}
|
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{
|
2020-12-07 19:23:54 +01:00
|
|
|
func(w io.Writer, name, prefix, moduleDir string) {
|
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")
|
2022-04-13 20:27:19 +02:00
|
|
|
fmt.Fprintf(w, "$(call declare-0p-target,%s)\n", dstubs.apiLintReport.String())
|
2019-11-01 13:42:39 +01:00
|
|
|
}
|
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-09-16 03:30:11 +02:00
|
|
|
if a.hideApexVariantFromMake {
|
2020-04-21 15:34:28 +02:00
|
|
|
// 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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, 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())
|
2021-01-09 01:09:09 +01:00
|
|
|
if Bool(a.properties.Export_package_resources) {
|
|
|
|
entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", a.outputFile)
|
|
|
|
}
|
2023-07-16 22:20:33 +02:00
|
|
|
// TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts
|
2019-08-28 02:33:16 +02:00
|
|
|
},
|
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]
|
2020-07-03 22:18:24 +02:00
|
|
|
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2021-09-25 00:47:17 +02:00
|
|
|
testSuiteComponent(entries, a.testProperties.Test_suites, Bool(a.testProperties.Per_testcase_directory))
|
2019-08-29 23:56:03 +02:00
|
|
|
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{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2020-01-31 19:11:47 +01:00
|
|
|
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
|
2021-11-12 03:59:15 +01:00
|
|
|
entries.SetPath("LOCAL_MODULE_PATH", r.installDir)
|
2020-04-25 00:22:40 +02:00
|
|
|
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
|
2023-07-16 22:20:33 +02:00
|
|
|
// TODO: LOCAL_ACONFIG_FILES -- Might eventually need aconfig flags?
|
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",
|
2021-11-12 21:19:42 +01:00
|
|
|
OutputFile: android.OptionalPathForPath(apkSet.primaryOutput),
|
2020-04-23 18:49:59 +02:00
|
|
|
Include: "$(BUILD_SYSTEM)/soong_android_app_set.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
2020-07-03 22:18:24 +02:00
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
2020-04-23 18:49:59 +02:00
|
|
|
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged())
|
2021-11-12 21:19:42 +01:00
|
|
|
entries.SetPath("LOCAL_APK_SET_INSTALL_FILE", apkSet.PackedAdditionalOutputs())
|
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...)
|
2023-07-16 22:20:33 +02:00
|
|
|
// TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts -- Both declarations and values
|
2020-04-23 18:49:59 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2023-01-17 21:40:22 +01:00
|
|
|
|
|
|
|
func (al *ApiLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
|
|
|
var entriesList []android.AndroidMkEntries
|
|
|
|
|
|
|
|
entriesList = append(entriesList, android.AndroidMkEntries{
|
|
|
|
Class: "JAVA_LIBRARIES",
|
|
|
|
OutputFile: android.OptionalPathForPath(al.stubsJar),
|
|
|
|
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
|
|
|
|
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
|
|
|
|
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
|
|
|
|
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
|
|
|
entries.SetPath("LOCAL_SOONG_CLASSES_JAR", al.stubsJar)
|
|
|
|
entries.SetPath("LOCAL_SOONG_HEADER_JAR", al.stubsJar)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
return entriesList
|
|
|
|
}
|