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