Make binaries executable
Split InstallFileName into InstallExecutable that does chmod +x after copying the file. Also remove InstallFile and rename InstallFileName to InstallFile. Test: m -j checkbuild Change-Id: Id41ad4eafe521f6cd5d8cc250b7747ecb3da8dfc
This commit is contained in:
@@ -52,6 +52,13 @@ var (
|
|||||||
},
|
},
|
||||||
"cpFlags")
|
"cpFlags")
|
||||||
|
|
||||||
|
CpExecutable = pctx.AndroidStaticRule("CpExecutable",
|
||||||
|
blueprint.RuleParams{
|
||||||
|
Command: "rm -f $out && cp $cpPreserveSymlinks $cpFlags $in $out && chmod +x $out",
|
||||||
|
Description: "cp $out",
|
||||||
|
},
|
||||||
|
"cpFlags")
|
||||||
|
|
||||||
// A timestamp touch rule.
|
// A timestamp touch rule.
|
||||||
Touch = pctx.AndroidStaticRule("Touch",
|
Touch = pctx.AndroidStaticRule("Touch",
|
||||||
blueprint.RuleParams{
|
blueprint.RuleParams{
|
||||||
|
@@ -83,8 +83,8 @@ type ModuleContext interface {
|
|||||||
ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths
|
ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths
|
||||||
Glob(globPattern string, excludes []string) Paths
|
Glob(globPattern string, excludes []string) Paths
|
||||||
|
|
||||||
InstallFile(installPath OutputPath, srcPath Path, deps ...Path) OutputPath
|
InstallExecutable(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
|
||||||
InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
|
InstallFile(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
|
||||||
InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath
|
InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath
|
||||||
CheckbuildFile(srcPath Path)
|
CheckbuildFile(srcPath Path)
|
||||||
|
|
||||||
@@ -717,8 +717,18 @@ func (a *androidModuleContext) skipInstall(fullInstallPath OutputPath) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) InstallFileName(installPath OutputPath, name string, srcPath Path,
|
func (a *androidModuleContext) InstallFile(installPath OutputPath, name string, srcPath Path,
|
||||||
deps ...Path) OutputPath {
|
deps ...Path) OutputPath {
|
||||||
|
return a.installFile(installPath, name, srcPath, Cp, deps)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) InstallExecutable(installPath OutputPath, name string, srcPath Path,
|
||||||
|
deps ...Path) OutputPath {
|
||||||
|
return a.installFile(installPath, name, srcPath, CpExecutable, deps)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *androidModuleContext) installFile(installPath OutputPath, name string, srcPath Path,
|
||||||
|
rule blueprint.Rule, deps []Path) OutputPath {
|
||||||
|
|
||||||
fullInstallPath := installPath.Join(a, name)
|
fullInstallPath := installPath.Join(a, name)
|
||||||
a.module.base().hooks.runInstallHooks(a, fullInstallPath, false)
|
a.module.base().hooks.runInstallHooks(a, fullInstallPath, false)
|
||||||
@@ -738,7 +748,7 @@ func (a *androidModuleContext) InstallFileName(installPath OutputPath, name stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.ModuleBuild(pctx, ModuleBuildParams{
|
a.ModuleBuild(pctx, ModuleBuildParams{
|
||||||
Rule: Cp,
|
Rule: rule,
|
||||||
Description: "install " + fullInstallPath.Base(),
|
Description: "install " + fullInstallPath.Base(),
|
||||||
Output: fullInstallPath,
|
Output: fullInstallPath,
|
||||||
Input: srcPath,
|
Input: srcPath,
|
||||||
@@ -753,10 +763,6 @@ func (a *androidModuleContext) InstallFileName(installPath OutputPath, name stri
|
|||||||
return fullInstallPath
|
return fullInstallPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *androidModuleContext) InstallFile(installPath OutputPath, srcPath Path, deps ...Path) OutputPath {
|
|
||||||
return a.InstallFileName(installPath, filepath.Base(srcPath.String()), srcPath, deps...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *androidModuleContext) InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath {
|
func (a *androidModuleContext) InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath {
|
||||||
fullInstallPath := installPath.Join(a, name)
|
fullInstallPath := installPath.Join(a, name)
|
||||||
a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)
|
a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)
|
||||||
|
@@ -76,7 +76,7 @@ func (installer *baseInstaller) installDir(ctx ModuleContext) android.OutputPath
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
|
func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
|
||||||
installer.path = ctx.InstallFile(installer.installDir(ctx), file)
|
installer.path = ctx.InstallFile(installer.installDir(ctx), file.Base(), file)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (installer *baseInstaller) inData() bool {
|
func (installer *baseInstaller) inData() bool {
|
||||||
|
@@ -122,7 +122,7 @@ func (m *headerModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
srcFiles := ctx.ExpandSources(m.properties.Srcs, nil)
|
srcFiles := ctx.ExpandSources(m.properties.Srcs, nil)
|
||||||
for _, header := range srcFiles {
|
for _, header := range srcFiles {
|
||||||
installDir := getHeaderInstallDir(ctx, header, m.properties.From, m.properties.To)
|
installDir := getHeaderInstallDir(ctx, header, m.properties.From, m.properties.To)
|
||||||
installedPath := ctx.InstallFile(installDir, header)
|
installedPath := ctx.InstallFile(installDir, header.Base(), header)
|
||||||
installPath := installDir.Join(ctx, header.Base())
|
installPath := installDir.Join(ctx, header.Base())
|
||||||
if installPath != installedPath {
|
if installPath != installedPath {
|
||||||
panic(fmt.Sprintf(
|
panic(fmt.Sprintf(
|
||||||
|
@@ -341,7 +341,7 @@ func (stub *stubDecorator) install(ctx ModuleContext, path android.Path) {
|
|||||||
|
|
||||||
installDir := getNdkInstallBase(ctx).Join(ctx, fmt.Sprintf(
|
installDir := getNdkInstallBase(ctx).Join(ctx, fmt.Sprintf(
|
||||||
"platforms/android-%s/arch-%s/usr/%s", apiLevel, arch, libDir))
|
"platforms/android-%s/arch-%s/usr/%s", apiLevel, arch, libDir))
|
||||||
stub.installPath = ctx.InstallFile(installDir, path).String()
|
stub.installPath = ctx.InstallFile(installDir, path.Base(), path).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func newStubLibrary() *Module {
|
func newStubLibrary() *Module {
|
||||||
|
@@ -125,7 +125,7 @@ func (p *prebuiltBinaryLinker) link(ctx ModuleContext,
|
|||||||
outputFile := android.PathForModuleOut(ctx, fileName)
|
outputFile := android.PathForModuleOut(ctx, fileName)
|
||||||
|
|
||||||
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
|
||||||
Rule: android.Cp,
|
Rule: android.CpExecutable,
|
||||||
Description: "prebuilt",
|
Description: "prebuilt",
|
||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
Input: p.Prebuilt.SingleSourcePath(ctx),
|
Input: p.Prebuilt.SingleSourcePath(ctx),
|
||||||
|
@@ -150,7 +150,7 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.outputFile = CreateAppPackage(ctx, aaptPackageFlags, a.outputFile, certificates)
|
a.outputFile = CreateAppPackage(ctx, aaptPackageFlags, a.outputFile, certificates)
|
||||||
ctx.InstallFileName(android.PathForModuleInstall(ctx, "app"), ctx.ModuleName()+".apk", a.outputFile)
|
ctx.InstallFile(android.PathForModuleInstall(ctx, "app"), ctx.ModuleName()+".apk", a.outputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
var aaptIgnoreFilenames = []string{
|
var aaptIgnoreFilenames = []string{
|
||||||
|
@@ -457,7 +457,7 @@ type Library struct {
|
|||||||
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
j.compile(ctx)
|
j.compile(ctx)
|
||||||
|
|
||||||
j.installFile = ctx.InstallFileName(android.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".jar", j.outputFile)
|
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), ctx.ModuleName()+".jar", j.outputFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
@@ -510,8 +510,8 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// Depend on the installed jar (j.installFile) so that the wrapper doesn't get executed by
|
// 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.
|
// another build rule before the jar has been installed.
|
||||||
j.wrapperFile = android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper)
|
j.wrapperFile = android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper)
|
||||||
j.binaryFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "bin"),
|
j.binaryFile = ctx.InstallExecutable(android.PathForModuleInstall(ctx, "bin"),
|
||||||
j.wrapperFile, j.installFile)
|
ctx.ModuleName(), j.wrapperFile, j.installFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
@@ -590,7 +590,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
|
|
||||||
j.combinedClasspathFile = TransformClassesToJar(ctx, j.classJarSpecs, android.OptionalPath{}, nil)
|
j.combinedClasspathFile = TransformClassesToJar(ctx, j.classJarSpecs, android.OptionalPath{}, nil)
|
||||||
|
|
||||||
ctx.InstallFileName(android.PathForModuleInstall(ctx, "framework"),
|
ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
||||||
ctx.ModuleName()+".jar", j.combinedClasspathFile)
|
ctx.ModuleName()+".jar", j.combinedClasspathFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,5 +35,6 @@ func NewPythonInstaller(dir string) *pythonInstaller {
|
|||||||
var _ installer = (*pythonInstaller)(nil)
|
var _ installer = (*pythonInstaller)(nil)
|
||||||
|
|
||||||
func (installer *pythonInstaller) install(ctx android.ModuleContext, file android.Path) {
|
func (installer *pythonInstaller) install(ctx android.ModuleContext, file android.Path) {
|
||||||
installer.path = ctx.InstallFile(android.PathForModuleInstall(ctx, installer.dir), file)
|
installer.path = ctx.InstallFile(android.PathForModuleInstall(ctx, installer.dir),
|
||||||
|
file.Base(), file)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user