aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-08-31 12:29:17 -0700
committerColin Cross <ccross@android.com>2017-08-31 13:48:52 -0700
commit5c51792926b063945d786cc8a1e407a2ce2159cf (patch)
treecef55100e4632b4a1c4d141392287802c65f3693 /android
parentadd7fdf1a5d7652cfc8ef8da4e517eb4e11e0e08 (diff)
downloadbuild_soong-5c51792926b063945d786cc8a1e407a2ce2159cf.tar.gz
build_soong-5c51792926b063945d786cc8a1e407a2ce2159cf.tar.bz2
build_soong-5c51792926b063945d786cc8a1e407a2ce2159cf.zip
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
Diffstat (limited to 'android')
-rw-r--r--android/defs.go7
-rw-r--r--android/module.go22
2 files changed, 21 insertions, 8 deletions
diff --git a/android/defs.go b/android/defs.go
index ec8dcf9c..cd8b4e31 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -52,6 +52,13 @@ var (
},
"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.
Touch = pctx.AndroidStaticRule("Touch",
blueprint.RuleParams{
diff --git a/android/module.go b/android/module.go
index 3a3d1735..fb2e7030 100644
--- a/android/module.go
+++ b/android/module.go
@@ -83,8 +83,8 @@ type ModuleContext interface {
ExpandSourcesSubDir(srcFiles, excludes []string, subDir string) Paths
Glob(globPattern string, excludes []string) Paths
- InstallFile(installPath OutputPath, srcPath Path, deps ...Path) OutputPath
- InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
+ InstallExecutable(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
CheckbuildFile(srcPath Path)
@@ -717,8 +717,18 @@ func (a *androidModuleContext) skipInstall(fullInstallPath OutputPath) bool {
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 {
+ 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)
a.module.base().hooks.runInstallHooks(a, fullInstallPath, false)
@@ -738,7 +748,7 @@ func (a *androidModuleContext) InstallFileName(installPath OutputPath, name stri
}
a.ModuleBuild(pctx, ModuleBuildParams{
- Rule: Cp,
+ Rule: rule,
Description: "install " + fullInstallPath.Base(),
Output: fullInstallPath,
Input: srcPath,
@@ -753,10 +763,6 @@ func (a *androidModuleContext) InstallFileName(installPath OutputPath, name stri
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 {
fullInstallPath := installPath.Join(a, name)
a.module.base().hooks.runInstallHooks(a, fullInstallPath, true)