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 | |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 25 | func (library *Library) AndroidMk() android.AndroidMkData { |
| 26 | return android.AndroidMkData{ |
| 27 | Class: "JAVA_LIBRARIES", |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 28 | OutputFile: android.OptionalPathForPath(library.implementationJarFile), |
Colin Cross | 5349941 | 2017-09-07 13:20:25 -0700 | [diff] [blame] | 29 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 30 | Extra: []android.AndroidMkExtraFunc{ |
| 31 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | 5beccee | 2017-12-07 15:28:59 -0800 | [diff] [blame] | 32 | if len(library.logtagsSrcs) > 0 { |
| 33 | var logtags []string |
| 34 | for _, l := range library.logtagsSrcs { |
| 35 | logtags = append(logtags, l.Rel()) |
| 36 | } |
| 37 | fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(logtags, " ")) |
| 38 | } |
| 39 | |
Colin Cross | 9ae1b92 | 2018-06-26 17:59:05 -0700 | [diff] [blame] | 40 | if library.installFile == nil { |
Colin Cross | 2c429dc | 2017-08-31 16:45:16 -0700 | [diff] [blame] | 41 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true") |
| 42 | } |
Colin Cross | 6ade34f | 2017-09-15 13:00:47 -0700 | [diff] [blame] | 43 | if library.dexJarFile != nil { |
| 44 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", library.dexJarFile.String()) |
Colin Cross | 1bd8780 | 2017-12-05 15:31:19 -0800 | [diff] [blame] | 45 | if library.deviceProperties.Dex_preopt.Enabled != nil { |
| 46 | fmt.Fprintln(w, "LOCAL_DEX_PREOPT :=", *library.deviceProperties.Dex_preopt.Enabled) |
| 47 | } |
| 48 | if library.deviceProperties.Dex_preopt.App_image != nil { |
| 49 | fmt.Fprintln(w, "LOCAL_DEX_PREOPT_APP_IMAGE :=", *library.deviceProperties.Dex_preopt.App_image) |
| 50 | } |
| 51 | if library.deviceProperties.Dex_preopt.Profile_guided != nil { |
| 52 | fmt.Fprintln(w, "LOCAL_DEX_PREOPT_GENERATE_PROFILE :=", *library.deviceProperties.Dex_preopt.Profile_guided) |
| 53 | } |
| 54 | if library.deviceProperties.Dex_preopt.Profile != nil { |
| 55 | fmt.Fprintln(w, "LOCAL_DEX_PREOPT_GENERATE_PROFILE := true") |
| 56 | fmt.Fprintln(w, "LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING := $(LOCAL_PATH)/"+*library.deviceProperties.Dex_preopt.Profile) |
Colin Cross | a22116e | 2017-10-19 14:18:58 -0700 | [diff] [blame] | 57 | } |
Colin Cross | 6ade34f | 2017-09-15 13:00:47 -0700 | [diff] [blame] | 58 | } |
Colin Cross | 83bb316 | 2018-06-25 15:48:06 -0700 | [diff] [blame] | 59 | fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", library.sdkVersion()) |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 60 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String()) |
Colin Cross | cb93359 | 2017-11-22 13:49:43 -0800 | [diff] [blame] | 61 | |
| 62 | if library.jacocoReportClassesFile != nil { |
| 63 | fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", library.jacocoReportClassesFile.String()) |
| 64 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 65 | |
Jiyong Park | 1be9691 | 2018-05-28 18:02:19 +0900 | [diff] [blame] | 66 | if len(library.exportedSdkLibs) != 0 { |
| 67 | fmt.Fprintln(w, "LOCAL_EXPORT_SDK_LIBRARIES :=", strings.Join(library.exportedSdkLibs, " ")) |
| 68 | } |
| 69 | |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 70 | // Temporary hack: export sources used to compile framework.jar to Make |
| 71 | // to be used for droiddoc |
| 72 | // TODO(ccross): remove this once droiddoc is in soong |
| 73 | if library.Name() == "framework" { |
| 74 | fmt.Fprintln(w, "SOONG_FRAMEWORK_SRCS :=", strings.Join(library.compiledJavaSrcs.Strings(), " ")) |
| 75 | fmt.Fprintln(w, "SOONG_FRAMEWORK_SRCJARS :=", strings.Join(library.compiledSrcJars.Strings(), " ")) |
| 76 | } |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 77 | }, |
| 78 | }, |
Colin Cross | 9243010 | 2017-10-09 14:59:32 -0700 | [diff] [blame] | 79 | Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { |
| 80 | android.WriteAndroidMkData(w, data) |
| 81 | |
Colin Cross | ff3ae9d | 2018-04-10 16:15:18 -0700 | [diff] [blame] | 82 | if Bool(library.deviceProperties.Hostdex) && !library.Host() { |
Colin Cross | 9243010 | 2017-10-09 14:59:32 -0700 | [diff] [blame] | 83 | fmt.Fprintln(w, "include $(CLEAR_VARS)") |
| 84 | fmt.Fprintln(w, "LOCAL_MODULE := "+name+"-hostdex") |
| 85 | fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true") |
| 86 | fmt.Fprintln(w, "LOCAL_MODULE_CLASS := JAVA_LIBRARIES") |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 87 | fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", library.implementationJarFile.String()) |
Colin Cross | 9ae1b92 | 2018-06-26 17:59:05 -0700 | [diff] [blame] | 88 | if library.installFile == nil { |
Colin Cross | 9243010 | 2017-10-09 14:59:32 -0700 | [diff] [blame] | 89 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true") |
| 90 | } |
| 91 | if library.dexJarFile != nil { |
| 92 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", library.dexJarFile.String()) |
| 93 | } |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 94 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.implementationJarFile.String()) |
Colin Cross | 9243010 | 2017-10-09 14:59:32 -0700 | [diff] [blame] | 95 | fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES := "+strings.Join(data.Required, " ")) |
| 96 | fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_java_prebuilt.mk") |
| 97 | } |
| 98 | }, |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 99 | } |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 100 | } |
| 101 | |
Colin Cross | 05638fc | 2018-04-09 18:40:24 -0700 | [diff] [blame] | 102 | func (j *Test) AndroidMk() android.AndroidMkData { |
| 103 | data := j.Library.AndroidMk() |
| 104 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
| 105 | fmt.Fprintln(w, "LOCAL_MODULE_TAGS := tests") |
| 106 | if len(j.testProperties.Test_suites) > 0 { |
| 107 | fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=", |
| 108 | strings.Join(j.testProperties.Test_suites, " ")) |
| 109 | } |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 110 | if j.testProperties.Test_config != nil { |
| 111 | fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=", |
| 112 | *j.testProperties.Test_config) |
| 113 | } |
Colin Cross | 05638fc | 2018-04-09 18:40:24 -0700 | [diff] [blame] | 114 | }) |
| 115 | |
| 116 | return data |
| 117 | } |
| 118 | |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 119 | func (prebuilt *Import) AndroidMk() android.AndroidMkData { |
| 120 | return android.AndroidMkData{ |
| 121 | Class: "JAVA_LIBRARIES", |
| 122 | OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile), |
Colin Cross | 5349941 | 2017-09-07 13:20:25 -0700 | [diff] [blame] | 123 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 124 | Extra: []android.AndroidMkExtraFunc{ |
| 125 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | ff3ae9d | 2018-04-10 16:15:18 -0700 | [diff] [blame] | 126 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !Bool(prebuilt.properties.Installable)) |
Nan Zhang | ed19fc3 | 2017-10-19 13:06:22 -0700 | [diff] [blame] | 127 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String()) |
Colin Cross | 83bb316 | 2018-06-25 15:48:06 -0700 | [diff] [blame] | 128 | fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.sdkVersion()) |
Colin Cross | a18e9cf | 2017-08-10 17:00:19 -0700 | [diff] [blame] | 129 | }, |
| 130 | }, |
| 131 | } |
Dan Willemsen | 218f656 | 2015-07-08 18:13:11 -0700 | [diff] [blame] | 132 | } |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 133 | |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 134 | func (prebuilt *AARImport) AndroidMk() android.AndroidMkData { |
| 135 | return android.AndroidMkData{ |
| 136 | Class: "JAVA_LIBRARIES", |
| 137 | OutputFile: android.OptionalPathForPath(prebuilt.classpathFile), |
| 138 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
| 139 | Extra: []android.AndroidMkExtraFunc{ |
| 140 | func(w io.Writer, outputFile android.Path) { |
| 141 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true") |
| 142 | fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false") |
| 143 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.classpathFile.String()) |
| 144 | fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", prebuilt.exportPackage.String()) |
| 145 | fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", prebuilt.proguardFlags.String()) |
Colin Cross | 66f7882 | 2018-05-02 12:58:28 -0700 | [diff] [blame] | 146 | fmt.Fprintln(w, "LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=", prebuilt.extraAaptPackagesFile.String()) |
Colin Cross | 10f7c4a | 2018-05-23 10:59:28 -0700 | [diff] [blame] | 147 | fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", prebuilt.manifest.String()) |
Colin Cross | 83bb316 | 2018-06-25 15:48:06 -0700 | [diff] [blame] | 148 | fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.sdkVersion()) |
Colin Cross | fabb608 | 2018-02-20 17:22:23 -0800 | [diff] [blame] | 149 | }, |
| 150 | }, |
| 151 | } |
| 152 | } |
| 153 | |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 154 | func (binary *Binary) AndroidMk() android.AndroidMkData { |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 155 | |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 156 | if !binary.isWrapperVariant { |
| 157 | return android.AndroidMkData{ |
| 158 | Class: "JAVA_LIBRARIES", |
| 159 | OutputFile: android.OptionalPathForPath(binary.implementationJarFile), |
| 160 | Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", |
| 161 | Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { |
| 162 | android.WriteAndroidMkData(w, data) |
Colin Cross | 1965568 | 2017-09-07 17:00:22 -0700 | [diff] [blame] | 163 | |
Colin Cross | 6b4a32d | 2017-12-05 13:42:45 -0800 | [diff] [blame] | 164 | fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)") |
| 165 | }, |
| 166 | } |
| 167 | } else { |
| 168 | return android.AndroidMkData{ |
| 169 | Class: "EXECUTABLES", |
| 170 | OutputFile: android.OptionalPathForPath(binary.wrapperFile), |
| 171 | Extra: []android.AndroidMkExtraFunc{ |
| 172 | func(w io.Writer, outputFile android.Path) { |
| 173 | fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false") |
| 174 | }, |
| 175 | }, |
| 176 | Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { |
| 177 | android.WriteAndroidMkData(w, data) |
| 178 | |
| 179 | // Ensure that the wrapper script timestamp is always updated when the jar is updated |
| 180 | fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): $(jar_installed_module)") |
| 181 | fmt.Fprintln(w, "jar_installed_module :=") |
| 182 | }, |
| 183 | } |
Colin Cross | 10a0349 | 2017-08-10 17:09:43 -0700 | [diff] [blame] | 184 | } |
| 185 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 186 | |
| 187 | func (app *AndroidApp) AndroidMk() android.AndroidMkData { |
| 188 | return android.AndroidMkData{ |
| 189 | Class: "APPS", |
| 190 | OutputFile: android.OptionalPathForPath(app.outputFile), |
| 191 | Include: "$(BUILD_SYSTEM)/soong_app_prebuilt.mk", |
| 192 | Extra: []android.AndroidMkExtraFunc{ |
| 193 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 194 | fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", app.exportPackage.String()) |
| 195 | if app.dexJarFile != nil { |
| 196 | fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", app.dexJarFile.String()) |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 197 | } |
Colin Cross | 5dfabfb | 2017-12-14 13:19:01 -0800 | [diff] [blame] | 198 | if app.implementationJarFile != nil { |
| 199 | fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", app.implementationJarFile) |
| 200 | } |
| 201 | if app.headerJarFile != nil { |
| 202 | fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", app.headerJarFile.String()) |
| 203 | } |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 204 | if app.jacocoReportClassesFile != nil { |
| 205 | fmt.Fprintln(w, "LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR :=", app.jacocoReportClassesFile.String()) |
| 206 | } |
Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 207 | if app.proguardDictionary != nil { |
| 208 | fmt.Fprintln(w, "LOCAL_SOONG_PROGUARD_DICT :=", app.proguardDictionary.String()) |
| 209 | } |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 210 | |
| 211 | if app.Name() == "framework-res" { |
| 212 | fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)") |
| 213 | // Make base_rules.mk not put framework-res in a subdirectory called |
| 214 | // framework_res. |
| 215 | fmt.Fprintln(w, "LOCAL_NO_STANDARD_LIBRARIES := true") |
| 216 | } |
| 217 | |
| 218 | if len(app.rroDirs) > 0 { |
Colin Cross | a140bb0 | 2018-04-17 10:52:26 -0700 | [diff] [blame] | 219 | // Reverse the order, Soong stores rroDirs in aapt2 order (low to high priority), but Make |
| 220 | // expects it in LOCAL_RESOURCE_DIRS order (high to low priority). |
| 221 | fmt.Fprintln(w, "LOCAL_SOONG_RRO_DIRS :=", strings.Join(android.ReversePaths(app.rroDirs).Strings(), " ")) |
Colin Cross | 7079856 | 2017-12-13 22:42:59 -0800 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | if Bool(app.appProperties.Export_package_resources) { |
| 225 | fmt.Fprintln(w, "LOCAL_EXPORT_PACKAGE_RESOURCES := true") |
| 226 | } |
| 227 | |
| 228 | fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", app.manifestPath.String()) |
| 229 | |
Colin Cross | 1605606 | 2017-12-13 22:46:28 -0800 | [diff] [blame] | 230 | if Bool(app.appProperties.Privileged) { |
| 231 | fmt.Fprintln(w, "LOCAL_PRIVILEGED_MODULE := true") |
| 232 | } |
Colin Cross | e1731a5 | 2017-12-14 11:22:55 -0800 | [diff] [blame] | 233 | |
| 234 | fmt.Fprintln(w, "LOCAL_CERTIFICATE :=", app.certificate.pem.String()) |
Jason Monk | d4122be | 2018-08-10 09:33:36 -0400 | [diff] [blame^] | 235 | if len(app.appProperties.Overrides) > 0 { |
| 236 | fmt.Fprintln(w, "LOCAL_OVERRIDES_PACKAGES := "+strings.Join(app.appProperties.Overrides, " ")) |
| 237 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 238 | }, |
| 239 | }, |
| 240 | } |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 241 | } |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 242 | |
Colin Cross | ae5caf5 | 2018-05-22 11:11:52 -0700 | [diff] [blame] | 243 | func (a *AndroidTest) AndroidMk() android.AndroidMkData { |
| 244 | data := a.AndroidApp.AndroidMk() |
| 245 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
| 246 | fmt.Fprintln(w, "LOCAL_MODULE_TAGS := tests") |
| 247 | if len(a.testProperties.Test_suites) > 0 { |
| 248 | fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=", |
| 249 | strings.Join(a.testProperties.Test_suites, " ")) |
| 250 | } |
Julien Desprez | e146e39 | 2018-08-02 15:00:46 -0700 | [diff] [blame] | 251 | if a.testProperties.Test_config != nil { |
| 252 | fmt.Fprintln(w, "LOCAL_TEST_CONFIG :=", |
| 253 | *a.testProperties.Test_config) |
| 254 | } |
Colin Cross | ae5caf5 | 2018-05-22 11:11:52 -0700 | [diff] [blame] | 255 | }) |
| 256 | |
| 257 | return data |
| 258 | } |
| 259 | |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 260 | func (a *AndroidLibrary) AndroidMk() android.AndroidMkData { |
| 261 | data := a.Library.AndroidMk() |
| 262 | |
| 263 | data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) { |
| 264 | if a.proguardDictionary != nil { |
| 265 | fmt.Fprintln(w, "LOCAL_SOONG_PROGUARD_DICT :=", a.proguardDictionary.String()) |
| 266 | } |
| 267 | |
| 268 | if a.Name() == "framework-res" { |
| 269 | fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)") |
| 270 | // Make base_rules.mk not put framework-res in a subdirectory called |
| 271 | // framework_res. |
| 272 | fmt.Fprintln(w, "LOCAL_NO_STANDARD_LIBRARIES := true") |
| 273 | } |
| 274 | |
| 275 | fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", a.exportPackage.String()) |
Colin Cross | 66f7882 | 2018-05-02 12:58:28 -0700 | [diff] [blame] | 276 | fmt.Fprintln(w, "LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=", a.extraAaptPackagesFile.String()) |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 277 | fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", a.manifestPath.String()) |
Colin Cross | 89c3158 | 2018-04-30 15:55:11 -0700 | [diff] [blame] | 278 | fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", |
| 279 | strings.Join(a.exportedProguardFlagFiles.Strings(), " ")) |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 280 | fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true") |
| 281 | fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false") |
| 282 | }) |
| 283 | |
| 284 | return data |
Colin Cross | 5ab4e6d | 2017-11-22 16:20:45 -0800 | [diff] [blame] | 285 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 286 | |
| 287 | func (jd *Javadoc) AndroidMk() android.AndroidMkData { |
| 288 | return android.AndroidMkData{ |
| 289 | Class: "JAVA_LIBRARIES", |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 290 | OutputFile: android.OptionalPathForPath(jd.stubsSrcJar), |
Colin Cross | 5fa9d6f | 2018-08-08 21:44:48 -0700 | [diff] [blame] | 291 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 292 | Extra: []android.AndroidMkExtraFunc{ |
| 293 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | 38b40df | 2018-04-10 16:14:46 -0700 | [diff] [blame] | 294 | if BoolDefault(jd.properties.Installable, true) { |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 295 | fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", jd.docZip.String()) |
| 296 | } |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 297 | if jd.stubsSrcJar != nil { |
| 298 | fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", jd.stubsSrcJar.String()) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 299 | } |
| 300 | }, |
| 301 | }, |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | func (ddoc *Droiddoc) AndroidMk() android.AndroidMkData { |
| 306 | return android.AndroidMkData{ |
| 307 | Class: "JAVA_LIBRARIES", |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 308 | OutputFile: android.OptionalPathForPath(ddoc.stubsSrcJar), |
Colin Cross | 5fa9d6f | 2018-08-08 21:44:48 -0700 | [diff] [blame] | 309 | Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk", |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 310 | Extra: []android.AndroidMkExtraFunc{ |
| 311 | func(w io.Writer, outputFile android.Path) { |
Colin Cross | 38b40df | 2018-04-10 16:14:46 -0700 | [diff] [blame] | 312 | if BoolDefault(ddoc.Javadoc.properties.Installable, true) { |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 313 | fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", ddoc.Javadoc.docZip.String()) |
| 314 | } |
Nan Zhang | ccff0f7 | 2018-03-08 17:26:16 -0800 | [diff] [blame] | 315 | if ddoc.Javadoc.stubsSrcJar != nil { |
| 316 | fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", ddoc.Javadoc.stubsSrcJar.String()) |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 317 | } |
Nan Zhang | 03b733c | 2018-06-26 13:24:05 -0700 | [diff] [blame] | 318 | if ddoc.annotationsZip != nil { |
| 319 | fmt.Fprintln(w, "LOCAL_DROIDDOC_ANNOTATIONS_ZIP := ", ddoc.annotationsZip.String()) |
| 320 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 321 | if ddoc.checkCurrentApiTimestamp != nil { |
| 322 | fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-current-api") |
| 323 | fmt.Fprintln(w, ddoc.Name()+"-check-current-api:", |
| 324 | ddoc.checkCurrentApiTimestamp.String()) |
| 325 | |
| 326 | fmt.Fprintln(w, ".PHONY: checkapi") |
Jiyong Park | eeb8a64 | 2018-05-12 22:21:20 +0900 | [diff] [blame] | 327 | fmt.Fprintln(w, "checkapi:", |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 328 | ddoc.checkCurrentApiTimestamp.String()) |
| 329 | |
| 330 | fmt.Fprintln(w, ".PHONY: droidcore") |
| 331 | fmt.Fprintln(w, "droidcore: checkapi") |
| 332 | } |
| 333 | if ddoc.updateCurrentApiTimestamp != nil { |
Dan Willemsen | a03c43a | 2018-07-24 13:00:52 -0700 | [diff] [blame] | 334 | fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-update-current-api") |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 335 | fmt.Fprintln(w, ddoc.Name()+"-update-current-api:", |
| 336 | ddoc.updateCurrentApiTimestamp.String()) |
| 337 | |
| 338 | fmt.Fprintln(w, ".PHONY: update-api") |
| 339 | fmt.Fprintln(w, "update-api:", |
| 340 | ddoc.updateCurrentApiTimestamp.String()) |
| 341 | } |
| 342 | if ddoc.checkLastReleasedApiTimestamp != nil { |
| 343 | fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-last-released-api") |
| 344 | fmt.Fprintln(w, ddoc.Name()+"-check-last-released-api:", |
| 345 | ddoc.checkLastReleasedApiTimestamp.String()) |
| 346 | } |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 347 | apiFilePrefix := "INTERNAL_PLATFORM_" |
| 348 | if String(ddoc.properties.Api_tag_name) != "" { |
| 349 | apiFilePrefix += String(ddoc.properties.Api_tag_name) + "_" |
| 350 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 351 | if ddoc.apiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 352 | fmt.Fprintln(w, apiFilePrefix+"API_FILE := ", ddoc.apiFile.String()) |
| 353 | } |
David Brazdil | fbe4cc3 | 2018-05-31 13:56:46 +0100 | [diff] [blame] | 354 | if ddoc.dexApiFile != nil { |
| 355 | fmt.Fprintln(w, apiFilePrefix+"DEX_API_FILE := ", ddoc.dexApiFile.String()) |
| 356 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 357 | if ddoc.privateApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 358 | fmt.Fprintln(w, apiFilePrefix+"PRIVATE_API_FILE := ", ddoc.privateApiFile.String()) |
| 359 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 360 | if ddoc.privateDexApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 361 | fmt.Fprintln(w, apiFilePrefix+"PRIVATE_DEX_API_FILE := ", ddoc.privateDexApiFile.String()) |
| 362 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 363 | if ddoc.removedApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 364 | fmt.Fprintln(w, apiFilePrefix+"REMOVED_API_FILE := ", ddoc.removedApiFile.String()) |
| 365 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 366 | if ddoc.removedDexApiFile != nil { |
David Brazdil | aac0c3c | 2018-04-24 16:23:29 +0100 | [diff] [blame] | 367 | fmt.Fprintln(w, apiFilePrefix+"REMOVED_DEX_API_FILE := ", ddoc.removedDexApiFile.String()) |
| 368 | } |
Nan Zhang | 61819ce | 2018-05-04 18:49:16 -0700 | [diff] [blame] | 369 | if ddoc.exactApiFile != nil { |
Nan Zhang | 28c68b9 | 2018-03-13 16:17:01 -0700 | [diff] [blame] | 370 | fmt.Fprintln(w, apiFilePrefix+"EXACT_API_FILE := ", ddoc.exactApiFile.String()) |
| 371 | } |
Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 372 | }, |
| 373 | }, |
| 374 | } |
| 375 | } |