2015-03-31 02:20:39 +02:00
|
|
|
// Copyright 2015 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package java
|
|
|
|
|
|
|
|
// This file generates the final rules for compiling all Java. All properties related to
|
|
|
|
// compiling should have been translated into javaBuilderFlags or another argument to the Transform*
|
|
|
|
// functions.
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/google/blueprint"
|
2017-09-05 22:16:45 +02:00
|
|
|
|
|
|
|
"android/soong/android"
|
|
|
|
"android/soong/java/config"
|
2015-03-31 02:20:39 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2016-05-19 00:37:25 +02:00
|
|
|
pctx = android.NewPackageContext("android/soong/java")
|
2015-03-31 02:20:39 +02:00
|
|
|
|
|
|
|
// Compiling java is not conducive to proper dependency tracking. The path-matches-class-name
|
|
|
|
// requirement leads to unpredictable generated source file names, and a single .java file
|
|
|
|
// will get compiled into multiple .class files if it contains inner classes. To work around
|
|
|
|
// this, all java rules write into separate directories and then a post-processing step lists
|
|
|
|
// the files in the the directory into a list file that later rules depend on (and sometimes
|
|
|
|
// read from directly using @<listfile>)
|
2017-06-05 10:41:50 +02:00
|
|
|
javac = pctx.AndroidGomaStaticRule("javac",
|
2015-03-31 02:20:39 +02:00
|
|
|
blueprint.RuleParams{
|
2017-08-08 22:17:59 +02:00
|
|
|
Command: `rm -rf "$outDir" "$annoDir" && mkdir -p "$outDir" "$annoDir" && ` +
|
2017-08-29 02:23:21 +02:00
|
|
|
`${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
|
2017-08-08 22:17:59 +02:00
|
|
|
`$javacFlags $bootClasspath $classpath ` +
|
|
|
|
`-source $javaVersion -target $javaVersion ` +
|
2017-08-11 02:58:12 +02:00
|
|
|
`-d $outDir -s $annoDir @$out.rsp && ` +
|
2017-08-30 23:24:55 +02:00
|
|
|
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
|
|
|
CommandDeps: []string{"${config.JavacCmd}", "${config.SoongZipCmd}"},
|
2015-03-31 02:20:39 +02:00
|
|
|
Rspfile: "$out.rsp",
|
|
|
|
RspfileContent: "$in",
|
|
|
|
},
|
2017-08-08 22:17:59 +02:00
|
|
|
"javacFlags", "bootClasspath", "classpath", "outDir", "annoDir", "javaVersion")
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2017-08-14 23:16:06 +02:00
|
|
|
errorprone = pctx.AndroidStaticRule("errorprone",
|
|
|
|
blueprint.RuleParams{
|
|
|
|
Command: `rm -rf "$outDir" "$annoDir" && mkdir -p "$outDir" "$annoDir" && ` +
|
2017-09-12 08:10:21 +02:00
|
|
|
`${config.ErrorProneCmd} ` +
|
2017-08-14 23:16:06 +02:00
|
|
|
`$javacFlags $bootClasspath $classpath ` +
|
|
|
|
`-source $javaVersion -target $javaVersion ` +
|
|
|
|
`-d $outDir -s $annoDir @$out.rsp && ` +
|
2017-08-30 23:24:55 +02:00
|
|
|
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
2017-08-14 23:16:06 +02:00
|
|
|
CommandDeps: []string{
|
|
|
|
"${config.JavaCmd}",
|
|
|
|
"${config.ErrorProneJavacJar}",
|
|
|
|
"${config.ErrorProneJar}",
|
2017-08-30 23:24:55 +02:00
|
|
|
"${config.SoongZipCmd}",
|
2017-08-14 23:16:06 +02:00
|
|
|
},
|
|
|
|
Rspfile: "$out.rsp",
|
|
|
|
RspfileContent: "$in",
|
|
|
|
},
|
|
|
|
"javacFlags", "bootClasspath", "classpath", "outDir", "annoDir", "javaVersion")
|
|
|
|
|
2016-08-30 01:14:13 +02:00
|
|
|
jar = pctx.AndroidStaticRule("jar",
|
2015-03-31 02:20:39 +02:00
|
|
|
blueprint.RuleParams{
|
2017-08-30 23:24:55 +02:00
|
|
|
Command: `${config.SoongZipCmd} -jar -o $out $jarArgs`,
|
|
|
|
CommandDeps: []string{"${config.SoongZipCmd}"},
|
2015-03-31 02:20:39 +02:00
|
|
|
},
|
2017-08-30 23:24:55 +02:00
|
|
|
"jarArgs")
|
|
|
|
|
|
|
|
combineJar = pctx.AndroidStaticRule("combineJar",
|
|
|
|
blueprint.RuleParams{
|
2017-09-13 07:50:46 +02:00
|
|
|
Command: `${config.MergeZipsCmd} -j $jarArgs $out $in`,
|
2017-08-30 23:24:55 +02:00
|
|
|
CommandDeps: []string{"${config.MergeZipsCmd}"},
|
|
|
|
},
|
2017-09-13 07:50:46 +02:00
|
|
|
"jarArgs")
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2017-09-15 22:00:47 +02:00
|
|
|
desugar = pctx.AndroidStaticRule("desugar",
|
|
|
|
blueprint.RuleParams{
|
|
|
|
Command: `rm -rf $dumpDir && mkdir -p $dumpDir && ` +
|
|
|
|
`${config.JavaCmd} ` +
|
|
|
|
`-Djdk.internal.lambda.dumpProxyClasses=$$(cd $dumpDir && pwd) ` +
|
|
|
|
`$javaFlags ` +
|
|
|
|
`-jar ${config.DesugarJar} $classpathFlags $desugarFlags ` +
|
|
|
|
`-i $in -o $out`,
|
|
|
|
CommandDeps: []string{"${config.DesugarJar}"},
|
|
|
|
},
|
|
|
|
"javaFlags", "classpathFlags", "desugarFlags", "dumpDir")
|
|
|
|
|
2016-08-30 01:14:13 +02:00
|
|
|
dx = pctx.AndroidStaticRule("dx",
|
2015-03-31 02:20:39 +02:00
|
|
|
blueprint.RuleParams{
|
2015-04-11 02:44:24 +02:00
|
|
|
Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
|
2017-09-15 22:00:47 +02:00
|
|
|
`${config.DxCmd} --dex --output=$outDir $dxFlags $in && ` +
|
|
|
|
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
|
|
|
|
CommandDeps: []string{
|
|
|
|
"${config.DxCmd}",
|
|
|
|
"${config.SoongZipCmd}",
|
|
|
|
},
|
2015-03-31 02:20:39 +02:00
|
|
|
},
|
|
|
|
"outDir", "dxFlags")
|
2015-04-04 01:53:05 +02:00
|
|
|
|
2016-08-30 01:14:13 +02:00
|
|
|
jarjar = pctx.AndroidStaticRule("jarjar",
|
2015-04-04 01:54:17 +02:00
|
|
|
blueprint.RuleParams{
|
2017-08-08 22:17:59 +02:00
|
|
|
Command: "${config.JavaCmd} -jar ${config.JarjarCmd} process $rulesFile $in $out",
|
|
|
|
CommandDeps: []string{"${config.JavaCmd}", "${config.JarjarCmd}", "$rulesFile"},
|
2015-04-04 01:54:17 +02:00
|
|
|
},
|
|
|
|
"rulesFile")
|
2015-03-31 02:20:39 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2017-08-08 22:17:59 +02:00
|
|
|
pctx.Import("android/soong/java/config")
|
2015-03-31 02:20:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type javaBuilderFlags struct {
|
|
|
|
javacFlags string
|
|
|
|
dxFlags string
|
2017-09-15 22:00:47 +02:00
|
|
|
bootClasspath classpath
|
|
|
|
classpath classpath
|
|
|
|
desugarFlags string
|
2015-04-08 22:03:43 +02:00
|
|
|
aidlFlags string
|
2017-08-08 22:17:59 +02:00
|
|
|
javaVersion string
|
2015-03-31 02:20:39 +02:00
|
|
|
}
|
|
|
|
|
2017-08-30 23:24:55 +02:00
|
|
|
func TransformJavaToClasses(ctx android.ModuleContext, srcFiles, srcFileLists android.Paths,
|
|
|
|
flags javaBuilderFlags, deps android.Paths) android.ModuleOutPath {
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
classDir := android.PathForModuleOut(ctx, "classes")
|
2017-08-08 22:17:59 +02:00
|
|
|
annoDir := android.PathForModuleOut(ctx, "anno")
|
2017-09-13 07:50:46 +02:00
|
|
|
classJar := android.PathForModuleOut(ctx, "classes-compiled.jar")
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
javacFlags := flags.javacFlags + android.JoinWithPrefix(srcFileLists.Strings(), "@")
|
2015-04-13 23:02:52 +02:00
|
|
|
|
|
|
|
deps = append(deps, srcFileLists...)
|
2017-09-15 22:00:47 +02:00
|
|
|
deps = append(deps, flags.bootClasspath...)
|
|
|
|
deps = append(deps, flags.classpath...)
|
2015-04-13 23:02:52 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
2017-05-09 22:45:28 +02:00
|
|
|
Rule: javac,
|
|
|
|
Description: "javac",
|
2017-08-30 23:24:55 +02:00
|
|
|
Output: classJar,
|
2017-05-09 22:45:28 +02:00
|
|
|
Inputs: srcFiles,
|
|
|
|
Implicits: deps,
|
2015-03-31 02:20:39 +02:00
|
|
|
Args: map[string]string{
|
2015-04-13 23:02:52 +02:00
|
|
|
"javacFlags": javacFlags,
|
2017-09-15 22:00:47 +02:00
|
|
|
"bootClasspath": flags.bootClasspath.JavaBootClasspath(ctx.Device()),
|
|
|
|
"classpath": flags.classpath.JavaClasspath(),
|
2015-09-24 00:26:20 +02:00
|
|
|
"outDir": classDir.String(),
|
2017-08-08 22:17:59 +02:00
|
|
|
"annoDir": annoDir.String(),
|
|
|
|
"javaVersion": flags.javaVersion,
|
2015-03-31 02:20:39 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2017-08-30 23:24:55 +02:00
|
|
|
return classJar
|
2015-03-31 02:20:39 +02:00
|
|
|
}
|
|
|
|
|
2017-08-14 23:16:06 +02:00
|
|
|
func RunErrorProne(ctx android.ModuleContext, srcFiles android.Paths, srcFileLists android.Paths,
|
|
|
|
flags javaBuilderFlags, deps android.Paths) android.Path {
|
|
|
|
|
2017-09-05 22:16:45 +02:00
|
|
|
if config.ErrorProneJar == "" {
|
|
|
|
ctx.ModuleErrorf("cannot build with Error Prone, missing external/error_prone?")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2017-08-14 23:16:06 +02:00
|
|
|
classDir := android.PathForModuleOut(ctx, "classes-errorprone")
|
|
|
|
annoDir := android.PathForModuleOut(ctx, "anno-errorprone")
|
|
|
|
classFileList := android.PathForModuleOut(ctx, "classes-errorprone.list")
|
|
|
|
|
|
|
|
javacFlags := flags.javacFlags + android.JoinWithPrefix(srcFileLists.Strings(), "@")
|
|
|
|
|
|
|
|
deps = append(deps, srcFileLists...)
|
2017-09-15 22:00:47 +02:00
|
|
|
deps = append(deps, flags.bootClasspath...)
|
|
|
|
deps = append(deps, flags.classpath...)
|
2017-08-14 23:16:06 +02:00
|
|
|
|
|
|
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
|
|
|
Rule: errorprone,
|
|
|
|
Description: "errorprone",
|
|
|
|
Output: classFileList,
|
|
|
|
Inputs: srcFiles,
|
|
|
|
Implicits: deps,
|
|
|
|
Args: map[string]string{
|
|
|
|
"javacFlags": javacFlags,
|
2017-09-15 22:00:47 +02:00
|
|
|
"bootClasspath": flags.bootClasspath.JavaBootClasspath(ctx.Device()),
|
|
|
|
"classpath": flags.classpath.JavaClasspath(),
|
2017-08-14 23:16:06 +02:00
|
|
|
"outDir": classDir.String(),
|
|
|
|
"annoDir": annoDir.String(),
|
|
|
|
"javaVersion": flags.javaVersion,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
return classFileList
|
|
|
|
}
|
|
|
|
|
2017-09-28 02:41:35 +02:00
|
|
|
func TransformResourcesToJar(ctx android.ModuleContext, jarArgs []string,
|
2017-09-13 07:50:46 +02:00
|
|
|
deps android.Paths) android.Path {
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2017-08-30 23:24:55 +02:00
|
|
|
outputFile := android.PathForModuleOut(ctx, "res.jar")
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
2017-05-09 22:45:28 +02:00
|
|
|
Rule: jar,
|
|
|
|
Description: "jar",
|
|
|
|
Output: outputFile,
|
|
|
|
Implicits: deps,
|
2015-03-31 02:20:39 +02:00
|
|
|
Args: map[string]string{
|
2017-08-30 23:24:55 +02:00
|
|
|
"jarArgs": strings.Join(jarArgs, " "),
|
2015-03-31 02:20:39 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
return outputFile
|
|
|
|
}
|
|
|
|
|
2017-09-13 07:50:46 +02:00
|
|
|
func TransformJarsToJar(ctx android.ModuleContext, stem string, jars android.Paths,
|
|
|
|
manifest android.OptionalPath, stripDirs bool) android.Path {
|
2017-08-30 23:24:55 +02:00
|
|
|
|
|
|
|
outputFile := android.PathForModuleOut(ctx, stem)
|
|
|
|
|
2017-09-13 07:50:46 +02:00
|
|
|
if len(jars) == 1 && !manifest.Valid() {
|
2017-08-30 23:24:55 +02:00
|
|
|
return jars[0]
|
|
|
|
}
|
|
|
|
|
2017-09-13 07:50:46 +02:00
|
|
|
var deps android.Paths
|
|
|
|
|
|
|
|
var jarArgs []string
|
|
|
|
if manifest.Valid() {
|
|
|
|
jarArgs = append(jarArgs, "-m "+manifest.String())
|
|
|
|
deps = append(deps, manifest.Path())
|
|
|
|
}
|
|
|
|
|
|
|
|
if stripDirs {
|
|
|
|
jarArgs = append(jarArgs, "-D")
|
|
|
|
}
|
|
|
|
|
2017-08-30 23:24:55 +02:00
|
|
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
|
|
|
Rule: combineJar,
|
|
|
|
Description: "combine jars",
|
|
|
|
Output: outputFile,
|
|
|
|
Inputs: jars,
|
2017-09-13 07:50:46 +02:00
|
|
|
Implicits: deps,
|
|
|
|
Args: map[string]string{
|
|
|
|
"jarArgs": strings.Join(jarArgs, " "),
|
|
|
|
},
|
2017-08-30 23:24:55 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
return outputFile
|
|
|
|
}
|
|
|
|
|
2017-09-15 22:00:47 +02:00
|
|
|
func TransformDesugar(ctx android.ModuleContext, classesJar android.Path,
|
|
|
|
flags javaBuilderFlags) android.Path {
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2017-09-15 22:00:47 +02:00
|
|
|
outputFile := android.PathForModuleOut(ctx, "classes-desugar.jar")
|
|
|
|
dumpDir := android.PathForModuleOut(ctx, "desugar_dumped_classes")
|
|
|
|
|
|
|
|
javaFlags := ""
|
|
|
|
if ctx.AConfig().Getenv("EXPERIMENTAL_USE_OPENJDK9") != "" {
|
|
|
|
javaFlags = "--add-opens java.base/java.lang.invoke=ALL-UNNAMED"
|
|
|
|
}
|
|
|
|
|
|
|
|
var desugarFlags []string
|
|
|
|
desugarFlags = append(desugarFlags, flags.bootClasspath.DesugarBootClasspath()...)
|
|
|
|
desugarFlags = append(desugarFlags, flags.classpath.DesugarClasspath()...)
|
|
|
|
|
|
|
|
var deps android.Paths
|
|
|
|
deps = append(deps, flags.bootClasspath...)
|
|
|
|
deps = append(deps, flags.classpath...)
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
2017-09-15 22:00:47 +02:00
|
|
|
Rule: desugar,
|
|
|
|
Description: "desugar",
|
2017-05-09 22:45:28 +02:00
|
|
|
Output: outputFile,
|
|
|
|
Input: classesJar,
|
2017-09-15 22:00:47 +02:00
|
|
|
Implicits: deps,
|
2015-03-31 02:20:39 +02:00
|
|
|
Args: map[string]string{
|
2017-09-15 22:00:47 +02:00
|
|
|
"dumpDir": dumpDir.String(),
|
|
|
|
"javaFlags": javaFlags,
|
|
|
|
"classpathFlags": strings.Join(desugarFlags, " "),
|
|
|
|
"desugarFlags": flags.desugarFlags,
|
2015-03-31 02:20:39 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2017-09-15 22:00:47 +02:00
|
|
|
return outputFile
|
2015-03-31 02:20:39 +02:00
|
|
|
}
|
|
|
|
|
2017-09-15 22:00:47 +02:00
|
|
|
func TransformClassesJarToDexJar(ctx android.ModuleContext, classesJar android.Path,
|
|
|
|
flags javaBuilderFlags) android.Path {
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2017-09-15 22:00:47 +02:00
|
|
|
outDir := android.PathForModuleOut(ctx, "dex")
|
|
|
|
outputFile := android.PathForModuleOut(ctx, "classes.dex.jar")
|
2015-03-31 02:20:39 +02:00
|
|
|
|
2016-05-19 00:37:25 +02:00
|
|
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
2017-09-15 22:00:47 +02:00
|
|
|
Rule: dx,
|
|
|
|
Description: "dx",
|
2017-05-09 22:45:28 +02:00
|
|
|
Output: outputFile,
|
2017-09-15 22:00:47 +02:00
|
|
|
Input: classesJar,
|
2015-03-31 02:20:39 +02:00
|
|
|
Args: map[string]string{
|
2017-09-15 22:00:47 +02:00
|
|
|
"dxFlags": flags.dxFlags,
|
|
|
|
"outDir": outDir.String(),
|
2015-03-31 02:20:39 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
return outputFile
|
|
|
|
}
|
2015-04-04 01:53:05 +02:00
|
|
|
|
2017-08-30 23:24:55 +02:00
|
|
|
func TransformJarJar(ctx android.ModuleContext, classesJar android.Path, rulesFile android.Path) android.ModuleOutPath {
|
2016-05-19 00:37:25 +02:00
|
|
|
outputFile := android.PathForModuleOut(ctx, "classes-jarjar.jar")
|
|
|
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
2017-05-09 22:45:28 +02:00
|
|
|
Rule: jarjar,
|
|
|
|
Description: "jarjar",
|
|
|
|
Output: outputFile,
|
|
|
|
Input: classesJar,
|
|
|
|
Implicit: rulesFile,
|
2015-04-04 01:54:17 +02:00
|
|
|
Args: map[string]string{
|
2015-09-24 00:26:20 +02:00
|
|
|
"rulesFile": rulesFile.String(),
|
2015-04-04 01:54:17 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
return outputFile
|
|
|
|
}
|
2017-09-15 22:00:47 +02:00
|
|
|
|
|
|
|
type classpath []android.Path
|
|
|
|
|
|
|
|
// Returns a -classpath argument in the form java or javac expects
|
|
|
|
func (x *classpath) JavaClasspath() string {
|
|
|
|
if len(*x) > 0 {
|
|
|
|
return "-classpath " + strings.Join(x.Strings(), ":")
|
|
|
|
} else {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns a -processorpath argument in the form java or javac expects
|
|
|
|
func (x *classpath) JavaProcessorpath() string {
|
|
|
|
if len(*x) > 0 {
|
|
|
|
return "-processorpath " + strings.Join(x.Strings(), ":")
|
|
|
|
} else {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns a -bootclasspath argument in the form java or javac expects. If forceEmpty is true,
|
|
|
|
// returns -bootclasspath "" if the bootclasspath is empty to ensure javac does not fall back to the
|
|
|
|
// default bootclasspath.
|
|
|
|
func (x *classpath) JavaBootClasspath(forceEmpty bool) string {
|
|
|
|
if len(*x) > 0 {
|
|
|
|
return "-bootclasspath " + strings.Join(x.Strings(), ":")
|
|
|
|
} else if forceEmpty {
|
|
|
|
return `-bootclasspath ""`
|
|
|
|
} else {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *classpath) DesugarBootClasspath() []string {
|
|
|
|
if x == nil || *x == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
flags := make([]string, len(*x))
|
|
|
|
for i, v := range *x {
|
|
|
|
flags[i] = "--bootclasspath_entry " + v.String()
|
|
|
|
}
|
|
|
|
|
|
|
|
return flags
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *classpath) DesugarClasspath() []string {
|
|
|
|
if x == nil || *x == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
flags := make([]string, len(*x))
|
|
|
|
for i, v := range *x {
|
|
|
|
flags[i] = "--classpath_entry " + v.String()
|
|
|
|
}
|
|
|
|
|
|
|
|
return flags
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append an android.Paths to the end of the classpath list
|
|
|
|
func (x *classpath) AddPaths(paths android.Paths) {
|
|
|
|
for _, path := range paths {
|
|
|
|
*x = append(*x, path)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert a classpath to an android.Paths
|
|
|
|
func (x *classpath) Paths() android.Paths {
|
|
|
|
return append(android.Paths(nil), (*x)...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (x *classpath) Strings() []string {
|
|
|
|
if x == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
ret := make([]string, len(*x))
|
|
|
|
for i, path := range *x {
|
|
|
|
ret[i] = path.String()
|
|
|
|
}
|
|
|
|
return ret
|
|
|
|
}
|