Colin Cross | 30e076a | 2015-04-13 13:58:27 -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 | // This file generates the final rules for compiling all Java. All properties related to |
| 18 | // compiling should have been translated into javaBuilderFlags or another argument to the Transform* |
| 19 | // functions. |
| 20 | |
| 21 | import ( |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 22 | "path/filepath" |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 23 | "strings" |
| 24 | |
| 25 | "github.com/google/blueprint" |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 26 | "github.com/google/blueprint/proptools" |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 27 | |
Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 28 | "android/soong/android" |
Kousik Kumar | 309b1c0 | 2020-05-28 06:13:33 -0700 | [diff] [blame] | 29 | "android/soong/remoteexec" |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 30 | ) |
| 31 | |
| 32 | var ( |
Colin Cross | 77cdcfd | 2021-03-12 11:28:25 -0800 | [diff] [blame] | 33 | Signapk, SignapkRE = pctx.RemoteStaticRules("signapk", |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 34 | blueprint.RuleParams{ |
Ulf Adams | 7e7ef56 | 2020-11-25 23:07:23 +0100 | [diff] [blame] | 35 | Command: `rm -f $out && $reTemplate${config.JavaCmd} ${config.JavaVmFlags} -Djava.library.path=$$(dirname ${config.SignapkJniLibrary}) ` + |
Colin Cross | bdf9514 | 2019-08-08 12:56:34 -0700 | [diff] [blame] | 36 | `-jar ${config.SignapkCmd} $flags $certificates $in $out`, |
| 37 | CommandDeps: []string{"${config.SignapkCmd}", "${config.SignapkJniLibrary}"}, |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 38 | }, |
Kousik Kumar | 309b1c0 | 2020-05-28 06:13:33 -0700 | [diff] [blame] | 39 | &remoteexec.REParams{Labels: map[string]string{"type": "tool", "name": "signapk"}, |
| 40 | ExecStrategy: "${config.RESignApkExecStrategy}", |
| 41 | Inputs: []string{"${config.SignapkCmd}", "$in", "$$(dirname ${config.SignapkJniLibrary})", "$implicits"}, |
| 42 | OutputFiles: []string{"$outCommaList"}, |
| 43 | ToolchainInputs: []string{"${config.JavaCmd}"}, |
| 44 | Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, |
| 45 | }, []string{"flags", "certificates"}, []string{"implicits", "outCommaList"}) |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 46 | ) |
| 47 | |
Colin Cross | 3bc7ffa | 2017-11-22 16:19:37 -0800 | [diff] [blame] | 48 | var combineApk = pctx.AndroidStaticRule("combineApk", |
| 49 | blueprint.RuleParams{ |
| 50 | Command: `${config.MergeZipsCmd} $out $in`, |
| 51 | CommandDeps: []string{"${config.MergeZipsCmd}"}, |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 52 | }) |
| 53 | |
Jaewoong Jung | ccbb393 | 2019-04-15 09:48:31 -0700 | [diff] [blame] | 54 | func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.WritablePath, |
Rico Wind | 351bac9 | 2022-09-22 10:41:42 +0200 | [diff] [blame] | 55 | packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string, shrinkResources bool) { |
Colin Cross | 3bc7ffa | 2017-11-22 16:19:37 -0800 | [diff] [blame] | 56 | |
Colin Cross | e560c4a | 2019-03-19 16:03:11 -0700 | [diff] [blame] | 57 | unsignedApkName := strings.TrimSuffix(outputFile.Base(), ".apk") + "-unsigned.apk" |
| 58 | unsignedApk := android.PathForModuleOut(ctx, unsignedApkName) |
Colin Cross | 3bc7ffa | 2017-11-22 16:19:37 -0800 | [diff] [blame] | 59 | |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 60 | var inputs android.Paths |
Colin Cross | 3bc7ffa | 2017-11-22 16:19:37 -0800 | [diff] [blame] | 61 | if dexJarFile != nil { |
| 62 | inputs = append(inputs, dexJarFile) |
| 63 | } |
Colin Cross | fd94c40 | 2018-11-01 14:50:55 -0700 | [diff] [blame] | 64 | inputs = append(inputs, packageFile) |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 65 | if jniJarFile != nil { |
| 66 | inputs = append(inputs, jniJarFile) |
| 67 | } |
Colin Cross | ae88703 | 2017-10-23 17:16:14 -0700 | [diff] [blame] | 68 | ctx.Build(pctx, android.BuildParams{ |
Colin Cross | 50ddcc4 | 2019-05-16 12:28:22 -0700 | [diff] [blame] | 69 | Rule: combineApk, |
| 70 | Inputs: inputs, |
| 71 | Output: unsignedApk, |
| 72 | Implicits: deps, |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 73 | }) |
| 74 | |
Rico Wind | 351bac9 | 2022-09-22 10:41:42 +0200 | [diff] [blame] | 75 | if shrinkResources { |
| 76 | shrunkenApk := android.PathForModuleOut(ctx, "resource-shrunken", unsignedApk.Base()) |
| 77 | ShrinkResources(ctx, unsignedApk, shrunkenApk) |
| 78 | unsignedApk = shrunkenApk |
| 79 | } |
Rupert Shuttleworth | 8eab869 | 2021-11-03 10:39:39 -0400 | [diff] [blame] | 80 | SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile, lineageFile, rotationMinSdkVersion) |
Jaewoong Jung | ccbb393 | 2019-04-15 09:48:31 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Rupert Shuttleworth | 8eab869 | 2021-11-03 10:39:39 -0400 | [diff] [blame] | 83 | func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string) { |
Jaewoong Jung | ccbb393 | 2019-04-15 09:48:31 -0700 | [diff] [blame] | 84 | |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 85 | var certificateArgs []string |
Dan Willemsen | c4bd8f8 | 2019-04-09 21:26:14 -0700 | [diff] [blame] | 86 | var deps android.Paths |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 87 | for _, c := range certificates { |
Jiyong Park | c00cbd9 | 2018-10-30 21:20:05 +0900 | [diff] [blame] | 88 | certificateArgs = append(certificateArgs, c.Pem.String(), c.Key.String()) |
Dan Willemsen | c4bd8f8 | 2019-04-09 21:26:14 -0700 | [diff] [blame] | 89 | deps = append(deps, c.Pem, c.Key) |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 90 | } |
Songchun Fan | 688de9a | 2020-03-24 20:32:24 -0700 | [diff] [blame] | 91 | outputFiles := android.WritablePaths{signedApk} |
Liz Kammer | 70dd74d | 2020-05-07 13:24:05 -0700 | [diff] [blame] | 92 | var flags []string |
Songchun Fan | 688de9a | 2020-03-24 20:32:24 -0700 | [diff] [blame] | 93 | if v4SignatureFile != nil { |
| 94 | outputFiles = append(outputFiles, v4SignatureFile) |
Liz Kammer | 70dd74d | 2020-05-07 13:24:05 -0700 | [diff] [blame] | 95 | flags = append(flags, "--enable-v4") |
| 96 | } |
| 97 | |
| 98 | if lineageFile != nil { |
| 99 | flags = append(flags, "--lineage", lineageFile.String()) |
Liz Kammer | 9cd4f81 | 2020-05-08 17:19:26 -0700 | [diff] [blame] | 100 | deps = append(deps, lineageFile) |
Songchun Fan | 688de9a | 2020-03-24 20:32:24 -0700 | [diff] [blame] | 101 | } |
| 102 | |
Rupert Shuttleworth | 8eab869 | 2021-11-03 10:39:39 -0400 | [diff] [blame] | 103 | if rotationMinSdkVersion != "" { |
| 104 | flags = append(flags, "--rotation-min-sdk-version", rotationMinSdkVersion) |
| 105 | } |
| 106 | |
Kousik Kumar | 309b1c0 | 2020-05-28 06:13:33 -0700 | [diff] [blame] | 107 | rule := Signapk |
| 108 | args := map[string]string{ |
| 109 | "certificates": strings.Join(certificateArgs, " "), |
| 110 | "flags": strings.Join(flags, " "), |
| 111 | } |
Ramy Medhat | 16f23a4 | 2020-09-03 01:29:49 -0400 | [diff] [blame] | 112 | if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_SIGNAPK") { |
Kousik Kumar | 309b1c0 | 2020-05-28 06:13:33 -0700 | [diff] [blame] | 113 | rule = SignapkRE |
| 114 | args["implicits"] = strings.Join(deps.Strings(), ",") |
| 115 | args["outCommaList"] = strings.Join(outputFiles.Strings(), ",") |
| 116 | } |
Colin Cross | ae88703 | 2017-10-23 17:16:14 -0700 | [diff] [blame] | 117 | ctx.Build(pctx, android.BuildParams{ |
Kousik Kumar | 309b1c0 | 2020-05-28 06:13:33 -0700 | [diff] [blame] | 118 | Rule: rule, |
Colin Cross | 67a5c13 | 2017-05-09 13:45:28 -0700 | [diff] [blame] | 119 | Description: "signapk", |
Songchun Fan | 688de9a | 2020-03-24 20:32:24 -0700 | [diff] [blame] | 120 | Outputs: outputFiles, |
Colin Cross | 3bc7ffa | 2017-11-22 16:19:37 -0800 | [diff] [blame] | 121 | Input: unsignedApk, |
Dan Willemsen | c4bd8f8 | 2019-04-09 21:26:14 -0700 | [diff] [blame] | 122 | Implicits: deps, |
Kousik Kumar | 309b1c0 | 2020-05-28 06:13:33 -0700 | [diff] [blame] | 123 | Args: args, |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 124 | }) |
Colin Cross | 30e076a | 2015-04-13 13:58:27 -0700 | [diff] [blame] | 125 | } |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 126 | |
| 127 | var buildAAR = pctx.AndroidStaticRule("buildAAR", |
| 128 | blueprint.RuleParams{ |
| 129 | Command: `rm -rf ${outDir} && mkdir -p ${outDir} && ` + |
| 130 | `cp ${manifest} ${outDir}/AndroidManifest.xml && ` + |
| 131 | `cp ${classesJar} ${outDir}/classes.jar && ` + |
| 132 | `cp ${rTxt} ${outDir}/R.txt && ` + |
Colin Cross | 1d98ee2 | 2018-09-18 17:05:15 -0700 | [diff] [blame] | 133 | `${config.SoongZipCmd} -jar -o $out -C ${outDir} -D ${outDir}`, |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 134 | CommandDeps: []string{"${config.SoongZipCmd}"}, |
| 135 | }, |
Colin Cross | 1d98ee2 | 2018-09-18 17:05:15 -0700 | [diff] [blame] | 136 | "manifest", "classesJar", "rTxt", "outDir") |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 137 | |
| 138 | func BuildAAR(ctx android.ModuleContext, outputFile android.WritablePath, |
| 139 | classesJar, manifest, rTxt android.Path, res android.Paths) { |
| 140 | |
| 141 | // TODO(ccross): uniquify and copy resources with dependencies |
| 142 | |
| 143 | deps := android.Paths{manifest, rTxt} |
| 144 | classesJarPath := "" |
| 145 | if classesJar != nil { |
| 146 | deps = append(deps, classesJar) |
| 147 | classesJarPath = classesJar.String() |
| 148 | } |
| 149 | |
| 150 | ctx.Build(pctx, android.BuildParams{ |
Colin Cross | f57c578 | 2019-01-25 13:20:38 -0800 | [diff] [blame] | 151 | Rule: buildAAR, |
| 152 | Description: "aar", |
| 153 | Implicits: deps, |
| 154 | Output: outputFile, |
Colin Cross | a97c5d3 | 2018-03-28 14:58:31 -0700 | [diff] [blame] | 155 | Args: map[string]string{ |
| 156 | "manifest": manifest.String(), |
| 157 | "classesJar": classesJarPath, |
| 158 | "rTxt": rTxt.String(), |
| 159 | "outDir": android.PathForModuleOut(ctx, "aar").String(), |
| 160 | }, |
| 161 | }) |
| 162 | } |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 163 | |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 164 | var buildBundleModule = pctx.AndroidStaticRule("buildBundleModule", |
| 165 | blueprint.RuleParams{ |
Colin Cross | fd94c40 | 2018-11-01 14:50:55 -0700 | [diff] [blame] | 166 | Command: `${config.MergeZipsCmd} ${out} ${in}`, |
| 167 | CommandDeps: []string{"${config.MergeZipsCmd}"}, |
| 168 | }) |
| 169 | |
| 170 | var bundleMungePackage = pctx.AndroidStaticRule("bundleMungePackage", |
| 171 | blueprint.RuleParams{ |
| 172 | Command: `${config.Zip2ZipCmd} -i ${in} -o ${out} AndroidManifest.xml:manifest/AndroidManifest.xml resources.pb "res/**/*" "assets/**/*"`, |
| 173 | CommandDeps: []string{"${config.Zip2ZipCmd}"}, |
| 174 | }) |
| 175 | |
| 176 | var bundleMungeDexJar = pctx.AndroidStaticRule("bundleMungeDexJar", |
| 177 | blueprint.RuleParams{ |
| 178 | Command: `${config.Zip2ZipCmd} -i ${in} -o ${out} "classes*.dex:dex/" && ` + |
| 179 | `${config.Zip2ZipCmd} -i ${in} -o ${resJar} -x "classes*.dex" "**/*:root/"`, |
| 180 | CommandDeps: []string{"${config.Zip2ZipCmd}"}, |
| 181 | }, "resJar") |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 182 | |
| 183 | // Builds an app into a module suitable for input to bundletool |
| 184 | func BuildBundleModule(ctx android.ModuleContext, outputFile android.WritablePath, |
Colin Cross | fd94c40 | 2018-11-01 14:50:55 -0700 | [diff] [blame] | 185 | packageFile, jniJarFile, dexJarFile android.Path) { |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 186 | |
| 187 | protoResJarFile := android.PathForModuleOut(ctx, "package-res.pb.apk") |
Rico Wind | 351bac9 | 2022-09-22 10:41:42 +0200 | [diff] [blame] | 188 | aapt2Convert(ctx, protoResJarFile, packageFile, "proto") |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 189 | |
Colin Cross | fd94c40 | 2018-11-01 14:50:55 -0700 | [diff] [blame] | 190 | var zips android.Paths |
| 191 | |
| 192 | mungedPackage := android.PathForModuleOut(ctx, "bundle", "apk.zip") |
| 193 | ctx.Build(pctx, android.BuildParams{ |
| 194 | Rule: bundleMungePackage, |
| 195 | Input: protoResJarFile, |
| 196 | Output: mungedPackage, |
| 197 | Description: "bundle apk", |
| 198 | }) |
| 199 | zips = append(zips, mungedPackage) |
| 200 | |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 201 | if dexJarFile != nil { |
Colin Cross | fd94c40 | 2018-11-01 14:50:55 -0700 | [diff] [blame] | 202 | mungedDexJar := android.PathForModuleOut(ctx, "bundle", "dex.zip") |
| 203 | mungedResJar := android.PathForModuleOut(ctx, "bundle", "res.zip") |
| 204 | ctx.Build(pctx, android.BuildParams{ |
| 205 | Rule: bundleMungeDexJar, |
| 206 | Input: dexJarFile, |
| 207 | Output: mungedDexJar, |
| 208 | ImplicitOutput: mungedResJar, |
| 209 | Description: "bundle dex", |
| 210 | Args: map[string]string{ |
| 211 | "resJar": mungedResJar.String(), |
| 212 | }, |
| 213 | }) |
| 214 | zips = append(zips, mungedDexJar, mungedResJar) |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 215 | } |
| 216 | if jniJarFile != nil { |
Colin Cross | fd94c40 | 2018-11-01 14:50:55 -0700 | [diff] [blame] | 217 | zips = append(zips, jniJarFile) |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | ctx.Build(pctx, android.BuildParams{ |
| 221 | Rule: buildBundleModule, |
Colin Cross | fd94c40 | 2018-11-01 14:50:55 -0700 | [diff] [blame] | 222 | Inputs: zips, |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 223 | Output: outputFile, |
| 224 | Description: "bundle", |
Colin Cross | f623721 | 2018-10-29 23:14:58 -0700 | [diff] [blame] | 225 | }) |
| 226 | } |
| 227 | |
Sam Delmerico | 8260249 | 2022-06-10 17:05:42 +0000 | [diff] [blame] | 228 | const jniJarOutputPathString = "jniJarOutput.zip" |
| 229 | |
| 230 | func TransformJniLibsToJar( |
| 231 | ctx android.ModuleContext, |
| 232 | outputFile android.WritablePath, |
| 233 | jniLibs []jniLib, |
| 234 | prebuiltJniPackages android.Paths, |
| 235 | uncompressJNI bool) { |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 236 | |
| 237 | var deps android.Paths |
| 238 | jarArgs := []string{ |
| 239 | "-j", // junk paths, they will be added back with -P arguments |
| 240 | } |
| 241 | |
Colin Cross | e4246ab | 2019-02-05 21:55:21 -0800 | [diff] [blame] | 242 | if uncompressJNI { |
Peter Collingbourne | ad84f97 | 2019-12-17 16:46:18 -0800 | [diff] [blame] | 243 | jarArgs = append(jarArgs, "-L", "0") |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | for _, j := range jniLibs { |
| 247 | deps = append(deps, j.path) |
| 248 | jarArgs = append(jarArgs, |
Peter Collingbourne | ad84f97 | 2019-12-17 16:46:18 -0800 | [diff] [blame] | 249 | "-P", targetToJniDir(j.target), |
| 250 | "-f", j.path.String()) |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 251 | } |
| 252 | |
Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 253 | rule := zip |
| 254 | args := map[string]string{ |
| 255 | "jarArgs": strings.Join(proptools.NinjaAndShellEscapeList(jarArgs), " "), |
| 256 | } |
Ramy Medhat | 16f23a4 | 2020-09-03 01:29:49 -0400 | [diff] [blame] | 257 | if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_ZIP") { |
Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 258 | rule = zipRE |
| 259 | args["implicits"] = strings.Join(deps.Strings(), ",") |
| 260 | } |
Sam Delmerico | 8260249 | 2022-06-10 17:05:42 +0000 | [diff] [blame] | 261 | jniJarPath := android.PathForModuleOut(ctx, jniJarOutputPathString) |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 262 | ctx.Build(pctx, android.BuildParams{ |
Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 263 | Rule: rule, |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 264 | Description: "zip jni libs", |
Sam Delmerico | 8260249 | 2022-06-10 17:05:42 +0000 | [diff] [blame] | 265 | Output: jniJarPath, |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 266 | Implicits: deps, |
Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 267 | Args: args, |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 268 | }) |
Sam Delmerico | 8260249 | 2022-06-10 17:05:42 +0000 | [diff] [blame] | 269 | ctx.Build(pctx, android.BuildParams{ |
| 270 | Rule: mergeAssetsRule, |
| 271 | Description: "merge prebuilt JNI packages", |
| 272 | Inputs: append(prebuiltJniPackages, jniJarPath), |
| 273 | Output: outputFile, |
| 274 | }) |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 275 | } |
| 276 | |
Matt Banda | 8c80126 | 2022-04-01 17:48:31 +0000 | [diff] [blame] | 277 | func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) { |
| 278 | javaApiUsedByOutputFile := android.PathForModuleOut(ctx, a.installApkName+"_using.xml") |
| 279 | javaUsedByRule := android.NewRuleBuilder(pctx, ctx) |
| 280 | javaUsedByRule.Command(). |
| 281 | Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")). |
| 282 | BuiltTool("dexdeps"). |
| 283 | Output(javaApiUsedByOutputFile). |
| 284 | Input(a.Library.Module.outputFile) |
| 285 | javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex") |
| 286 | a.javaApiUsedByOutputFile = javaApiUsedByOutputFile |
| 287 | } |
| 288 | |
Colin Cross | a4f0881 | 2018-10-02 22:03:40 -0700 | [diff] [blame] | 289 | func targetToJniDir(target android.Target) string { |
| 290 | return filepath.Join("lib", target.Arch.Abi[0]) |
| 291 | } |