Install java_binary wrappers in make
Convert java_binary modules into two make modules, one for the underlying java_library and one for the wrapper prebuilt. Test: m -j checkbuild Change-Id: I5ddf74f24f1e41fc1f39b3e8d254b7e191dbd47a
This commit is contained in:
parent
b8245ea839
commit
10a0349d98
2 changed files with 29 additions and 2 deletions
|
@ -17,6 +17,7 @@ package java
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
)
|
||||
|
@ -44,3 +45,25 @@ func (prebuilt *Import) AndroidMk() android.AndroidMkData {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (binary *Binary) AndroidMk() android.AndroidMkData {
|
||||
return android.AndroidMkData{
|
||||
Class: "JAVA_LIBRARIES",
|
||||
OutputFile: android.OptionalPathForPath(binary.outputFile),
|
||||
SubName: ".jar",
|
||||
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
|
||||
android.WriteAndroidMkData(w, data)
|
||||
|
||||
fmt.Fprintln(w, "include $(CLEAR_VARS)")
|
||||
fmt.Fprintln(w, "LOCAL_MODULE := "+name)
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := EXECUTABLES")
|
||||
if strings.Contains(prefix, "HOST_") {
|
||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||
}
|
||||
fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
|
||||
fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES := "+name+".jar")
|
||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE := "+binary.wrapperFile.String())
|
||||
fmt.Fprintln(w, "include $(BUILD_PREBUILT)")
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -486,6 +486,9 @@ type Binary struct {
|
|||
Library
|
||||
|
||||
binaryProperties binaryProperties
|
||||
|
||||
wrapperFile android.ModuleSrcPath
|
||||
binaryFile android.OutputPath
|
||||
}
|
||||
|
||||
func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
|
@ -493,8 +496,9 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
|
||||
// Depend on the installed jar (j.installFile) so that the wrapper doesn't get executed by
|
||||
// another build rule before the jar has been installed.
|
||||
ctx.InstallFile(android.PathForModuleInstall(ctx, "bin"), android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper),
|
||||
j.installFile)
|
||||
j.wrapperFile = android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper)
|
||||
j.binaryFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "bin"),
|
||||
j.wrapperFile, j.installFile)
|
||||
}
|
||||
|
||||
func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
|
Loading…
Reference in a new issue