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