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" |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [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" |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 23 | ) |
| 24 | |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 25 | func (library *Library) AndroidMkHostDex(w io.Writer, name string, data android.AndroidMkData) { |
| 26 | if Bool(library.deviceProperties.Hostdex) && !library.Host() { |
| 27 | fmt.Fprintln(w, "include $(CLEAR_VARS)") |
| 28 | fmt.Fprintln(w, "LOCAL_MODULE := "+name+"-hostdex") |
| 29 | fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true") |
| 30 | fmt.Fprintln(w, "LOCAL_MODULE_CLASS := JAVA_LIBRARIES") |
Colin Cross | 56abb83 | 2019-01-14 14:13:51 -0800 | [diff] [blame] | 31 | if library.dexJarFile != nil { |
| 32 | fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", library.dexJarFile.String()) |
| 33 | } else { |
| 34 | fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", library.implementationAndResourcesJar.String()) |
| 35 | } |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 36 | if library.dexJarFile != nil { |
| 37 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", library.dexJarFile.String()) |
| 38 | } |
| 39 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String()) |
| 40 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", library.implementationAndResourcesJar.String()) |
Jaewoong Jung | 9aa3ab1 | 2019-04-03 15:47:29 -0700 | [diff] [blame] | 41 | if len(data.Required) > 0 { |
| 42 | fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES :=", strings.Join(data.Required, " ")) |
| 43 | } |
| 44 | if len(data.Host_required) > 0 { |
| 45 | fmt.Fprintln(w, "LOCAL_HOST_REQUIRED_MODULES :=", strings.Join(data.Host_required, " ")) |
| 46 | } |
| 47 | if len(data.Target_required) > 0 { |
| 48 | fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES :=", strings.Join(data.Target_required, " ")) |
| 49 | } |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 50 | fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk") |
| 51 | } |
| 52 | } |
| 53 | |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 54 | func (library *Library) AndroidMk() android.AndroidMkData { |
| 55 | return android.AndroidMkData{ |
| 56 | Class: "JAVA_LIBRARIES", |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 57 | OutputFile: android.OptionalPathForPath(library.outputFile), |
Colin Cross | 5349941 | 2017-09-07 13:20:25 -0700 | [diff] [blame] | 58 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 59 | Extra: []android.AndroidMkExtraFunc{ |
| 60 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | 5beccee | 2017-12-07 15:28:59 -0800 | [diff] [blame] | 61 | if len(library.logtagsSrcs) > 0 { |
| 62 | var logtags []string |
| 63 | for _, l := range library.logtagsSrcs { |
| 64 | logtags = append(logtags, l.Rel()) |
| 65 | } |
| 66 | fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(logtags, " ")) |
| 67 | } |
| 68 | |
Colin Cross | 9ae1b92 | 2018-06-26 17:59:05 -0700 | [diff] [blame] | 69 | if library.installFile == nil { |
Colin Cross | 2c429dc | 2017-08-31 16:45:16 -0700 | [diff] [blame] | 70 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true") |
| 71 | } |
Colin Cross | 6ade34f | 2017-09-15 13:00:47 -0700 | [diff] [blame] | 72 | if library.dexJarFile != nil { |
| 73 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", library.dexJarFile.String()) |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 74 | } |
| 75 | if len(library.dexpreopter.builtInstalled) > 0 { |
Colin Cross | deabb94 | 2019-02-11 14:11:09 -0800 | [diff] [blame] | 76 | fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", library.dexpreopter.builtInstalled) |
Colin Cross | 6ade34f | 2017-09-15 13:00:47 -0700 | [diff] [blame] | 77 | } |
Colin Cross | 83bb316 | 2018-06-25 15:48:06 -0700 | [diff] [blame] | 78 | fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", library.sdkVersion()) |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 79 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", library.implementationAndResourcesJar.String()) |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 80 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String()) |
Colin Cross | cb93359 | 2017-11-22 13:49:43 -0800 | [diff] [blame] | 81 | |
| 82 | if library.jacocoReportClassesFile != nil { |
| 83 | fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", library.jacocoReportClassesFile.String()) |
| 84 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 85 | |
Jiyong Park | 1be9691 | 2018-05-28 18:02:19 +0900 | [diff] [blame] | 86 | if len(library.exportedSdkLibs) != 0 { |
| 87 | fmt.Fprintln(w, "LOCAL_EXPORT_SDK_LIBRARIES :=", strings.Join(library.exportedSdkLibs, " ")) |
| 88 | } |
| 89 | |
Vladimir Marko | 0975ee0 | 2019-04-02 10:29:55 +0100 | [diff] [blame] | 90 | if len(library.additionalCheckedModules) != 0 { |
| 91 | fmt.Fprintln(w, "LOCAL_ADDITIONAL_CHECKED_MODULE +=", strings.Join(library.additionalCheckedModules.Strings(), " ")) |
| 92 | } |
| 93 | |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 94 | // Temporary hack: export sources used to compile framework.jar to Make |
| 95 | // to be used for droiddoc |
| 96 | // TODO(ccross): remove this once droiddoc is in soong |
Mathew Inwood | ebe29ce | 2018-09-04 14:26:19 +0100 | [diff] [blame] | 97 | if (library.Name() == "framework") || (library.Name() == "framework-annotation-proc") { |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 98 | fmt.Fprintln(w, "SOONG_FRAMEWORK_SRCS :=", strings.Join(library.compiledJavaSrcs.Strings(), " ")) |
| 99 | fmt.Fprintln(w, "SOONG_FRAMEWORK_SRCJARS :=", strings.Join(library.compiledSrcJars.Strings(), " ")) |
| 100 | } |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 101 | }, |
| 102 | }, |
Colin Cross | 9243010 | 2017-10-09 14:59:32 -0700 | [diff] [blame] | 103 | Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { |
| 104 | android.WriteAndroidMkData(w, data) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 105 | library.AndroidMkHostDex(w, name, data) |
Colin Cross | 9243010 | 2017-10-09 14:59:32 -0700 | [diff] [blame] | 106 | }, |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 107 | } |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 108 | } |
| 109 | |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 110 | // Called for modules that are a component of a test suite. |
| 111 | func testSuiteComponent(w io.Writer, test_suites []string) { |
| 112 | fmt.Fprintln(w, "LOCAL_MODULE_TAGS := tests") |
| 113 | if len(test_suites) > 0 { |
| 114 | fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=", |
| 115 | strings.Join(test_suites, " ")) |
| 116 | } else { |
| 117 | fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE := null-suite") |
| 118 | } |
| 119 | } |
| 120 | |
Colin Cross | 05638fc | 2018-04-09 18:40:24 -0700 | [diff] [blame] | 121 | func (j *Test) AndroidMk() android.AndroidMkData { |
| 122 | data := j.Library.AndroidMk() |
| 123 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 124 | testSuiteComponent(w, j.testProperties.Test_suites) |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 125 | if j.testConfig != nil { |
| 126 | fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", j.testConfig.String()) |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 127 | } |
Colin Cross | 05638fc | 2018-04-09 18:40:24 -0700 | [diff] [blame] | 128 | }) |
| 129 | |
Colin Cross | d96ca35 | 2018-08-10 16:06:24 -0700 | [diff] [blame] | 130 | androidMkWriteTestData(j.data, &data) |
| 131 | |
Colin Cross | 05638fc | 2018-04-09 18:40:24 -0700 | [diff] [blame] | 132 | return data |
| 133 | } |
| 134 | |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 135 | func (j *TestHelperLibrary) AndroidMk() android.AndroidMkData { |
| 136 | data := j.Library.AndroidMk() |
| 137 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
| 138 | testSuiteComponent(w, j.testHelperLibraryProperties.Test_suites) |
| 139 | }) |
| 140 | |
| 141 | return data |
| 142 | } |
| 143 | |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 144 | func (prebuilt *Import) AndroidMk() android.AndroidMkData { |
| 145 | return android.AndroidMkData{ |
| 146 | Class: "JAVA_LIBRARIES", |
| 147 | OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile), |
Colin Cross | 5349941 | 2017-09-07 13:20:25 -0700 | [diff] [blame] | 148 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 149 | Extra: []android.AndroidMkExtraFunc{ |
| 150 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | ff3ae9d | 2018-04-10 16:15:18 -0700 | [diff] [blame] | 151 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !Bool(prebuilt.properties.Installable)) |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 152 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String()) |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 153 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", prebuilt.combinedClasspathFile.String()) |
Colin Cross | 83bb316 | 2018-06-25 15:48:06 -0700 | [diff] [blame] | 154 | fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.sdkVersion()) |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 155 | }, |
| 156 | }, |
| 157 | } |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 158 | } |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 159 | |
Colin Cross | 42be761 | 2019-02-21 18:12:14 -0800 | [diff] [blame] | 160 | func (prebuilt *DexImport) AndroidMk() android.AndroidMkData { |
| 161 | return android.AndroidMkData{ |
| 162 | Class: "JAVA_LIBRARIES", |
| 163 | OutputFile: android.OptionalPathForPath(prebuilt.maybeStrippedDexJarFile), |
| 164 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
| 165 | Extra: []android.AndroidMkExtraFunc{ |
| 166 | func(w io.Writer, outputFile android.Path) { |
| 167 | if prebuilt.dexJarFile != nil { |
| 168 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", prebuilt.dexJarFile.String()) |
| 169 | // TODO(b/125517186): export the dex jar as a classes jar to match some mis-uses in Make until |
| 170 | // boot_jars_package_check.mk can check dex jars. |
| 171 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.dexJarFile.String()) |
| 172 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", prebuilt.dexJarFile.String()) |
| 173 | } |
| 174 | if len(prebuilt.dexpreopter.builtInstalled) > 0 { |
| 175 | fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", prebuilt.dexpreopter.builtInstalled) |
| 176 | } |
| 177 | }, |
| 178 | }, |
| 179 | } |
| 180 | } |
| 181 | |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 182 | func (prebuilt *AARImport) AndroidMk() android.AndroidMkData { |
| 183 | return android.AndroidMkData{ |
| 184 | Class: "JAVA_LIBRARIES", |
| 185 | OutputFile: android.OptionalPathForPath(prebuilt.classpathFile), |
| 186 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
| 187 | Extra: []android.AndroidMkExtraFunc{ |
| 188 | func(w io.Writer, outputFile android.Path) { |
| 189 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true") |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 190 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.classpathFile.String()) |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 191 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", prebuilt.classpathFile.String()) |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 192 | fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", prebuilt.exportPackage.String()) |
| 193 | fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", prebuilt.proguardFlags.String()) |
Colin Cross | 66f7882 | 2018-05-02 12:58:28 -0700 | [diff] [blame] | 194 | fmt.Fprintln(w, "LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=", prebuilt.extraAaptPackagesFile.String()) |
Colin Cross | 10f7c4a | 2018-05-23 10:59:28 -0700 | [diff] [blame] | 195 | fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", prebuilt.manifest.String()) |
Colin Cross | 83bb316 | 2018-06-25 15:48:06 -0700 | [diff] [blame] | 196 | fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.sdkVersion()) |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 197 | }, |
| 198 | }, |
| 199 | } |
| 200 | } |
| 201 | |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 202 | func (binary *Binary) AndroidMk() android.AndroidMkData { |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 203 | |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 204 | if !binary.isWrapperVariant { |
| 205 | return android.AndroidMkData{ |
| 206 | Class: "JAVA_LIBRARIES", |
Colin Cross | 331a121 | 2018-08-15 20:40:52 -0700 | [diff] [blame] | 207 | OutputFile: android.OptionalPathForPath(binary.outputFile), |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 208 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Colin Cross | 331a121 | 2018-08-15 20:40:52 -0700 | [diff] [blame] | 209 | Extra: []android.AndroidMkExtraFunc{ |
| 210 | func(w io.Writer, outputFile android.Path) { |
| 211 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", binary.headerJarFile.String()) |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 212 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", binary.implementationAndResourcesJar.String()) |
Colin Cross | 12fc2af | 2019-01-14 12:35:45 -0800 | [diff] [blame] | 213 | if binary.dexJarFile != nil { |
| 214 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", binary.dexJarFile.String()) |
| 215 | } |
| 216 | if len(binary.dexpreopter.builtInstalled) > 0 { |
Colin Cross | deabb94 | 2019-02-11 14:11:09 -0800 | [diff] [blame] | 217 | fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", binary.dexpreopter.builtInstalled) |
Colin Cross | 12fc2af | 2019-01-14 12:35:45 -0800 | [diff] [blame] | 218 | } |
Colin Cross | 331a121 | 2018-08-15 20:40:52 -0700 | [diff] [blame] | 219 | }, |
| 220 | }, |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 221 | Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { |
| 222 | android.WriteAndroidMkData(w, data) |
Colin Cross | 1965568 | 2017-09-07 17:00:22 -0700 | [diff] [blame] | 223 | |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 224 | fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)") |
| 225 | }, |
| 226 | } |
| 227 | } else { |
| 228 | return android.AndroidMkData{ |
| 229 | Class: "EXECUTABLES", |
| 230 | OutputFile: android.OptionalPathForPath(binary.wrapperFile), |
| 231 | Extra: []android.AndroidMkExtraFunc{ |
| 232 | func(w io.Writer, outputFile android.Path) { |
| 233 | fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false") |
| 234 | }, |
| 235 | }, |
| 236 | Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { |
| 237 | android.WriteAndroidMkData(w, data) |
| 238 | |
| 239 | // Ensure that the wrapper script timestamp is always updated when the jar is updated |
| 240 | fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): $(jar_installed_module)") |
| 241 | fmt.Fprintln(w, "jar_installed_module :=") |
| 242 | }, |
| 243 | } |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 244 | } |
| 245 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 246 | |
| 247 | func (app *AndroidApp) AndroidMk() android.AndroidMkData { |
| 248 | return android.AndroidMkData{ |
| 249 | Class: "APPS", |
| 250 | OutputFile: android.OptionalPathForPath(app.outputFile), |
| 251 | Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", |
| 252 | Extra: []android.AndroidMkExtraFunc{ |
| 253 | func(w io.Writer, outputFile android.Path) { |
Jaewoong Jung | 9109d72 | 2019-01-30 13:13:52 -0800 | [diff] [blame] | 254 | // TODO(jungjw): This, outputting two LOCAL_MODULE lines, works, but is not ideal. Find a better solution. |
| 255 | if app.Name() != app.installApkName { |
| 256 | fmt.Fprintln(w, "# Overridden by PRODUCT_PACKAGE_NAME_OVERRIDES") |
| 257 | fmt.Fprintln(w, "LOCAL_MODULE :=", app.installApkName) |
| 258 | } |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 259 | fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", app.exportPackage.String()) |
| 260 | if app.dexJarFile != nil { |
| 261 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", app.dexJarFile.String()) |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 262 | } |
Colin Cross | 331a121 | 2018-08-15 20:40:52 -0700 | [diff] [blame] | 263 | if app.implementationAndResourcesJar != nil { |
| 264 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", app.implementationAndResourcesJar.String()) |
Colin Cross | 5dfabfb | 2017-12-14 13:19:01 -0800 | [diff] [blame] | 265 | } |
| 266 | if app.headerJarFile != nil { |
| 267 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", app.headerJarFile.String()) |
| 268 | } |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 269 | if app.bundleFile != nil { |
| 270 | fmt.Fprintln(w, "LOCAL_SOONG_BUNDLE :=", app.bundleFile.String()) |
| 271 | } |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 272 | if app.jacocoReportClassesFile != nil { |
| 273 | fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", app.jacocoReportClassesFile.String()) |
| 274 | } |
Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 275 | if app.proguardDictionary != nil { |
| 276 | fmt.Fprintln(w, "LOCAL_SOONG_PROGUARD_DICT :=", app.proguardDictionary.String()) |
| 277 | } |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 278 | |
| 279 | if app.Name() == "framework-res" { |
| 280 | fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)") |
| 281 | // Make base_rules.mk not put framework-res in a subdirectory called |
| 282 | // framework_res. |
| 283 | fmt.Fprintln(w, "LOCAL_NO_STANDARD_LIBRARIES := true") |
| 284 | } |
| 285 | |
Anton Hansson | 53c8844 | 2019-03-18 15:53:16 +0000 | [diff] [blame] | 286 | filterRRO := func(filter overlayType) android.Paths { |
| 287 | var paths android.Paths |
| 288 | for _, d := range app.rroDirs { |
| 289 | if d.overlayType == filter { |
| 290 | paths = append(paths, d.path) |
| 291 | } |
| 292 | } |
Colin Cross | a140bb0 | 2018-04-17 10:52:26 -0700 | [diff] [blame] | 293 | // Reverse the order, Soong stores rroDirs in aapt2 order (low to high priority), but Make |
| 294 | // expects it in LOCAL_RESOURCE_DIRS order (high to low priority). |
Anton Hansson | 53c8844 | 2019-03-18 15:53:16 +0000 | [diff] [blame] | 295 | return android.ReversePaths(paths) |
| 296 | } |
| 297 | deviceRRODirs := filterRRO(device) |
| 298 | if len(deviceRRODirs) > 0 { |
| 299 | fmt.Fprintln(w, "LOCAL_SOONG_DEVICE_RRO_DIRS :=", strings.Join(deviceRRODirs.Strings(), " ")) |
| 300 | } |
| 301 | productRRODirs := filterRRO(product) |
| 302 | if len(productRRODirs) > 0 { |
| 303 | fmt.Fprintln(w, "LOCAL_SOONG_PRODUCT_RRO_DIRS :=", strings.Join(productRRODirs.Strings(), " ")) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | if Bool(app.appProperties.Export_package_resources) { |
| 307 | fmt.Fprintln(w, "LOCAL_EXPORT_PACKAGE_RESOURCES := true") |
| 308 | } |
| 309 | |
| 310 | fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", app.manifestPath.String()) |
| 311 | |
Colin Cross | 1605606 | 2017-12-13 22:46:28 -0800 | [diff] [blame] | 312 | if Bool(app.appProperties.Privileged) { |
| 313 | fmt.Fprintln(w, "LOCAL_PRIVILEGED_MODULE := true") |
| 314 | } |
Colin Cross | e1731a5 | 2017-12-14 11:22:55 -0800 | [diff] [blame] | 315 | |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 316 | fmt.Fprintln(w, "LOCAL_CERTIFICATE :=", app.certificate.Pem.String()) |
Jaewoong Jung | 9109d72 | 2019-01-30 13:13:52 -0800 | [diff] [blame] | 317 | if overriddenPkgs := app.getOverriddenPackages(); len(overriddenPkgs) > 0 { |
| 318 | fmt.Fprintln(w, "LOCAL_OVERRIDES_PACKAGES :=", strings.Join(overriddenPkgs, " ")) |
Jason Monk | d4122be | 2018-08-10 09:33:36 -0400 | [diff] [blame] | 319 | } |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 320 | |
| 321 | for _, jniLib := range app.installJniLibs { |
| 322 | fmt.Fprintln(w, "LOCAL_SOONG_JNI_LIBS_"+jniLib.target.Arch.ArchType.String(), "+=", jniLib.name) |
| 323 | } |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 324 | if len(app.dexpreopter.builtInstalled) > 0 { |
Colin Cross | deabb94 | 2019-02-11 14:11:09 -0800 | [diff] [blame] | 325 | fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", app.dexpreopter.builtInstalled) |
Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 326 | } |
Colin Cross | e560c4a | 2019-03-19 16:03:11 -0700 | [diff] [blame] | 327 | for _, split := range app.aapt.splits { |
| 328 | install := "$(LOCAL_MODULE_PATH)/" + strings.TrimSuffix(app.installApkName, ".apk") + split.suffix + ".apk" |
| 329 | fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED +=", split.path.String()+":"+install) |
| 330 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 331 | }, |
| 332 | }, |
| 333 | } |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 334 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 335 | |
Jaewoong Jung | 9109d72 | 2019-01-30 13:13:52 -0800 | [diff] [blame] | 336 | func (a *AndroidApp) getOverriddenPackages() []string { |
| 337 | var overridden []string |
| 338 | if len(a.appProperties.Overrides) > 0 { |
| 339 | overridden = append(overridden, a.appProperties.Overrides...) |
| 340 | } |
| 341 | if a.Name() != a.installApkName { |
| 342 | overridden = append(overridden, a.Name()) |
| 343 | } |
| 344 | return overridden |
| 345 | } |
| 346 | |
Colin Cross | ae5caf5 | 2018-05-22 11:11:52 -0700 | [diff] [blame] | 347 | func (a *AndroidTest) AndroidMk() android.AndroidMkData { |
| 348 | data := a.AndroidApp.AndroidMk() |
| 349 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 350 | testSuiteComponent(w, a.testProperties.Test_suites) |
Colin Cross | 303e21f | 2018-08-07 16:49:25 -0700 | [diff] [blame] | 351 | if a.testConfig != nil { |
| 352 | fmt.Fprintln(w, "LOCAL_FULL_TEST_CONFIG :=", a.testConfig.String()) |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 353 | } |
Colin Cross | ae5caf5 | 2018-05-22 11:11:52 -0700 | [diff] [blame] | 354 | }) |
Colin Cross | d96ca35 | 2018-08-10 16:06:24 -0700 | [diff] [blame] | 355 | androidMkWriteTestData(a.data, &data) |
Colin Cross | ae5caf5 | 2018-05-22 11:11:52 -0700 | [diff] [blame] | 356 | |
| 357 | return data |
| 358 | } |
| 359 | |
Colin Cross | 252fc6f | 2018-10-04 15:22:03 -0700 | [diff] [blame] | 360 | func (a *AndroidTestHelperApp) AndroidMk() android.AndroidMkData { |
| 361 | data := a.AndroidApp.AndroidMk() |
| 362 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
Paul Duffin | 42df144 | 2019-03-20 12:45:53 +0000 | [diff] [blame] | 363 | testSuiteComponent(w, a.appTestHelperAppProperties.Test_suites) |
Colin Cross | 252fc6f | 2018-10-04 15:22:03 -0700 | [diff] [blame] | 364 | }) |
| 365 | |
| 366 | return data |
| 367 | } |
| 368 | |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 369 | func (a *AndroidLibrary) AndroidMk() android.AndroidMkData { |
| 370 | data := a.Library.AndroidMk() |
| 371 | |
| 372 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
Colin Cross | a54974c | 2018-10-29 23:15:37 -0700 | [diff] [blame] | 373 | if a.aarFile != nil { |
| 374 | fmt.Fprintln(w, "LOCAL_SOONG_AAR :=", a.aarFile.String()) |
| 375 | } |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 376 | if a.proguardDictionary != nil { |
| 377 | fmt.Fprintln(w, "LOCAL_SOONG_PROGUARD_DICT :=", a.proguardDictionary.String()) |
| 378 | } |
| 379 | |
| 380 | if a.Name() == "framework-res" { |
| 381 | fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)") |
| 382 | // Make base_rules.mk not put framework-res in a subdirectory called |
| 383 | // framework_res. |
| 384 | fmt.Fprintln(w, "LOCAL_NO_STANDARD_LIBRARIES := true") |
| 385 | } |
| 386 | |
| 387 | fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", a.exportPackage.String()) |
Colin Cross | 66f7882 | 2018-05-02 12:58:28 -0700 | [diff] [blame] | 388 | fmt.Fprintln(w, "LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=", a.extraAaptPackagesFile.String()) |
Colin Cross | 90c25c6 | 2019-04-19 16:22:57 -0700 | [diff] [blame^] | 389 | fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", a.mergedManifestFile.String()) |
Colin Cross | 89c3158 | 2018-04-30 15:55:11 -0700 | [diff] [blame] | 390 | fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", |
| 391 | strings.Join(a.exportedProguardFlagFiles.Strings(), " ")) |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 392 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true") |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 393 | }) |
| 394 | |
| 395 | return data |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 396 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 397 | |
| 398 | func (jd *Javadoc) AndroidMk() android.AndroidMkData { |
| 399 | return android.AndroidMkData{ |
| 400 | Class: "JAVA_LIBRARIES", |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 401 | OutputFile: android.OptionalPathForPath(jd.stubsSrcJar), |
Colin Cross | 5fa9d6f | 2018-08-08 21:44:48 -0700 | [diff] [blame] | 402 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 403 | Extra: []android.AndroidMkExtraFunc{ |
| 404 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | 38b40df | 2018-04-10 16:14:46 -0700 | [diff] [blame] | 405 | if BoolDefault(jd.properties.Installable, true) { |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 406 | fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", jd.docZip.String()) |
| 407 | } |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 408 | if jd.stubsSrcJar != nil { |
| 409 | fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", jd.stubsSrcJar.String()) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 410 | } |
| 411 | }, |
| 412 | }, |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | func (ddoc *Droiddoc) AndroidMk() android.AndroidMkData { |
| 417 | return android.AndroidMkData{ |
| 418 | Class: "JAVA_LIBRARIES", |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 419 | OutputFile: android.OptionalPathForPath(ddoc.stubsSrcJar), |
Colin Cross | 5fa9d6f | 2018-08-08 21:44:48 -0700 | [diff] [blame] | 420 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 421 | Extra: []android.AndroidMkExtraFunc{ |
| 422 | func(w io.Writer, outputFile android.Path) { |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 423 | if BoolDefault(ddoc.Javadoc.properties.Installable, true) && ddoc.Javadoc.docZip != nil { |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 424 | fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", ddoc.Javadoc.docZip.String()) |
| 425 | } |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 426 | if ddoc.Javadoc.stubsSrcJar != nil { |
| 427 | fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", ddoc.Javadoc.stubsSrcJar.String()) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 428 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 429 | if ddoc.checkCurrentApiTimestamp != nil { |
| 430 | fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-current-api") |
| 431 | fmt.Fprintln(w, ddoc.Name()+"-check-current-api:", |
| 432 | ddoc.checkCurrentApiTimestamp.String()) |
| 433 | |
| 434 | fmt.Fprintln(w, ".PHONY: checkapi") |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 435 | fmt.Fprintln(w, "checkapi:", |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 436 | ddoc.checkCurrentApiTimestamp.String()) |
| 437 | |
| 438 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 439 | fmt.Fprintln(w, "droidcore: checkapi") |
| 440 | } |
| 441 | if ddoc.updateCurrentApiTimestamp != nil { |
Dan Willemsen | a03c43a | 2018-07-24 13:00:52 -0700 | [diff] [blame] | 442 | fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-update-current-api") |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 443 | fmt.Fprintln(w, ddoc.Name()+"-update-current-api:", |
| 444 | ddoc.updateCurrentApiTimestamp.String()) |
| 445 | |
| 446 | fmt.Fprintln(w, ".PHONY: update-api") |
| 447 | fmt.Fprintln(w, "update-api:", |
| 448 | ddoc.updateCurrentApiTimestamp.String()) |
| 449 | } |
| 450 | if ddoc.checkLastReleasedApiTimestamp != nil { |
| 451 | fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-last-released-api") |
| 452 | fmt.Fprintln(w, ddoc.Name()+"-check-last-released-api:", |
| 453 | ddoc.checkLastReleasedApiTimestamp.String()) |
Adrian Roos | e3fe481 | 2019-01-23 14:51:55 +0100 | [diff] [blame] | 454 | |
Adrian Roos | 62e34b9 | 2019-01-30 19:51:39 +0100 | [diff] [blame] | 455 | if ddoc.Name() == "api-stubs-docs" || ddoc.Name() == "system-api-stubs-docs" { |
Adrian Roos | e3fe481 | 2019-01-23 14:51:55 +0100 | [diff] [blame] | 456 | fmt.Fprintln(w, ".PHONY: checkapi") |
| 457 | fmt.Fprintln(w, "checkapi:", |
| 458 | ddoc.checkLastReleasedApiTimestamp.String()) |
| 459 | |
| 460 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 461 | fmt.Fprintln(w, "droidcore: checkapi") |
| 462 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 463 | } |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 464 | apiFilePrefix := "INTERNAL_PLATFORM_" |
| 465 | if String(ddoc.properties.Api_tag_name) != "" { |
| 466 | apiFilePrefix += String(ddoc.properties.Api_tag_name) + "_" |
| 467 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 468 | if ddoc.apiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 469 | fmt.Fprintln(w, apiFilePrefix+"API_FILE := ", ddoc.apiFile.String()) |
| 470 | } |
David Brazdil | fbe4cc3 | 2018-05-31 13:56:46 +0100 | [diff] [blame] | 471 | if ddoc.dexApiFile != nil { |
| 472 | fmt.Fprintln(w, apiFilePrefix+"DEX_API_FILE := ", ddoc.dexApiFile.String()) |
| 473 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 474 | if ddoc.privateApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 475 | fmt.Fprintln(w, apiFilePrefix+"PRIVATE_API_FILE := ", ddoc.privateApiFile.String()) |
| 476 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 477 | if ddoc.privateDexApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 478 | fmt.Fprintln(w, apiFilePrefix+"PRIVATE_DEX_API_FILE := ", ddoc.privateDexApiFile.String()) |
| 479 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 480 | if ddoc.removedApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 481 | fmt.Fprintln(w, apiFilePrefix+"REMOVED_API_FILE := ", ddoc.removedApiFile.String()) |
| 482 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 483 | if ddoc.removedDexApiFile != nil { |
David Brazdil | aac0c3c | 2018-04-24 16:23:29 +0100 | [diff] [blame] | 484 | fmt.Fprintln(w, apiFilePrefix+"REMOVED_DEX_API_FILE := ", ddoc.removedDexApiFile.String()) |
| 485 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 486 | if ddoc.exactApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 487 | fmt.Fprintln(w, apiFilePrefix+"EXACT_API_FILE := ", ddoc.exactApiFile.String()) |
| 488 | } |
Nan Zhang | 66dc236 | 2018-08-14 20:41:04 -0700 | [diff] [blame] | 489 | if ddoc.proguardFile != nil { |
| 490 | fmt.Fprintln(w, apiFilePrefix+"PROGUARD_FILE := ", ddoc.proguardFile.String()) |
| 491 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 492 | }, |
| 493 | }, |
| 494 | } |
| 495 | } |
Colin Cross | d96ca35 | 2018-08-10 16:06:24 -0700 | [diff] [blame] | 496 | |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 497 | func (dstubs *Droidstubs) AndroidMk() android.AndroidMkData { |
| 498 | return android.AndroidMkData{ |
| 499 | Class: "JAVA_LIBRARIES", |
| 500 | OutputFile: android.OptionalPathForPath(dstubs.stubsSrcJar), |
| 501 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
| 502 | Extra: []android.AndroidMkExtraFunc{ |
| 503 | func(w io.Writer, outputFile android.Path) { |
| 504 | if dstubs.Javadoc.stubsSrcJar != nil { |
| 505 | fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", dstubs.Javadoc.stubsSrcJar.String()) |
| 506 | } |
Nan Zhang | d23ac69 | 2018-09-18 10:41:33 -0700 | [diff] [blame] | 507 | if dstubs.apiVersionsXml != nil { |
| 508 | fmt.Fprintln(w, "LOCAL_DROIDDOC_API_VERSIONS_XML := ", dstubs.apiVersionsXml.String()) |
| 509 | } |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 510 | if dstubs.annotationsZip != nil { |
| 511 | fmt.Fprintln(w, "LOCAL_DROIDDOC_ANNOTATIONS_ZIP := ", dstubs.annotationsZip.String()) |
| 512 | } |
Nan Zhang | 71bbe63 | 2018-09-17 14:32:21 -0700 | [diff] [blame] | 513 | if dstubs.jdiffDocZip != nil { |
| 514 | fmt.Fprintln(w, "LOCAL_DROIDDOC_JDIFF_DOC_ZIP := ", dstubs.jdiffDocZip.String()) |
| 515 | } |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 516 | if dstubs.checkCurrentApiTimestamp != nil { |
| 517 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-current-api") |
| 518 | fmt.Fprintln(w, dstubs.Name()+"-check-current-api:", |
| 519 | dstubs.checkCurrentApiTimestamp.String()) |
| 520 | |
| 521 | fmt.Fprintln(w, ".PHONY: checkapi") |
| 522 | fmt.Fprintln(w, "checkapi:", |
| 523 | dstubs.checkCurrentApiTimestamp.String()) |
| 524 | |
| 525 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 526 | fmt.Fprintln(w, "droidcore: checkapi") |
| 527 | } |
| 528 | if dstubs.updateCurrentApiTimestamp != nil { |
| 529 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-update-current-api") |
| 530 | fmt.Fprintln(w, dstubs.Name()+"-update-current-api:", |
| 531 | dstubs.updateCurrentApiTimestamp.String()) |
| 532 | |
| 533 | fmt.Fprintln(w, ".PHONY: update-api") |
| 534 | fmt.Fprintln(w, "update-api:", |
| 535 | dstubs.updateCurrentApiTimestamp.String()) |
| 536 | } |
| 537 | if dstubs.checkLastReleasedApiTimestamp != nil { |
| 538 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-last-released-api") |
| 539 | fmt.Fprintln(w, dstubs.Name()+"-check-last-released-api:", |
| 540 | dstubs.checkLastReleasedApiTimestamp.String()) |
Adrian Roos | e3fe481 | 2019-01-23 14:51:55 +0100 | [diff] [blame] | 541 | |
Adrian Roos | 62e34b9 | 2019-01-30 19:51:39 +0100 | [diff] [blame] | 542 | if dstubs.Name() == "api-stubs-docs" || dstubs.Name() == "system-api-stubs-docs" { |
Adrian Roos | e3fe481 | 2019-01-23 14:51:55 +0100 | [diff] [blame] | 543 | fmt.Fprintln(w, ".PHONY: checkapi") |
| 544 | fmt.Fprintln(w, "checkapi:", |
| 545 | dstubs.checkLastReleasedApiTimestamp.String()) |
| 546 | |
| 547 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 548 | fmt.Fprintln(w, "droidcore: checkapi") |
| 549 | } |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 550 | } |
Pete Gillin | 581d608 | 2018-10-22 15:55:04 +0100 | [diff] [blame] | 551 | if dstubs.checkNullabilityWarningsTimestamp != nil { |
| 552 | fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-nullability-warnings") |
| 553 | fmt.Fprintln(w, dstubs.Name()+"-check-nullability-warnings:", |
| 554 | dstubs.checkNullabilityWarningsTimestamp.String()) |
| 555 | |
| 556 | fmt.Fprintln(w, ".PHONY:", "droidcore") |
| 557 | fmt.Fprintln(w, "droidcore: ", dstubs.Name()+"-check-nullability-warnings") |
| 558 | } |
Nan Zhang | 1598a9e | 2018-09-04 17:14:32 -0700 | [diff] [blame] | 559 | apiFilePrefix := "INTERNAL_PLATFORM_" |
| 560 | if String(dstubs.properties.Api_tag_name) != "" { |
| 561 | apiFilePrefix += String(dstubs.properties.Api_tag_name) + "_" |
| 562 | } |
| 563 | if dstubs.apiFile != nil { |
| 564 | fmt.Fprintln(w, apiFilePrefix+"API_FILE := ", dstubs.apiFile.String()) |
| 565 | } |
| 566 | if dstubs.dexApiFile != nil { |
| 567 | fmt.Fprintln(w, apiFilePrefix+"DEX_API_FILE := ", dstubs.dexApiFile.String()) |
| 568 | } |
| 569 | if dstubs.privateApiFile != nil { |
| 570 | fmt.Fprintln(w, apiFilePrefix+"PRIVATE_API_FILE := ", dstubs.privateApiFile.String()) |
| 571 | } |
| 572 | if dstubs.privateDexApiFile != nil { |
| 573 | fmt.Fprintln(w, apiFilePrefix+"PRIVATE_DEX_API_FILE := ", dstubs.privateDexApiFile.String()) |
| 574 | } |
| 575 | if dstubs.removedApiFile != nil { |
| 576 | fmt.Fprintln(w, apiFilePrefix+"REMOVED_API_FILE := ", dstubs.removedApiFile.String()) |
| 577 | } |
| 578 | if dstubs.removedDexApiFile != nil { |
| 579 | fmt.Fprintln(w, apiFilePrefix+"REMOVED_DEX_API_FILE := ", dstubs.removedDexApiFile.String()) |
| 580 | } |
| 581 | if dstubs.exactApiFile != nil { |
| 582 | fmt.Fprintln(w, apiFilePrefix+"EXACT_API_FILE := ", dstubs.exactApiFile.String()) |
| 583 | } |
| 584 | }, |
| 585 | }, |
| 586 | } |
| 587 | } |
| 588 | |
Colin Cross | d96ca35 | 2018-08-10 16:06:24 -0700 | [diff] [blame] | 589 | func androidMkWriteTestData(data android.Paths, ret *android.AndroidMkData) { |
| 590 | var testFiles []string |
| 591 | for _, d := range data { |
| 592 | testFiles = append(testFiles, d.String()+":"+d.Rel()) |
| 593 | } |
| 594 | if len(testFiles) > 0 { |
| 595 | ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) { |
| 596 | fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUPPORT_FILES := "+strings.Join(testFiles, " ")) |
| 597 | }) |
| 598 | } |
| 599 | } |