Loading java/device_host_converter.go +1 −1 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont if len(d.headerJars) > 1 { outputFile := android.PathForModuleOut(ctx, "turbine-combined", jarName) TransformJarsToJar(ctx, outputFile, "turbine combine", d.headerJars, android.OptionalPath{}, false, nil, nil) android.OptionalPath{}, false, nil, []string{"META-INF/TRANSITIVE"}) d.combinedHeaderJar = outputFile } else { d.combinedHeaderJar = d.headerJars[0] Loading java/java.go +1 −1 Original line number Diff line number Diff line Loading @@ -1380,7 +1380,7 @@ func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles, srcJars // since we have to strip META-INF/TRANSITIVE dir from turbine.jar combinedJar := android.PathForModuleOut(ctx, "turbine-combined", jarName) TransformJarsToJar(ctx, combinedJar, "for turbine", jars, android.OptionalPath{}, false, nil, []string{"META-INF"}) false, nil, []string{"META-INF/TRANSITIVE"}) headerJar = combinedJar if j.expandJarjarRules != nil { Loading java/kotlin.go +14 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import ( "bytes" "encoding/base64" "encoding/binary" "path/filepath" "strings" "android/soong/android" Loading @@ -30,7 +31,7 @@ var kotlinc = pctx.AndroidGomaStaticRule("kotlinc", Command: `rm -rf "$classesDir" "$srcJarDir" "$kotlinBuildFile" "$emptyDir" && ` + `mkdir -p "$classesDir" "$srcJarDir" "$emptyDir" && ` + `${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` + `${config.GenKotlinBuildFileCmd} $classpath $classesDir $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.GenKotlinBuildFileCmd} $classpath "$name" $classesDir $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.KotlincCmd} ${config.JavacHeapFlags} $kotlincFlags ` + `-jvm-target $kotlinJvmTarget -Xbuild-file=$kotlinBuildFile -kotlin-home $emptyDir && ` + `${config.SoongZipCmd} -jar -o $out -C $classesDir -D $classesDir && ` + Loading @@ -50,7 +51,8 @@ var kotlinc = pctx.AndroidGomaStaticRule("kotlinc", Rspfile: "$out.rsp", RspfileContent: `$in`, }, "kotlincFlags", "classpath", "srcJars", "srcJarDir", "classesDir", "kotlinJvmTarget", "kotlinBuildFile", "emptyDir") "kotlincFlags", "classpath", "srcJars", "srcJarDir", "classesDir", "kotlinJvmTarget", "kotlinBuildFile", "emptyDir", "name") // kotlinCompile takes .java and .kt sources and srcJars, and compiles the .kt sources into a classes jar in outputFile. func kotlinCompile(ctx android.ModuleContext, outputFile android.WritablePath, Loading @@ -61,6 +63,9 @@ func kotlinCompile(ctx android.ModuleContext, outputFile android.WritablePath, deps = append(deps, flags.kotlincClasspath...) deps = append(deps, srcJars...) kotlinName := filepath.Join(ctx.ModuleDir(), ctx.ModuleSubDir(), ctx.ModuleName()) kotlinName = strings.ReplaceAll(kotlinName, "/", "__") ctx.Build(pctx, android.BuildParams{ Rule: kotlinc, Description: "kotlinc", Loading @@ -77,6 +82,7 @@ func kotlinCompile(ctx android.ModuleContext, outputFile android.WritablePath, "emptyDir": android.PathForModuleOut(ctx, "kotlinc", "empty").String(), // http://b/69160377 kotlinc only supports -jvm-target 1.6 and 1.8 "kotlinJvmTarget": "1.8", "name": kotlinName, }, }) } Loading @@ -85,7 +91,7 @@ var kapt = pctx.AndroidGomaStaticRule("kapt", blueprint.RuleParams{ Command: `rm -rf "$srcJarDir" "$kotlinBuildFile" "$kaptDir" && mkdir -p "$srcJarDir" "$kaptDir" && ` + `${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` + `${config.GenKotlinBuildFileCmd} $classpath "" $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.GenKotlinBuildFileCmd} $classpath "$name" "" $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.KotlincCmd} ${config.KotlincSuppressJDK9Warnings} ${config.JavacHeapFlags} $kotlincFlags ` + `-Xplugin=${config.KotlinKaptJar} ` + `-P plugin:org.jetbrains.kotlin.kapt3:sources=$kaptDir/sources ` + Loading @@ -111,7 +117,7 @@ var kapt = pctx.AndroidGomaStaticRule("kapt", RspfileContent: `$in`, }, "kotlincFlags", "encodedJavacFlags", "kaptProcessorPath", "kaptProcessor", "classpath", "srcJars", "srcJarDir", "kaptDir", "kotlinJvmTarget", "kotlinBuildFile") "classpath", "srcJars", "srcJarDir", "kaptDir", "kotlinJvmTarget", "kotlinBuildFile", "name") // kotlinKapt performs Kotlin-compatible annotation processing. It takes .kt and .java sources and srcjars, and runs // annotation processors over all of them, producing a srcjar of generated code in outputFile. The srcjar should be Loading @@ -138,6 +144,9 @@ func kotlinKapt(ctx android.ModuleContext, outputFile android.WritablePath, {"-target", flags.javaVersion}, }) kotlinName := filepath.Join(ctx.ModuleDir(), ctx.ModuleSubDir(), ctx.ModuleName()) kotlinName = strings.ReplaceAll(kotlinName, "/", "__") ctx.Build(pctx, android.BuildParams{ Rule: kapt, Description: "kapt", Loading @@ -154,6 +163,7 @@ func kotlinKapt(ctx android.ModuleContext, outputFile android.WritablePath, "kaptProcessor": kaptProcessor, "kaptDir": android.PathForModuleOut(ctx, "kapt/gen").String(), "encodedJavacFlags": encodedJavacFlags, "name": kotlinName, }, }) } Loading scripts/gen-kotlin-build-file.sh +5 −4 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ # Generates kotlinc module xml file to standard output based on rsp files if [[ -z "$1" ]]; then echo "usage: $0 <classpath> <outDir> <rspFiles>..." >&2 echo "usage: $0 <classpath> <name> <outDir> <rspFiles>..." >&2 exit 1 fi Loading @@ -27,8 +27,9 @@ if [[ $1 == "-classpath" ]]; then fi; classpath=$1 out_dir=$2 shift 2 name=$2 out_dir=$3 shift 3 # Path in the build file may be relative to the build file, we need to make them # absolute Loading @@ -44,7 +45,7 @@ get_abs_path () { } # Print preamble echo "<modules><module name=\"name\" type=\"java-production\" outputDir=\"${out_dir}\">" echo "<modules><module name=\"${name}\" type=\"java-production\" outputDir=\"${out_dir}\">" # Print classpath entries for file in $(echo "$classpath" | tr ":" "\n"); do Loading Loading
java/device_host_converter.go +1 −1 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont if len(d.headerJars) > 1 { outputFile := android.PathForModuleOut(ctx, "turbine-combined", jarName) TransformJarsToJar(ctx, outputFile, "turbine combine", d.headerJars, android.OptionalPath{}, false, nil, nil) android.OptionalPath{}, false, nil, []string{"META-INF/TRANSITIVE"}) d.combinedHeaderJar = outputFile } else { d.combinedHeaderJar = d.headerJars[0] Loading
java/java.go +1 −1 Original line number Diff line number Diff line Loading @@ -1380,7 +1380,7 @@ func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles, srcJars // since we have to strip META-INF/TRANSITIVE dir from turbine.jar combinedJar := android.PathForModuleOut(ctx, "turbine-combined", jarName) TransformJarsToJar(ctx, combinedJar, "for turbine", jars, android.OptionalPath{}, false, nil, []string{"META-INF"}) false, nil, []string{"META-INF/TRANSITIVE"}) headerJar = combinedJar if j.expandJarjarRules != nil { Loading
java/kotlin.go +14 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import ( "bytes" "encoding/base64" "encoding/binary" "path/filepath" "strings" "android/soong/android" Loading @@ -30,7 +31,7 @@ var kotlinc = pctx.AndroidGomaStaticRule("kotlinc", Command: `rm -rf "$classesDir" "$srcJarDir" "$kotlinBuildFile" "$emptyDir" && ` + `mkdir -p "$classesDir" "$srcJarDir" "$emptyDir" && ` + `${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` + `${config.GenKotlinBuildFileCmd} $classpath $classesDir $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.GenKotlinBuildFileCmd} $classpath "$name" $classesDir $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.KotlincCmd} ${config.JavacHeapFlags} $kotlincFlags ` + `-jvm-target $kotlinJvmTarget -Xbuild-file=$kotlinBuildFile -kotlin-home $emptyDir && ` + `${config.SoongZipCmd} -jar -o $out -C $classesDir -D $classesDir && ` + Loading @@ -50,7 +51,8 @@ var kotlinc = pctx.AndroidGomaStaticRule("kotlinc", Rspfile: "$out.rsp", RspfileContent: `$in`, }, "kotlincFlags", "classpath", "srcJars", "srcJarDir", "classesDir", "kotlinJvmTarget", "kotlinBuildFile", "emptyDir") "kotlincFlags", "classpath", "srcJars", "srcJarDir", "classesDir", "kotlinJvmTarget", "kotlinBuildFile", "emptyDir", "name") // kotlinCompile takes .java and .kt sources and srcJars, and compiles the .kt sources into a classes jar in outputFile. func kotlinCompile(ctx android.ModuleContext, outputFile android.WritablePath, Loading @@ -61,6 +63,9 @@ func kotlinCompile(ctx android.ModuleContext, outputFile android.WritablePath, deps = append(deps, flags.kotlincClasspath...) deps = append(deps, srcJars...) kotlinName := filepath.Join(ctx.ModuleDir(), ctx.ModuleSubDir(), ctx.ModuleName()) kotlinName = strings.ReplaceAll(kotlinName, "/", "__") ctx.Build(pctx, android.BuildParams{ Rule: kotlinc, Description: "kotlinc", Loading @@ -77,6 +82,7 @@ func kotlinCompile(ctx android.ModuleContext, outputFile android.WritablePath, "emptyDir": android.PathForModuleOut(ctx, "kotlinc", "empty").String(), // http://b/69160377 kotlinc only supports -jvm-target 1.6 and 1.8 "kotlinJvmTarget": "1.8", "name": kotlinName, }, }) } Loading @@ -85,7 +91,7 @@ var kapt = pctx.AndroidGomaStaticRule("kapt", blueprint.RuleParams{ Command: `rm -rf "$srcJarDir" "$kotlinBuildFile" "$kaptDir" && mkdir -p "$srcJarDir" "$kaptDir" && ` + `${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` + `${config.GenKotlinBuildFileCmd} $classpath "" $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.GenKotlinBuildFileCmd} $classpath "$name" "" $out.rsp $srcJarDir/list > $kotlinBuildFile &&` + `${config.KotlincCmd} ${config.KotlincSuppressJDK9Warnings} ${config.JavacHeapFlags} $kotlincFlags ` + `-Xplugin=${config.KotlinKaptJar} ` + `-P plugin:org.jetbrains.kotlin.kapt3:sources=$kaptDir/sources ` + Loading @@ -111,7 +117,7 @@ var kapt = pctx.AndroidGomaStaticRule("kapt", RspfileContent: `$in`, }, "kotlincFlags", "encodedJavacFlags", "kaptProcessorPath", "kaptProcessor", "classpath", "srcJars", "srcJarDir", "kaptDir", "kotlinJvmTarget", "kotlinBuildFile") "classpath", "srcJars", "srcJarDir", "kaptDir", "kotlinJvmTarget", "kotlinBuildFile", "name") // kotlinKapt performs Kotlin-compatible annotation processing. It takes .kt and .java sources and srcjars, and runs // annotation processors over all of them, producing a srcjar of generated code in outputFile. The srcjar should be Loading @@ -138,6 +144,9 @@ func kotlinKapt(ctx android.ModuleContext, outputFile android.WritablePath, {"-target", flags.javaVersion}, }) kotlinName := filepath.Join(ctx.ModuleDir(), ctx.ModuleSubDir(), ctx.ModuleName()) kotlinName = strings.ReplaceAll(kotlinName, "/", "__") ctx.Build(pctx, android.BuildParams{ Rule: kapt, Description: "kapt", Loading @@ -154,6 +163,7 @@ func kotlinKapt(ctx android.ModuleContext, outputFile android.WritablePath, "kaptProcessor": kaptProcessor, "kaptDir": android.PathForModuleOut(ctx, "kapt/gen").String(), "encodedJavacFlags": encodedJavacFlags, "name": kotlinName, }, }) } Loading
scripts/gen-kotlin-build-file.sh +5 −4 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ # Generates kotlinc module xml file to standard output based on rsp files if [[ -z "$1" ]]; then echo "usage: $0 <classpath> <outDir> <rspFiles>..." >&2 echo "usage: $0 <classpath> <name> <outDir> <rspFiles>..." >&2 exit 1 fi Loading @@ -27,8 +27,9 @@ if [[ $1 == "-classpath" ]]; then fi; classpath=$1 out_dir=$2 shift 2 name=$2 out_dir=$3 shift 3 # Path in the build file may be relative to the build file, we need to make them # absolute Loading @@ -44,7 +45,7 @@ get_abs_path () { } # Print preamble echo "<modules><module name=\"name\" type=\"java-production\" outputDir=\"${out_dir}\">" echo "<modules><module name=\"${name}\" type=\"java-production\" outputDir=\"${out_dir}\">" # Print classpath entries for file in $(echo "$classpath" | tr ":" "\n"); do Loading