Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package java |
| 16 | |
| 17 | import ( |
Colin Cross | 74d73e2 | 2017-08-02 11:05:49 -0700 | [diff] [blame] | 18 | "fmt" |
| 19 | "io" |
| 20 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 21 | "android/soong/android" |
Liz Kammer | 6077263 | 2023-10-05 17:18:44 -0400 | [diff] [blame] | 22 | |
| 23 | "github.com/google/blueprint/proptools" |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 24 | ) |
| 25 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 26 | func (library *Library) AndroidMkEntriesHostDex() android.AndroidMkEntries { |
| 27 | hostDexNeeded := Bool(library.deviceProperties.Hostdex) && !library.Host() |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 28 | if library.hideApexVariantFromMake { |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 29 | hostDexNeeded = false |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 30 | } |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 31 | |
| 32 | if hostDexNeeded { |
| 33 | var output android.Path |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 34 | if library.dexJarFile.IsSet() { |
| 35 | output = library.dexJarFile.Path() |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 36 | } else { |
| 37 | output = library.implementationAndResourcesJar |
| 38 | } |
| 39 | return android.AndroidMkEntries{ |
| 40 | Class: "JAVA_LIBRARIES", |
| 41 | SubName: "-hostdex", |
| 42 | OutputFile: android.OptionalPathForPath(output), |
| 43 | Required: library.deviceProperties.Target.Hostdex.Required, |
| 44 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
| 45 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 46 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 47 | entries.SetBool("LOCAL_IS_HOST_MODULE", true) |
| 48 | entries.SetPath("LOCAL_PREBUILT_MODULE_FILE", output) |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 49 | if library.dexJarFile.IsSet() { |
| 50 | entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile.Path()) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 51 | } |
Colin Cross | 3108ce1 | 2021-11-10 14:38:50 -0800 | [diff] [blame] | 52 | entries.SetPath("LOCAL_SOONG_INSTALLED_MODULE", library.hostdexInstallFile) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 53 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", library.headerJarFile) |
| 54 | entries.SetPath("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar) |
| 55 | entries.SetString("LOCAL_MODULE_STEM", library.Stem()+"-hostdex") |
| 56 | }, |
| 57 | }, |
| 58 | } |
| 59 | } |
| 60 | return android.AndroidMkEntries{Disabled: true} |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 61 | } |
| 62 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 63 | func (library *Library) AndroidMkEntries() []android.AndroidMkEntries { |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 64 | var entriesList []android.AndroidMkEntries |
| 65 | |
Dan Willemsen | 9fe1410 | 2021-07-13 21:52:04 -0700 | [diff] [blame] | 66 | if library.Os() == android.Windows { |
| 67 | // Make does not support Windows Java modules |
| 68 | return nil |
| 69 | } |
| 70 | |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 71 | if library.hideApexVariantFromMake { |
Jiakai Zhang | 519c5c8 | 2021-09-16 06:15:39 +0000 | [diff] [blame] | 72 | // For a java library built for an APEX, we don't need a Make module for itself. Otherwise, it |
| 73 | // will conflict with the platform variant because they have the same module name in the |
| 74 | // makefile. However, we need to add its dexpreopt outputs as sub-modules, if it is preopted. |
| 75 | dexpreoptEntries := library.dexpreopter.AndroidMkEntriesForApex() |
| 76 | if len(dexpreoptEntries) > 0 { |
| 77 | entriesList = append(entriesList, dexpreoptEntries...) |
| 78 | } |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 79 | entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true}) |
Jingwen Chen | 8ac7d7d | 2023-03-20 11:05:16 +0000 | [diff] [blame] | 80 | } else if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) { |
| 81 | // Platform variant. If not available for the platform, we don't need Make module. |
| 82 | entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true}) |
Liz Kammer | 6077263 | 2023-10-05 17:18:44 -0400 | [diff] [blame] | 83 | } else if proptools.Bool(library.properties.Headers_only) { |
Mark White | a15790a | 2023-08-22 21:28:11 +0000 | [diff] [blame] | 84 | // If generating headers only then don't expose to Make. |
| 85 | entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true}) |
Colin Cross | b549b77 | 2020-06-03 17:14:31 +0000 | [diff] [blame] | 86 | } else { |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 87 | entriesList = append(entriesList, android.AndroidMkEntries{ |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 88 | Class: "JAVA_LIBRARIES", |
| 89 | OutputFile: android.OptionalPathForPath(library.outputFile), |
| 90 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
| 91 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 92 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 93 | if len(library.logtagsSrcs) > 0 { |
Inseob Kim | 37e0bb0 | 2024-04-29 15:54:44 +0900 | [diff] [blame] | 94 | entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", library.logtagsSrcs.Strings()...) |
Colin Cross | 5beccee | 2017-12-07 15:28:59 -0800 | [diff] [blame] | 95 | } |
Colin Cross | 5beccee | 2017-12-07 15:28:59 -0800 | [diff] [blame] | 96 | |
Jingwen Chen | 8ac7d7d | 2023-03-20 11:05:16 +0000 | [diff] [blame] | 97 | if library.installFile == nil { |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 98 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true) |
| 99 | } |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 100 | if library.dexJarFile.IsSet() { |
| 101 | entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile.Path()) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 102 | } |
| 103 | if len(library.dexpreopter.builtInstalled) > 0 { |
| 104 | entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", library.dexpreopter.builtInstalled) |
| 105 | } |
Jiyong Park | 9231537 | 2021-04-02 08:45:46 +0900 | [diff] [blame] | 106 | entries.SetString("LOCAL_SDK_VERSION", library.sdkVersion.String()) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 107 | entries.SetPath("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar) |
| 108 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", library.headerJarFile) |
Colin Cross | cb93359 | 2017-11-22 13:49:43 -0800 | [diff] [blame] | 109 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 110 | if library.jacocoReportClassesFile != nil { |
| 111 | entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", library.jacocoReportClassesFile) |
| 112 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 113 | |
Ulya Trafimovich | fc0f6e3 | 2021-08-12 16:16:11 +0100 | [diff] [blame] | 114 | requiredUsesLibs, optionalUsesLibs := library.classLoaderContexts.UsesLibs() |
| 115 | entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", append(requiredUsesLibs, optionalUsesLibs...)...) |
Jiyong Park | 1be9691 | 2018-05-28 18:02:19 +0900 | [diff] [blame] | 116 | |
Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 117 | entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", library.dexer.proguardDictionary) |
| 118 | entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", library.dexer.proguardUsageZip) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 119 | entries.SetString("LOCAL_MODULE_STEM", library.Stem()) |
Colin Cross | c0efd1d | 2020-07-03 11:56:24 -0700 | [diff] [blame] | 120 | |
Colin Cross | 08dca38 | 2020-07-21 20:31:17 -0700 | [diff] [blame] | 121 | entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", library.linter.reports) |
Ulya Trafimovich | 76b0852 | 2021-01-14 17:52:43 +0000 | [diff] [blame] | 122 | |
| 123 | if library.dexpreopter.configPath != nil { |
| 124 | entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath) |
| 125 | } |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 126 | }, |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 127 | }, |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 128 | }) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 129 | } |
| 130 | |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 131 | entriesList = append(entriesList, library.AndroidMkEntriesHostDex()) |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 132 | |
Jiyong Park | 55bd98b | 2019-12-11 17:27:07 +0900 | [diff] [blame] | 133 | return entriesList |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 134 | } |
| 135 | |
Cory Barker | eaf7f5e | 2023-02-03 00:20:52 +0000 | [diff] [blame] | 136 | func (j *JavaFuzzTest) AndroidMkEntries() []android.AndroidMkEntries { |
Muhammad Haseeb Ahmad | 7e74405 | 2022-03-25 22:50:53 +0000 | [diff] [blame] | 137 | entriesList := j.Library.AndroidMkEntries() |
| 138 | entries := &entriesList[0] |
| 139 | entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
| 140 | entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", "null-suite") |
Muhammad Haseeb Ahmad | eb14ff2 | 2022-09-28 17:53:11 +0000 | [diff] [blame] | 141 | androidMkWriteTestData(android.Paths{j.implementationJarFile}, entries) |
Cory Barker | eaf7f5e | 2023-02-03 00:20:52 +0000 | [diff] [blame] | 142 | androidMkWriteTestData(j.jniFilePaths, entries) |
| 143 | if j.fuzzPackagedModule.Corpus != nil { |
| 144 | androidMkWriteTestData(j.fuzzPackagedModule.Corpus, entries) |
| 145 | } |
| 146 | if j.fuzzPackagedModule.Dictionary != nil { |
| 147 | androidMkWriteTestData(android.Paths{j.fuzzPackagedModule.Dictionary}, entries) |
| 148 | } |
Muhammad Haseeb Ahmad | 7e74405 | 2022-03-25 22:50:53 +0000 | [diff] [blame] | 149 | }) |
| 150 | return entriesList |
| 151 | } |
| 152 | |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 153 | // Called for modules that are a component of a test suite. |
Colin Cross | cfb0f5e | 2021-09-24 15:47:17 -0700 | [diff] [blame] | 154 | func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string, perTestcaseDirectory bool) { |
Jaewoong Jung | b28eb5f | 2019-08-27 15:01:50 -0700 | [diff] [blame] | 155 | entries.SetString("LOCAL_MODULE_TAGS", "tests") |
| 156 | if len(test_suites) > 0 { |
Liz Kammer | 57f5b33 | 2020-11-24 12:42:58 -0800 | [diff] [blame] | 157 | entries.AddCompatibilityTestSuites(test_suites...) |
Jaewoong Jung | b28eb5f | 2019-08-27 15:01:50 -0700 | [diff] [blame] | 158 | } else { |
Liz Kammer | 57f5b33 | 2020-11-24 12:42:58 -0800 | [diff] [blame] | 159 | entries.AddCompatibilityTestSuites("null-suite") |
Jaewoong Jung | b28eb5f | 2019-08-27 15:01:50 -0700 | [diff] [blame] | 160 | } |
Colin Cross | cfb0f5e | 2021-09-24 15:47:17 -0700 | [diff] [blame] | 161 | entries.SetBoolIfTrue("LOCAL_COMPATIBILITY_PER_TESTCASE_DIRECTORY", perTestcaseDirectory) |
Jaewoong Jung | b28eb5f | 2019-08-27 15:01:50 -0700 | [diff] [blame] | 162 | } |
| 163 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 164 | func (j *Test) AndroidMkEntries() []android.AndroidMkEntries { |
| 165 | entriesList := j.Library.AndroidMkEntries() |
| 166 | entries := &entriesList[0] |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 167 | entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Colin Cross | cfb0f5e | 2021-09-24 15:47:17 -0700 | [diff] [blame] | 168 | testSuiteComponent(entries, j.testProperties.Test_suites, Bool(j.testProperties.Per_testcase_directory)) |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 169 | if j.testConfig != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 170 | entries.SetPath("LOCAL_FULL_TEST_CONFIG", j.testConfig) |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 171 | } |
Dan Shi | 95d1942 | 2020-08-15 12:24:26 -0700 | [diff] [blame] | 172 | androidMkWriteExtraTestConfigs(j.extraTestConfigs, entries) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 173 | androidMkWriteTestData(j.data, entries) |
Dan Shi | 2468d01 | 2020-01-06 15:47:57 -0800 | [diff] [blame] | 174 | if !BoolDefault(j.testProperties.Auto_gen_config, true) { |
| 175 | entries.SetString("LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG", "true") |
| 176 | } |
kellyhung | 74b0052 | 2020-08-17 18:46:00 +0800 | [diff] [blame] | 177 | entries.AddStrings("LOCAL_TEST_MAINLINE_MODULES", j.testProperties.Test_mainline_modules...) |
Zhenhuang Wang | 0ac5a43 | 2022-08-12 18:49:20 +0800 | [diff] [blame] | 178 | |
| 179 | j.testProperties.Test_options.CommonTestOptions.SetAndroidMkEntries(entries) |
Colin Cross | 05638fc | 2018-04-09 18:40:24 -0700 | [diff] [blame] | 180 | }) |
| 181 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 182 | return entriesList |
Colin Cross | 05638fc | 2018-04-09 18:40:24 -0700 | [diff] [blame] | 183 | } |
| 184 | |
Dan Shi | 95d1942 | 2020-08-15 12:24:26 -0700 | [diff] [blame] | 185 | func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *android.AndroidMkEntries) { |
| 186 | if len(extraTestConfigs) > 0 { |
| 187 | entries.AddStrings("LOCAL_EXTRA_FULL_TEST_CONFIGS", extraTestConfigs.Strings()...) |
| 188 | } |
| 189 | } |
| 190 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 191 | func (j *TestHelperLibrary) AndroidMkEntries() []android.AndroidMkEntries { |
| 192 | entriesList := j.Library.AndroidMkEntries() |
| 193 | entries := &entriesList[0] |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 194 | entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Colin Cross | cfb0f5e | 2021-09-24 15:47:17 -0700 | [diff] [blame] | 195 | testSuiteComponent(entries, j.testHelperLibraryProperties.Test_suites, Bool(j.testHelperLibraryProperties.Per_testcase_directory)) |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 196 | }) |
| 197 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 198 | return entriesList |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 199 | } |
| 200 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 201 | func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries { |
Jiakai Zhang | 28bc9a8 | 2021-12-20 15:08:57 +0000 | [diff] [blame] | 202 | if prebuilt.hideApexVariantFromMake { |
Spandan Das | 2069c3f | 2023-12-06 19:40:24 +0000 | [diff] [blame] | 203 | return []android.AndroidMkEntries{} |
Jiakai Zhang | 28bc9a8 | 2021-12-20 15:08:57 +0000 | [diff] [blame] | 204 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 205 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Spandan Das | 3cf0463 | 2024-01-19 00:22:22 +0000 | [diff] [blame] | 206 | Class: "JAVA_LIBRARIES", |
| 207 | OverrideName: prebuilt.BaseModuleName(), |
Colin Cross | dad2a36 | 2024-03-23 04:43:41 +0000 | [diff] [blame] | 208 | OutputFile: android.OptionalPathForPath(prebuilt.combinedImplementationFile), |
Spandan Das | 3cf0463 | 2024-01-19 00:22:22 +0000 | [diff] [blame] | 209 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 210 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 211 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 212 | entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable)) |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 213 | if prebuilt.dexJarFile.IsSet() { |
| 214 | entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile.Path()) |
Bill Peckham | fb04df4 | 2021-01-11 12:27:24 -0800 | [diff] [blame] | 215 | } |
Colin Cross | dad2a36 | 2024-03-23 04:43:41 +0000 | [diff] [blame] | 216 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.combinedHeaderFile) |
| 217 | entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.combinedImplementationFile) |
Jiyong Park | 9231537 | 2021-04-02 08:45:46 +0900 | [diff] [blame] | 218 | entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion.String()) |
Jiyong Park | 0b23875 | 2019-10-29 11:23:10 +0900 | [diff] [blame] | 219 | entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem()) |
Joe Onorato | 6fe59eb | 2023-07-16 13:20:33 -0700 | [diff] [blame] | 220 | // TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 221 | }, |
| 222 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 223 | }} |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 224 | } |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 225 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 226 | func (prebuilt *DexImport) AndroidMkEntries() []android.AndroidMkEntries { |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 227 | if prebuilt.hideApexVariantFromMake { |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 228 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Jiyong Park | 7f7766d | 2019-07-25 22:02:35 +0900 | [diff] [blame] | 229 | Disabled: true, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 230 | }} |
Jiyong Park | 7f7766d | 2019-07-25 22:02:35 +0900 | [diff] [blame] | 231 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 232 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Colin Cross | 42be761 | 2019-02-21 18:12:14 -0800 | [diff] [blame] | 233 | Class: "JAVA_LIBRARIES", |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 234 | OutputFile: android.OptionalPathForPath(prebuilt.dexJarFile.Path()), |
Colin Cross | 42be761 | 2019-02-21 18:12:14 -0800 | [diff] [blame] | 235 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 236 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 237 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 238 | if prebuilt.dexJarFile.IsSet() { |
| 239 | entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile.Path()) |
Colin Cross | 42be761 | 2019-02-21 18:12:14 -0800 | [diff] [blame] | 240 | } |
| 241 | if len(prebuilt.dexpreopter.builtInstalled) > 0 { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 242 | entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", prebuilt.dexpreopter.builtInstalled) |
Colin Cross | 42be761 | 2019-02-21 18:12:14 -0800 | [diff] [blame] | 243 | } |
Jiyong Park | 0b23875 | 2019-10-29 11:23:10 +0900 | [diff] [blame] | 244 | entries.SetString("LOCAL_MODULE_STEM", prebuilt.Stem()) |
Joe Onorato | 6fe59eb | 2023-07-16 13:20:33 -0700 | [diff] [blame] | 245 | // TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts |
Colin Cross | 42be761 | 2019-02-21 18:12:14 -0800 | [diff] [blame] | 246 | }, |
| 247 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 248 | }} |
Colin Cross | 42be761 | 2019-02-21 18:12:14 -0800 | [diff] [blame] | 249 | } |
| 250 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 251 | func (prebuilt *AARImport) AndroidMkEntries() []android.AndroidMkEntries { |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 252 | if prebuilt.hideApexVariantFromMake { |
Jooyung Han | acc7bbe | 2020-05-20 09:06:00 +0900 | [diff] [blame] | 253 | return []android.AndroidMkEntries{{ |
| 254 | Disabled: true, |
| 255 | }} |
| 256 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 257 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 258 | Class: "JAVA_LIBRARIES", |
Colin Cross | 9055e21 | 2024-03-23 04:43:41 +0000 | [diff] [blame] | 259 | OutputFile: android.OptionalPathForPath(prebuilt.implementationJarFile), |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 260 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 261 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 262 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 263 | entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true) |
Colin Cross | 9055e21 | 2024-03-23 04:43:41 +0000 | [diff] [blame] | 264 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.headerJarFile) |
| 265 | entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.implementationJarFile) |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 266 | entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", prebuilt.exportPackage) |
Colin Cross | 312634e | 2023-11-21 15:13:56 -0800 | [diff] [blame] | 267 | entries.SetPath("LOCAL_SOONG_TRANSITIVE_RES_PACKAGES", prebuilt.transitiveAaptResourcePackagesFile) |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 268 | entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", prebuilt.proguardFlags) |
| 269 | entries.SetPath("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", prebuilt.extraAaptPackagesFile) |
| 270 | entries.SetPath("LOCAL_FULL_MANIFEST_FILE", prebuilt.manifest) |
Jiyong Park | 9231537 | 2021-04-02 08:45:46 +0900 | [diff] [blame] | 271 | entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion.String()) |
Joe Onorato | 6fe59eb | 2023-07-16 13:20:33 -0700 | [diff] [blame] | 272 | // TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 273 | }, |
| 274 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 275 | }} |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 276 | } |
| 277 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 278 | func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries { |
Dan Willemsen | 9fe1410 | 2021-07-13 21:52:04 -0700 | [diff] [blame] | 279 | if binary.Os() == android.Windows { |
| 280 | // Make does not support Windows Java modules |
| 281 | return nil |
| 282 | } |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 283 | |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 284 | if !binary.isWrapperVariant { |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 285 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 286 | Class: "JAVA_LIBRARIES", |
Colin Cross | 331a121 | 2018-08-15 20:40:52 -0700 | [diff] [blame] | 287 | OutputFile: android.OptionalPathForPath(binary.outputFile), |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 288 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 289 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 290 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 291 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", binary.headerJarFile) |
| 292 | entries.SetPath("LOCAL_SOONG_CLASSES_JAR", binary.implementationAndResourcesJar) |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 293 | if binary.dexJarFile.IsSet() { |
| 294 | entries.SetPath("LOCAL_SOONG_DEX_JAR", binary.dexJarFile.Path()) |
Colin Cross | 12fc2af | 2019-01-14 12:35:45 -0800 | [diff] [blame] | 295 | } |
| 296 | if len(binary.dexpreopter.builtInstalled) > 0 { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 297 | entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled) |
Colin Cross | 12fc2af | 2019-01-14 12:35:45 -0800 | [diff] [blame] | 298 | } |
Colin Cross | 331a121 | 2018-08-15 20:40:52 -0700 | [diff] [blame] | 299 | }, |
| 300 | }, |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 301 | ExtraFooters: []android.AndroidMkExtraFootersFunc{ |
Jaewoong Jung | 02b11a6 | 2020-12-07 10:23:54 -0800 | [diff] [blame] | 302 | func(w io.Writer, name, prefix, moduleDir string) { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 303 | fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)") |
| 304 | }, |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 305 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 306 | }} |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 307 | } else { |
Colin Cross | 44b85d0 | 2021-02-19 17:37:04 -0800 | [diff] [blame] | 308 | outputFile := binary.wrapperFile |
Colin Cross | 44b85d0 | 2021-02-19 17:37:04 -0800 | [diff] [blame] | 309 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 310 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 311 | Class: "EXECUTABLES", |
Colin Cross | 44b85d0 | 2021-02-19 17:37:04 -0800 | [diff] [blame] | 312 | OutputFile: android.OptionalPathForPath(outputFile), |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 313 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 314 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 315 | entries.SetBool("LOCAL_STRIP_MODULE", false) |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 316 | }, |
| 317 | }, |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 318 | ExtraFooters: []android.AndroidMkExtraFootersFunc{ |
Jaewoong Jung | 02b11a6 | 2020-12-07 10:23:54 -0800 | [diff] [blame] | 319 | func(w io.Writer, name, prefix, moduleDir string) { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 320 | // Ensure that the wrapper script timestamp is always updated when the jar is updated |
| 321 | fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): $(jar_installed_module)") |
| 322 | fmt.Fprintln(w, "jar_installed_module :=") |
| 323 | }, |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 324 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 325 | }} |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 326 | } |
| 327 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 328 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 329 | func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries { |
Colin Cross | aaa0c1f | 2022-05-16 16:19:54 -0700 | [diff] [blame] | 330 | if app.hideApexVariantFromMake || app.IsHideFromMake() { |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 331 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Jiyong Park | 52cd06f | 2019-11-11 10:14:32 +0900 | [diff] [blame] | 332 | Disabled: true, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 333 | }} |
Jiyong Park | 52cd06f | 2019-11-11 10:14:32 +0900 | [diff] [blame] | 334 | } |
Inseob Kim | 34dc4cd | 2023-11-07 13:37:14 +0900 | [diff] [blame] | 335 | var required []string |
| 336 | if proptools.Bool(app.appProperties.Generate_product_characteristics_rro) { |
| 337 | required = []string{app.productCharacteristicsRROPackageName()} |
| 338 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 339 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 340 | Class: "APPS", |
| 341 | OutputFile: android.OptionalPathForPath(app.outputFile), |
| 342 | Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", |
Inseob Kim | 34dc4cd | 2023-11-07 13:37:14 +0900 | [diff] [blame] | 343 | Required: required, |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 344 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 345 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 346 | // App module names can be overridden. |
| 347 | entries.SetString("LOCAL_MODULE", app.installApkName) |
Jaewoong Jung | 87a33e7 | 2020-03-26 14:01:48 -0700 | [diff] [blame] | 348 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", app.appProperties.PreventInstall) |
Colin Cross | f06d8dc | 2023-07-18 22:11:07 -0700 | [diff] [blame] | 349 | if app.headerJarFile != nil { |
| 350 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", app.headerJarFile) |
| 351 | } |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 352 | entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", app.exportPackage) |
Martin Stjernholm | 8be1e6d | 2021-09-15 03:34:04 +0100 | [diff] [blame] | 353 | if app.dexJarFile.IsSet() { |
| 354 | entries.SetPath("LOCAL_SOONG_DEX_JAR", app.dexJarFile.Path()) |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 355 | } |
Colin Cross | 331a121 | 2018-08-15 20:40:52 -0700 | [diff] [blame] | 356 | if app.implementationAndResourcesJar != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 357 | entries.SetPath("LOCAL_SOONG_CLASSES_JAR", app.implementationAndResourcesJar) |
Colin Cross | 5dfabfb | 2017-12-14 13:19:01 -0800 | [diff] [blame] | 358 | } |
| 359 | if app.headerJarFile != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 360 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", app.headerJarFile) |
Colin Cross | 5dfabfb | 2017-12-14 13:19:01 -0800 | [diff] [blame] | 361 | } |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 362 | if app.bundleFile != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 363 | entries.SetPath("LOCAL_SOONG_BUNDLE", app.bundleFile) |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 364 | } |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 365 | if app.jacocoReportClassesFile != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 366 | entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", app.jacocoReportClassesFile) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 367 | } |
Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 368 | entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", app.dexer.proguardDictionary) |
| 369 | entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", app.dexer.proguardUsageZip) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 370 | |
Rashed Abdel-Tawab | ec0843e | 2018-08-09 14:08:53 -0700 | [diff] [blame] | 371 | if app.Name() == "framework-res" || app.Name() == "org.lineageos.platform-res" { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 372 | entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)") |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 373 | // Make base_rules.mk not put framework-res in a subdirectory called |
| 374 | // framework_res. |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 375 | entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 376 | } |
| 377 | |
Anton Hansson | 53c8844 | 2019-03-18 15:53:16 +0000 | [diff] [blame] | 378 | filterRRO := func(filter overlayType) android.Paths { |
| 379 | var paths android.Paths |
Colin Cross | 4c90f99 | 2023-06-13 16:44:58 -0700 | [diff] [blame] | 380 | seen := make(map[android.Path]bool) |
| 381 | for _, d := range app.rroDirsDepSet.ToList() { |
Anton Hansson | 53c8844 | 2019-03-18 15:53:16 +0000 | [diff] [blame] | 382 | if d.overlayType == filter { |
Colin Cross | 4c90f99 | 2023-06-13 16:44:58 -0700 | [diff] [blame] | 383 | if seen[d.path] { |
| 384 | continue |
| 385 | } |
| 386 | seen[d.path] = true |
Anton Hansson | 53c8844 | 2019-03-18 15:53:16 +0000 | [diff] [blame] | 387 | paths = append(paths, d.path) |
| 388 | } |
| 389 | } |
Colin Cross | a140bb0 | 2018-04-17 10:52:26 -0700 | [diff] [blame] | 390 | // Reverse the order, Soong stores rroDirs in aapt2 order (low to high priority), but Make |
| 391 | // expects it in LOCAL_RESOURCE_DIRS order (high to low priority). |
Anton Hansson | 53c8844 | 2019-03-18 15:53:16 +0000 | [diff] [blame] | 392 | return android.ReversePaths(paths) |
| 393 | } |
| 394 | deviceRRODirs := filterRRO(device) |
| 395 | if len(deviceRRODirs) > 0 { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 396 | entries.AddStrings("LOCAL_SOONG_DEVICE_RRO_DIRS", deviceRRODirs.Strings()...) |
Anton Hansson | 53c8844 | 2019-03-18 15:53:16 +0000 | [diff] [blame] | 397 | } |
| 398 | productRRODirs := filterRRO(product) |
| 399 | if len(productRRODirs) > 0 { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 400 | entries.AddStrings("LOCAL_SOONG_PRODUCT_RRO_DIRS", productRRODirs.Strings()...) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 401 | } |
| 402 | |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 403 | entries.SetBoolIfTrue("LOCAL_EXPORT_PACKAGE_RESOURCES", Bool(app.appProperties.Export_package_resources)) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 404 | |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 405 | entries.SetPath("LOCAL_FULL_MANIFEST_FILE", app.manifestPath) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 406 | |
Jiyong Park | f748731 | 2019-10-17 12:54:30 +0900 | [diff] [blame] | 407 | entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", app.Privileged()) |
Colin Cross | e1731a5 | 2017-12-14 11:22:55 -0800 | [diff] [blame] | 408 | |
Jaewoong Jung | 78ec5d8 | 2020-01-31 10:11:47 -0800 | [diff] [blame] | 409 | entries.SetString("LOCAL_CERTIFICATE", app.certificate.AndroidMkString()) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 410 | entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", app.getOverriddenPackages()...) |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 411 | |
Colin Cross | 403cc15 | 2020-07-06 14:15:24 -0700 | [diff] [blame] | 412 | if app.embeddedJniLibs { |
| 413 | jniSymbols := app.JNISymbolsInstalls(app.installPathForJNISymbols.String()) |
| 414 | entries.SetString("LOCAL_SOONG_JNI_LIBS_SYMBOLS", jniSymbols.String()) |
Yu Shan | b7646e4 | 2024-05-17 20:09:23 +0000 | [diff] [blame] | 415 | } else { |
Jiyong Park | 25b9222 | 2024-05-17 22:58:54 +0000 | [diff] [blame] | 416 | var names []string |
Yu Shan | b7646e4 | 2024-05-17 20:09:23 +0000 | [diff] [blame] | 417 | for _, jniLib := range app.jniLibs { |
Jiyong Park | 25b9222 | 2024-05-17 22:58:54 +0000 | [diff] [blame] | 418 | names = append(names, jniLib.name) |
Yu Shan | b7646e4 | 2024-05-17 20:09:23 +0000 | [diff] [blame] | 419 | } |
Jiyong Park | 25b9222 | 2024-05-17 22:58:54 +0000 | [diff] [blame] | 420 | entries.AddStrings("LOCAL_REQUIRED_MODULES", names...) |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 421 | } |
Colin Cross | 403cc15 | 2020-07-06 14:15:24 -0700 | [diff] [blame] | 422 | |
Jaewoong Jung | 87a33e7 | 2020-03-26 14:01:48 -0700 | [diff] [blame] | 423 | if len(app.jniCoverageOutputs) > 0 { |
| 424 | entries.AddStrings("LOCAL_PREBUILT_COVERAGE_ARCHIVE", app.jniCoverageOutputs.Strings()...) |
| 425 | } |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 426 | if len(app.dexpreopter.builtInstalled) > 0 { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 427 | entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", app.dexpreopter.builtInstalled) |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 428 | } |
Jeongik Cha | c624667 | 2021-04-08 00:00:19 +0900 | [diff] [blame] | 429 | if app.dexpreopter.configPath != nil { |
| 430 | entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", app.dexpreopter.configPath) |
| 431 | } |
Jaewoong Jung | 5a49881 | 2019-11-07 14:14:38 -0800 | [diff] [blame] | 432 | for _, extra := range app.extraOutputFiles { |
| 433 | install := app.onDeviceDir + "/" + extra.Base() |
| 434 | entries.AddStrings("LOCAL_SOONG_BUILT_INSTALLED", extra.String()+":"+install) |
Colin Cross | e560c4a | 2019-03-19 16:03:11 -0700 | [diff] [blame] | 435 | } |
Colin Cross | c0efd1d | 2020-07-03 11:56:24 -0700 | [diff] [blame] | 436 | |
Colin Cross | 08dca38 | 2020-07-21 20:31:17 -0700 | [diff] [blame] | 437 | entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports) |
Joe Onorato | 6fe59eb | 2023-07-16 13:20:33 -0700 | [diff] [blame] | 438 | |
Inseob Kim | 17ce834 | 2024-04-29 16:43:49 +0900 | [diff] [blame] | 439 | entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", app.logtagsSrcs.Strings()...) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 440 | }, |
| 441 | }, |
Matt Banda | 8c80126 | 2022-04-01 17:48:31 +0000 | [diff] [blame] | 442 | ExtraFooters: []android.AndroidMkExtraFootersFunc{ |
| 443 | func(w io.Writer, name, prefix, moduleDir string) { |
| 444 | if app.javaApiUsedByOutputFile.String() != "" { |
| 445 | fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s/$(notdir %s))\n", |
| 446 | app.installApkName, app.javaApiUsedByOutputFile.String(), "java_apis_used_by_apex", app.javaApiUsedByOutputFile.String()) |
| 447 | } |
| 448 | }, |
| 449 | }}, |
| 450 | } |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 451 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 452 | |
Jaewoong Jung | 9109d72 | 2019-01-30 13:13:52 -0800 | [diff] [blame] | 453 | func (a *AndroidApp) getOverriddenPackages() []string { |
| 454 | var overridden []string |
zhidou | a2ce78f | 2022-02-17 02:33:12 +0000 | [diff] [blame] | 455 | if len(a.overridableAppProperties.Overrides) > 0 { |
| 456 | overridden = append(overridden, a.overridableAppProperties.Overrides...) |
Jaewoong Jung | 9109d72 | 2019-01-30 13:13:52 -0800 | [diff] [blame] | 457 | } |
Jaewoong Jung | 9109d72 | 2019-01-30 13:13:52 -0800 | [diff] [blame] | 458 | return overridden |
| 459 | } |
| 460 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 461 | func (a *AndroidTest) AndroidMkEntries() []android.AndroidMkEntries { |
| 462 | entriesList := a.AndroidApp.AndroidMkEntries() |
| 463 | entries := &entriesList[0] |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 464 | entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Colin Cross | cfb0f5e | 2021-09-24 15:47:17 -0700 | [diff] [blame] | 465 | testSuiteComponent(entries, a.testProperties.Test_suites, Bool(a.testProperties.Per_testcase_directory)) |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 466 | if a.testConfig != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 467 | entries.SetPath("LOCAL_FULL_TEST_CONFIG", a.testConfig) |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 468 | } |
Dan Shi | 95d1942 | 2020-08-15 12:24:26 -0700 | [diff] [blame] | 469 | androidMkWriteExtraTestConfigs(a.extraTestConfigs, entries) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 470 | androidMkWriteTestData(a.data, entries) |
kellyhung | 74b0052 | 2020-08-17 18:46:00 +0800 | [diff] [blame] | 471 | entries.AddStrings("LOCAL_TEST_MAINLINE_MODULES", a.testProperties.Test_mainline_modules...) |
Colin Cross | 252fc6f | 2018-10-04 15:22:03 -0700 | [diff] [blame] | 472 | }) |
| 473 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 474 | return entriesList |
Colin Cross | 252fc6f | 2018-10-04 15:22:03 -0700 | [diff] [blame] | 475 | } |
| 476 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 477 | func (a *AndroidTestHelperApp) AndroidMkEntries() []android.AndroidMkEntries { |
| 478 | entriesList := a.AndroidApp.AndroidMkEntries() |
| 479 | entries := &entriesList[0] |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 480 | entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Colin Cross | cfb0f5e | 2021-09-24 15:47:17 -0700 | [diff] [blame] | 481 | testSuiteComponent(entries, a.appTestHelperAppProperties.Test_suites, Bool(a.appTestHelperAppProperties.Per_testcase_directory)) |
Yuntao Xu | 7a31855 | 2021-05-27 10:30:26 -0700 | [diff] [blame] | 482 | // introduce a flag variable to control the generation of the .config file |
| 483 | entries.SetString("LOCAL_DISABLE_TEST_CONFIG", "true") |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 484 | }) |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 485 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 486 | return entriesList |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 487 | } |
| 488 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 489 | func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries { |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 490 | if a.hideApexVariantFromMake { |
Jooyung Han | acc7bbe | 2020-05-20 09:06:00 +0900 | [diff] [blame] | 491 | return []android.AndroidMkEntries{{ |
| 492 | Disabled: true, |
| 493 | }} |
| 494 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 495 | entriesList := a.Library.AndroidMkEntries() |
| 496 | entries := &entriesList[0] |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 497 | |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 498 | entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Colin Cross | a54974c | 2018-10-29 23:15:37 -0700 | [diff] [blame] | 499 | if a.aarFile != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 500 | entries.SetPath("LOCAL_SOONG_AAR", a.aarFile) |
Colin Cross | a54974c | 2018-10-29 23:15:37 -0700 | [diff] [blame] | 501 | } |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 502 | |
Rashed Abdel-Tawab | ec0843e | 2018-08-09 14:08:53 -0700 | [diff] [blame] | 503 | if a.Name() == "framework-res" || a.Name() == "org.lineageos.platform-res" { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 504 | entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)") |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 505 | // Make base_rules.mk not put framework-res in a subdirectory called |
| 506 | // framework_res. |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 507 | entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true) |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 508 | } |
| 509 | |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 510 | entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", a.exportPackage) |
Colin Cross | 312634e | 2023-11-21 15:13:56 -0800 | [diff] [blame] | 511 | entries.SetPath("LOCAL_SOONG_TRANSITIVE_RES_PACKAGES", a.transitiveAaptResourcePackagesFile) |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 512 | entries.SetPath("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", a.extraAaptPackagesFile) |
| 513 | entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile) |
Colin Cross | 312634e | 2023-11-21 15:13:56 -0800 | [diff] [blame] | 514 | entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.combinedExportedProguardFlagsFile) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 515 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true) |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 516 | }) |
| 517 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 518 | return entriesList |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 519 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 520 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 521 | func (jd *Javadoc) AndroidMkEntries() []android.AndroidMkEntries { |
| 522 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 523 | Class: "JAVA_LIBRARIES", |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 524 | OutputFile: android.OptionalPathForPath(jd.stubsSrcJar), |
Colin Cross | 5fa9d6f | 2018-08-08 21:44:48 -0700 | [diff] [blame] | 525 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 526 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 527 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Colin Cross | 38b40df | 2018-04-10 16:14:46 -0700 | [diff] [blame] | 528 | if BoolDefault(jd.properties.Installable, true) { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 529 | entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 530 | } |
Jihoon Kang | 246690a | 2024-02-01 21:55:01 +0000 | [diff] [blame] | 531 | if jd.exportableStubsSrcJar != nil { |
| 532 | entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", jd.exportableStubsSrcJar) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 533 | } |
| 534 | }, |
| 535 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 536 | }} |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 537 | } |
| 538 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 539 | func (ddoc *Droiddoc) AndroidMkEntries() []android.AndroidMkEntries { |
| 540 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 541 | Class: "JAVA_LIBRARIES", |
Liz Kammer | e1ab250 | 2020-09-10 15:29:25 +0000 | [diff] [blame] | 542 | OutputFile: android.OptionalPathForPath(ddoc.Javadoc.docZip), |
Colin Cross | 5fa9d6f | 2018-08-08 21:44:48 -0700 | [diff] [blame] | 543 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 544 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 545 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Liz Kammer | e1ab250 | 2020-09-10 15:29:25 +0000 | [diff] [blame] | 546 | if ddoc.Javadoc.docZip != nil { |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 547 | entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", ddoc.Javadoc.docZip) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 548 | } |
Liz Kammer | e1ab250 | 2020-09-10 15:29:25 +0000 | [diff] [blame] | 549 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !BoolDefault(ddoc.Javadoc.properties.Installable, true)) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 550 | }, |
| 551 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 552 | }} |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 553 | } |
Colin Cross | d96ca35 | 2018-08-10 16:06:24 -0700 | [diff] [blame] | 554 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 555 | func (dstubs *Droidstubs) AndroidMkEntries() []android.AndroidMkEntries { |
Paul Duffin | 3ae2951 | 2020-04-08 18:18:03 +0100 | [diff] [blame] | 556 | // If the stubsSrcJar is not generated (because generate_stubs is false) then |
| 557 | // use the api file as the output file to ensure the relevant phony targets |
| 558 | // are created in make if only the api txt file is being generated. This is |
| 559 | // needed because an invalid output file would prevent the make entries from |
| 560 | // being written. |
Jingwen Chen | 7b27ca7 | 2020-07-24 09:13:49 +0000 | [diff] [blame] | 561 | // |
| 562 | // Note that dstubs.apiFile can be also be nil if WITHOUT_CHECKS_API is true. |
Paul Duffin | 3ae2951 | 2020-04-08 18:18:03 +0100 | [diff] [blame] | 563 | // TODO(b/146727827): Revert when we do not need to generate stubs and API separately. |
Jingwen Chen | 7b27ca7 | 2020-07-24 09:13:49 +0000 | [diff] [blame] | 564 | |
Paul Duffin | 3ae2951 | 2020-04-08 18:18:03 +0100 | [diff] [blame] | 565 | outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar) |
| 566 | if !outputFile.Valid() { |
Jingwen Chen | 7b27ca7 | 2020-07-24 09:13:49 +0000 | [diff] [blame] | 567 | outputFile = android.OptionalPathForPath(dstubs.apiFile) |
Paul Duffin | 3ae2951 | 2020-04-08 18:18:03 +0100 | [diff] [blame] | 568 | } |
Anton Hansson | 4bf0080 | 2022-05-09 10:23:59 +0000 | [diff] [blame] | 569 | if !outputFile.Valid() { |
Jihoon Kang | ee11328 | 2024-01-23 00:16:41 +0000 | [diff] [blame] | 570 | outputFile = android.OptionalPathForPath(dstubs.everythingArtifacts.apiVersionsXml) |
Anton Hansson | 4bf0080 | 2022-05-09 10:23:59 +0000 | [diff] [blame] | 571 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 572 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 573 | Class: "JAVA_LIBRARIES", |
Paul Duffin | 3ae2951 | 2020-04-08 18:18:03 +0100 | [diff] [blame] | 574 | OutputFile: outputFile, |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 575 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 576 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 577 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jihoon Kang | 246690a | 2024-02-01 21:55:01 +0000 | [diff] [blame] | 578 | if dstubs.Javadoc.exportableStubsSrcJar != nil { |
| 579 | entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.exportableStubsSrcJar) |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 580 | } |
Jihoon Kang | ee11328 | 2024-01-23 00:16:41 +0000 | [diff] [blame] | 581 | if dstubs.everythingArtifacts.apiVersionsXml != nil { |
Jihoon Kang | 246690a | 2024-02-01 21:55:01 +0000 | [diff] [blame] | 582 | entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.exportableArtifacts.apiVersionsXml) |
Nan Zhang | d23ac69 | 2018-09-18 10:41:33 -0700 | [diff] [blame] | 583 | } |
Jihoon Kang | ee11328 | 2024-01-23 00:16:41 +0000 | [diff] [blame] | 584 | if dstubs.everythingArtifacts.annotationsZip != nil { |
Jihoon Kang | 246690a | 2024-02-01 21:55:01 +0000 | [diff] [blame] | 585 | entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.exportableArtifacts.annotationsZip) |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 586 | } |
Jihoon Kang | ee11328 | 2024-01-23 00:16:41 +0000 | [diff] [blame] | 587 | if dstubs.everythingArtifacts.metadataZip != nil { |
Jihoon Kang | 246690a | 2024-02-01 21:55:01 +0000 | [diff] [blame] | 588 | entries.SetPath("LOCAL_DROIDDOC_METADATA_ZIP", dstubs.exportableArtifacts.metadataZip) |
Jerome Gaillard | 0f59903 | 2019-10-10 19:29:11 +0100 | [diff] [blame] | 589 | } |
Jaewoong Jung | 9a1e8bd | 2019-09-04 20:17:54 -0700 | [diff] [blame] | 590 | }, |
| 591 | }, |
| 592 | ExtraFooters: []android.AndroidMkExtraFootersFunc{ |
Jaewoong Jung | 02b11a6 | 2020-12-07 10:23:54 -0800 | [diff] [blame] | 593 | func(w io.Writer, name, prefix, moduleDir string) { |
Anton Hansson | 27d9ec1 | 2020-04-17 11:48:24 +0100 | [diff] [blame] | 594 | if dstubs.apiFile != nil { |
| 595 | fmt.Fprintf(w, ".PHONY: %s %s.txt\n", dstubs.Name(), dstubs.Name()) |
| 596 | fmt.Fprintf(w, "%s %s.txt: %s\n", dstubs.Name(), dstubs.Name(), dstubs.apiFile) |
| 597 | } |
| 598 | if dstubs.removedApiFile != nil { |
| 599 | fmt.Fprintf(w, ".PHONY: %s %s.txt\n", dstubs.Name(), dstubs.Name()) |
| 600 | fmt.Fprintf(w, "%s %s.txt: %s\n", dstubs.Name(), dstubs.Name(), dstubs.removedApiFile) |
| 601 | } |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 602 | if dstubs.checkCurrentApiTimestamp != nil { |
| 603 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-current-api") |
| 604 | fmt.Fprintln(w, dstubs.Name()+"-check-current-api:", |
| 605 | dstubs.checkCurrentApiTimestamp.String()) |
| 606 | |
| 607 | fmt.Fprintln(w, ".PHONY: checkapi") |
| 608 | fmt.Fprintln(w, "checkapi:", |
| 609 | dstubs.checkCurrentApiTimestamp.String()) |
| 610 | |
| 611 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 612 | fmt.Fprintln(w, "droidcore: checkapi") |
| 613 | } |
| 614 | if dstubs.updateCurrentApiTimestamp != nil { |
| 615 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-update-current-api") |
| 616 | fmt.Fprintln(w, dstubs.Name()+"-update-current-api:", |
| 617 | dstubs.updateCurrentApiTimestamp.String()) |
| 618 | |
| 619 | fmt.Fprintln(w, ".PHONY: update-api") |
| 620 | fmt.Fprintln(w, "update-api:", |
| 621 | dstubs.updateCurrentApiTimestamp.String()) |
| 622 | } |
| 623 | if dstubs.checkLastReleasedApiTimestamp != nil { |
| 624 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-last-released-api") |
| 625 | fmt.Fprintln(w, dstubs.Name()+"-check-last-released-api:", |
| 626 | dstubs.checkLastReleasedApiTimestamp.String()) |
Adrian Roos | e3fe481 | 2019-01-23 14:51:55 +0100 | [diff] [blame] | 627 | |
Makoto Onuki | a573f19 | 2020-04-21 11:52:39 -0700 | [diff] [blame] | 628 | fmt.Fprintln(w, ".PHONY: checkapi") |
| 629 | fmt.Fprintln(w, "checkapi:", |
| 630 | dstubs.checkLastReleasedApiTimestamp.String()) |
Adrian Roos | e3fe481 | 2019-01-23 14:51:55 +0100 | [diff] [blame] | 631 | |
Makoto Onuki | a573f19 | 2020-04-21 11:52:39 -0700 | [diff] [blame] | 632 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 633 | fmt.Fprintln(w, "droidcore: checkapi") |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 634 | } |
Adrian Roos | 075eedc | 2019-10-10 12:07:03 +0200 | [diff] [blame] | 635 | if dstubs.apiLintTimestamp != nil { |
| 636 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-api-lint") |
| 637 | fmt.Fprintln(w, dstubs.Name()+"-api-lint:", |
| 638 | dstubs.apiLintTimestamp.String()) |
| 639 | |
| 640 | fmt.Fprintln(w, ".PHONY: checkapi") |
| 641 | fmt.Fprintln(w, "checkapi:", |
Adrian Roos | 3b8f1cd | 2019-11-01 13:42:39 +0100 | [diff] [blame] | 642 | dstubs.Name()+"-api-lint") |
Adrian Roos | 075eedc | 2019-10-10 12:07:03 +0200 | [diff] [blame] | 643 | |
| 644 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 645 | fmt.Fprintln(w, "droidcore: checkapi") |
Adrian Roos | 3b8f1cd | 2019-11-01 13:42:39 +0100 | [diff] [blame] | 646 | |
| 647 | if dstubs.apiLintReport != nil { |
| 648 | fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s)\n", dstubs.Name()+"-api-lint", |
| 649 | dstubs.apiLintReport.String(), "apilint/"+dstubs.Name()+"-lint-report.txt") |
Bob Badour | 5180438 | 2022-04-13 11:27:19 -0700 | [diff] [blame] | 650 | fmt.Fprintf(w, "$(call declare-0p-target,%s)\n", dstubs.apiLintReport.String()) |
Adrian Roos | 3b8f1cd | 2019-11-01 13:42:39 +0100 | [diff] [blame] | 651 | } |
Adrian Roos | 075eedc | 2019-10-10 12:07:03 +0200 | [diff] [blame] | 652 | } |
Pete Gillin | 581d608 | 2018-10-22 15:55:04 +0100 | [diff] [blame] | 653 | if dstubs.checkNullabilityWarningsTimestamp != nil { |
| 654 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-nullability-warnings") |
| 655 | fmt.Fprintln(w, dstubs.Name()+"-check-nullability-warnings:", |
| 656 | dstubs.checkNullabilityWarningsTimestamp.String()) |
| 657 | |
| 658 | fmt.Fprintln(w, ".PHONY:", "droidcore") |
| 659 | fmt.Fprintln(w, "droidcore: ", dstubs.Name()+"-check-nullability-warnings") |
| 660 | } |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 661 | }, |
| 662 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 663 | }} |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 664 | } |
| 665 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 666 | func (a *AndroidAppImport) AndroidMkEntries() []android.AndroidMkEntries { |
Colin Cross | 56a8321 | 2020-09-15 18:30:11 -0700 | [diff] [blame] | 667 | if a.hideApexVariantFromMake { |
Jiyong Park | 592a6a4 | 2020-04-21 22:34:28 +0900 | [diff] [blame] | 668 | // The non-platform variant is placed inside APEX. No reason to |
| 669 | // make it available to Make. |
| 670 | return nil |
| 671 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 672 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
Spandan Das | 614a6f2 | 2024-02-29 19:54:28 +0000 | [diff] [blame] | 673 | Class: "APPS", |
| 674 | OutputFile: android.OptionalPathForPath(a.outputFile), |
| 675 | OverrideName: a.BaseModuleName(), // TODO (spandandas): Add a test |
| 676 | Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 677 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 678 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jiyong Park | f748731 | 2019-10-17 12:54:30 +0900 | [diff] [blame] | 679 | entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", a.Privileged()) |
Colin Cross | 503c1d0 | 2020-01-28 14:00:53 -0800 | [diff] [blame] | 680 | entries.SetString("LOCAL_CERTIFICATE", a.certificate.AndroidMkString()) |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 681 | entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", a.properties.Overrides...) |
| 682 | if len(a.dexpreopter.builtInstalled) > 0 { |
| 683 | entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", a.dexpreopter.builtInstalled) |
| 684 | } |
| 685 | entries.AddStrings("LOCAL_INSTALLED_MODULE_STEM", a.installPath.Rel()) |
Bill Peckham | a036da9 | 2021-01-08 16:09:09 -0800 | [diff] [blame] | 686 | if Bool(a.properties.Export_package_resources) { |
| 687 | entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", a.outputFile) |
| 688 | } |
Joe Onorato | 6fe59eb | 2023-07-16 13:20:33 -0700 | [diff] [blame] | 689 | // TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts |
Jaewoong Jung | e0dc8df | 2019-08-27 17:33:16 -0700 | [diff] [blame] | 690 | }, |
Jaewoong Jung | ccbb393 | 2019-04-15 09:48:31 -0700 | [diff] [blame] | 691 | }, |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 692 | }} |
Jaewoong Jung | ccbb393 | 2019-04-15 09:48:31 -0700 | [diff] [blame] | 693 | } |
| 694 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 695 | func (a *AndroidTestImport) AndroidMkEntries() []android.AndroidMkEntries { |
| 696 | entriesList := a.AndroidAppImport.AndroidMkEntries() |
| 697 | entries := &entriesList[0] |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 698 | entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Colin Cross | cfb0f5e | 2021-09-24 15:47:17 -0700 | [diff] [blame] | 699 | testSuiteComponent(entries, a.testProperties.Test_suites, Bool(a.testProperties.Per_testcase_directory)) |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 700 | androidMkWriteTestData(a.data, entries) |
Jaewoong Jung | b28eb5f | 2019-08-27 15:01:50 -0700 | [diff] [blame] | 701 | }) |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 702 | return entriesList |
Jaewoong Jung | b28eb5f | 2019-08-27 15:01:50 -0700 | [diff] [blame] | 703 | } |
| 704 | |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 705 | func androidMkWriteTestData(data android.Paths, entries *android.AndroidMkEntries) { |
Jaewoong Jung | b28eb5f | 2019-08-27 15:01:50 -0700 | [diff] [blame] | 706 | var testFiles []string |
| 707 | for _, d := range data { |
| 708 | testFiles = append(testFiles, d.String()+":"+d.Rel()) |
| 709 | } |
| 710 | entries.AddStrings("LOCAL_COMPATIBILITY_SUPPORT_FILES", testFiles...) |
| 711 | } |
Jaewoong Jung | 9befb0c | 2020-01-18 10:33:43 -0800 | [diff] [blame] | 712 | |
| 713 | func (r *RuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEntries { |
| 714 | return []android.AndroidMkEntries{android.AndroidMkEntries{ |
| 715 | Class: "ETC", |
| 716 | OutputFile: android.OptionalPathForPath(r.outputFile), |
| 717 | Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", |
| 718 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 719 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Jaewoong Jung | 78ec5d8 | 2020-01-31 10:11:47 -0800 | [diff] [blame] | 720 | entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString()) |
Colin Cross | c68db4b | 2021-11-11 18:59:15 -0800 | [diff] [blame] | 721 | entries.SetPath("LOCAL_MODULE_PATH", r.installDir) |
Jaewoong Jung | ad0177b | 2020-04-24 15:22:40 -0700 | [diff] [blame] | 722 | entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...) |
Joe Onorato | 6fe59eb | 2023-07-16 13:20:33 -0700 | [diff] [blame] | 723 | // TODO: LOCAL_ACONFIG_FILES -- Might eventually need aconfig flags? |
Jaewoong Jung | 9befb0c | 2020-01-18 10:33:43 -0800 | [diff] [blame] | 724 | }, |
| 725 | }, |
| 726 | }} |
| 727 | } |
Sasha Smundak | a7856c0 | 2020-04-23 09:49:59 -0700 | [diff] [blame] | 728 | |
| 729 | func (apkSet *AndroidAppSet) AndroidMkEntries() []android.AndroidMkEntries { |
| 730 | return []android.AndroidMkEntries{ |
| 731 | android.AndroidMkEntries{ |
| 732 | Class: "APPS", |
Colin Cross | ffbcd1d | 2021-11-12 12:19:42 -0800 | [diff] [blame] | 733 | OutputFile: android.OptionalPathForPath(apkSet.primaryOutput), |
Sasha Smundak | a7856c0 | 2020-04-23 09:49:59 -0700 | [diff] [blame] | 734 | Include: "$(BUILD_SYSTEM)/soong_android_app_set.mk", |
| 735 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
Colin Cross | aa25553 | 2020-07-03 13:18:24 -0700 | [diff] [blame] | 736 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
Sasha Smundak | a7856c0 | 2020-04-23 09:49:59 -0700 | [diff] [blame] | 737 | entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", apkSet.Privileged()) |
Colin Cross | ffbcd1d | 2021-11-12 12:19:42 -0800 | [diff] [blame] | 738 | entries.SetPath("LOCAL_APK_SET_INSTALL_FILE", apkSet.PackedAdditionalOutputs()) |
Jaewoong Jung | 11c1e0f | 2020-06-29 19:18:44 -0700 | [diff] [blame] | 739 | entries.SetPath("LOCAL_APKCERTS_FILE", apkSet.apkcertsFile) |
Sasha Smundak | a7856c0 | 2020-04-23 09:49:59 -0700 | [diff] [blame] | 740 | entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", apkSet.properties.Overrides...) |
Joe Onorato | 6fe59eb | 2023-07-16 13:20:33 -0700 | [diff] [blame] | 741 | // TODO(b/289117800): LOCAL_ACONFIG_FILES for prebuilts -- Both declarations and values |
Sasha Smundak | a7856c0 | 2020-04-23 09:49:59 -0700 | [diff] [blame] | 742 | }, |
| 743 | }, |
| 744 | }, |
| 745 | } |
| 746 | } |
Jihoon Kang | 1bff034 | 2023-01-17 20:40:22 +0000 | [diff] [blame] | 747 | |
| 748 | func (al *ApiLibrary) AndroidMkEntries() []android.AndroidMkEntries { |
| 749 | var entriesList []android.AndroidMkEntries |
| 750 | |
| 751 | entriesList = append(entriesList, android.AndroidMkEntries{ |
| 752 | Class: "JAVA_LIBRARIES", |
| 753 | OutputFile: android.OptionalPathForPath(al.stubsJar), |
| 754 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
| 755 | ExtraEntries: []android.AndroidMkExtraEntriesFunc{ |
| 756 | func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { |
| 757 | entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true) |
| 758 | entries.SetPath("LOCAL_SOONG_CLASSES_JAR", al.stubsJar) |
| 759 | entries.SetPath("LOCAL_SOONG_HEADER_JAR", al.stubsJar) |
| 760 | }, |
| 761 | }, |
| 762 | }) |
| 763 | |
| 764 | return entriesList |
| 765 | } |