Merge \\"Add symlink installation support\\" am: b4b613931f

am: 7a4a749ca9

Change-Id: Ide8f908f25371f37a257eecf6f6d52878225e679
This commit is contained in:
Colin Cross
2016-07-15 22:29:22 +00:00
committed by android-build-merger
3 changed files with 31 additions and 0 deletions

View File

@@ -78,6 +78,7 @@ type ModuleContext interface {
InstallFile(installPath OutputPath, srcPath Path, deps ...Path) OutputPath InstallFile(installPath OutputPath, srcPath Path, deps ...Path) OutputPath
InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath InstallFileName(installPath OutputPath, name string, srcPath Path, deps ...Path) OutputPath
InstallSymlink(installPath OutputPath, name string, srcPath OutputPath) OutputPath
CheckbuildFile(srcPath Path) CheckbuildFile(srcPath Path)
AddMissingDependencies(deps []string) AddMissingDependencies(deps []string)
@@ -563,6 +564,24 @@ func (a *androidModuleContext) InstallFile(installPath OutputPath, srcPath Path,
return a.InstallFileName(installPath, filepath.Base(srcPath.String()), srcPath, deps...) 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.ModuleBuild(pctx, ModuleBuildParams{
Rule: Symlink,
Output: fullInstallPath,
OrderOnly: Paths{srcPath},
Default: !a.AConfig().EmbeddedInMake(),
Args: map[string]string{
"fromPath": srcPath.String(),
},
})
a.installFiles = append(a.installFiles, fullInstallPath)
a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
return fullInstallPath
}
func (a *androidModuleContext) CheckbuildFile(srcPath Path) { func (a *androidModuleContext) CheckbuildFile(srcPath Path) {
a.checkbuildFiles = append(a.checkbuildFiles, srcPath) a.checkbuildFiles = append(a.checkbuildFiles, srcPath)
} }

View File

@@ -124,6 +124,9 @@ func (binary *binaryLinker) AndroidMk(ctx AndroidMkContext, ret *android.Android
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error { ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
fmt.Fprintln(w, "LOCAL_CXX_STL := none") fmt.Fprintln(w, "LOCAL_CXX_STL := none")
fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=") fmt.Fprintln(w, "LOCAL_SYSTEM_SHARED_LIBRARIES :=")
if binary.static() {
fmt.Fprintln(w, "LOCAL_FORCE_STATIC_EXECUTABLE := true")
}
return nil return nil
}) })
} }
@@ -173,6 +176,9 @@ func (installer *baseInstaller) AndroidMk(ctx AndroidMkContext, ret *android.And
stem := strings.TrimSuffix(file, filepath.Ext(file)) stem := strings.TrimSuffix(file, filepath.Ext(file))
fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir)) fmt.Fprintln(w, "LOCAL_MODULE_PATH := $(OUT_DIR)/"+filepath.Clean(dir))
fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem) fmt.Fprintln(w, "LOCAL_MODULE_STEM := "+stem)
if len(installer.Properties.Symlinks) > 0 {
fmt.Fprintln(w, "LOCAL_MODULE_SYMLINKS := "+strings.Join(installer.Properties.Symlinks, " "))
}
return nil return nil
}) })
} }

View File

@@ -454,6 +454,9 @@ type BaseProperties struct {
type InstallerProperties struct { type InstallerProperties struct {
// install to a subdirectory of the default install path for the module // install to a subdirectory of the default install path for the module
Relative_install_path string Relative_install_path string
// install symlinks to the module
Symlinks []string `android:"arch_variant"`
} }
type StripProperties struct { type StripProperties struct {
@@ -1472,6 +1475,9 @@ func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
} }
dir := android.PathForModuleInstall(ctx, subDir, installer.Properties.Relative_install_path) dir := android.PathForModuleInstall(ctx, subDir, installer.Properties.Relative_install_path)
installer.path = ctx.InstallFile(dir, file) installer.path = ctx.InstallFile(dir, file)
for _, symlink := range installer.Properties.Symlinks {
ctx.InstallSymlink(dir, symlink, installer.path)
}
} }
func (installer *baseInstaller) inData() bool { func (installer *baseInstaller) inData() bool {