Merge changes Ic2a585ea,I11ccabc4,Icc932c4a,I020556c7,I08713e91
* changes: Fix date on mac builds Convert javadoc modules to android.RuleBuilder Convert droiddoc modules to android.RuleBuilder Add a systemModules utility type Convert droidstubs to android.RuleBuilder
This commit is contained in:
@@ -95,6 +95,16 @@ func (once *OncePer) Once2StringSlice(key OnceKey, value func() ([]string, []str
|
|||||||
return s[0], s[1]
|
return s[0], s[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OncePath is the same as Once, but returns the value cast to a Path
|
||||||
|
func (once *OncePer) OncePath(key OnceKey, value func() Path) Path {
|
||||||
|
return once.Once(key, func() interface{} { return value() }).(Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// OncePath is the same as Once, but returns the value cast to a SourcePath
|
||||||
|
func (once *OncePer) OnceSourcePath(key OnceKey, value func() SourcePath) SourcePath {
|
||||||
|
return once.Once(key, func() interface{} { return value() }).(SourcePath)
|
||||||
|
}
|
||||||
|
|
||||||
// OnceKey is an opaque type to be used as the key in calls to Once.
|
// OnceKey is an opaque type to be used as the key in calls to Once.
|
||||||
type OnceKey struct {
|
type OnceKey struct {
|
||||||
key interface{}
|
key interface{}
|
||||||
|
@@ -478,6 +478,16 @@ func (c *RuleBuilderCommand) Flag(flag string) *RuleBuilderCommand {
|
|||||||
return c.Text(flag)
|
return c.Text(flag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OptionalFlag adds the specified raw text to the command line if it is not nil. The text should not contain input or
|
||||||
|
// output paths or the rule will not have them listed in its dependencies or outputs.
|
||||||
|
func (c *RuleBuilderCommand) OptionalFlag(flag *string) *RuleBuilderCommand {
|
||||||
|
if flag != nil {
|
||||||
|
c.Text(*flag)
|
||||||
|
}
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
// Flags adds the specified raw text to the command line. The text should not contain input or output paths or the
|
// Flags adds the specified raw text to the command line. The text should not contain input or output paths or the
|
||||||
// rule will not have them listed in its dependencies or outputs.
|
// rule will not have them listed in its dependencies or outputs.
|
||||||
func (c *RuleBuilderCommand) Flags(flags []string) *RuleBuilderCommand {
|
func (c *RuleBuilderCommand) Flags(flags []string) *RuleBuilderCommand {
|
||||||
|
@@ -153,8 +153,7 @@ type javaBuilderFlags struct {
|
|||||||
classpath classpath
|
classpath classpath
|
||||||
processorPath classpath
|
processorPath classpath
|
||||||
processor string
|
processor string
|
||||||
systemModules classpath
|
systemModules *systemModules
|
||||||
systemModulesDeps android.Paths
|
|
||||||
aidlFlags string
|
aidlFlags string
|
||||||
aidlDeps android.Paths
|
aidlDeps android.Paths
|
||||||
javaVersion string
|
javaVersion string
|
||||||
@@ -249,8 +248,9 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
|
|||||||
|
|
||||||
var bootClasspath string
|
var bootClasspath string
|
||||||
if flags.javaVersion == "1.9" {
|
if flags.javaVersion == "1.9" {
|
||||||
deps = append(deps, flags.systemModulesDeps...)
|
var systemModuleDeps android.Paths
|
||||||
bootClasspath = flags.systemModules.FormJavaSystemModulesPath("--system=", ctx.Device())
|
bootClasspath, systemModuleDeps = flags.systemModules.FormJavaSystemModulesPath(ctx.Device())
|
||||||
|
deps = append(deps, systemModuleDeps...)
|
||||||
} else {
|
} else {
|
||||||
deps = append(deps, flags.bootClasspath...)
|
deps = append(deps, flags.bootClasspath...)
|
||||||
if len(flags.bootClasspath) == 0 && ctx.Device() {
|
if len(flags.bootClasspath) == 0 && ctx.Device() {
|
||||||
@@ -411,7 +411,7 @@ func TransformZipAlign(ctx android.ModuleContext, outputFile android.WritablePat
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type classpath []android.Path
|
type classpath android.Paths
|
||||||
|
|
||||||
func (x *classpath) FormJavaClassPath(optName string) string {
|
func (x *classpath) FormJavaClassPath(optName string) string {
|
||||||
if optName != "" && !strings.HasSuffix(optName, "=") && !strings.HasSuffix(optName, " ") {
|
if optName != "" && !strings.HasSuffix(optName, "=") && !strings.HasSuffix(optName, " ") {
|
||||||
@@ -424,21 +424,6 @@ func (x *classpath) FormJavaClassPath(optName string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a --system argument in the form javac expects with -source 1.9. If forceEmpty is true,
|
|
||||||
// returns --system=none if the list is empty to ensure javac does not fall back to the default
|
|
||||||
// system modules.
|
|
||||||
func (x *classpath) FormJavaSystemModulesPath(optName string, forceEmpty bool) string {
|
|
||||||
if len(*x) > 1 {
|
|
||||||
panic("more than one system module")
|
|
||||||
} else if len(*x) == 1 {
|
|
||||||
return optName + (*x)[0].String()
|
|
||||||
} else if forceEmpty {
|
|
||||||
return optName + "none"
|
|
||||||
} else {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *classpath) FormTurbineClasspath(optName string) []string {
|
func (x *classpath) FormTurbineClasspath(optName string) []string {
|
||||||
if x == nil || *x == nil {
|
if x == nil || *x == nil {
|
||||||
return nil
|
return nil
|
||||||
@@ -466,3 +451,21 @@ func (x *classpath) Strings() []string {
|
|||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type systemModules struct {
|
||||||
|
dir android.Path
|
||||||
|
deps android.Paths
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a --system argument in the form javac expects with -source 1.9. If forceEmpty is true,
|
||||||
|
// returns --system=none if the list is empty to ensure javac does not fall back to the default
|
||||||
|
// system modules.
|
||||||
|
func (x *systemModules) FormJavaSystemModulesPath(forceEmpty bool) (string, android.Paths) {
|
||||||
|
if x != nil {
|
||||||
|
return "--system=" + x.dir.String(), x.deps
|
||||||
|
} else if forceEmpty {
|
||||||
|
return "--system=none", nil
|
||||||
|
} else {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -47,6 +47,11 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
JavaVmFlags = `-XX:OnError="cat hs_err_pid%p.log" -XX:CICompilerCount=6 -XX:+UseDynamicNumberOfGCThreads`
|
||||||
|
JavacVmFlags = `-J-XX:OnError="cat hs_err_pid%p.log" -J-XX:CICompilerCount=6 -J-XX:+UseDynamicNumberOfGCThreads`
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pctx.Import("github.com/google/blueprint/bootstrap")
|
pctx.Import("github.com/google/blueprint/bootstrap")
|
||||||
|
|
||||||
@@ -69,8 +74,9 @@ func init() {
|
|||||||
// b/65004097: prevent using java.lang.invoke.StringConcatFactory when using -target 1.9
|
// b/65004097: prevent using java.lang.invoke.StringConcatFactory when using -target 1.9
|
||||||
`-XDstringConcat=inline`,
|
`-XDstringConcat=inline`,
|
||||||
}, " "))
|
}, " "))
|
||||||
pctx.StaticVariable("JavaVmFlags", "-XX:OnError=\"cat hs_err_pid%p.log\" -XX:CICompilerCount=6 -XX:+UseDynamicNumberOfGCThreads")
|
|
||||||
pctx.StaticVariable("JavacVmFlags", "-J-XX:OnError=\"cat hs_err_pid%p.log\" -J-XX:CICompilerCount=6 -J-XX:+UseDynamicNumberOfGCThreads")
|
pctx.StaticVariable("JavaVmFlags", JavaVmFlags)
|
||||||
|
pctx.StaticVariable("JavacVmFlags", JavacVmFlags)
|
||||||
|
|
||||||
pctx.VariableConfigMethod("hostPrebuiltTag", android.Config.PrebuiltOS)
|
pctx.VariableConfigMethod("hostPrebuiltTag", android.Config.PrebuiltOS)
|
||||||
|
|
||||||
@@ -154,3 +160,41 @@ func init() {
|
|||||||
pctx.HostBinToolVariable("Class2Greylist", "class2greylist")
|
pctx.HostBinToolVariable("Class2Greylist", "class2greylist")
|
||||||
pctx.HostBinToolVariable("HiddenAPI", "hiddenapi")
|
pctx.HostBinToolVariable("HiddenAPI", "hiddenapi")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JavaCmd returns a SourcePath object with the path to the java command.
|
||||||
|
func JavaCmd(ctx android.PathContext) android.SourcePath {
|
||||||
|
return javaTool(ctx, "java")
|
||||||
|
}
|
||||||
|
|
||||||
|
// JavadocCmd returns a SourcePath object with the path to the java command.
|
||||||
|
func JavadocCmd(ctx android.PathContext) android.SourcePath {
|
||||||
|
return javaTool(ctx, "javadoc")
|
||||||
|
}
|
||||||
|
|
||||||
|
func javaTool(ctx android.PathContext, tool string) android.SourcePath {
|
||||||
|
type javaToolKey string
|
||||||
|
|
||||||
|
key := android.NewCustomOnceKey(javaToolKey(tool))
|
||||||
|
|
||||||
|
return ctx.Config().OnceSourcePath(key, func() android.SourcePath {
|
||||||
|
return javaToolchain(ctx).Join(ctx, tool)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var javaToolchainKey = android.NewOnceKey("javaToolchain")
|
||||||
|
|
||||||
|
func javaToolchain(ctx android.PathContext) android.SourcePath {
|
||||||
|
return ctx.Config().OnceSourcePath(javaToolchainKey, func() android.SourcePath {
|
||||||
|
return javaHome(ctx).Join(ctx, "bin")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var javaHomeKey = android.NewOnceKey("javaHome")
|
||||||
|
|
||||||
|
func javaHome(ctx android.PathContext) android.SourcePath {
|
||||||
|
return ctx.Config().OnceSourcePath(javaHomeKey, func() android.SourcePath {
|
||||||
|
// This is set up and guaranteed by soong_ui
|
||||||
|
return android.PathForSource(ctx, ctx.Config().Getenv("ANDROID_JAVA_HOME"))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
1215
java/droiddoc.go
1215
java/droiddoc.go
File diff suppressed because it is too large
Load Diff
11
java/java.go
11
java/java.go
@@ -632,8 +632,7 @@ type deps struct {
|
|||||||
aidlIncludeDirs android.Paths
|
aidlIncludeDirs android.Paths
|
||||||
srcs android.Paths
|
srcs android.Paths
|
||||||
srcJars android.Paths
|
srcJars android.Paths
|
||||||
systemModules android.Path
|
systemModules *systemModules
|
||||||
systemModulesDeps android.Paths
|
|
||||||
aidlPreprocess android.OptionalPath
|
aidlPreprocess android.OptionalPath
|
||||||
kotlinStdlib android.Paths
|
kotlinStdlib android.Paths
|
||||||
kotlinAnnotations android.Paths
|
kotlinAnnotations android.Paths
|
||||||
@@ -844,8 +843,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||||||
if sm.outputDir == nil || len(sm.outputDeps) == 0 {
|
if sm.outputDir == nil || len(sm.outputDeps) == 0 {
|
||||||
panic("Missing directory for system module dependency")
|
panic("Missing directory for system module dependency")
|
||||||
}
|
}
|
||||||
deps.systemModules = sm.outputDir
|
deps.systemModules = &systemModules{sm.outputDir, sm.outputDeps}
|
||||||
deps.systemModulesDeps = sm.outputDeps
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -973,10 +971,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
|
|||||||
}
|
}
|
||||||
|
|
||||||
// systemModules
|
// systemModules
|
||||||
if deps.systemModules != nil {
|
flags.systemModules = deps.systemModules
|
||||||
flags.systemModules = append(flags.systemModules, deps.systemModules)
|
|
||||||
flags.systemModulesDeps = append(flags.systemModulesDeps, deps.systemModulesDeps...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// aidl flags.
|
// aidl flags.
|
||||||
flags.aidlFlags, flags.aidlDeps = j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs)
|
flags.aidlFlags, flags.aidlDeps = j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs)
|
||||||
|
@@ -783,11 +783,6 @@ func TestDroiddoc(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
stubsJar := filepath.Join(buildDir, ".intermediates", "bar-doc", "android_common", "bar-doc-stubs.srcjar")
|
|
||||||
barDoc := ctx.ModuleForTests("bar-doc", "android_common").Output("bar-doc-stubs.srcjar")
|
|
||||||
if stubsJar != barDoc.Output.String() {
|
|
||||||
t.Errorf("expected stubs Jar [%q], got %q", stubsJar, barDoc.Output.String())
|
|
||||||
}
|
|
||||||
inputs := ctx.ModuleForTests("bar-doc", "android_common").Rule("javadoc").Inputs
|
inputs := ctx.ModuleForTests("bar-doc", "android_common").Rule("javadoc").Inputs
|
||||||
var javaSrcs []string
|
var javaSrcs []string
|
||||||
for _, i := range inputs {
|
for _, i := range inputs {
|
||||||
|
Reference in New Issue
Block a user