Skip to content

Commit

Permalink
Expose one version enforcement level and allowlist to Starlark
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 384414372
  • Loading branch information
hvadehra authored and copybara-github committed Jul 13, 2021
1 parent 5b3eac0 commit 19a3a44
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ public OneVersionEnforcementLevel oneVersionEnforcementLevel() {
return enforceOneVersion;
}

@Override
public String starlarkOneVersionEnforcementLevel() {
return oneVersionEnforcementLevel().name();
}

public boolean enforceOneVersionOnJavaTests() {
return enforceOneVersionOnJavaTests;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ public Artifact getOneVersionBinary() {

/** Return the {@link Artifact} of the allowlist used by the one-version compliance checker. */
@Nullable
@Override
public Artifact getOneVersionAllowlist() {
return oneVersionAllowlist;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public interface JavaConfigurationApi extends StarlarkValue {
doc = "Additional options to pass to the Java VM for each java_binary target")
ImmutableList<String> getDefaultJvmFlags();

@StarlarkMethod(
name = "one_version_enforcement_level",
structField = true,
doc = "The value of the --experimental_one_version_enforcement flag.")
String starlarkOneVersionEnforcementLevel();

@StarlarkMethod(
name = "plugins",
structField = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ public interface JavaToolchainStarlarkApiProviderApi extends StructApi {
@StarlarkMethod(name = "single_jar", doc = "The SingleJar deploy jar.", structField = true)
FileApi getSingleJar();

@StarlarkMethod(
name = "one_version_allowlist",
doc = "The allowlist used by the One-Version compliance checker",
structField = true,
allowReturnNones = true)
@Nullable
FileApi getOneVersionAllowlist();

@StarlarkMethod(
name = "bootclasspath",
doc = "The Java target bootclasspath entries. Corresponds to javac's -bootclasspath flag.",
Expand Down

0 comments on commit 19a3a44

Please sign in to comment.