Depend on all the files from system modules am: ff60a73d89

am: fde13865d6

Change-Id: Ifdc822d3ae118bb3a46302f521115a0b032a0a03
This commit is contained in:
Dan Willemsen 2019-06-18 16:25:45 -07:00 committed by android-build-merger
commit dbfe69e934
5 changed files with 40 additions and 27 deletions

View File

@ -148,15 +148,16 @@ func init() {
}
type javaBuilderFlags struct {
javacFlags string
bootClasspath classpath
classpath classpath
processorPath classpath
processor string
systemModules classpath
aidlFlags string
aidlDeps android.Paths
javaVersion string
javacFlags string
bootClasspath classpath
classpath classpath
processorPath classpath
processor string
systemModules classpath
systemModulesDeps android.Paths
aidlFlags string
aidlDeps android.Paths
javaVersion string
errorProneExtraJavacFlags string
errorProneProcessorPath classpath
@ -248,7 +249,7 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab
var bootClasspath string
if flags.javaVersion == "1.9" {
deps = append(deps, flags.systemModules...)
deps = append(deps, flags.systemModulesDeps...)
bootClasspath = flags.systemModules.FormJavaSystemModulesPath("--system=", ctx.Device())
} else {
deps = append(deps, flags.bootClasspath...)
@ -430,7 +431,7 @@ func (x *classpath) FormJavaSystemModulesPath(optName string, forceEmpty bool) s
if len(*x) > 1 {
panic("more than one system module")
} else if len(*x) == 1 {
return optName + strings.TrimSuffix((*x)[0].String(), "lib/modules")
return optName + (*x)[0].String()
} else if forceEmpty {
return optName + "none"
} else {

View File

@ -692,10 +692,11 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
panic("Found two system module dependencies")
}
sm := module.(*SystemModules)
if sm.outputFile == nil {
if sm.outputDir == nil && len(sm.outputDeps) == 0 {
panic("Missing directory for system module dependency")
}
deps.systemModules = sm.outputFile
deps.systemModules = sm.outputDir
deps.systemModulesDeps = sm.outputDeps
}
})
// do not pass exclude_srcs directly when expanding srcFiles since exclude_srcs
@ -776,6 +777,7 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if deps.systemModules != nil {
systemModules = append(systemModules, deps.systemModules)
}
implicits = append(implicits, deps.systemModulesDeps...)
bootClasspathArgs = systemModules.FormJavaSystemModulesPath("--system ", ctx.Device())
bootClasspathArgs = bootClasspathArgs + " --patch-module java.base=."
}

View File

@ -628,6 +628,7 @@ type deps struct {
srcs android.Paths
srcJars android.Paths
systemModules android.Path
systemModulesDeps android.Paths
aidlPreprocess android.OptionalPath
kotlinStdlib android.Paths
kotlinAnnotations android.Paths
@ -835,10 +836,11 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
panic("Found two system module dependencies")
}
sm := module.(*SystemModules)
if sm.outputFile == nil {
if sm.outputDir == nil || len(sm.outputDeps) == 0 {
panic("Missing directory for system module dependency")
}
deps.systemModules = sm.outputFile
deps.systemModules = sm.outputDir
deps.systemModulesDeps = sm.outputDeps
}
}
})
@ -968,6 +970,7 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
// systemModules
if deps.systemModules != nil {
flags.systemModules = append(flags.systemModules, deps.systemModules)
flags.systemModulesDeps = append(flags.systemModulesDeps, deps.systemModulesDeps...)
}
// aidl flags.

View File

@ -254,7 +254,7 @@ func TestClasspath(t *testing.T) {
if testcase.system == "none" {
system = "--system=none"
} else if testcase.system != "" {
system = "--system=" + filepath.Join(buildDir, ".intermediates", testcase.system, "android_common", "system") + "/"
system = "--system=" + filepath.Join(buildDir, ".intermediates", testcase.system, "android_common", "system")
}
checkClasspath := func(t *testing.T, ctx *android.TestContext) {

View File

@ -61,7 +61,7 @@ var (
"moduleName", "classpath", "outDir", "workDir")
)
func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string, jars android.Paths) android.WritablePath {
func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string, jars android.Paths) (android.Path, android.Paths) {
outDir := android.PathForModuleOut(ctx, "system")
workDir := android.PathForModuleOut(ctx, "modules")
outputFile := android.PathForModuleOut(ctx, "system/lib/modules")
@ -84,7 +84,7 @@ func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string,
},
})
return outputFile
return outDir, outputs.Paths()
}
func SystemModulesFactory() android.Module {
@ -101,7 +101,8 @@ type SystemModules struct {
properties SystemModulesProperties
outputFile android.Path
outputDir android.Path
outputDeps android.Paths
}
type SystemModulesProperties struct {
@ -117,7 +118,7 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
jars = append(jars, dep.HeaderJars()...)
})
system.outputFile = TransformJarsToSystemModules(ctx, "java.base", jars)
system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, "java.base", jars)
}
func (system *SystemModules) DepsMutator(ctx android.BottomUpMutatorContext) {
@ -127,16 +128,22 @@ func (system *SystemModules) DepsMutator(ctx android.BottomUpMutatorContext) {
func (system *SystemModules) AndroidMk() android.AndroidMkData {
return android.AndroidMkData{
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
makevar := "SOONG_SYSTEM_MODULES_" + name
fmt.Fprintln(w)
fmt.Fprintln(w, makevar, ":=", system.outputFile.String())
fmt.Fprintln(w, ".KATI_READONLY", ":=", makevar)
makevar := "SOONG_SYSTEM_MODULES_" + name
fmt.Fprintln(w, makevar, ":=$=", system.outputDir.String())
fmt.Fprintln(w)
makevar = "SOONG_SYSTEM_MODULES_LIBS_" + name
fmt.Fprintln(w, makevar, ":=$=", strings.Join(system.properties.Libs, " "))
fmt.Fprintln(w)
makevar = "SOONG_SYSTEM_MODULE_DEPS_" + name
fmt.Fprintln(w, makevar, ":=$=", strings.Join(system.outputDeps.Strings(), " "))
fmt.Fprintln(w)
fmt.Fprintln(w, name+":", "$("+makevar+")")
fmt.Fprintln(w, ".PHONY:", name)
fmt.Fprintln(w)
makevar = "SOONG_SYSTEM_MODULES_LIBS_" + name
fmt.Fprintln(w, makevar, ":=", strings.Join(system.properties.Libs, " "))
fmt.Fprintln(w, ".KATI_READONLY :=", makevar)
},
}
}