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

Commit 140c40a2 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

Add TIDY_EXTERNAL_VENDOR

Allow external/vendor owners and toolchain developers
to run clang-tidy with external/vendor files,
by setting TIDY_EXTERNAL_VENDOR=1 or true
instead of touching .bp or .go files.

Bug: 244631413
Test: TIDY_EXTERNAL_VENDOR=1 make tidy-soong_subset
Change-Id: I0c903f32eb0e5daa0f8dfa2f6dc892b8f8c4ebcc
parent 1832b5cc
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -76,9 +76,12 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
	if tidy.Properties.Tidy != nil && !*tidy.Properties.Tidy {
		return flags
	}
	// Some projects like external/* and vendor/* have clang-tidy disabled by default.
	// They can enable clang-tidy explicitly with the "tidy:true" property.
	if config.NoClangTidyForDir(ctx.ModuleDir()) && !proptools.Bool(tidy.Properties.Tidy) {
	// Some projects like external/* and vendor/* have clang-tidy disabled by default,
	// unless they are enabled explicitly with the "tidy:true" property or
	// when TIDY_EXTERNAL_VENDOR is set to true.
	if !ctx.Config().IsEnvTrue("TIDY_EXTERNAL_VENDOR") &&
		!proptools.Bool(tidy.Properties.Tidy) &&
		config.NoClangTidyForDir(ctx.ModuleDir()) {
		return flags
	}
	// If not explicitly disabled, set flags.Tidy to generate .tidy rules.