Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packaging: Move java version checker back to its own jar #30708

Merged
merged 5 commits into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Nit
  • Loading branch information
jasontedor committed Jun 10, 2018
commit cb077c1c2cf8b13e52fea86d814efc3185780f39
4 changes: 1 addition & 3 deletions distribution/tools/java-version-checker/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import org.elasticsearch.gradle.precommit.PrecommitTasks
import org.gradle.api.JavaVersion

apply plugin: 'elasticsearch.build'

targetCompatibility = JavaVersion.VERSION_1_7

// java_version_checker do not depend on core so only JDK signatures should be checked
List jdkSignatures = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
forbiddenApisMain.signaturesURLs = jdkSignatures
forbiddenApisMain.signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]

test.enabled = false
namingConventions.enabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,30 @@ public static void main(final String[] args) {
Locale.ROOT,
"the minimum required Java version is 8; your Java version from [%s] does not meet this requirement",
System.getProperty("java.home"));
fail(message);
errPrintln(message);
exit(1);
}
exit(0);
}

@SuppressForbidden(reason = "need to print error and exit")
private static void fail(String message) {
/**
* Prints a string and terminates the line on standard error.
*
* @param message the message to print
*/
@SuppressForbidden(reason = "System#err")
static void errPrintln(final String message) {
System.err.println(message);
System.exit(1);
}

/**
* Exit the VM with the specified status.
*
* @param status the status
*/
@SuppressForbidden(reason = "System#exit")
static void exit(final int status) {
System.exit(status);
}

}