blob: 49ee5000e9cac68c49ce055db8e584f16e016e69 [file] [log] [blame]
syntax = "proto2";
package bazel_analyze;
// A DependencyGroup represents a list of alternatives for satisfying
// a missing dependency.
message DependencyGroup {
// Represents the visibility status of this dependency group. All the
// dependencies have the same visibility status indicated by the visibility
// field. Producers of this message (i.e. checkdeps) will ensure that
// the invariant is true.
enum Visibility {
// Visibility was not considered. (Default)
UNKNOWN = 0;
// All the alternatives are visible
ALL_VISIBLE = 1;
// All the alternatives are invisible
ALL_INVISIBLE = 2;
}
repeated string dependency = 1;
optional Visibility visibility = 2 [default = UNKNOWN];
// The set of import paths for which any of these dependencies can provide.
// It is legal for there to be multiple entries there (in practice it is
// not very common). This happens if the dependencies required by one
// import_path is a subset of the other. In that case, the smaller set of
// dependencies is populated in dependency field, and both import_path's are
// listed here.
repeated string import_path = 3;
}
// Represents information about arbitrary non-deps attributes.
message AttributeReport {
// Name of the attribute (e.g. "runtime_deps").
optional string attribute = 1;
// Attribute value that is required but missing.
repeated string missing_value = 2;
// Attribute value that is declared but not needed.
repeated string unnecessary_value = 3;
}
// The result of checking a single build rule (called X in comments
// below) for missing or unnecessary dependencies. Produced by
// java/com/google/devtools/build/checkbuilddeps (which for external
// users means it's produced by bazel analyze).
message DependencyReport {
required string rule = 1; // Name of rule X, in canonical google3 format.
// Names of targets that are, or should be, declared as dependencies
// by rule X. Some need to be declared and some don't; in some
// cases it is impossible to tell by static analysis. Each is the
// full canonical name of the target, i.e. //x/y:z, or the shorthand
// form if the target name equals the package name, i.e. //x/y
// (shorthand for //x/y:y).
// Declared and needed. Removing these dependencies should break the build.
repeated string necessary_dependency = 2;
// Declared but not needed. Removing these dependencies should not break
// the build.
repeated string unnecessary_dependency = 3;
// Can't tell. These may be dependencies where no corresponding imports
// were found, but alwayslink=1.
repeated string ambiguous_dependency = 4;
// Needed but not declared. If there are imports which can be satisfied
// by more than one dependency declared in a best-matching package, list
// all of them. If this list is not empty, we expect the build to break.
repeated DependencyGroup missing_dependency_group = 8;
// Files/classes that a source file imports, but for which no
// appropriate dependency could be found. We expect the build to break
// if this list is not empty.
// NOTE: If there are unreseolved imports, it may indicate that
// analysis failed to connect a declared dependency with a
// corresponding import statement, and so you may want to have less
// faith in the unnecessary_dependency field (though, in general,
// rules in unnecessary_dependency are still PROBABLY unnecessary).
repeated string unresolved_import = 7;
// Source files that are inputs to the rule but cannot be found.
// Values are absolute labels, e.g. '//foo:bar/baz.c'.
repeated string missing_source_file = 13;
// General-purpose feedback messages from the dependency checker
// (errors, warnings, any kind of info).
repeated string feedback = 6;
// Indicates whether the dependency analysis completed without errors.
optional bool successful = 10 [default = true];
}
// Aggregate DependencyReports for multiple analysis
// targets - used to support bazel analyze --analysis_output=proto
message AnalyzeResult {
repeated DependencyReport dependency_report = 1;
}