diff options
author | 2023-07-26 16:16:47 -0700 | |
---|---|---|
committer | 2023-07-27 14:57:45 +0000 | |
commit | 49889c088b22278436d754ee6d2fbc666df59477 (patch) | |
tree | d17c9bda2c025913e2e78dd3efb273d81eb60b84 | |
parent | c7c29b9b8e3c5063d33f646788caeb7748daa564 (diff) |
Delete the javac/classes directory after zipping it
javac produces a directory containing class files, which is then zipped
with soong_zip into a jar file. The class files are never used outside
of the rule, so delete them after zipping them. This should save 19 GB
of disk space in checkbuilds.
Do the same for kotlinc/classes directories for consistency.
Bug: 293352015
Test: treehugger
Change-Id: Id1e889cfbee47eab552a5bb27134fa4b3b4c4d14
-rw-r--r-- | java/builder.go | 2 | ||||
-rw-r--r-- | java/kotlin.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/java/builder.go b/java/builder.go index afbd69ee4..debf49a00 100644 --- a/java/builder.go +++ b/java/builder.go @@ -55,7 +55,7 @@ var ( `$zipTemplate${config.SoongZipCmd} -jar -o $out.tmp -C $outDir -D $outDir && ` + `if ! cmp -s "$out.tmp" "$out"; then mv "$out.tmp" "$out"; fi && ` + `if ! cmp -s "$annoSrcJar.tmp" "$annoSrcJar"; then mv "$annoSrcJar.tmp" "$annoSrcJar"; fi && ` + - `rm -rf "$srcJarDir"`, + `rm -rf "$srcJarDir" "$outDir"`, CommandDeps: []string{ "${config.JavacCmd}", "${config.SoongZipCmd}", diff --git a/java/kotlin.go b/java/kotlin.go index f28d6c737..3637e2e71 100644 --- a/java/kotlin.go +++ b/java/kotlin.go @@ -42,7 +42,7 @@ var kotlinc = pctx.AndroidRemoteStaticRule("kotlinc", android.RemoteRuleSupports ` -P plugin:org.jetbrains.kotlin.jvm.abi:outputDir=$headerClassesDir && ` + `${config.SoongZipCmd} -jar -o $out -C $classesDir -D $classesDir -write_if_changed && ` + `${config.SoongZipCmd} -jar -o $headerJar -C $headerClassesDir -D $headerClassesDir -write_if_changed && ` + - `rm -rf "$srcJarDir"`, + `rm -rf "$srcJarDir" "$classesDir" "$headerClassesDir"`, CommandDeps: []string{ "${config.KotlincCmd}", "${config.KotlinCompilerJar}", |