本文整理汇总了Java中org.gradle.util.GradleVersion.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java GradleVersion.compareTo方法的具体用法?Java GradleVersion.compareTo怎么用?Java GradleVersion.compareTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.util.GradleVersion
的用法示例。
在下文中一共展示了GradleVersion.compareTo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: from
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
public static VersionDetails from(GradleVersion version) {
if (version.compareTo(GradleVersion.version("2.1")) >= 0) {
return new R21VersionDetails(version.getVersion());
}
if (version.compareTo(GradleVersion.version("1.12")) >= 0) {
return new R112VersionDetails(version.getVersion());
}
if (version.compareTo(GradleVersion.version("1.8")) >= 0) {
return new R18VersionDetails(version.getVersion());
}
if (version.compareTo(GradleVersion.version("1.6")) >= 0) {
return new R16VersionDetails(version.getVersion());
}
return new R12VersionDetails(version.getVersion());
}
示例2: checkMinimumGradleVersion
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
static void checkMinimumGradleVersion() throws IOException {
GradleVersion gradleVersionMinimum = GradleVersion.version("2.14.1");
GradleVersion gradleVersionCurrent = GradleVersion.current();
if (gradleVersionCurrent.compareTo(gradleVersionMinimum) > 0) {
throw new IOException("Execution on older Gradle version ("+gradleVersionCurrent.getVersion()+
") than is defined as the minimum ("+gradleVersionMinimum.getVersion()+")");
}
}
示例3: attachGradleSdkSources
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
private void attachGradleSdkSources(@NotNull IdeaModule gradleModule,
@NotNull final String libName,
@Nullable final File libFile,
LibraryData library) {
if (libFile == null || !libName.startsWith("gradle-")) return;
final BuildScriptClasspathModel buildScriptClasspathModel =
resolverCtx.getExtraProject(gradleModule, BuildScriptClasspathModel.class);
if (buildScriptClasspathModel == null) return;
final File gradleHomeDir = buildScriptClasspathModel.getGradleHomeDir();
if (gradleHomeDir == null) return;
if (!FileUtil.isAncestor(gradleHomeDir, libFile, true)) return;
File libOrPluginsFile = libFile.getParentFile();
if (libOrPluginsFile != null && ("plugins".equals(libOrPluginsFile.getName()))) {
libOrPluginsFile = libOrPluginsFile.getParentFile();
}
if (libOrPluginsFile != null && "lib".equals(libOrPluginsFile.getName()) && libOrPluginsFile.getParentFile() != null) {
File srcDir = new File(libOrPluginsFile.getParentFile(), "src");
GradleVersion current = GradleVersion.version(buildScriptClasspathModel.getGradleVersion());
if (current.compareTo(GradleVersion.version("1.9")) >= 0) {
int endIndex = libName.indexOf(current.getVersion());
if (endIndex != -1) {
String srcDirChild = libName.substring("gradle-".length(), endIndex - 1);
srcDir = new File(srcDir, srcDirChild);
}
}
if (srcDir.isDirectory()) {
library.addPath(LibraryPathType.SOURCE, srcDir.getAbsolutePath());
}
}
}
示例4: getVersionDetails
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
protected static VersionDetails getVersionDetails(String versionString) {
GradleVersion version = GradleVersion.version(versionString);
if (version.compareTo(GradleVersion.version("1.11")) > 0) {
return new R112VersionDetails(version.getVersion());
}
return new R18VersionDetails(version.getVersion());
}
示例5: isCanObtainProjectOutcomesModel
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
public boolean isCanObtainProjectOutcomesModel() {
GradleVersion version = getGradleVersion();
boolean isMinimumVersionOrHigher = version.compareTo(PROJECT_OUTCOMES_MINIMUM_VERSION) >= 0;
//noinspection SimplifiableIfStatement
if (isMinimumVersionOrHigher) {
return true;
} else {
// Special handling for snapshots/RCs of the minimum version
return version.getBaseVersion().equals(PROJECT_OUTCOMES_MINIMUM_VERSION);
}
}
示例6: getVersionDetails
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
public static VersionDetails getVersionDetails(String versionString) {
GradleVersion version = GradleVersion.version(versionString);
if (version.compareTo(GradleVersion.version("1.11")) > 0) {
return new R112VersionDetails(version.getVersion());
}
if (version.compareTo(GradleVersion.version("1.8-rc-1")) >= 0) {
return new R18VersionDetails(version.getVersion());
}
return new R16VersionDetails(version.getVersion());
}
示例7: getMetaData
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
private static VersionDetails getMetaData(final ConnectionVersion4 delegate) {
GradleVersion version = GradleVersion.version(delegate.getMetaData().getVersion());
if (version.compareTo(GradleVersion.version("1.0-milestone-5")) < 0) {
return new R10M3VersionDetails(delegate);
} else {
return new R10M5VersionDetails(delegate);
}
}
示例8: require
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
private static boolean require(GradleEnvironment environment, GradleVersion version) {
try {
GradleVersion current = GradleVersion.version(environment.getGradleVersion());
return current.isValid() && current.compareTo(version) >= 0;
} catch (RuntimeException e) {
LogUtil.log(IStatus.WARNING, MessageFormat.format(
Messages.GradleUtil_warnInvalidGradleVersion,
environment.getGradleVersion()), e);
return false;
}
}
示例9: compare
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
private static int compare(@NotNull GradleVersion gradleVersion, @NotNull String otherGradleVersion, boolean checkBaseVersions) {
return gradleVersion.compareTo(adjust(GradleVersion.version(otherGradleVersion), checkBaseVersions));
}
示例10: executeTasks
import org.gradle.util.GradleVersion; //导入方法依赖的package包/类
@Override
public void executeTasks(@NotNull final ExternalSystemTaskId id,
@NotNull final List<String> taskNames,
@NotNull String projectPath,
@Nullable final GradleExecutionSettings settings,
@NotNull final List<String> vmOptions,
@NotNull final List<String> scriptParameters,
@Nullable final String debuggerSetup,
@NotNull final ExternalSystemTaskNotificationListener listener) throws ExternalSystemException {
// TODO add support for external process mode
if (ExternalSystemApiUtil.isInProcessMode(GradleConstants.SYSTEM_ID)) {
for (GradleTaskManagerExtension gradleTaskManagerExtension : GradleTaskManagerExtension.EP_NAME.getExtensions()) {
if (gradleTaskManagerExtension.executeTasks(
id, taskNames, projectPath, settings, vmOptions, scriptParameters, debuggerSetup, listener)) {
return;
}
}
}
if(!scriptParameters.contains("--tests") && taskNames.contains("test")) {
ContainerUtil.addAll(scriptParameters, "--tests", "*");
}
Function<ProjectConnection, Void> f = new Function<ProjectConnection, Void>() {
@Override
public Void fun(ProjectConnection connection) {
final List<String> initScripts = ContainerUtil.newArrayList();
final GradleProjectResolverExtension projectResolverChain = GradleProjectResolver.createProjectResolverChain(settings);
for (GradleProjectResolverExtension resolverExtension = projectResolverChain;
resolverExtension != null;
resolverExtension = resolverExtension.getNext()) {
final String resolverClassName = resolverExtension.getClass().getName();
resolverExtension.enhanceTaskProcessing(taskNames, debuggerSetup, new Consumer<String>() {
@Override
public void consume(String script) {
if (StringUtil.isNotEmpty(script)) {
ContainerUtil.addAllNotNull(
initScripts,
"//-- Generated by " + resolverClassName,
script,
"//");
}
}
});
}
if (!initScripts.isEmpty()) {
try {
final File tempFile = FileUtil.createTempFile("init", ".gradle");
tempFile.deleteOnExit();
FileUtil.writeToFile(tempFile, StringUtil.join(initScripts, SystemProperties.getLineSeparator()));
ContainerUtil.addAll(scriptParameters, GradleConstants.INIT_SCRIPT_CMD_OPTION, tempFile.getAbsolutePath());
}
catch (IOException e) {
throw new ExternalSystemException(e);
}
}
GradleVersion gradleVersion = GradleExecutionHelper.getGradleVersion(connection);
BuildLauncher launcher = myHelper.getBuildLauncher(id, connection, settings, listener, vmOptions, scriptParameters);
launcher.forTasks(ArrayUtil.toStringArray(taskNames));
if (gradleVersion != null && gradleVersion.compareTo(GradleVersion.version("2.1")) < 0) {
myCancellationMap.put(id, new UnsupportedCancellationToken());
} else {
final CancellationTokenSource cancellationTokenSource = GradleConnector.newCancellationTokenSource();
launcher.withCancellationToken(cancellationTokenSource.token());
myCancellationMap.put(id, cancellationTokenSource);
}
try {
launcher.run();
}
finally {
myCancellationMap.remove(id);
}
return null;
}
};
myHelper.execute(projectPath, settings, f);
}