Skip to content

Commit d623892

Browse files
cushoncopybara-github
authored andcommitted
Remove support for --check_constaint=
PiperOrigin-RevId: 362391713
1 parent a443af7 commit d623892

File tree

4 files changed

+3
-50
lines changed

4 files changed

+3
-50
lines changed

site/docs/user-manual.html

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,6 @@ <h3 id='checking-options'>Error checking</h3>
102102
These options control Bazel's error-checking and/or warnings.
103103
</p>
104104

105-
<h4 id='flag--check_constraint'><code class='flag'>--check_constraint=<var>constraint</var></code></h4>
106-
<p>
107-
This option takes an argument that specifies which constraint
108-
should be checked.
109-
</p>
110-
<p>
111-
Bazel performs special checks on each rule that is annotated with the
112-
given constraint.
113-
</p>
114-
<p>
115-
The supported constraints and their checks are as follows:
116-
</p>
117-
<ul>
118-
119-
<li><code>public</code>: Verify that all java_libraries marked with
120-
<code>constraints = ['public']</code> only depend on java_libraries
121-
that are marked as <code>constraints = ['public']</code> too. If bazel
122-
finds a dependency that does not conform to this rule, bazel will issue
123-
an error.
124-
</li>
125-
</ul>
126-
127105
<h4 id='flag--check_visibility'><code class='flag'>--[no]check_visibility</code></h4>
128106
<p>
129107
If this option is set to false, visibility checks are demoted to warnings.

src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,24 +137,6 @@ public JavaSemantics getJavaSemantics() {
137137
return semantics;
138138
}
139139

140-
/**
141-
* Validates that the packages listed under "deps" all have the given constraint. If a package
142-
* does not have this attribute, an error is generated.
143-
*/
144-
public static final void validateConstraint(
145-
RuleContext ruleContext,
146-
String constraint,
147-
Iterable<? extends TransitiveInfoCollection> targets) {
148-
for (TransitiveInfoCollection target : targets) {
149-
JavaInfo javaInfo = JavaInfo.getJavaInfo(target);
150-
if (javaInfo != null && !javaInfo.getJavaConstraints().contains(constraint)) {
151-
ruleContext.attributeError(
152-
"deps",
153-
String.format("%s: does not have constraint '%s'", target.getLabel(), constraint));
154-
}
155-
}
156-
}
157-
158140
/**
159141
* Creates an action to aggregate all metadata artifacts into a single
160142
* &lt;target_name&gt;_instrumented.jar file.

src/main/java/com/google/devtools/build/lib/rules/java/JavaConfiguration.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ public enum ImportDepsCheckingLevel {
9393
private final JavaClasspathMode javaClasspath;
9494
private final boolean inmemoryJdepsFiles;
9595
private final ImmutableList<String> defaultJvmFlags;
96-
private final ImmutableList<String> checkedConstraints;
9796
private final StrictDepsMode strictJavaDeps;
9897
private final String fixDepsTool;
9998
private final Label proguardBinary;
@@ -133,7 +132,6 @@ public JavaConfiguration(BuildOptions buildOptions) throws InvalidConfigurationE
133132
this.javaClasspath = javaOptions.javaClasspath;
134133
this.inmemoryJdepsFiles = javaOptions.inmemoryJdepsFiles;
135134
this.defaultJvmFlags = ImmutableList.copyOf(javaOptions.jvmOpts);
136-
this.checkedConstraints = ImmutableList.copyOf(javaOptions.checkedConstraints);
137135
this.strictJavaDeps = javaOptions.strictJavaDeps;
138136
this.fixDepsTool = javaOptions.fixDepsTool;
139137
this.proguardBinary = javaOptions.proguard;
@@ -269,10 +267,6 @@ public ImmutableList<String> getDefaultJvmFlags() {
269267
return defaultJvmFlags;
270268
}
271269

272-
public ImmutableList<String> getCheckedConstraints() {
273-
return checkedConstraints;
274-
}
275-
276270
public StrictDepsMode getStrictJavaDeps() {
277271
return strictJavaDeps;
278272
}

src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,14 @@ public ImportDepsCheckingLevelConverter() {
446446
help = "The message translations used for translating messages in Java targets.")
447447
public List<String> translationTargets;
448448

449+
@Deprecated
449450
@Option(
450451
name = "check_constraint",
451452
allowMultiple = true,
452453
defaultValue = "null",
453-
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
454+
documentationCategory = OptionDocumentationCategory.UNDOCUMENTED,
454455
effectTags = {OptionEffectTag.UNKNOWN},
455-
help = "Check the listed constraint.")
456+
help = "No-op. Kept here for backwards compatibility.")
456457
public List<String> checkedConstraints;
457458

458459
@Option(
@@ -762,8 +763,6 @@ public FragmentOptions getHost() {
762763

763764
host.isJlplStrictDepsEnforced = isJlplStrictDepsEnforced;
764765

765-
host.requireJavaToolchainHeaderCompilerDirect = requireJavaToolchainHeaderCompilerDirect;
766-
767766
host.disallowResourceJars = disallowResourceJars;
768767

769768
host.javaRuntimeVersion = hostJavaRuntimeVersion;

0 commit comments

Comments
 (0)