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

Commit f96b0010 authored by Colin Cross's avatar Colin Cross
Browse files

Don't call android.PathForModuleSrc(ctx).String() to get ModuleDir

ctx.ModuleDir is much cheaper than android.PathForModuleSrc(ctx).String().

Test: builds
Change-Id: I81819088d9564b06a0336a59a45f2b110b0bd9d6
parent 4e6c3ef5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -534,7 +534,7 @@ func transformSourceToObj(ctx ModuleContext, subdir string, srcFiles, noTidySrcs
		toolingCppflags += " ${config.NoOverride64GlobalCflags}"
	}

	modulePath := android.PathForModuleSrc(ctx).String()
	modulePath := ctx.ModuleDir()
	if android.IsThirdPartyPath(modulePath) {
		cflags += " ${config.NoOverrideExternalGlobalCflags}"
		toolingCflags += " ${config.NoOverrideExternalGlobalCflags}"
+1 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ func parseCStd(cStdPtr *string) string {
// per-target values, module type values, and per-module Blueprints properties
func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps PathDeps) Flags {
	tc := ctx.toolchain()
	modulePath := android.PathForModuleSrc(ctx).String()
	modulePath := ctx.ModuleDir()

	compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, compiler.Properties.Srcs, compiler.Properties.Exclude_srcs)
	compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
+1 −1
Original line number Diff line number Diff line
@@ -303,7 +303,7 @@ func (j *Javadoc) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Op
	}

	flags = append(flags, android.JoinWithPrefix(aidlIncludes.Strings(), "-I"))
	flags = append(flags, "-I"+android.PathForModuleSrc(ctx).String())
	flags = append(flags, "-I"+ctx.ModuleDir())
	if src := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "src"); src.Valid() {
		flags = append(flags, "-I"+src.String())
	}
+2 −2
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ func transformSrctoCrate(ctx ModuleContext, main android.Path, deps PathDeps, fl
	}

	// Disallow experimental features
	modulePath := android.PathForModuleSrc(ctx).String()
	modulePath := ctx.ModuleDir()
	if !(android.IsThirdPartyPath(modulePath) || strings.HasPrefix(modulePath, "prebuilts")) {
		rustcFlags = append(rustcFlags, "-Zallow-features=\"\"")
	}
@@ -436,7 +436,7 @@ func Rustdoc(ctx ModuleContext, main android.Path, deps PathDeps,
	docTimestampFile := android.PathForModuleOut(ctx, "rustdoc.timestamp")

	// Silence warnings about renamed lints for third-party crates
	modulePath := android.PathForModuleSrc(ctx).String()
	modulePath := ctx.ModuleDir()
	if android.IsThirdPartyPath(modulePath) {
		rustdocFlags = append(rustdocFlags, " -A warnings")
	}