Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 897266ed authored by Colin Cross's avatar Colin Cross
Browse files

Make filesToInstall return InstallPaths and add it to Module

Test: m checkbuild
Change-Id: I9170c7e22f000a2d0343e74a96079b24e8ad66f5
parent 609c49a3
Loading
Loading
Loading
Loading
+17 −31
Original line number Original line Diff line number Diff line
@@ -241,6 +241,8 @@ type Module interface {
	RequiredModuleNames() []string
	RequiredModuleNames() []string
	HostRequiredModuleNames() []string
	HostRequiredModuleNames() []string
	TargetRequiredModuleNames() []string
	TargetRequiredModuleNames() []string

	filesToInstall() InstallPaths
}
}


// Qualified id for a module
// Qualified id for a module
@@ -645,7 +647,7 @@ type ModuleBase struct {
	primaryVisibilityProperty visibilityProperty
	primaryVisibilityProperty visibilityProperty


	noAddressSanitizer bool
	noAddressSanitizer bool
	installFiles       Paths
	installFiles       InstallPaths
	checkbuildFiles    Paths
	checkbuildFiles    Paths
	noticeFile         OptionalPath
	noticeFile         OptionalPath


@@ -844,22 +846,20 @@ func (m *ModuleBase) ExportedToMake() bool {
	return m.commonProperties.NamespaceExportedToMake
	return m.commonProperties.NamespaceExportedToMake
}
}


func (m *ModuleBase) computeInstallDeps(
func (m *ModuleBase) computeInstallDeps(ctx blueprint.ModuleContext) InstallPaths {
	ctx blueprint.ModuleContext) Paths {


	result := Paths{}
	var result InstallPaths
	// TODO(ccross): we need to use WalkDeps and have some way to know which dependencies require installation
	// TODO(ccross): we need to use WalkDeps and have some way to know which dependencies require installation
	ctx.VisitDepsDepthFirstIf(isFileInstaller,
	ctx.VisitDepsDepthFirst(func(m blueprint.Module) {
		func(m blueprint.Module) {
		if a, ok := m.(Module); ok {
			fileInstaller := m.(fileInstaller)
			result = append(result, a.filesToInstall()...)
			files := fileInstaller.filesToInstall()
		}
			result = append(result, files...)
	})
	})


	return result
	return result
}
}


func (m *ModuleBase) filesToInstall() Paths {
func (m *ModuleBase) filesToInstall() InstallPaths {
	return m.installFiles
	return m.installFiles
}
}


@@ -939,8 +939,8 @@ func (m *ModuleBase) TargetRequiredModuleNames() []string {
}
}


func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
	allInstalledFiles := Paths{}
	var allInstalledFiles InstallPaths
	allCheckbuildFiles := Paths{}
	var allCheckbuildFiles Paths
	ctx.VisitAllModuleVariants(func(module Module) {
	ctx.VisitAllModuleVariants(func(module Module) {
		a := module.base()
		a := module.base()
		allInstalledFiles = append(allInstalledFiles, a.installFiles...)
		allInstalledFiles = append(allInstalledFiles, a.installFiles...)
@@ -959,7 +959,7 @@ func (m *ModuleBase) generateModuleTarget(ctx ModuleContext) {
		ctx.Build(pctx, BuildParams{
		ctx.Build(pctx, BuildParams{
			Rule:      blueprint.Phony,
			Rule:      blueprint.Phony,
			Output:    name,
			Output:    name,
			Implicits: allInstalledFiles,
			Implicits: allInstalledFiles.Paths(),
			Default:   !ctx.Config().EmbeddedInMake(),
			Default:   !ctx.Config().EmbeddedInMake(),
		})
		})
		deps = append(deps, name)
		deps = append(deps, name)
@@ -1282,8 +1282,8 @@ func (b *baseModuleContext) GetDirectDepWithTag(name string, tag blueprint.Depen
type moduleContext struct {
type moduleContext struct {
	bp blueprint.ModuleContext
	bp blueprint.ModuleContext
	baseModuleContext
	baseModuleContext
	installDeps     Paths
	installDeps     InstallPaths
	installFiles    Paths
	installFiles    InstallPaths
	checkbuildFiles Paths
	checkbuildFiles Paths
	module          Module
	module          Module


@@ -1736,7 +1736,7 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat


	if !m.skipInstall(fullInstallPath) {
	if !m.skipInstall(fullInstallPath) {


		deps = append(deps, m.installDeps...)
		deps = append(deps, m.installDeps.Paths()...)


		var implicitDeps, orderOnlyDeps Paths
		var implicitDeps, orderOnlyDeps Paths


@@ -1817,20 +1817,6 @@ func (m *moduleContext) CheckbuildFile(srcPath Path) {
	m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
	m.checkbuildFiles = append(m.checkbuildFiles, srcPath)
}
}


type fileInstaller interface {
	filesToInstall() Paths
}

func isFileInstaller(m blueprint.Module) bool {
	_, ok := m.(fileInstaller)
	return ok
}

func isAndroidModule(m blueprint.Module) bool {
	_, ok := m.(Module)
	return ok
}

func findStringInSlice(str string, slice []string) int {
func findStringInSlice(str string, slice []string) int {
	for i, s := range slice {
	for i, s := range slice {
		if s == str {
		if s == str {