Merge changes I3454370a,I18dd900d
* changes: Move global cppflags to the beginning of cppflags genrule: let Android.bp file specify exported header dirs
This commit is contained in:
2
cc/cc.go
2
cc/cc.go
@@ -786,7 +786,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||||||
if genRule, ok := m.(genrule.SourceFileGenerator); ok {
|
if genRule, ok := m.(genrule.SourceFileGenerator); ok {
|
||||||
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders,
|
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders,
|
||||||
genRule.GeneratedSourceFiles()...)
|
genRule.GeneratedSourceFiles()...)
|
||||||
flags := includeDirsToFlags(android.Paths{genRule.GeneratedHeaderDir()})
|
flags := includeDirsToFlags(genRule.GeneratedHeaderDirs())
|
||||||
depPaths.Flags = append(depPaths.Flags, flags)
|
depPaths.Flags = append(depPaths.Flags, flags)
|
||||||
if tag == genHeaderExportDepTag {
|
if tag == genHeaderExportDepTag {
|
||||||
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags)
|
depPaths.ReexportedFlags = append(depPaths.ReexportedFlags, flags)
|
||||||
|
@@ -245,17 +245,17 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
|
|||||||
|
|
||||||
if !ctx.noDefaultCompilerFlags() {
|
if !ctx.noDefaultCompilerFlags() {
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
|
flags.GlobalFlags = append(flags.GlobalFlags, instructionSetFlags)
|
||||||
flags.ConlyFlags = append(flags.ConlyFlags, "${config.CommonGlobalConlyflags}")
|
flags.ConlyFlags = append([]string{"${config.CommonGlobalConlyflags}"}, flags.ConlyFlags...)
|
||||||
|
|
||||||
if flags.Clang {
|
if flags.Clang {
|
||||||
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
|
flags.AsFlags = append(flags.AsFlags, tc.ClangAsflags())
|
||||||
flags.CppFlags = append(flags.CppFlags, "${config.CommonClangGlobalCppflags}")
|
flags.CppFlags = append([]string{"${config.CommonClangGlobalCppflags}"}, flags.CppFlags...)
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||||
tc.ClangCflags(),
|
tc.ClangCflags(),
|
||||||
"${config.CommonClangGlobalCflags}",
|
"${config.CommonClangGlobalCflags}",
|
||||||
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
|
fmt.Sprintf("${config.%sClangGlobalCflags}", hod))
|
||||||
} else {
|
} else {
|
||||||
flags.CppFlags = append(flags.CppFlags, "${config.CommonGlobalCppflags}")
|
flags.CppFlags = append([]string{"${config.CommonGlobalCppflags}"}, flags.CppFlags...)
|
||||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||||
tc.Cflags(),
|
tc.Cflags(),
|
||||||
"${config.CommonGlobalCflags}",
|
"${config.CommonGlobalCflags}",
|
||||||
|
@@ -34,7 +34,7 @@ var (
|
|||||||
|
|
||||||
type SourceFileGenerator interface {
|
type SourceFileGenerator interface {
|
||||||
GeneratedSourceFiles() android.Paths
|
GeneratedSourceFiles() android.Paths
|
||||||
GeneratedHeaderDir() android.Path
|
GeneratedHeaderDirs() android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostToolProvider interface {
|
type HostToolProvider interface {
|
||||||
@@ -65,6 +65,9 @@ type generatorProperties struct {
|
|||||||
|
|
||||||
// Local file that is used as the tool
|
// Local file that is used as the tool
|
||||||
Tool_files []string
|
Tool_files []string
|
||||||
|
|
||||||
|
// List of directories to export generated headers from
|
||||||
|
Export_include_dirs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type generator struct {
|
type generator struct {
|
||||||
@@ -77,7 +80,7 @@ type generator struct {
|
|||||||
deps android.Paths
|
deps android.Paths
|
||||||
rule blueprint.Rule
|
rule blueprint.Rule
|
||||||
|
|
||||||
genPath android.Path
|
exportedIncludeDirs android.Paths
|
||||||
|
|
||||||
outputFiles android.Paths
|
outputFiles android.Paths
|
||||||
}
|
}
|
||||||
@@ -93,8 +96,8 @@ func (g *generator) GeneratedSourceFiles() android.Paths {
|
|||||||
return g.outputFiles
|
return g.outputFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *generator) GeneratedHeaderDir() android.Path {
|
func (g *generator) GeneratedHeaderDirs() android.Paths {
|
||||||
return g.genPath
|
return g.exportedIncludeDirs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *generator) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (g *generator) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
@@ -113,7 +116,14 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
g.genPath = android.PathForModuleGen(ctx, "")
|
if len(g.properties.Export_include_dirs) > 0 {
|
||||||
|
for _, dir := range g.properties.Export_include_dirs {
|
||||||
|
g.exportedIncludeDirs = append(g.exportedIncludeDirs,
|
||||||
|
android.PathForModuleGen(ctx, ctx.ModuleDir(), dir))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g.exportedIncludeDirs = append(g.exportedIncludeDirs, android.PathForModuleGen(ctx, ""))
|
||||||
|
}
|
||||||
|
|
||||||
tools := map[string]android.Path{}
|
tools := map[string]android.Path{}
|
||||||
|
|
||||||
@@ -166,7 +176,7 @@ func (g *generator) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
return "${depfile}", nil
|
return "${depfile}", nil
|
||||||
case "genDir":
|
case "genDir":
|
||||||
return g.genPath.String(), nil
|
return android.PathForModuleGen(ctx, "").String(), nil
|
||||||
default:
|
default:
|
||||||
if strings.HasPrefix(name, "location ") {
|
if strings.HasPrefix(name, "location ") {
|
||||||
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
label := strings.TrimSpace(strings.TrimPrefix(name, "location "))
|
||||||
|
Reference in New Issue
Block a user