当前位置: 首页>>代码示例>>Java>>正文


Java GradleVersion.compareTo方法代码示例

本文整理汇总了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());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:VersionDetails.java

示例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()+")");
    }
}
 
开发者ID:ctco,项目名称:gradle-mobile-plugin,代码行数:9,代码来源:MobilePluginUtil.java

示例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());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:BaseGradleProjectResolverExtension.java

示例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());
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:8,代码来源:ActionAwareConsumerConnection.java

示例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);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:12,代码来源:ComparableGradleBuildExecuter.java

示例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());
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:11,代码来源:ModelBuilderBackedConsumerConnection.java

示例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);
    }
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:9,代码来源:ConnectionVersion4BackedConsumerConnection.java

示例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;
    }
}
 
开发者ID:asakusafw,项目名称:asakusafw-shafu,代码行数:12,代码来源:GradleUtil.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:VersionMatcher.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:82,代码来源:GradleTaskManager.java


注:本文中的org.gradle.util.GradleVersion.compareTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。