Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 1 | // Copyright 2018 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 ( |
| 18 | "android/soong/android" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 19 | "fmt" |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 20 | "io" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 21 | "path" |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 22 | "path/filepath" |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 23 | "sort" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 24 | "strings" |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 25 | "sync" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 26 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 27 | "github.com/google/blueprint/proptools" |
| 28 | ) |
| 29 | |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 30 | const ( |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 31 | sdkStubsLibrarySuffix = ".stubs" |
| 32 | sdkSystemApiSuffix = ".system" |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 33 | sdkTestApiSuffix = ".test" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 34 | sdkDocsSuffix = ".docs" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 35 | sdkXmlFileSuffix = ".xml" |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 36 | permissionsTemplate = `<?xml version="1.0" encoding="utf-8"?>\n` + |
| 37 | `<!-- Copyright (C) 2018 The Android Open Source Project\n` + |
| 38 | `\n` + |
| 39 | ` Licensed under the Apache License, Version 2.0 (the "License");\n` + |
| 40 | ` you may not use this file except in compliance with the License.\n` + |
| 41 | ` You may obtain a copy of the License at\n` + |
| 42 | `\n` + |
| 43 | ` http://www.apache.org/licenses/LICENSE-2.0\n` + |
| 44 | `\n` + |
| 45 | ` Unless required by applicable law or agreed to in writing, software\n` + |
| 46 | ` distributed under the License is distributed on an "AS IS" BASIS,\n` + |
| 47 | ` WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n` + |
| 48 | ` See the License for the specific language governing permissions and\n` + |
| 49 | ` limitations under the License.\n` + |
| 50 | `-->\n` + |
| 51 | `<permissions>\n` + |
| 52 | ` <library name="%s" file="%s"/>\n` + |
| 53 | `</permissions>\n` |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 54 | ) |
| 55 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 56 | var ( |
| 57 | publicApiStubsTag = dependencyTag{name: "public"} |
| 58 | systemApiStubsTag = dependencyTag{name: "system"} |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 59 | testApiStubsTag = dependencyTag{name: "test"} |
Sundong Ahn | 20e998b | 2018-07-24 11:19:26 +0900 | [diff] [blame] | 60 | publicApiFileTag = dependencyTag{name: "publicApi"} |
| 61 | systemApiFileTag = dependencyTag{name: "systemApi"} |
| 62 | testApiFileTag = dependencyTag{name: "testApi"} |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 63 | ) |
| 64 | |
| 65 | type apiScope int |
| 66 | |
| 67 | const ( |
| 68 | apiScopePublic apiScope = iota |
| 69 | apiScopeSystem |
| 70 | apiScopeTest |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 71 | ) |
| 72 | |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 73 | var ( |
| 74 | javaSdkLibrariesLock sync.Mutex |
| 75 | ) |
| 76 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 77 | // TODO: these are big features that are currently missing |
Jiyong Park | 1be9691 | 2018-05-28 18:02:19 +0900 | [diff] [blame] | 78 | // 1) disallowing linking to the runtime shared lib |
| 79 | // 2) HTML generation |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 80 | |
| 81 | func init() { |
Paul Duffin | 43dc1cc | 2019-12-19 11:18:54 +0000 | [diff] [blame] | 82 | RegisterSdkLibraryBuildComponents(android.InitRegistrationContext) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 83 | |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 84 | android.RegisterMakeVarsProvider(pctx, func(ctx android.MakeVarsContext) { |
| 85 | javaSdkLibraries := javaSdkLibraries(ctx.Config()) |
| 86 | sort.Strings(*javaSdkLibraries) |
| 87 | ctx.Strict("JAVA_SDK_LIBRARIES", strings.Join(*javaSdkLibraries, " ")) |
| 88 | }) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 89 | } |
| 90 | |
Paul Duffin | 43dc1cc | 2019-12-19 11:18:54 +0000 | [diff] [blame] | 91 | func RegisterSdkLibraryBuildComponents(ctx android.RegistrationContext) { |
| 92 | ctx.RegisterModuleType("java_sdk_library", SdkLibraryFactory) |
| 93 | ctx.RegisterModuleType("java_sdk_library_import", sdkLibraryImportFactory) |
| 94 | } |
| 95 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 96 | type sdkLibraryProperties struct { |
Sundong Ahn | f043cf6 | 2018-06-25 16:04:37 +0900 | [diff] [blame] | 97 | // List of Java libraries that will be in the classpath when building stubs |
| 98 | Stub_only_libs []string `android:"arch_variant"` |
| 99 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 100 | // list of package names that will be documented and publicized as API |
| 101 | Api_packages []string |
| 102 | |
Jiyong Park | 5a2c9d7 | 2018-05-01 22:25:41 +0900 | [diff] [blame] | 103 | // list of package names that must be hidden from the API |
| 104 | Hidden_api_packages []string |
| 105 | |
Paul Duffin | 1151247 | 2019-02-11 15:55:17 +0000 | [diff] [blame] | 106 | // local files that are used within user customized droiddoc options. |
| 107 | Droiddoc_option_files []string |
| 108 | |
| 109 | // additional droiddoc options |
| 110 | // Available variables for substitution: |
| 111 | // |
| 112 | // $(location <label>): the path to the droiddoc_option_files with name <label> |
Sundong Ahn | dd567f9 | 2018-07-31 17:19:11 +0900 | [diff] [blame] | 113 | Droiddoc_options []string |
| 114 | |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 115 | // a list of top-level directories containing files to merge qualifier annotations |
| 116 | // (i.e. those intended to be included in the stubs written) from. |
| 117 | Merge_annotations_dirs []string |
| 118 | |
| 119 | // a list of top-level directories containing Java stub files to merge show/hide annotations from. |
| 120 | Merge_inclusion_annotations_dirs []string |
| 121 | |
| 122 | // If set to true, the path of dist files is apistubs/core. Defaults to false. |
| 123 | Core_lib *bool |
| 124 | |
Sundong Ahn | 80a87b3 | 2019-05-13 15:02:50 +0900 | [diff] [blame] | 125 | // don't create dist rules. |
| 126 | No_dist *bool `blueprint:"mutated"` |
| 127 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 128 | // TODO: determines whether to create HTML doc or not |
| 129 | //Html_doc *bool |
| 130 | } |
| 131 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 132 | type SdkLibrary struct { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 133 | Library |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 134 | |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 135 | sdkLibraryProperties sdkLibraryProperties |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 136 | |
| 137 | publicApiStubsPath android.Paths |
| 138 | systemApiStubsPath android.Paths |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 139 | testApiStubsPath android.Paths |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 140 | |
| 141 | publicApiStubsImplPath android.Paths |
| 142 | systemApiStubsImplPath android.Paths |
| 143 | testApiStubsImplPath android.Paths |
Sundong Ahn | 20e998b | 2018-07-24 11:19:26 +0900 | [diff] [blame] | 144 | |
| 145 | publicApiFilePath android.Path |
| 146 | systemApiFilePath android.Path |
| 147 | testApiFilePath android.Path |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 148 | |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 149 | permissionsFile android.Path |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 150 | } |
| 151 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 152 | var _ Dependency = (*SdkLibrary)(nil) |
| 153 | var _ SdkLibraryDependency = (*SdkLibrary)(nil) |
Colin Cross | 897d2ed | 2019-02-11 14:03:51 -0800 | [diff] [blame] | 154 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 155 | func (module *SdkLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { |
Jiyong Park | e3ef3c8 | 2019-07-15 15:31:16 +0900 | [diff] [blame] | 156 | useBuiltStubs := !ctx.Config().UnbundledBuildUsePrebuiltSdks() |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 157 | // Add dependencies to the stubs library |
Jiyong Park | e3ef3c8 | 2019-07-15 15:31:16 +0900 | [diff] [blame] | 158 | if useBuiltStubs { |
| 159 | ctx.AddVariationDependencies(nil, publicApiStubsTag, module.stubsName(apiScopePublic)) |
| 160 | } |
Colin Cross | 42d48b7 | 2018-08-29 14:10:52 -0700 | [diff] [blame] | 161 | ctx.AddVariationDependencies(nil, publicApiFileTag, module.docsName(apiScopePublic)) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 162 | |
Paul Duffin | 250e619 | 2019-06-07 10:44:37 +0100 | [diff] [blame] | 163 | sdkDep := decodeSdkDep(ctx, sdkContext(&module.Library)) |
| 164 | if sdkDep.hasStandardLibs() { |
Jiyong Park | e3ef3c8 | 2019-07-15 15:31:16 +0900 | [diff] [blame] | 165 | if useBuiltStubs { |
| 166 | ctx.AddVariationDependencies(nil, systemApiStubsTag, module.stubsName(apiScopeSystem)) |
| 167 | ctx.AddVariationDependencies(nil, testApiStubsTag, module.stubsName(apiScopeTest)) |
| 168 | } |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 169 | ctx.AddVariationDependencies(nil, systemApiFileTag, module.docsName(apiScopeSystem)) |
| 170 | ctx.AddVariationDependencies(nil, testApiFileTag, module.docsName(apiScopeTest)) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | module.Library.deps(ctx) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 174 | } |
| 175 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 176 | func (module *SdkLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 177 | module.Library.GenerateAndroidBuildActions(ctx) |
| 178 | |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 179 | module.buildPermissionsFile(ctx) |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 180 | |
Sundong Ahn | 57368eb | 2018-07-06 11:20:23 +0900 | [diff] [blame] | 181 | // Record the paths to the header jars of the library (stubs and impl). |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 182 | // When this java_sdk_library is dependened from others via "libs" property, |
| 183 | // the recorded paths will be returned depending on the link type of the caller. |
| 184 | ctx.VisitDirectDeps(func(to android.Module) { |
| 185 | otherName := ctx.OtherModuleName(to) |
| 186 | tag := ctx.OtherModuleDependencyTag(to) |
| 187 | |
Sundong Ahn | 57368eb | 2018-07-06 11:20:23 +0900 | [diff] [blame] | 188 | if lib, ok := to.(Dependency); ok { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 189 | switch tag { |
| 190 | case publicApiStubsTag: |
Sundong Ahn | 57368eb | 2018-07-06 11:20:23 +0900 | [diff] [blame] | 191 | module.publicApiStubsPath = lib.HeaderJars() |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 192 | module.publicApiStubsImplPath = lib.ImplementationJars() |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 193 | case systemApiStubsTag: |
Sundong Ahn | 57368eb | 2018-07-06 11:20:23 +0900 | [diff] [blame] | 194 | module.systemApiStubsPath = lib.HeaderJars() |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 195 | module.systemApiStubsImplPath = lib.ImplementationJars() |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 196 | case testApiStubsTag: |
Sundong Ahn | 57368eb | 2018-07-06 11:20:23 +0900 | [diff] [blame] | 197 | module.testApiStubsPath = lib.HeaderJars() |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 198 | module.testApiStubsImplPath = lib.ImplementationJars() |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 199 | } |
| 200 | } |
Sundong Ahn | 20e998b | 2018-07-24 11:19:26 +0900 | [diff] [blame] | 201 | if doc, ok := to.(ApiFilePath); ok { |
| 202 | switch tag { |
| 203 | case publicApiFileTag: |
| 204 | module.publicApiFilePath = doc.ApiFilePath() |
| 205 | case systemApiFileTag: |
| 206 | module.systemApiFilePath = doc.ApiFilePath() |
| 207 | case testApiFileTag: |
| 208 | module.testApiFilePath = doc.ApiFilePath() |
| 209 | default: |
| 210 | ctx.ModuleErrorf("depends on module %q of unknown tag %q", otherName, tag) |
| 211 | } |
| 212 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 213 | }) |
| 214 | } |
| 215 | |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 216 | func (module *SdkLibrary) buildPermissionsFile(ctx android.ModuleContext) { |
| 217 | xmlContent := fmt.Sprintf(permissionsTemplate, module.BaseModuleName(), module.implPath()) |
| 218 | permissionsFile := android.PathForModuleOut(ctx, module.xmlFileName()) |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 219 | |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 220 | ctx.Build(pctx, android.BuildParams{ |
| 221 | Rule: android.WriteFile, |
| 222 | Output: permissionsFile, |
| 223 | Description: "Generating " + module.BaseModuleName() + " permissions", |
| 224 | Args: map[string]string{ |
| 225 | "content": xmlContent, |
| 226 | }, |
| 227 | }) |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 228 | |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 229 | module.permissionsFile = permissionsFile |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 230 | } |
| 231 | |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 232 | func (module *SdkLibrary) OutputFiles(tag string) (android.Paths, error) { |
| 233 | switch tag { |
| 234 | case ".xml": |
| 235 | return android.Paths{module.permissionsFile}, nil |
| 236 | } |
| 237 | return module.Library.OutputFiles(tag) |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 238 | } |
| 239 | |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 240 | func (module *SdkLibrary) AndroidMkEntries() []android.AndroidMkEntries { |
| 241 | entriesList := module.Library.AndroidMkEntries() |
| 242 | entries := &entriesList[0] |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 243 | entries.Required = append(entries.Required, module.xmlFileName()) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 244 | |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 245 | entries.ExtraFooters = []android.AndroidMkExtraFootersFunc{ |
| 246 | func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) { |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 247 | if !Bool(module.sdkLibraryProperties.No_dist) { |
| 248 | // Create a phony module that installs the impl library, for the case when this lib is |
| 249 | // in PRODUCT_PACKAGES. |
| 250 | owner := module.ModuleBase.Owner() |
| 251 | if owner == "" { |
| 252 | if Bool(module.sdkLibraryProperties.Core_lib) { |
| 253 | owner = "core" |
| 254 | } else { |
| 255 | owner = "android" |
| 256 | } |
| 257 | } |
| 258 | // Create dist rules to install the stubs libs to the dist dir |
| 259 | if len(module.publicApiStubsPath) == 1 { |
| 260 | fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+ |
| 261 | module.publicApiStubsImplPath.Strings()[0]+ |
| 262 | ":"+path.Join("apistubs", owner, "public", |
| 263 | module.BaseModuleName()+".jar")+")") |
| 264 | } |
| 265 | if len(module.systemApiStubsPath) == 1 { |
| 266 | fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+ |
| 267 | module.systemApiStubsImplPath.Strings()[0]+ |
| 268 | ":"+path.Join("apistubs", owner, "system", |
| 269 | module.BaseModuleName()+".jar")+")") |
| 270 | } |
| 271 | if len(module.testApiStubsPath) == 1 { |
| 272 | fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+ |
| 273 | module.testApiStubsImplPath.Strings()[0]+ |
| 274 | ":"+path.Join("apistubs", owner, "test", |
| 275 | module.BaseModuleName()+".jar")+")") |
| 276 | } |
| 277 | if module.publicApiFilePath != nil { |
| 278 | fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+ |
| 279 | module.publicApiFilePath.String()+ |
| 280 | ":"+path.Join("apistubs", owner, "public", "api", |
| 281 | module.BaseModuleName()+".txt")+")") |
| 282 | } |
| 283 | if module.systemApiFilePath != nil { |
| 284 | fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+ |
| 285 | module.systemApiFilePath.String()+ |
| 286 | ":"+path.Join("apistubs", owner, "system", "api", |
| 287 | module.BaseModuleName()+".txt")+")") |
| 288 | } |
| 289 | if module.testApiFilePath != nil { |
| 290 | fmt.Fprintln(w, "$(call dist-for-goals,sdk win_sdk,"+ |
| 291 | module.testApiFilePath.String()+ |
| 292 | ":"+path.Join("apistubs", owner, "test", "api", |
| 293 | module.BaseModuleName()+".txt")+")") |
Sundong Ahn | 80a87b3 | 2019-05-13 15:02:50 +0900 | [diff] [blame] | 294 | } |
Sundong Ahn | 4fd04bb | 2018-08-31 18:01:37 +0900 | [diff] [blame] | 295 | } |
Jaewoong Jung | b0c127c | 2019-08-29 14:56:03 -0700 | [diff] [blame] | 296 | }, |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 297 | } |
Jiyong Park | 0b0e1b9 | 2019-12-03 13:24:29 +0900 | [diff] [blame] | 298 | return entriesList |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 299 | } |
| 300 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 301 | // Module name of the stubs library |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 302 | func (module *SdkLibrary) stubsName(apiScope apiScope) string { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 303 | stubsName := module.BaseModuleName() + sdkStubsLibrarySuffix |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 304 | switch apiScope { |
| 305 | case apiScopeSystem: |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 306 | stubsName = stubsName + sdkSystemApiSuffix |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 307 | case apiScopeTest: |
| 308 | stubsName = stubsName + sdkTestApiSuffix |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 309 | } |
| 310 | return stubsName |
| 311 | } |
| 312 | |
| 313 | // Module name of the docs |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 314 | func (module *SdkLibrary) docsName(apiScope apiScope) string { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 315 | docsName := module.BaseModuleName() + sdkDocsSuffix |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 316 | switch apiScope { |
| 317 | case apiScopeSystem: |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 318 | docsName = docsName + sdkSystemApiSuffix |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 319 | case apiScopeTest: |
| 320 | docsName = docsName + sdkTestApiSuffix |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 321 | } |
| 322 | return docsName |
| 323 | } |
| 324 | |
| 325 | // Module name of the runtime implementation library |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 326 | func (module *SdkLibrary) implName() string { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 327 | return module.BaseModuleName() |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | // File path to the runtime implementation library |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 331 | func (module *SdkLibrary) implPath() string { |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 332 | if apexName := module.ApexName(); apexName != "" { |
| 333 | // TODO(b/146468504): ApexName() is only a soong module name, not apex name. |
| 334 | // In most cases, this works fine. But when apex_name is set or override_apex is used |
| 335 | // this can be wrong. |
| 336 | return fmt.Sprintf("/apex/%s/javalib/%s.jar", apexName, module.implName()) |
| 337 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 338 | partition := "system" |
| 339 | if module.SocSpecific() { |
| 340 | partition = "vendor" |
| 341 | } else if module.DeviceSpecific() { |
| 342 | partition = "odm" |
| 343 | } else if module.ProductSpecific() { |
| 344 | partition = "product" |
Sundong Ahn | 0d7dff4 | 2019-12-04 12:53:44 +0900 | [diff] [blame] | 345 | } else if module.SystemExtSpecific() { |
| 346 | partition = "system_ext" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 347 | } |
| 348 | return "/" + partition + "/framework/" + module.implName() + ".jar" |
| 349 | } |
| 350 | |
| 351 | // Module name of the XML file for the lib |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 352 | func (module *SdkLibrary) xmlFileName() string { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 353 | return module.BaseModuleName() + sdkXmlFileSuffix |
| 354 | } |
| 355 | |
| 356 | // SDK version that the stubs library is built against. Note that this is always |
| 357 | // *current. Older stubs library built with a numberd SDK version is created from |
| 358 | // the prebuilt jar. |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 359 | func (module *SdkLibrary) sdkVersion(apiScope apiScope) string { |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 360 | switch apiScope { |
| 361 | case apiScopePublic: |
| 362 | return "current" |
| 363 | case apiScopeSystem: |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 364 | return "system_current" |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 365 | case apiScopeTest: |
| 366 | return "test_current" |
| 367 | default: |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 368 | return "current" |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | // $(INTERNAL_PLATFORM_<apiTagName>_API_FILE) points to the generated |
| 373 | // api file for the current source |
| 374 | // TODO: remove this when apicheck is done in soong |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 375 | func (module *SdkLibrary) apiTagName(apiScope apiScope) string { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 376 | apiTagName := strings.Replace(strings.ToUpper(module.BaseModuleName()), ".", "_", -1) |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 377 | switch apiScope { |
| 378 | case apiScopeSystem: |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 379 | apiTagName = apiTagName + "_SYSTEM" |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 380 | case apiScopeTest: |
| 381 | apiTagName = apiTagName + "_TEST" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 382 | } |
| 383 | return apiTagName |
| 384 | } |
| 385 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 386 | func (module *SdkLibrary) latestApiFilegroupName(apiScope apiScope) string { |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 387 | name := ":" + module.BaseModuleName() + ".api." |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 388 | switch apiScope { |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 389 | case apiScopePublic: |
| 390 | name = name + "public" |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 391 | case apiScopeSystem: |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 392 | name = name + "system" |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 393 | case apiScopeTest: |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 394 | name = name + "test" |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 395 | } |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 396 | name = name + ".latest" |
| 397 | return name |
| 398 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 399 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 400 | func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope apiScope) string { |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 401 | name := ":" + module.BaseModuleName() + "-removed.api." |
| 402 | switch apiScope { |
| 403 | case apiScopePublic: |
| 404 | name = name + "public" |
| 405 | case apiScopeSystem: |
| 406 | name = name + "system" |
| 407 | case apiScopeTest: |
| 408 | name = name + "test" |
| 409 | } |
| 410 | name = name + ".latest" |
| 411 | return name |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | // Creates a static java library that has API stubs |
Colin Cross | f8b860a | 2019-04-16 14:43:28 -0700 | [diff] [blame] | 415 | func (module *SdkLibrary) createStubsLibrary(mctx android.LoadHookContext, apiScope apiScope) { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 416 | props := struct { |
Sundong Ahn | 0d7dff4 | 2019-12-04 12:53:44 +0900 | [diff] [blame] | 417 | Name *string |
| 418 | Srcs []string |
| 419 | Sdk_version *string |
| 420 | Libs []string |
| 421 | Soc_specific *bool |
| 422 | Device_specific *bool |
| 423 | Product_specific *bool |
| 424 | System_ext_specific *bool |
| 425 | Compile_dex *bool |
| 426 | System_modules *string |
| 427 | Java_version *string |
| 428 | Product_variables struct { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 429 | Unbundled_build struct { |
| 430 | Enabled *bool |
| 431 | } |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 432 | Pdk struct { |
| 433 | Enabled *bool |
| 434 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 435 | } |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 436 | Openjdk9 struct { |
| 437 | Srcs []string |
| 438 | Javacflags []string |
| 439 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 440 | }{} |
| 441 | |
Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 442 | sdkVersion := module.sdkVersion(apiScope) |
Paul Duffin | 250e619 | 2019-06-07 10:44:37 +0100 | [diff] [blame] | 443 | sdkDep := decodeSdkDep(mctx, sdkContext(&module.Library)) |
Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 444 | if !sdkDep.hasStandardLibs() { |
| 445 | sdkVersion = "none" |
| 446 | } |
Paul Duffin | 250e619 | 2019-06-07 10:44:37 +0100 | [diff] [blame] | 447 | |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 448 | props.Name = proptools.StringPtr(module.stubsName(apiScope)) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 449 | // sources are generated from the droiddoc |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 450 | props.Srcs = []string{":" + module.docsName(apiScope)} |
Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 451 | props.Sdk_version = proptools.StringPtr(sdkVersion) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 452 | props.Libs = module.sdkLibraryProperties.Stub_only_libs |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 453 | // Unbundled apps will use the prebult one from /prebuilts/sdk |
Colin Cross | 1093287 | 2019-04-18 14:27:12 -0700 | [diff] [blame] | 454 | if mctx.Config().UnbundledBuildUsePrebuiltSdks() { |
Colin Cross | 2c77ceb | 2019-01-21 11:56:21 -0800 | [diff] [blame] | 455 | props.Product_variables.Unbundled_build.Enabled = proptools.BoolPtr(false) |
| 456 | } |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 457 | props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 458 | props.System_modules = module.Library.Module.deviceProperties.System_modules |
| 459 | props.Openjdk9.Srcs = module.Library.Module.properties.Openjdk9.Srcs |
| 460 | props.Openjdk9.Javacflags = module.Library.Module.properties.Openjdk9.Javacflags |
| 461 | props.Java_version = module.Library.Module.properties.Java_version |
| 462 | if module.Library.Module.deviceProperties.Compile_dex != nil { |
| 463 | props.Compile_dex = module.Library.Module.deviceProperties.Compile_dex |
Sundong Ahn | dd567f9 | 2018-07-31 17:19:11 +0900 | [diff] [blame] | 464 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 465 | |
| 466 | if module.SocSpecific() { |
| 467 | props.Soc_specific = proptools.BoolPtr(true) |
| 468 | } else if module.DeviceSpecific() { |
| 469 | props.Device_specific = proptools.BoolPtr(true) |
| 470 | } else if module.ProductSpecific() { |
| 471 | props.Product_specific = proptools.BoolPtr(true) |
Sundong Ahn | 0d7dff4 | 2019-12-04 12:53:44 +0900 | [diff] [blame] | 472 | } else if module.SystemExtSpecific() { |
| 473 | props.System_ext_specific = proptools.BoolPtr(true) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 474 | } |
| 475 | |
Colin Cross | 84dfc3d | 2019-09-25 11:33:01 -0700 | [diff] [blame] | 476 | mctx.CreateModule(LibraryFactory, &props) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | // Creates a droiddoc module that creates stubs source files from the given full source |
| 480 | // files |
Paul Duffin | c4cea76 | 2019-12-30 17:32:47 +0000 | [diff] [blame^] | 481 | func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiScope apiScope) { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 482 | props := struct { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 483 | Name *string |
| 484 | Srcs []string |
| 485 | Installable *bool |
Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 486 | Sdk_version *string |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 487 | Libs []string |
Paul Duffin | 1151247 | 2019-02-11 15:55:17 +0000 | [diff] [blame] | 488 | Arg_files []string |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 489 | Args *string |
| 490 | Api_tag_name *string |
| 491 | Api_filename *string |
| 492 | Removed_api_filename *string |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 493 | Java_version *string |
| 494 | Merge_annotations_dirs []string |
| 495 | Merge_inclusion_annotations_dirs []string |
| 496 | Check_api struct { |
Inseob Kim | 38449af | 2019-02-28 14:24:05 +0900 | [diff] [blame] | 497 | Current ApiToCheck |
| 498 | Last_released ApiToCheck |
| 499 | Ignore_missing_latest_api *bool |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 500 | } |
Sundong Ahn | 1b92c82 | 2018-05-29 11:35:17 +0900 | [diff] [blame] | 501 | Aidl struct { |
| 502 | Include_dirs []string |
| 503 | Local_include_dirs []string |
| 504 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 505 | }{} |
| 506 | |
Paul Duffin | 250e619 | 2019-06-07 10:44:37 +0100 | [diff] [blame] | 507 | sdkDep := decodeSdkDep(mctx, sdkContext(&module.Library)) |
Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 508 | sdkVersion := "" |
| 509 | if !sdkDep.hasStandardLibs() { |
| 510 | sdkVersion = "none" |
| 511 | } |
Paul Duffin | 250e619 | 2019-06-07 10:44:37 +0100 | [diff] [blame] | 512 | |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 513 | props.Name = proptools.StringPtr(module.docsName(apiScope)) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 514 | props.Srcs = append(props.Srcs, module.Library.Module.properties.Srcs...) |
Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 515 | props.Sdk_version = proptools.StringPtr(sdkVersion) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 516 | props.Installable = proptools.BoolPtr(false) |
Sundong Ahn | e6f0b05 | 2018-06-05 16:46:14 +0900 | [diff] [blame] | 517 | // A droiddoc module has only one Libs property and doesn't distinguish between |
| 518 | // shared libs and static libs. So we need to add both of these libs to Libs property. |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 519 | props.Libs = module.Library.Module.properties.Libs |
| 520 | props.Libs = append(props.Libs, module.Library.Module.properties.Static_libs...) |
| 521 | props.Aidl.Include_dirs = module.Library.Module.deviceProperties.Aidl.Include_dirs |
| 522 | props.Aidl.Local_include_dirs = module.Library.Module.deviceProperties.Aidl.Local_include_dirs |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 523 | props.Java_version = module.Library.Module.properties.Java_version |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 524 | |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 525 | props.Merge_annotations_dirs = module.sdkLibraryProperties.Merge_annotations_dirs |
| 526 | props.Merge_inclusion_annotations_dirs = module.sdkLibraryProperties.Merge_inclusion_annotations_dirs |
| 527 | |
Paul Duffin | 235ffff | 2019-12-24 10:41:30 +0000 | [diff] [blame] | 528 | droiddocArgs := []string{} |
| 529 | if len(module.sdkLibraryProperties.Api_packages) != 0 { |
| 530 | droiddocArgs = append(droiddocArgs, "--stub-packages "+strings.Join(module.sdkLibraryProperties.Api_packages, ":")) |
| 531 | } |
| 532 | if len(module.sdkLibraryProperties.Hidden_api_packages) != 0 { |
| 533 | droiddocArgs = append(droiddocArgs, |
| 534 | android.JoinWithPrefix(module.sdkLibraryProperties.Hidden_api_packages, " --hide-package ")) |
| 535 | } |
| 536 | droiddocArgs = append(droiddocArgs, module.sdkLibraryProperties.Droiddoc_options...) |
| 537 | disabledWarnings := []string{ |
| 538 | "MissingPermission", |
| 539 | "BroadcastBehavior", |
| 540 | "HiddenSuperclass", |
| 541 | "DeprecationMismatch", |
| 542 | "UnavailableSymbol", |
| 543 | "SdkConstant", |
| 544 | "HiddenTypeParameter", |
| 545 | "Todo", |
| 546 | "Typo", |
| 547 | } |
| 548 | droiddocArgs = append(droiddocArgs, android.JoinWithPrefix(disabledWarnings, "--hide ")) |
Sundong Ahn | fb2721f | 2018-09-17 13:23:09 +0900 | [diff] [blame] | 549 | |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 550 | switch apiScope { |
| 551 | case apiScopeSystem: |
Paul Duffin | 235ffff | 2019-12-24 10:41:30 +0000 | [diff] [blame] | 552 | droiddocArgs = append(droiddocArgs, "-showAnnotation android.annotation.SystemApi") |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 553 | case apiScopeTest: |
Paul Duffin | 235ffff | 2019-12-24 10:41:30 +0000 | [diff] [blame] | 554 | droiddocArgs = append(droiddocArgs, " -showAnnotation android.annotation.TestApi") |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 555 | } |
Paul Duffin | 1151247 | 2019-02-11 15:55:17 +0000 | [diff] [blame] | 556 | props.Arg_files = module.sdkLibraryProperties.Droiddoc_option_files |
Paul Duffin | 235ffff | 2019-12-24 10:41:30 +0000 | [diff] [blame] | 557 | props.Args = proptools.StringPtr(strings.Join(droiddocArgs, " ")) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 558 | |
| 559 | // List of APIs identified from the provided source files are created. They are later |
| 560 | // compared against to the not-yet-released (a.k.a current) list of APIs and to the |
| 561 | // last-released (a.k.a numbered) list of API. |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 562 | currentApiFileName := "current.txt" |
| 563 | removedApiFileName := "removed.txt" |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 564 | switch apiScope { |
| 565 | case apiScopeSystem: |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 566 | currentApiFileName = "system-" + currentApiFileName |
| 567 | removedApiFileName = "system-" + removedApiFileName |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 568 | case apiScopeTest: |
| 569 | currentApiFileName = "test-" + currentApiFileName |
| 570 | removedApiFileName = "test-" + removedApiFileName |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 571 | } |
| 572 | currentApiFileName = path.Join("api", currentApiFileName) |
| 573 | removedApiFileName = path.Join("api", removedApiFileName) |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 574 | // TODO(jiyong): remove these three props |
Jiyong Park | df13054 | 2018-04-27 16:29:21 +0900 | [diff] [blame] | 575 | props.Api_tag_name = proptools.StringPtr(module.apiTagName(apiScope)) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 576 | props.Api_filename = proptools.StringPtr(currentApiFileName) |
| 577 | props.Removed_api_filename = proptools.StringPtr(removedApiFileName) |
| 578 | |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 579 | // check against the not-yet-release API |
| 580 | props.Check_api.Current.Api_file = proptools.StringPtr(currentApiFileName) |
| 581 | props.Check_api.Current.Removed_api_file = proptools.StringPtr(removedApiFileName) |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 582 | |
| 583 | // check against the latest released API |
| 584 | props.Check_api.Last_released.Api_file = proptools.StringPtr( |
| 585 | module.latestApiFilegroupName(apiScope)) |
| 586 | props.Check_api.Last_released.Removed_api_file = proptools.StringPtr( |
| 587 | module.latestRemovedApiFilegroupName(apiScope)) |
Inseob Kim | 38449af | 2019-02-28 14:24:05 +0900 | [diff] [blame] | 588 | props.Check_api.Ignore_missing_latest_api = proptools.BoolPtr(true) |
Jiyong Park | 58c518b | 2018-05-12 22:29:12 +0900 | [diff] [blame] | 589 | |
Colin Cross | 84dfc3d | 2019-09-25 11:33:01 -0700 | [diff] [blame] | 590 | mctx.CreateModule(DroidstubsFactory, &props) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 591 | } |
| 592 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 593 | // Creates the xml file that publicizes the runtime library |
Colin Cross | f8b860a | 2019-04-16 14:43:28 -0700 | [diff] [blame] | 594 | func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 595 | // creates a prebuilt_etc module to actually place the xml file under |
| 596 | // <partition>/etc/permissions |
| 597 | etcProps := struct { |
Sundong Ahn | 0d7dff4 | 2019-12-04 12:53:44 +0900 | [diff] [blame] | 598 | Name *string |
| 599 | Src *string |
| 600 | Sub_dir *string |
| 601 | Soc_specific *bool |
| 602 | Device_specific *bool |
| 603 | Product_specific *bool |
| 604 | System_ext_specific *bool |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 605 | }{} |
| 606 | etcProps.Name = proptools.StringPtr(module.xmlFileName()) |
Jooyung Han | 624058e | 2019-12-24 18:38:06 +0900 | [diff] [blame] | 607 | etcProps.Src = proptools.StringPtr(":" + module.BaseModuleName() + "{.xml}") |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 608 | etcProps.Sub_dir = proptools.StringPtr("permissions") |
| 609 | if module.SocSpecific() { |
| 610 | etcProps.Soc_specific = proptools.BoolPtr(true) |
| 611 | } else if module.DeviceSpecific() { |
| 612 | etcProps.Device_specific = proptools.BoolPtr(true) |
| 613 | } else if module.ProductSpecific() { |
| 614 | etcProps.Product_specific = proptools.BoolPtr(true) |
Sundong Ahn | 0d7dff4 | 2019-12-04 12:53:44 +0900 | [diff] [blame] | 615 | } else if module.SystemExtSpecific() { |
| 616 | etcProps.System_ext_specific = proptools.BoolPtr(true) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 617 | } |
Colin Cross | 84dfc3d | 2019-09-25 11:33:01 -0700 | [diff] [blame] | 618 | mctx.CreateModule(android.PrebuiltEtcFactory, &etcProps) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 619 | } |
| 620 | |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 621 | func (module *SdkLibrary) PrebuiltJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 622 | var api, v string |
Paul Duffin | 52d398a | 2019-06-11 12:31:14 +0100 | [diff] [blame] | 623 | if sdkVersion == "" || sdkVersion == "none" { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 624 | api = "system" |
| 625 | v = "current" |
| 626 | } else if strings.Contains(sdkVersion, "_") { |
| 627 | t := strings.Split(sdkVersion, "_") |
| 628 | api = t[0] |
| 629 | v = t[1] |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 630 | } else { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 631 | api = "public" |
| 632 | v = sdkVersion |
| 633 | } |
| 634 | dir := filepath.Join("prebuilts", "sdk", v, api) |
| 635 | jar := filepath.Join(dir, module.BaseModuleName()+".jar") |
| 636 | jarPath := android.ExistentPathForSource(ctx, jar) |
Sundong Ahn | ae418ac | 2019-02-28 15:01:28 +0900 | [diff] [blame] | 637 | if !jarPath.Valid() { |
| 638 | ctx.PropertyErrorf("sdk_library", "invalid sdk version %q, %q does not exist", v, jar) |
| 639 | return nil |
| 640 | } |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 641 | return android.Paths{jarPath.Path()} |
| 642 | } |
| 643 | |
| 644 | // to satisfy SdkLibraryDependency interface |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 645 | func (module *SdkLibrary) SdkHeaderJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 646 | // This module is just a wrapper for the stubs. |
Colin Cross | 1093287 | 2019-04-18 14:27:12 -0700 | [diff] [blame] | 647 | if ctx.Config().UnbundledBuildUsePrebuiltSdks() { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 648 | return module.PrebuiltJars(ctx, sdkVersion) |
| 649 | } else { |
| 650 | if strings.HasPrefix(sdkVersion, "system_") { |
| 651 | return module.systemApiStubsPath |
| 652 | } else if sdkVersion == "" { |
| 653 | return module.Library.HeaderJars() |
| 654 | } else { |
| 655 | return module.publicApiStubsPath |
| 656 | } |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 657 | } |
| 658 | } |
| 659 | |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 660 | // to satisfy SdkLibraryDependency interface |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 661 | func (module *SdkLibrary) SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths { |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 662 | // This module is just a wrapper for the stubs. |
Colin Cross | 1093287 | 2019-04-18 14:27:12 -0700 | [diff] [blame] | 663 | if ctx.Config().UnbundledBuildUsePrebuiltSdks() { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 664 | return module.PrebuiltJars(ctx, sdkVersion) |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 665 | } else { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 666 | if strings.HasPrefix(sdkVersion, "system_") { |
| 667 | return module.systemApiStubsImplPath |
| 668 | } else if sdkVersion == "" { |
| 669 | return module.Library.ImplementationJars() |
| 670 | } else { |
| 671 | return module.publicApiStubsImplPath |
| 672 | } |
Sundong Ahn | 241cd37 | 2018-07-13 16:16:44 +0900 | [diff] [blame] | 673 | } |
| 674 | } |
| 675 | |
Sundong Ahn | 80a87b3 | 2019-05-13 15:02:50 +0900 | [diff] [blame] | 676 | func (module *SdkLibrary) SetNoDist() { |
| 677 | module.sdkLibraryProperties.No_dist = proptools.BoolPtr(true) |
| 678 | } |
| 679 | |
Colin Cross | 571cccf | 2019-02-04 11:22:08 -0800 | [diff] [blame] | 680 | var javaSdkLibrariesKey = android.NewOnceKey("javaSdkLibraries") |
| 681 | |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 682 | func javaSdkLibraries(config android.Config) *[]string { |
Colin Cross | 571cccf | 2019-02-04 11:22:08 -0800 | [diff] [blame] | 683 | return config.Once(javaSdkLibrariesKey, func() interface{} { |
Jiyong Park | 82484c0 | 2018-04-23 21:41:26 +0900 | [diff] [blame] | 684 | return &[]string{} |
| 685 | }).(*[]string) |
| 686 | } |
| 687 | |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 688 | // For a java_sdk_library module, create internal modules for stubs, docs, |
| 689 | // runtime libs and xml file. If requested, the stubs and docs are created twice |
| 690 | // once for public API level and once for system API level |
Colin Cross | f8b860a | 2019-04-16 14:43:28 -0700 | [diff] [blame] | 691 | func (module *SdkLibrary) CreateInternalModules(mctx android.LoadHookContext) { |
Inseob Kim | 6e93ac9 | 2019-03-21 17:43:49 +0900 | [diff] [blame] | 692 | if len(module.Library.Module.properties.Srcs) == 0 { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 693 | mctx.PropertyErrorf("srcs", "java_sdk_library must specify srcs") |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 694 | return |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 695 | } |
| 696 | |
Inseob Kim | 6e93ac9 | 2019-03-21 17:43:49 +0900 | [diff] [blame] | 697 | if len(module.sdkLibraryProperties.Api_packages) == 0 { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 698 | mctx.PropertyErrorf("api_packages", "java_sdk_library must specify api_packages") |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 699 | return |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 700 | } |
Inseob Kim | 8098faa | 2019-03-18 10:19:51 +0900 | [diff] [blame] | 701 | |
| 702 | missing_current_api := false |
| 703 | |
| 704 | for _, scope := range []string{"", "system-", "test-"} { |
| 705 | for _, api := range []string{"current.txt", "removed.txt"} { |
| 706 | path := path.Join(mctx.ModuleDir(), "api", scope+api) |
| 707 | p := android.ExistentPathForSource(mctx, path) |
| 708 | if !p.Valid() { |
| 709 | mctx.ModuleErrorf("Current api file %#v doesn't exist", path) |
| 710 | missing_current_api = true |
| 711 | } |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | if missing_current_api { |
| 716 | script := "build/soong/scripts/gen-java-current-api-files.sh" |
| 717 | p := android.ExistentPathForSource(mctx, script) |
| 718 | |
| 719 | if !p.Valid() { |
| 720 | panic(fmt.Sprintf("script file %s doesn't exist", script)) |
| 721 | } |
| 722 | |
| 723 | mctx.ModuleErrorf("One or more current api files are missing. "+ |
| 724 | "You can update them by:\n"+ |
| 725 | "%s %q && m update-api", script, mctx.ModuleDir()) |
| 726 | return |
| 727 | } |
| 728 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 729 | // for public API stubs |
| 730 | module.createStubsLibrary(mctx, apiScopePublic) |
Paul Duffin | c4cea76 | 2019-12-30 17:32:47 +0000 | [diff] [blame^] | 731 | module.createStubsSources(mctx, apiScopePublic) |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 732 | |
Paul Duffin | 250e619 | 2019-06-07 10:44:37 +0100 | [diff] [blame] | 733 | sdkDep := decodeSdkDep(mctx, sdkContext(&module.Library)) |
| 734 | if sdkDep.hasStandardLibs() { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 735 | // for system API stubs |
| 736 | module.createStubsLibrary(mctx, apiScopeSystem) |
Paul Duffin | c4cea76 | 2019-12-30 17:32:47 +0000 | [diff] [blame^] | 737 | module.createStubsSources(mctx, apiScopeSystem) |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 738 | |
| 739 | // for test API stubs |
| 740 | module.createStubsLibrary(mctx, apiScopeTest) |
Paul Duffin | c4cea76 | 2019-12-30 17:32:47 +0000 | [diff] [blame^] | 741 | module.createStubsSources(mctx, apiScopeTest) |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 742 | |
| 743 | // for runtime |
| 744 | module.createXmlFile(mctx) |
| 745 | } |
| 746 | |
| 747 | // record java_sdk_library modules so that they are exported to make |
| 748 | javaSdkLibraries := javaSdkLibraries(mctx.Config()) |
| 749 | javaSdkLibrariesLock.Lock() |
| 750 | defer javaSdkLibrariesLock.Unlock() |
| 751 | *javaSdkLibraries = append(*javaSdkLibraries, module.BaseModuleName()) |
| 752 | } |
| 753 | |
| 754 | func (module *SdkLibrary) InitSdkLibraryProperties() { |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 755 | module.AddProperties( |
| 756 | &module.sdkLibraryProperties, |
| 757 | &module.Library.Module.properties, |
| 758 | &module.Library.Module.dexpreoptProperties, |
| 759 | &module.Library.Module.deviceProperties, |
| 760 | &module.Library.Module.protoProperties, |
| 761 | ) |
| 762 | |
| 763 | module.Library.Module.properties.Installable = proptools.BoolPtr(true) |
| 764 | module.Library.Module.deviceProperties.IsSDKLibrary = true |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 765 | } |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 766 | |
Jaewoong Jung | 4f158ee | 2019-07-11 10:05:35 -0700 | [diff] [blame] | 767 | // java_sdk_library is a special Java library that provides optional platform APIs to apps. |
| 768 | // In practice, it can be viewed as a combination of several modules: 1) stubs library that clients |
| 769 | // are linked against to, 2) droiddoc module that internally generates API stubs source files, |
| 770 | // 3) the real runtime shared library that implements the APIs, and 4) XML file for adding |
| 771 | // the runtime lib to the classpath at runtime if requested via <uses-library>. |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 772 | func SdkLibraryFactory() android.Module { |
| 773 | module := &SdkLibrary{} |
| 774 | module.InitSdkLibraryProperties() |
Jooyung Han | 58f26ab | 2019-12-18 15:34:32 +0900 | [diff] [blame] | 775 | android.InitApexModule(module) |
Sundong Ahn | 054b19a | 2018-10-19 13:46:09 +0900 | [diff] [blame] | 776 | InitJavaModule(module, android.HostAndDeviceSupported) |
Colin Cross | f8b860a | 2019-04-16 14:43:28 -0700 | [diff] [blame] | 777 | android.AddLoadHook(module, func(ctx android.LoadHookContext) { module.CreateInternalModules(ctx) }) |
Jiyong Park | c678ad3 | 2018-04-10 13:07:10 +0900 | [diff] [blame] | 778 | return module |
| 779 | } |
Colin Cross | 79c7c26 | 2019-04-17 11:11:46 -0700 | [diff] [blame] | 780 | |
| 781 | // |
| 782 | // SDK library prebuilts |
| 783 | // |
| 784 | |
| 785 | type sdkLibraryImportProperties struct { |
| 786 | Jars []string `android:"path"` |
| 787 | |
| 788 | Sdk_version *string |
| 789 | |
| 790 | Installable *bool |
| 791 | |
| 792 | // List of shared java libs that this module has dependencies to |
| 793 | Libs []string |
| 794 | |
| 795 | // List of files to remove from the jar file(s) |
| 796 | Exclude_files []string |
| 797 | |
| 798 | // List of directories to remove from the jar file(s) |
| 799 | Exclude_dirs []string |
| 800 | } |
| 801 | |
| 802 | type sdkLibraryImport struct { |
| 803 | android.ModuleBase |
| 804 | android.DefaultableModuleBase |
| 805 | prebuilt android.Prebuilt |
| 806 | |
| 807 | properties sdkLibraryImportProperties |
| 808 | |
| 809 | stubsPath android.Paths |
| 810 | } |
| 811 | |
| 812 | var _ SdkLibraryDependency = (*sdkLibraryImport)(nil) |
| 813 | |
Jaewoong Jung | 4f158ee | 2019-07-11 10:05:35 -0700 | [diff] [blame] | 814 | // java_sdk_library_import imports a prebuilt java_sdk_library. |
Colin Cross | 79c7c26 | 2019-04-17 11:11:46 -0700 | [diff] [blame] | 815 | func sdkLibraryImportFactory() android.Module { |
| 816 | module := &sdkLibraryImport{} |
| 817 | |
| 818 | module.AddProperties(&module.properties) |
| 819 | |
| 820 | android.InitPrebuiltModule(module, &module.properties.Jars) |
| 821 | InitJavaModule(module, android.HostAndDeviceSupported) |
| 822 | |
| 823 | android.AddLoadHook(module, func(mctx android.LoadHookContext) { module.createInternalModules(mctx) }) |
| 824 | return module |
| 825 | } |
| 826 | |
| 827 | func (module *sdkLibraryImport) Prebuilt() *android.Prebuilt { |
| 828 | return &module.prebuilt |
| 829 | } |
| 830 | |
| 831 | func (module *sdkLibraryImport) Name() string { |
| 832 | return module.prebuilt.Name(module.ModuleBase.Name()) |
| 833 | } |
| 834 | |
| 835 | func (module *sdkLibraryImport) createInternalModules(mctx android.LoadHookContext) { |
| 836 | // Creates a java import for the jar with ".stubs" suffix |
| 837 | props := struct { |
Sundong Ahn | 0d7dff4 | 2019-12-04 12:53:44 +0900 | [diff] [blame] | 838 | Name *string |
| 839 | Soc_specific *bool |
| 840 | Device_specific *bool |
| 841 | Product_specific *bool |
| 842 | System_ext_specific *bool |
Colin Cross | 79c7c26 | 2019-04-17 11:11:46 -0700 | [diff] [blame] | 843 | }{} |
| 844 | |
| 845 | props.Name = proptools.StringPtr(module.BaseModuleName() + sdkStubsLibrarySuffix) |
| 846 | |
| 847 | if module.SocSpecific() { |
| 848 | props.Soc_specific = proptools.BoolPtr(true) |
| 849 | } else if module.DeviceSpecific() { |
| 850 | props.Device_specific = proptools.BoolPtr(true) |
| 851 | } else if module.ProductSpecific() { |
| 852 | props.Product_specific = proptools.BoolPtr(true) |
Sundong Ahn | 0d7dff4 | 2019-12-04 12:53:44 +0900 | [diff] [blame] | 853 | } else if module.SystemExtSpecific() { |
| 854 | props.System_ext_specific = proptools.BoolPtr(true) |
Colin Cross | 79c7c26 | 2019-04-17 11:11:46 -0700 | [diff] [blame] | 855 | } |
| 856 | |
Colin Cross | 84dfc3d | 2019-09-25 11:33:01 -0700 | [diff] [blame] | 857 | mctx.CreateModule(ImportFactory, &props, &module.properties) |
Colin Cross | 79c7c26 | 2019-04-17 11:11:46 -0700 | [diff] [blame] | 858 | |
| 859 | javaSdkLibraries := javaSdkLibraries(mctx.Config()) |
| 860 | javaSdkLibrariesLock.Lock() |
| 861 | defer javaSdkLibrariesLock.Unlock() |
| 862 | *javaSdkLibraries = append(*javaSdkLibraries, module.BaseModuleName()) |
| 863 | } |
| 864 | |
| 865 | func (module *sdkLibraryImport) DepsMutator(ctx android.BottomUpMutatorContext) { |
| 866 | // Add dependencies to the prebuilt stubs library |
| 867 | ctx.AddVariationDependencies(nil, publicApiStubsTag, module.BaseModuleName()+sdkStubsLibrarySuffix) |
| 868 | } |
| 869 | |
| 870 | func (module *sdkLibraryImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { |
| 871 | // Record the paths to the prebuilt stubs library. |
| 872 | ctx.VisitDirectDeps(func(to android.Module) { |
| 873 | tag := ctx.OtherModuleDependencyTag(to) |
| 874 | |
| 875 | switch tag { |
| 876 | case publicApiStubsTag: |
| 877 | module.stubsPath = to.(Dependency).HeaderJars() |
| 878 | } |
| 879 | }) |
| 880 | } |
| 881 | |
| 882 | // to satisfy SdkLibraryDependency interface |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 883 | func (module *sdkLibraryImport) SdkHeaderJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths { |
Colin Cross | 79c7c26 | 2019-04-17 11:11:46 -0700 | [diff] [blame] | 884 | // This module is just a wrapper for the prebuilt stubs. |
| 885 | return module.stubsPath |
| 886 | } |
| 887 | |
| 888 | // to satisfy SdkLibraryDependency interface |
Colin Cross | 0ea8ba8 | 2019-06-06 14:33:29 -0700 | [diff] [blame] | 889 | func (module *sdkLibraryImport) SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion string) android.Paths { |
Colin Cross | 79c7c26 | 2019-04-17 11:11:46 -0700 | [diff] [blame] | 890 | // This module is just a wrapper for the stubs. |
| 891 | return module.stubsPath |
| 892 | } |