Merge "Add Sh_binaries property"
This commit is contained in:
21
apex/apex.go
21
apex/apex.go
@@ -111,6 +111,9 @@ type apexBundleProperties struct {
|
|||||||
// List of java libraries that are embedded inside this APEX bundle.
|
// List of java libraries that are embedded inside this APEX bundle.
|
||||||
Java_libs []string
|
Java_libs []string
|
||||||
|
|
||||||
|
// List of sh binaries that are embedded inside this APEX bundle.
|
||||||
|
Sh_binaries []string
|
||||||
|
|
||||||
// List of platform_compat_config files that are embedded inside this APEX bundle.
|
// List of platform_compat_config files that are embedded inside this APEX bundle.
|
||||||
Compat_configs []string
|
Compat_configs []string
|
||||||
|
|
||||||
@@ -618,6 +621,7 @@ var (
|
|||||||
sharedLibTag = dependencyTag{name: "sharedLib", payload: true}
|
sharedLibTag = dependencyTag{name: "sharedLib", payload: true}
|
||||||
testForTag = dependencyTag{name: "test for"}
|
testForTag = dependencyTag{name: "test for"}
|
||||||
testTag = dependencyTag{name: "test", payload: true}
|
testTag = dependencyTag{name: "test", payload: true}
|
||||||
|
shBinaryTag = dependencyTag{name: "shBinary", payload: true}
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(jiyong): shorten this function signature
|
// TODO(jiyong): shorten this function signature
|
||||||
@@ -762,6 +766,10 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
for _, d := range depsList {
|
for _, d := range depsList {
|
||||||
addDependenciesForNativeModules(ctx, d, target, imageVariation)
|
addDependenciesForNativeModules(ctx, d, target, imageVariation)
|
||||||
}
|
}
|
||||||
|
ctx.AddFarVariationDependencies([]blueprint.Variation{
|
||||||
|
{Mutator: "os", Variation: target.OsVariation()},
|
||||||
|
{Mutator: "arch", Variation: target.ArchVariation()},
|
||||||
|
}, shBinaryTag, a.properties.Sh_binaries...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common-arch dependencies come next
|
// Common-arch dependencies come next
|
||||||
@@ -1482,6 +1490,9 @@ func apexFileForGoBinary(ctx android.BaseModuleContext, depName string, gb boots
|
|||||||
|
|
||||||
func apexFileForShBinary(ctx android.BaseModuleContext, sh *sh.ShBinary) apexFile {
|
func apexFileForShBinary(ctx android.BaseModuleContext, sh *sh.ShBinary) apexFile {
|
||||||
dirInApex := filepath.Join("bin", sh.SubDir())
|
dirInApex := filepath.Join("bin", sh.SubDir())
|
||||||
|
if sh.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
|
dirInApex = filepath.Join(dirInApex, sh.Target().NativeBridgeRelativePath)
|
||||||
|
}
|
||||||
fileToCopy := sh.OutputFile()
|
fileToCopy := sh.OutputFile()
|
||||||
af := newApexFile(ctx, fileToCopy, sh.BaseModuleName(), dirInApex, shBinary, sh)
|
af := newApexFile(ctx, fileToCopy, sh.BaseModuleName(), dirInApex, shBinary, sh)
|
||||||
af.symlinks = sh.Symlinks()
|
af.symlinks = sh.Symlinks()
|
||||||
@@ -1723,8 +1734,6 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
if cc, ok := child.(*cc.Module); ok {
|
if cc, ok := child.(*cc.Module); ok {
|
||||||
filesInfo = append(filesInfo, apexFileForExecutable(ctx, cc))
|
filesInfo = append(filesInfo, apexFileForExecutable(ctx, cc))
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
} else if sh, ok := child.(*sh.ShBinary); ok {
|
|
||||||
filesInfo = append(filesInfo, apexFileForShBinary(ctx, sh))
|
|
||||||
} else if py, ok := child.(*python.Module); ok && py.HostToolPath().Valid() {
|
} else if py, ok := child.(*python.Module); ok && py.HostToolPath().Valid() {
|
||||||
filesInfo = append(filesInfo, apexFileForPyBinary(ctx, py))
|
filesInfo = append(filesInfo, apexFileForPyBinary(ctx, py))
|
||||||
} else if gb, ok := child.(bootstrap.GoBinaryTool); ok && a.Host() {
|
} else if gb, ok := child.(bootstrap.GoBinaryTool); ok && a.Host() {
|
||||||
@@ -1733,7 +1742,13 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
filesInfo = append(filesInfo, apexFileForRustExecutable(ctx, rust))
|
filesInfo = append(filesInfo, apexFileForRustExecutable(ctx, rust))
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
} else {
|
} else {
|
||||||
ctx.PropertyErrorf("binaries", "%q is neither cc_binary, rust_binary, (embedded) py_binary, (host) blueprint_go_binary, (host) bootstrap_go_binary, nor sh_binary", depName)
|
ctx.PropertyErrorf("binaries", "%q is neither cc_binary, rust_binary, (embedded) py_binary, (host) blueprint_go_binary, nor (host) bootstrap_go_binary", depName)
|
||||||
|
}
|
||||||
|
case shBinaryTag:
|
||||||
|
if sh, ok := child.(*sh.ShBinary); ok {
|
||||||
|
filesInfo = append(filesInfo, apexFileForShBinary(ctx, sh))
|
||||||
|
} else {
|
||||||
|
ctx.PropertyErrorf("sh_binaries", "%q is not a sh_binary module", depName)
|
||||||
}
|
}
|
||||||
case bcpfTag:
|
case bcpfTag:
|
||||||
{
|
{
|
||||||
|
@@ -4250,7 +4250,7 @@ func TestApexWithShBinary(t *testing.T) {
|
|||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
key: "myapex.key",
|
key: "myapex.key",
|
||||||
binaries: ["myscript"],
|
sh_binaries: ["myscript"],
|
||||||
updatable: false,
|
updatable: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user