| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 1 | // Copyright 2017 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 ( | 
| Jiyong Park | 54105c4 | 2021-03-31 18:17:53 +0900 | [diff] [blame] | 18 | 	"strconv" | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 19 | 	"strings" | 
 | 20 |  | 
 | 21 | 	"github.com/google/blueprint" | 
| David Srbecky | e033cba | 2020-05-20 22:20:28 +0100 | [diff] [blame] | 22 | 	"github.com/google/blueprint/proptools" | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 23 |  | 
 | 24 | 	"android/soong/android" | 
| Ramy Medhat | 1dcc27e | 2020-04-21 21:36:23 -0400 | [diff] [blame] | 25 | 	"android/soong/remoteexec" | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 26 | ) | 
 | 27 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 28 | type DexProperties struct { | 
 | 29 | 	// If set to true, compile dex regardless of installable.  Defaults to false. | 
 | 30 | 	Compile_dex *bool | 
 | 31 |  | 
 | 32 | 	// list of module-specific flags that will be used for dex compiles | 
 | 33 | 	Dxflags []string `android:"arch_variant"` | 
 | 34 |  | 
| Colin Cross | 5ea963e | 2021-09-16 19:13:43 -0700 | [diff] [blame] | 35 | 	// A list of files containing rules that specify the classes to keep in the main dex file. | 
 | 36 | 	Main_dex_rules []string `android:"path"` | 
 | 37 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 38 | 	Optimize struct { | 
| Jared Duke | 63a3da9 | 2022-06-02 19:11:14 +0000 | [diff] [blame] | 39 | 		// If false, disable all optimization.  Defaults to true for android_app and | 
 | 40 | 		// android_test_helper_app modules, false for android_test, java_library, and java_test modules. | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 41 | 		Enabled *bool | 
 | 42 | 		// True if the module containing this has it set by default. | 
 | 43 | 		EnabledByDefault bool `blueprint:"mutated"` | 
 | 44 |  | 
| Ajinkya Chalke | ddad41b | 2023-02-09 14:09:58 +0000 | [diff] [blame] | 45 | 		// Whether to continue building even if warnings are emitted.  Defaults to true. | 
| Remi NGUYEN VAN | bdad314 | 2022-08-04 13:19:03 +0900 | [diff] [blame] | 46 | 		Ignore_warnings *bool | 
 | 47 |  | 
| Jared Duke | aa88b3d | 2023-08-29 17:07:20 +0000 | [diff] [blame] | 48 | 		// If true, runs R8 in Proguard compatibility mode, otherwise runs R8 in full mode. | 
 | 49 | 		// Defaults to false for apps, true for libraries and tests. | 
| Christoffer Quist Adamsen | f2d7b16 | 2020-08-24 15:56:16 +0200 | [diff] [blame] | 50 | 		Proguard_compatibility *bool | 
 | 51 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 52 | 		// If true, optimize for size by removing unused code.  Defaults to true for apps, | 
 | 53 | 		// false for libraries and tests. | 
 | 54 | 		Shrink *bool | 
 | 55 |  | 
 | 56 | 		// If true, optimize bytecode.  Defaults to false. | 
 | 57 | 		Optimize *bool | 
 | 58 |  | 
 | 59 | 		// If true, obfuscate bytecode.  Defaults to false. | 
 | 60 | 		Obfuscate *bool | 
 | 61 |  | 
 | 62 | 		// If true, do not use the flag files generated by aapt that automatically keep | 
 | 63 | 		// classes referenced by the app manifest.  Defaults to false. | 
 | 64 | 		No_aapt_flags *bool | 
 | 65 |  | 
| Jared Duke | 51b0a10 | 2022-09-27 16:53:11 -0700 | [diff] [blame] | 66 | 		// If true, optimize for size by removing unused resources. Defaults to false. | 
| Rico Wind | 351bac9 | 2022-09-22 10:41:42 +0200 | [diff] [blame] | 67 | 		Shrink_resources *bool | 
 | 68 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 69 | 		// Flags to pass to proguard. | 
 | 70 | 		Proguard_flags []string | 
 | 71 |  | 
 | 72 | 		// Specifies the locations of files containing proguard flags. | 
 | 73 | 		Proguard_flags_files []string `android:"path"` | 
| Sam Delmerico | 95d7094 | 2023-08-02 18:00:35 -0400 | [diff] [blame] | 74 |  | 
 | 75 | 		// If true, transitive reverse dependencies of this module will have this | 
 | 76 | 		// module's proguard spec appended to their optimization action | 
 | 77 | 		Export_proguard_flags_files *bool | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 78 | 	} | 
 | 79 |  | 
 | 80 | 	// Keep the data uncompressed. We always need uncompressed dex for execution, | 
 | 81 | 	// so this might actually save space by avoiding storing the same data twice. | 
 | 82 | 	// This defaults to reasonable value based on module and should not be set. | 
 | 83 | 	// It exists only to support ART tests. | 
 | 84 | 	Uncompress_dex *bool | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 85 |  | 
| Wei Li | 92cd54b | 2022-01-12 13:22:55 -0800 | [diff] [blame] | 86 | 	// Exclude kotlinc generate files: *.kotlin_module, *.kotlin_builtins. Defaults to false. | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 87 | 	Exclude_kotlinc_generated_files *bool | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 88 | } | 
 | 89 |  | 
 | 90 | type dexer struct { | 
 | 91 | 	dexProperties DexProperties | 
 | 92 |  | 
 | 93 | 	// list of extra proguard flag files | 
| Colin Cross | 312634e | 2023-11-21 15:13:56 -0800 | [diff] [blame] | 94 | 	extraProguardFlagsFiles android.Paths | 
 | 95 | 	proguardDictionary      android.OptionalPath | 
 | 96 | 	proguardConfiguration   android.OptionalPath | 
 | 97 | 	proguardUsageZip        android.OptionalPath | 
 | 98 | 	resourcesInput          android.OptionalPath | 
 | 99 | 	resourcesOutput         android.OptionalPath | 
| Sam Delmerico | 9f9c0a2 | 2022-11-29 11:19:37 -0500 | [diff] [blame] | 100 |  | 
 | 101 | 	providesTransitiveHeaderJars | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 102 | } | 
 | 103 |  | 
 | 104 | func (d *dexer) effectiveOptimizeEnabled() bool { | 
 | 105 | 	return BoolDefault(d.dexProperties.Optimize.Enabled, d.dexProperties.Optimize.EnabledByDefault) | 
 | 106 | } | 
 | 107 |  | 
| Colin Cross | 77cdcfd | 2021-03-12 11:28:25 -0800 | [diff] [blame] | 108 | var d8, d8RE = pctx.MultiCommandRemoteStaticRules("d8", | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 109 | 	blueprint.RuleParams{ | 
 | 110 | 		Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` + | 
| David Srbecky | bda964c | 2023-11-24 15:57:54 +0000 | [diff] [blame] | 111 | 			`$d8Template${config.D8Cmd} ${config.D8Flags} $d8Flags --output $outDir --no-dex-input-jar $in && ` + | 
| Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 112 | 			`$zipTemplate${config.SoongZipCmd} $zipFlags -o $outDir/classes.dex.jar -C $outDir -f "$outDir/classes*.dex" && ` + | 
| Colin Cross | 56e2840 | 2023-09-28 14:38:06 -0700 | [diff] [blame] | 113 | 			`${config.MergeZipsCmd} -D -stripFile "**/*.class" $mergeZipsFlags $out $outDir/classes.dex.jar $in && ` + | 
| Ian Zerny | db2d35b | 2023-10-10 12:22:39 +0200 | [diff] [blame] | 114 | 			`rm -f "$outDir/classes*.dex" "$outDir/classes.dex.jar"`, | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 115 | 		CommandDeps: []string{ | 
 | 116 | 			"${config.D8Cmd}", | 
 | 117 | 			"${config.SoongZipCmd}", | 
 | 118 | 			"${config.MergeZipsCmd}", | 
 | 119 | 		}, | 
| Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 120 | 	}, map[string]*remoteexec.REParams{ | 
 | 121 | 		"$d8Template": &remoteexec.REParams{ | 
 | 122 | 			Labels:          map[string]string{"type": "compile", "compiler": "d8"}, | 
 | 123 | 			Inputs:          []string{"${config.D8Jar}"}, | 
 | 124 | 			ExecStrategy:    "${config.RED8ExecStrategy}", | 
 | 125 | 			ToolchainInputs: []string{"${config.JavaCmd}"}, | 
 | 126 | 			Platform:        map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, | 
 | 127 | 		}, | 
 | 128 | 		"$zipTemplate": &remoteexec.REParams{ | 
 | 129 | 			Labels:       map[string]string{"type": "tool", "name": "soong_zip"}, | 
 | 130 | 			Inputs:       []string{"${config.SoongZipCmd}", "$outDir"}, | 
 | 131 | 			OutputFiles:  []string{"$outDir/classes.dex.jar"}, | 
 | 132 | 			ExecStrategy: "${config.RED8ExecStrategy}", | 
 | 133 | 			Platform:     map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, | 
 | 134 | 		}, | 
| Ian Zerny | db2d35b | 2023-10-10 12:22:39 +0200 | [diff] [blame] | 135 | 	}, []string{"outDir", "d8Flags", "zipFlags", "mergeZipsFlags"}, nil) | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 136 |  | 
| Colin Cross | 77cdcfd | 2021-03-12 11:28:25 -0800 | [diff] [blame] | 137 | var r8, r8RE = pctx.MultiCommandRemoteStaticRules("r8", | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 138 | 	blueprint.RuleParams{ | 
 | 139 | 		Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` + | 
| Ian Zerny | 82044f1 | 2023-01-25 12:11:27 +0100 | [diff] [blame] | 140 | 			`rm -f "$outDict" && rm -f "$outConfig" && rm -rf "${outUsageDir}" && ` + | 
| Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 141 | 			`mkdir -p $$(dirname ${outUsage}) && ` + | 
| David Srbecky | bda964c | 2023-11-24 15:57:54 +0000 | [diff] [blame] | 142 | 			`$r8Template${config.R8Cmd} ${config.R8Flags} $r8Flags -injars $in --output $outDir ` + | 
| Søren Gjesse | 24f1702 | 2018-09-14 15:20:42 +0200 | [diff] [blame] | 143 | 			`--no-data-resources ` + | 
| Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 144 | 			`-printmapping ${outDict} ` + | 
| Jared Duke | 34c6d7d | 2023-05-05 20:40:20 +0000 | [diff] [blame] | 145 | 			`-printconfiguration ${outConfig} ` + | 
| Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 146 | 			`-printusage ${outUsage} ` + | 
| David Srbecky | bda964c | 2023-11-24 15:57:54 +0000 | [diff] [blame] | 147 | 			`--deps-file ${out}.d && ` + | 
| Ian Zerny | 82044f1 | 2023-01-25 12:11:27 +0100 | [diff] [blame] | 148 | 			`touch "${outDict}" "${outConfig}" "${outUsage}" && ` + | 
| Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 149 | 			`${config.SoongZipCmd} -o ${outUsageZip} -C ${outUsageDir} -f ${outUsage} && ` + | 
 | 150 | 			`rm -rf ${outUsageDir} && ` + | 
| Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 151 | 			`$zipTemplate${config.SoongZipCmd} $zipFlags -o $outDir/classes.dex.jar -C $outDir -f "$outDir/classes*.dex" && ` + | 
| Colin Cross | 56e2840 | 2023-09-28 14:38:06 -0700 | [diff] [blame] | 152 | 			`${config.MergeZipsCmd} -D -stripFile "**/*.class" $mergeZipsFlags $out $outDir/classes.dex.jar $in && ` + | 
| Colin Cross | b716ceb | 2023-10-03 09:40:06 -0700 | [diff] [blame] | 153 | 			`rm -f "$outDir/classes*.dex" "$outDir/classes.dex.jar"`, | 
| Colin Cross | 22e6a6f | 2022-03-21 12:19:44 -0700 | [diff] [blame] | 154 | 		Depfile: "${out}.d", | 
 | 155 | 		Deps:    blueprint.DepsGCC, | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 156 | 		CommandDeps: []string{ | 
| Colin Cross | a832a04 | 2021-08-05 16:56:18 -0700 | [diff] [blame] | 157 | 			"${config.R8Cmd}", | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 158 | 			"${config.SoongZipCmd}", | 
 | 159 | 			"${config.MergeZipsCmd}", | 
 | 160 | 		}, | 
| Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 161 | 	}, map[string]*remoteexec.REParams{ | 
 | 162 | 		"$r8Template": &remoteexec.REParams{ | 
 | 163 | 			Labels:          map[string]string{"type": "compile", "compiler": "r8"}, | 
 | 164 | 			Inputs:          []string{"$implicits", "${config.R8Jar}"}, | 
| Rico Wind | 98e7fa8 | 2023-11-27 09:44:03 +0100 | [diff] [blame] | 165 | 			OutputFiles:     []string{"${outUsage}", "${outConfig}", "${outDict}", "${resourcesOutput}"}, | 
| Kousik Kumar | 366afc5 | 2020-05-20 11:27:16 -0700 | [diff] [blame] | 166 | 			ExecStrategy:    "${config.RER8ExecStrategy}", | 
 | 167 | 			ToolchainInputs: []string{"${config.JavaCmd}"}, | 
 | 168 | 			Platform:        map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, | 
 | 169 | 		}, | 
 | 170 | 		"$zipTemplate": &remoteexec.REParams{ | 
 | 171 | 			Labels:       map[string]string{"type": "tool", "name": "soong_zip"}, | 
 | 172 | 			Inputs:       []string{"${config.SoongZipCmd}", "$outDir"}, | 
 | 173 | 			OutputFiles:  []string{"$outDir/classes.dex.jar"}, | 
 | 174 | 			ExecStrategy: "${config.RER8ExecStrategy}", | 
 | 175 | 			Platform:     map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, | 
 | 176 | 		}, | 
| Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 177 | 		"$zipUsageTemplate": &remoteexec.REParams{ | 
 | 178 | 			Labels:       map[string]string{"type": "tool", "name": "soong_zip"}, | 
 | 179 | 			Inputs:       []string{"${config.SoongZipCmd}", "${outUsage}"}, | 
 | 180 | 			OutputFiles:  []string{"${outUsageZip}"}, | 
 | 181 | 			ExecStrategy: "${config.RER8ExecStrategy}", | 
 | 182 | 			Platform:     map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"}, | 
 | 183 | 		}, | 
| Ian Zerny | 82044f1 | 2023-01-25 12:11:27 +0100 | [diff] [blame] | 184 | 	}, []string{"outDir", "outDict", "outConfig", "outUsage", "outUsageZip", "outUsageDir", | 
| Rico Wind | 98e7fa8 | 2023-11-27 09:44:03 +0100 | [diff] [blame] | 185 | 		"r8Flags", "zipFlags", "mergeZipsFlags", "resourcesOutput"}, []string{"implicits"}) | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 186 |  | 
| Colin Cross | 5ea963e | 2021-09-16 19:13:43 -0700 | [diff] [blame] | 187 | func (d *dexer) dexCommonFlags(ctx android.ModuleContext, | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 188 | 	dexParams *compileDexParams) (flags []string, deps android.Paths) { | 
| Colin Cross | 5ea963e | 2021-09-16 19:13:43 -0700 | [diff] [blame] | 189 |  | 
 | 190 | 	flags = d.dexProperties.Dxflags | 
| Colin Cross | bafb897 | 2018-06-06 21:46:32 +0000 | [diff] [blame] | 191 | 	// Translate all the DX flags to D8 ones until all the build files have been migrated | 
 | 192 | 	// to D8 flags. See: b/69377755 | 
 | 193 | 	flags = android.RemoveListFromList(flags, | 
 | 194 | 		[]string{"--core-library", "--dex", "--multi-dex"}) | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 195 |  | 
| Colin Cross | 5ea963e | 2021-09-16 19:13:43 -0700 | [diff] [blame] | 196 | 	for _, f := range android.PathsForModuleSrc(ctx, d.dexProperties.Main_dex_rules) { | 
 | 197 | 		flags = append(flags, "--main-dex-rules", f.String()) | 
 | 198 | 		deps = append(deps, f) | 
 | 199 | 	} | 
 | 200 |  | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 201 | 	if ctx.Config().Getenv("NO_OPTIMIZE_DX") != "" { | 
| Colin Cross | bafb897 | 2018-06-06 21:46:32 +0000 | [diff] [blame] | 202 | 		flags = append(flags, "--debug") | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 203 | 	} | 
 | 204 |  | 
 | 205 | 	if ctx.Config().Getenv("GENERATE_DEX_DEBUG") != "" { | 
 | 206 | 		flags = append(flags, | 
 | 207 | 			"--debug", | 
 | 208 | 			"--verbose") | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 209 | 	} | 
 | 210 |  | 
| Jared Duke | 40d731a | 2022-09-20 15:32:14 -0700 | [diff] [blame] | 211 | 	// Supplying the platform build flag disables various features like API modeling and desugaring. | 
 | 212 | 	// For targets with a stable min SDK version (i.e., when the min SDK is both explicitly specified | 
 | 213 | 	// and managed+versioned), we suppress this flag to ensure portability. | 
 | 214 | 	// Note: Targets with a min SDK kind of core_platform (e.g., framework.jar) or unspecified (e.g., | 
 | 215 | 	// services.jar), are not classified as stable, which is WAI. | 
 | 216 | 	// TODO(b/232073181): Expand to additional min SDK cases after validation. | 
| Ian Zerny | c26029b | 2023-08-25 13:43:44 +0200 | [diff] [blame] | 217 | 	var addAndroidPlatformBuildFlag = false | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 218 | 	if !dexParams.sdkVersion.Stable() { | 
| Ian Zerny | c26029b | 2023-08-25 13:43:44 +0200 | [diff] [blame] | 219 | 		addAndroidPlatformBuildFlag = true | 
| Jared Duke | 40d731a | 2022-09-20 15:32:14 -0700 | [diff] [blame] | 220 | 	} | 
 | 221 |  | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 222 | 	effectiveVersion, err := dexParams.minSdkVersion.EffectiveVersion(ctx) | 
| Colin Cross | 83bb316 | 2018-06-25 15:48:06 -0700 | [diff] [blame] | 223 | 	if err != nil { | 
 | 224 | 		ctx.PropertyErrorf("min_sdk_version", "%s", err) | 
 | 225 | 	} | 
 | 226 |  | 
| Ian Zerny | c26029b | 2023-08-25 13:43:44 +0200 | [diff] [blame] | 227 | 	// If the specified SDK level is 10000, then configure the compiler to use the | 
 | 228 | 	// current platform SDK level and to compile the build as a platform build. | 
 | 229 | 	var minApiFlagValue = effectiveVersion.FinalOrFutureInt() | 
 | 230 | 	if minApiFlagValue == 10000 { | 
 | 231 | 		minApiFlagValue = ctx.Config().PlatformSdkVersion().FinalInt() | 
 | 232 | 		addAndroidPlatformBuildFlag = true | 
 | 233 | 	} | 
 | 234 | 	flags = append(flags, "--min-api "+strconv.Itoa(minApiFlagValue)) | 
 | 235 |  | 
 | 236 | 	if addAndroidPlatformBuildFlag { | 
 | 237 | 		flags = append(flags, "--android-platform-build") | 
 | 238 | 	} | 
| Colin Cross | 5ea963e | 2021-09-16 19:13:43 -0700 | [diff] [blame] | 239 | 	return flags, deps | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 240 | } | 
 | 241 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 242 | func d8Flags(flags javaBuilderFlags) (d8Flags []string, d8Deps android.Paths) { | 
| Colin Cross | c2557d1 | 2019-10-31 15:22:57 -0700 | [diff] [blame] | 243 | 	d8Flags = append(d8Flags, flags.bootClasspath.FormRepeatedClassPath("--lib ")...) | 
| Colin Cross | 9bb9bfb | 2022-03-17 11:12:32 -0700 | [diff] [blame] | 244 | 	d8Flags = append(d8Flags, flags.dexClasspath.FormRepeatedClassPath("--lib ")...) | 
| Colin Cross | ffb657e | 2018-09-21 12:29:22 -0700 | [diff] [blame] | 245 |  | 
| Colin Cross | 6dab9bd | 2018-09-28 08:06:24 -0700 | [diff] [blame] | 246 | 	d8Deps = append(d8Deps, flags.bootClasspath...) | 
| Colin Cross | 9bb9bfb | 2022-03-17 11:12:32 -0700 | [diff] [blame] | 247 | 	d8Deps = append(d8Deps, flags.dexClasspath...) | 
| Colin Cross | 6dab9bd | 2018-09-28 08:06:24 -0700 | [diff] [blame] | 248 |  | 
 | 249 | 	return d8Flags, d8Deps | 
| Colin Cross | ffb657e | 2018-09-21 12:29:22 -0700 | [diff] [blame] | 250 | } | 
 | 251 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 252 | func (d *dexer) r8Flags(ctx android.ModuleContext, flags javaBuilderFlags) (r8Flags []string, r8Deps android.Paths) { | 
 | 253 | 	opt := d.dexProperties.Optimize | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 254 |  | 
 | 255 | 	// When an app contains references to APIs that are not in the SDK specified by | 
 | 256 | 	// its LOCAL_SDK_VERSION for example added by support library or by runtime | 
| Colin Cross | bafb897 | 2018-06-06 21:46:32 +0000 | [diff] [blame] | 257 | 	// classes added by desugaring, we artifically raise the "SDK version" "linked" by | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 258 | 	// ProGuard, to | 
 | 259 | 	// - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version. | 
 | 260 | 	// - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version. | 
 | 261 | 	// See b/20667396 | 
 | 262 | 	var proguardRaiseDeps classpath | 
| Colin Cross | dcf71b2 | 2021-02-01 13:59:03 -0800 | [diff] [blame] | 263 | 	ctx.VisitDirectDepsWithTag(proguardRaiseTag, func(m android.Module) { | 
 | 264 | 		dep := ctx.OtherModuleProvider(m, JavaInfoProvider).(JavaInfo) | 
 | 265 | 		proguardRaiseDeps = append(proguardRaiseDeps, dep.HeaderJars...) | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 266 | 	}) | 
 | 267 |  | 
 | 268 | 	r8Flags = append(r8Flags, proguardRaiseDeps.FormJavaClassPath("-libraryjars")) | 
| Colin Cross | 6dab9bd | 2018-09-28 08:06:24 -0700 | [diff] [blame] | 269 | 	r8Deps = append(r8Deps, proguardRaiseDeps...) | 
| Sam Delmerico | 9f9c0a2 | 2022-11-29 11:19:37 -0500 | [diff] [blame] | 270 | 	r8Flags = append(r8Flags, flags.bootClasspath.FormJavaClassPath("-libraryjars")) | 
| Colin Cross | 6dab9bd | 2018-09-28 08:06:24 -0700 | [diff] [blame] | 271 | 	r8Deps = append(r8Deps, flags.bootClasspath...) | 
| Sam Delmerico | 9f9c0a2 | 2022-11-29 11:19:37 -0500 | [diff] [blame] | 272 | 	r8Flags = append(r8Flags, flags.dexClasspath.FormJavaClassPath("-libraryjars")) | 
| Colin Cross | 9bb9bfb | 2022-03-17 11:12:32 -0700 | [diff] [blame] | 273 | 	r8Deps = append(r8Deps, flags.dexClasspath...) | 
| Sam Delmerico | 9f9c0a2 | 2022-11-29 11:19:37 -0500 | [diff] [blame] | 274 |  | 
 | 275 | 	transitiveStaticLibsLookupMap := map[android.Path]bool{} | 
 | 276 | 	if d.transitiveStaticLibsHeaderJars != nil { | 
 | 277 | 		for _, jar := range d.transitiveStaticLibsHeaderJars.ToList() { | 
 | 278 | 			transitiveStaticLibsLookupMap[jar] = true | 
 | 279 | 		} | 
 | 280 | 	} | 
 | 281 | 	transitiveHeaderJars := android.Paths{} | 
 | 282 | 	if d.transitiveLibsHeaderJars != nil { | 
 | 283 | 		for _, jar := range d.transitiveLibsHeaderJars.ToList() { | 
 | 284 | 			if _, ok := transitiveStaticLibsLookupMap[jar]; ok { | 
 | 285 | 				// don't include a lib if it is already packaged in the current JAR as a static lib | 
 | 286 | 				continue | 
 | 287 | 			} | 
 | 288 | 			transitiveHeaderJars = append(transitiveHeaderJars, jar) | 
 | 289 | 		} | 
 | 290 | 	} | 
 | 291 | 	transitiveClasspath := classpath(transitiveHeaderJars) | 
 | 292 | 	r8Flags = append(r8Flags, transitiveClasspath.FormJavaClassPath("-libraryjars")) | 
 | 293 | 	r8Deps = append(r8Deps, transitiveClasspath...) | 
| Colin Cross | 6dab9bd | 2018-09-28 08:06:24 -0700 | [diff] [blame] | 294 |  | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 295 | 	flagFiles := android.Paths{ | 
 | 296 | 		android.PathForSource(ctx, "build/make/core/proguard.flags"), | 
 | 297 | 	} | 
 | 298 |  | 
| Colin Cross | 312634e | 2023-11-21 15:13:56 -0800 | [diff] [blame] | 299 | 	flagFiles = append(flagFiles, d.extraProguardFlagsFiles...) | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 300 | 	// TODO(ccross): static android library proguard files | 
 | 301 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 302 | 	flagFiles = append(flagFiles, android.PathsForModuleSrc(ctx, opt.Proguard_flags_files)...) | 
| Colin Cross | bd1cef5 | 2018-08-13 10:28:18 -0700 | [diff] [blame] | 303 |  | 
| Sam Delmerico | c8e040c | 2023-10-31 17:27:02 +0000 | [diff] [blame] | 304 | 	flagFiles = android.FirstUniquePaths(flagFiles) | 
 | 305 |  | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 306 | 	r8Flags = append(r8Flags, android.JoinWithPrefix(flagFiles.Strings(), "-include ")) | 
 | 307 | 	r8Deps = append(r8Deps, flagFiles...) | 
 | 308 |  | 
 | 309 | 	// TODO(b/70942988): This is included from build/make/core/proguard.flags | 
 | 310 | 	r8Deps = append(r8Deps, android.PathForSource(ctx, | 
 | 311 | 		"build/make/core/proguard_basic_keeps.flags")) | 
 | 312 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 313 | 	r8Flags = append(r8Flags, opt.Proguard_flags...) | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 314 |  | 
| Christoffer Quist Adamsen | f2d7b16 | 2020-08-24 15:56:16 +0200 | [diff] [blame] | 315 | 	if BoolDefault(opt.Proguard_compatibility, true) { | 
 | 316 | 		r8Flags = append(r8Flags, "--force-proguard-compatibility") | 
| Jared Duke | b832fbb | 2023-09-15 17:16:36 +0000 | [diff] [blame] | 317 | 	} | 
 | 318 |  | 
 | 319 | 	if Bool(opt.Optimize) || Bool(opt.Obfuscate) { | 
| Ian Zerny | fc7df61 | 2021-11-02 15:37:06 +0100 | [diff] [blame] | 320 | 		// TODO(b/213833843): Allow configuration of the prefix via a build variable. | 
 | 321 | 		var sourceFilePrefix = "go/retraceme " | 
 | 322 | 		var sourceFileTemplate = "\"" + sourceFilePrefix + "%MAP_ID\"" | 
| Jared Duke | b832fbb | 2023-09-15 17:16:36 +0000 | [diff] [blame] | 323 | 		r8Flags = append(r8Flags, "--map-id-template", "%MAP_HASH") | 
 | 324 | 		r8Flags = append(r8Flags, "--source-file-template", sourceFileTemplate) | 
| Christoffer Quist Adamsen | f2d7b16 | 2020-08-24 15:56:16 +0200 | [diff] [blame] | 325 | 	} | 
 | 326 |  | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 327 | 	// TODO(ccross): Don't shrink app instrumentation tests by default. | 
 | 328 | 	if !Bool(opt.Shrink) { | 
 | 329 | 		r8Flags = append(r8Flags, "-dontshrink") | 
 | 330 | 	} | 
 | 331 |  | 
 | 332 | 	if !Bool(opt.Optimize) { | 
 | 333 | 		r8Flags = append(r8Flags, "-dontoptimize") | 
 | 334 | 	} | 
 | 335 |  | 
 | 336 | 	// TODO(ccross): error if obufscation + app instrumentation test. | 
 | 337 | 	if !Bool(opt.Obfuscate) { | 
 | 338 | 		r8Flags = append(r8Flags, "-dontobfuscate") | 
 | 339 | 	} | 
| Colin Cross | 4b964c0 | 2018-10-15 16:18:06 -0700 | [diff] [blame] | 340 | 	// TODO(ccross): if this is an instrumentation test of an obfuscated app, use the | 
 | 341 | 	// dictionary of the app and move the app from libraryjars to injars. | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 342 |  | 
| Jaewoong Jung | 1d6eb68 | 2018-11-29 15:08:44 -0800 | [diff] [blame] | 343 | 	// Don't strip out debug information for eng builds. | 
 | 344 | 	if ctx.Config().Eng() { | 
 | 345 | 		r8Flags = append(r8Flags, "--debug") | 
 | 346 | 	} | 
 | 347 |  | 
| Christoffer Quist Adamsen | e850737 | 2021-02-22 09:44:09 +0100 | [diff] [blame] | 348 | 	// TODO(b/180878971): missing classes should be added to the relevant builds. | 
| Ajinkya Chalke | ddad41b | 2023-02-09 14:09:58 +0000 | [diff] [blame] | 349 | 	// TODO(b/229727645): do not use true as default for Android platform builds. | 
 | 350 | 	if proptools.BoolDefault(opt.Ignore_warnings, true) { | 
| Remi NGUYEN VAN | bdad314 | 2022-08-04 13:19:03 +0900 | [diff] [blame] | 351 | 		r8Flags = append(r8Flags, "-ignorewarnings") | 
 | 352 | 	} | 
| Christoffer Quist Adamsen | e850737 | 2021-02-22 09:44:09 +0100 | [diff] [blame] | 353 |  | 
| Rico Wind | 98e7fa8 | 2023-11-27 09:44:03 +0100 | [diff] [blame] | 354 | 	if d.resourcesInput.Valid() { | 
 | 355 | 		r8Flags = append(r8Flags, "--resource-input", d.resourcesInput.Path().String()) | 
 | 356 | 		r8Deps = append(r8Deps, d.resourcesInput.Path()) | 
 | 357 | 		r8Flags = append(r8Flags, "--resource-output", d.resourcesOutput.Path().String()) | 
 | 358 | 	} | 
 | 359 |  | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 360 | 	return r8Flags, r8Deps | 
 | 361 | } | 
 | 362 |  | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 363 | type compileDexParams struct { | 
 | 364 | 	flags         javaBuilderFlags | 
 | 365 | 	sdkVersion    android.SdkSpec | 
| Spandan Das | 8c9ae7e | 2023-03-03 21:20:36 +0000 | [diff] [blame] | 366 | 	minSdkVersion android.ApiLevel | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 367 | 	classesJar    android.Path | 
 | 368 | 	jarName       string | 
 | 369 | } | 
 | 370 |  | 
 | 371 | func (d *dexer) compileDex(ctx android.ModuleContext, dexParams *compileDexParams) android.OutputPath { | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 372 |  | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 373 | 	// Compile classes.jar into classes.dex and then javalib.jar | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 374 | 	javalibJar := android.PathForModuleOut(ctx, "dex", dexParams.jarName).OutputPath | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 375 | 	outDir := android.PathForModuleOut(ctx, "dex") | 
 | 376 |  | 
| Sasha Smundak | d3cf4ee | 2019-02-15 10:14:23 -0800 | [diff] [blame] | 377 | 	zipFlags := "--ignore_missing_files" | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 378 | 	if proptools.Bool(d.dexProperties.Uncompress_dex) { | 
| Sasha Smundak | d3cf4ee | 2019-02-15 10:14:23 -0800 | [diff] [blame] | 379 | 		zipFlags += " -L 0" | 
| Colin Cross | 5a0dcd5 | 2018-10-05 14:20:06 -0700 | [diff] [blame] | 380 | 	} | 
 | 381 |  | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 382 | 	commonFlags, commonDeps := d.dexCommonFlags(ctx, dexParams) | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 383 |  | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 384 | 	// Exclude kotlinc generated files when "exclude_kotlinc_generated_files" is set to true. | 
 | 385 | 	mergeZipsFlags := "" | 
 | 386 | 	if proptools.BoolDefault(d.dexProperties.Exclude_kotlinc_generated_files, false) { | 
 | 387 | 		mergeZipsFlags = "-stripFile META-INF/*.kotlin_module -stripFile **/*.kotlin_builtins" | 
 | 388 | 	} | 
 | 389 |  | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 390 | 	useR8 := d.effectiveOptimizeEnabled() | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 391 | 	if useR8 { | 
| Colin Cross | c0c664c | 2018-05-16 16:47:21 -0700 | [diff] [blame] | 392 | 		proguardDictionary := android.PathForModuleOut(ctx, "proguard_dictionary") | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 393 | 		d.proguardDictionary = android.OptionalPathForPath(proguardDictionary) | 
| Ian Zerny | 82044f1 | 2023-01-25 12:11:27 +0100 | [diff] [blame] | 394 | 		proguardConfiguration := android.PathForModuleOut(ctx, "proguard_configuration") | 
 | 395 | 		d.proguardConfiguration = android.OptionalPathForPath(proguardConfiguration) | 
| Colin Cross | cb6143a | 2020-08-14 17:39:29 -0700 | [diff] [blame] | 396 | 		proguardUsageDir := android.PathForModuleOut(ctx, "proguard_usage") | 
 | 397 | 		proguardUsage := proguardUsageDir.Join(ctx, ctx.Namespace().Path, | 
 | 398 | 			android.ModuleNameWithPossibleOverride(ctx), "unused.txt") | 
 | 399 | 		proguardUsageZip := android.PathForModuleOut(ctx, "proguard_usage.zip") | 
 | 400 | 		d.proguardUsageZip = android.OptionalPathForPath(proguardUsageZip) | 
| Rico Wind | 98e7fa8 | 2023-11-27 09:44:03 +0100 | [diff] [blame] | 401 | 		resourcesOutput := android.PathForModuleOut(ctx, "package-res-shrunken.apk") | 
 | 402 | 		d.resourcesOutput = android.OptionalPathForPath(resourcesOutput) | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 403 | 		r8Flags, r8Deps := d.r8Flags(ctx, dexParams.flags) | 
| Colin Cross | 5ea963e | 2021-09-16 19:13:43 -0700 | [diff] [blame] | 404 | 		r8Deps = append(r8Deps, commonDeps...) | 
| Ramy Medhat | 1dcc27e | 2020-04-21 21:36:23 -0400 | [diff] [blame] | 405 | 		rule := r8 | 
 | 406 | 		args := map[string]string{ | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 407 | 			"r8Flags":        strings.Join(append(commonFlags, r8Flags...), " "), | 
 | 408 | 			"zipFlags":       zipFlags, | 
 | 409 | 			"outDict":        proguardDictionary.String(), | 
| Ian Zerny | 82044f1 | 2023-01-25 12:11:27 +0100 | [diff] [blame] | 410 | 			"outConfig":      proguardConfiguration.String(), | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 411 | 			"outUsageDir":    proguardUsageDir.String(), | 
 | 412 | 			"outUsage":       proguardUsage.String(), | 
 | 413 | 			"outUsageZip":    proguardUsageZip.String(), | 
 | 414 | 			"outDir":         outDir.String(), | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 415 | 			"mergeZipsFlags": mergeZipsFlags, | 
| Ramy Medhat | 1dcc27e | 2020-04-21 21:36:23 -0400 | [diff] [blame] | 416 | 		} | 
| Ramy Medhat | 16f23a4 | 2020-09-03 01:29:49 -0400 | [diff] [blame] | 417 | 		if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_R8") { | 
| Ramy Medhat | 1dcc27e | 2020-04-21 21:36:23 -0400 | [diff] [blame] | 418 | 			rule = r8RE | 
 | 419 | 			args["implicits"] = strings.Join(r8Deps.Strings(), ",") | 
 | 420 | 		} | 
| Rico Wind | 98e7fa8 | 2023-11-27 09:44:03 +0100 | [diff] [blame] | 421 | 		implicitOutputs := android.WritablePaths{ | 
 | 422 | 			proguardDictionary, | 
 | 423 | 			proguardUsageZip, | 
 | 424 | 			proguardConfiguration} | 
 | 425 | 		if d.resourcesInput.Valid() { | 
 | 426 | 			implicitOutputs = append(implicitOutputs, resourcesOutput) | 
 | 427 | 			args["resourcesOutput"] = resourcesOutput.String() | 
 | 428 | 		} | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 429 | 		ctx.Build(pctx, android.BuildParams{ | 
| Rico Wind | 98e7fa8 | 2023-11-27 09:44:03 +0100 | [diff] [blame] | 430 | 			Rule:            rule, | 
 | 431 | 			Description:     "r8", | 
 | 432 | 			Output:          javalibJar, | 
 | 433 | 			ImplicitOutputs: implicitOutputs, | 
 | 434 | 			Input:           dexParams.classesJar, | 
 | 435 | 			Implicits:       r8Deps, | 
 | 436 | 			Args:            args, | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 437 | 		}) | 
 | 438 | 	} else { | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 439 | 		d8Flags, d8Deps := d8Flags(dexParams.flags) | 
| Colin Cross | 5ea963e | 2021-09-16 19:13:43 -0700 | [diff] [blame] | 440 | 		d8Deps = append(d8Deps, commonDeps...) | 
| Ramy Medhat | 1dcc27e | 2020-04-21 21:36:23 -0400 | [diff] [blame] | 441 | 		rule := d8 | 
| Ramy Medhat | 16f23a4 | 2020-09-03 01:29:49 -0400 | [diff] [blame] | 442 | 		if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_D8") { | 
| Ramy Medhat | 1dcc27e | 2020-04-21 21:36:23 -0400 | [diff] [blame] | 443 | 			rule = d8RE | 
 | 444 | 		} | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 445 | 		ctx.Build(pctx, android.BuildParams{ | 
| Ramy Medhat | 1dcc27e | 2020-04-21 21:36:23 -0400 | [diff] [blame] | 446 | 			Rule:        rule, | 
| Colin Cross | bafb897 | 2018-06-06 21:46:32 +0000 | [diff] [blame] | 447 | 			Description: "d8", | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 448 | 			Output:      javalibJar, | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 449 | 			Input:       dexParams.classesJar, | 
| Colin Cross | 6dab9bd | 2018-09-28 08:06:24 -0700 | [diff] [blame] | 450 | 			Implicits:   d8Deps, | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 451 | 			Args: map[string]string{ | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 452 | 				"d8Flags":        strings.Join(append(commonFlags, d8Flags...), " "), | 
 | 453 | 				"zipFlags":       zipFlags, | 
 | 454 | 				"outDir":         outDir.String(), | 
| Wei Li | 1e73c65 | 2021-12-06 13:35:11 -0800 | [diff] [blame] | 455 | 				"mergeZipsFlags": mergeZipsFlags, | 
| Colin Cross | 66dbc0b | 2017-12-28 12:23:20 -0800 | [diff] [blame] | 456 | 			}, | 
 | 457 | 		}) | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 458 | 	} | 
| Liz Kammer | a7a64f3 | 2020-07-09 15:16:41 -0700 | [diff] [blame] | 459 | 	if proptools.Bool(d.dexProperties.Uncompress_dex) { | 
| Spandan Das | c404cc7 | 2023-02-23 18:05:05 +0000 | [diff] [blame] | 460 | 		alignedJavalibJar := android.PathForModuleOut(ctx, "aligned", dexParams.jarName).OutputPath | 
| Cole Faust | 51d7bfd | 2023-09-07 05:31:32 +0000 | [diff] [blame] | 461 | 		TransformZipAlign(ctx, alignedJavalibJar, javalibJar, nil) | 
| Nicolas Geoffray | 65fd8ba | 2019-01-21 23:20:23 +0000 | [diff] [blame] | 462 | 		javalibJar = alignedJavalibJar | 
 | 463 | 	} | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 464 |  | 
| Colin Cross | f0056cb | 2017-12-22 15:56:08 -0800 | [diff] [blame] | 465 | 	return javalibJar | 
 | 466 | } |