本文整理汇总了Java中org.gradle.api.JavaVersion.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java JavaVersion.compareTo方法的具体用法?Java JavaVersion.compareTo怎么用?Java JavaVersion.compareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.JavaVersion
的用法示例。
在下文中一共展示了JavaVersion.compareTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: worksWith
import org.gradle.api.JavaVersion; //导入方法依赖的package包/类
private boolean worksWith(JavaVersion javaVersion) {
// 0.9-rc-1 was broken for Java 5
if (isVersion("0.9-rc-1") && javaVersion == JavaVersion.VERSION_1_5) {
return false;
}
// 1.x works on Java 5 - 8
if (isSameOrOlder("1.12")) {
return javaVersion.compareTo(JavaVersion.VERSION_1_5) >= 0 && javaVersion.compareTo(JavaVersion.VERSION_1_8) <= 0;
}
// 2.x and 3.0-milestone-1 work on Java 6 - 8
if (isSameOrOlder("3.0-milestone-1")) {
return javaVersion.compareTo(JavaVersion.VERSION_1_6) >= 0 && javaVersion.compareTo(JavaVersion.VERSION_1_8) <= 0;
}
// 3.x works on Java 7 - 9
return javaVersion.compareTo(JavaVersion.VERSION_1_7) >= 0 && javaVersion.compareTo(JavaVersion.VERSION_1_9) <= 0;
}
示例2: assertUsingVersion
import org.gradle.api.JavaVersion; //导入方法依赖的package包/类
public static void assertUsingVersion(String component, JavaVersion minVersion) throws UnsupportedJavaRuntimeException {
JavaVersion current = JavaVersion.current();
if (current.compareTo(minVersion) >= 0) {
return;
}
throw new UnsupportedJavaRuntimeException(String.format("%s %s requires Java %s or later to run. You are currently using Java %s.", component, GradleVersion.current().getVersion(),
minVersion.getMajorVersion(), current.getMajorVersion()));
}
示例3: applyDefaultsFor
import org.gradle.api.JavaVersion; //导入方法依赖的package包/类
public void applyDefaultsFor(JavaVersion javaVersion) {
if (hasJvmArgs) {
return;
}
if (javaVersion.compareTo(JavaVersion.VERSION_1_9) >= 0) {
jvmOptions.jvmArgs(DEFAULT_JVM_9_ARGS);
} else {
jvmOptions.jvmArgs(DEFAULT_JVM_ARGS);
}
}