Remove the moduleName parameter to jarsToSystemModules.
This rule takes a moduleName parameter which only ever has the value java.base. What's more, the assuption that the value will always be java.base is baked into the rule in other ways (most significantly, the module created with this name is passed to jlink, and jlink requires a java.base module). This change removes the parameter and hard-codes java.base everywhere, on the basis that it's better to have it completely hard-coded than partially configurable and partially hard-coded. Test: make Change-Id: Ib42cda92f623c5a1f929b5a99248ca8919e4700c
This commit is contained in:
parent
583a226c0e
commit
df7dc82a04
1 changed files with 9 additions and 10 deletions
|
@ -36,13 +36,13 @@ func init() {
|
|||
var (
|
||||
jarsTosystemModules = pctx.AndroidStaticRule("jarsTosystemModules", blueprint.RuleParams{
|
||||
Command: `rm -rf ${outDir} ${workDir} && mkdir -p ${workDir}/jmod && ` +
|
||||
`${moduleInfoJavaPath} ${moduleName} $in > ${workDir}/module-info.java && ` +
|
||||
`${moduleInfoJavaPath} java.base $in > ${workDir}/module-info.java && ` +
|
||||
`${config.JavacCmd} --system=none --patch-module=java.base=${classpath} ${workDir}/module-info.java && ` +
|
||||
`${config.SoongZipCmd} -jar -o ${workDir}/classes.jar -C ${workDir} -f ${workDir}/module-info.class && ` +
|
||||
`${config.MergeZipsCmd} -j ${workDir}/module.jar ${workDir}/classes.jar $in && ` +
|
||||
`${config.JmodCmd} create --module-version 9 --target-platform android ` +
|
||||
` --class-path ${workDir}/module.jar ${workDir}/jmod/${moduleName}.jmod && ` +
|
||||
`${config.JlinkCmd} --module-path ${workDir}/jmod --add-modules ${moduleName} --output ${outDir} ` +
|
||||
` --class-path ${workDir}/module.jar ${workDir}/jmod/java.base.jmod && ` +
|
||||
`${config.JlinkCmd} --module-path ${workDir}/jmod --add-modules java.base --output ${outDir} ` +
|
||||
// Note: The system-modules jlink plugin is disabled because (a) it is not
|
||||
// useful on Android, and (b) it causes errors with later versions of jlink
|
||||
// when the jdk.internal.module is absent from java.base (as it is here).
|
||||
|
@ -58,10 +58,10 @@ var (
|
|||
"${config.JrtFsJar}",
|
||||
},
|
||||
},
|
||||
"moduleName", "classpath", "outDir", "workDir")
|
||||
"classpath", "outDir", "workDir")
|
||||
)
|
||||
|
||||
func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string, jars android.Paths) (android.Path, android.Paths) {
|
||||
func TransformJarsToSystemModules(ctx android.ModuleContext, jars android.Paths) (android.Path, android.Paths) {
|
||||
outDir := android.PathForModuleOut(ctx, "system")
|
||||
workDir := android.PathForModuleOut(ctx, "modules")
|
||||
outputFile := android.PathForModuleOut(ctx, "system/lib/modules")
|
||||
|
@ -77,10 +77,9 @@ func TransformJarsToSystemModules(ctx android.ModuleContext, moduleName string,
|
|||
Outputs: outputs,
|
||||
Inputs: jars,
|
||||
Args: map[string]string{
|
||||
"moduleName": moduleName,
|
||||
"classpath": strings.Join(jars.Strings(), ":"),
|
||||
"workDir": workDir.String(),
|
||||
"outDir": outDir.String(),
|
||||
"classpath": strings.Join(jars.Strings(), ":"),
|
||||
"workDir": workDir.String(),
|
||||
"outDir": outDir.String(),
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -123,7 +122,7 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte
|
|||
|
||||
system.headerJars = jars
|
||||
|
||||
system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, "java.base", jars)
|
||||
system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, jars)
|
||||
}
|
||||
|
||||
func (system *SystemModules) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
|
Loading…
Reference in a new issue