summaryrefslogtreecommitdiff
path: root/cc/compiler.go
diff options
context:
space:
mode:
Diffstat (limited to 'cc/compiler.go')
-rw-r--r--cc/compiler.go26
1 files changed, 14 insertions, 12 deletions
diff --git a/cc/compiler.go b/cc/compiler.go
index a6f623f5b..022b712e9 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -228,9 +228,6 @@ type BaseCompilerProperties struct {
Static *bool `android:"arch_variant"`
} `android:"arch_variant"`
- // Stores the original list of source files before being cleared by library reuse
- OriginalSrcs proptools.Configurable[[]string] `blueprint:"mutated"`
-
// Build and link with OpenMP
Openmp *bool `android:"arch_variant"`
}
@@ -363,10 +360,20 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
tc := ctx.toolchain()
modulePath := ctx.ModuleDir()
- srcs := compiler.Properties.Srcs.GetOrDefault(ctx, nil)
- exclude_srcs := compiler.Properties.Exclude_srcs.GetOrDefault(ctx, nil)
- compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, srcs, exclude_srcs)
- compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
+ reuseObjs := false
+ if len(ctx.GetDirectDepsWithTag(reuseObjTag)) > 0 {
+ reuseObjs = true
+ }
+
+ // If a reuseObjTag dependency exists then this module is reusing the objects (generally the shared variant
+ // reusing objects from the static variant), and doesn't need to compile any sources of its own.
+ var srcs []string
+ if !reuseObjs {
+ srcs = compiler.Properties.Srcs.GetOrDefault(ctx, nil)
+ exclude_srcs := compiler.Properties.Exclude_srcs.GetOrDefault(ctx, nil)
+ compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, srcs, exclude_srcs)
+ compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
+ }
cflags := compiler.Properties.Cflags.GetOrDefault(ctx, nil)
cppflags := compiler.Properties.Cppflags.GetOrDefault(ctx, nil)
@@ -721,11 +728,6 @@ func (compiler *baseCompiler) hasSrcExt(ctx BaseModuleContext, ext string) bool
return true
}
}
- for _, src := range compiler.Properties.OriginalSrcs.GetOrDefault(ctx, nil) {
- if filepath.Ext(src) == ext {
- return true
- }
- }
return false
}