From b2703adce4c5d69ff0b3334dd4cca0583c2d82c6 Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Fri, 30 Jul 2021 13:25:42 -0700 Subject: Conditionally apply rustdoc flags to third party crates This CL changes the logic in rust/builder.go so that some rustdoc flags are only applied to external crates. This will allow us to since warnings and deal with soft-failures in external crates while allowing us to be more strict with our internal Rust code. Bug: 195136952 Test: m rustdoc Change-Id: Icdde304bbbb323cae9657e8f842f58ae79e811ce --- rust/builder.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'rust/builder.go') diff --git a/rust/builder.go b/rust/builder.go index 6c4416631..a5b3ab9de 100644 --- a/rust/builder.go +++ b/rust/builder.go @@ -332,8 +332,11 @@ func Rustdoc(ctx ModuleContext, main android.Path, deps PathDeps, rustdocFlags = append(rustdocFlags, makeLibFlags(deps)...) docTimestampFile := android.PathForModuleOut(ctx, "rustdoc.timestamp") - // Silence warnings about renamed lints - rustdocFlags = append(rustdocFlags, " -A renamed_and_removed_lints") + // Silence warnings about renamed lints for third-party crates + modulePath := android.PathForModuleSrc(ctx).String() + if android.IsThirdPartyPath(modulePath) { + rustdocFlags = append(rustdocFlags, " -A renamed_and_removed_lints") + } // Yes, the same out directory is used simultaneously by all rustdoc builds. // This is what cargo does. The docs for individual crates get generated to -- cgit v1.2.3-59-g8ed1b