Java Code Examples for org.gradle.util.GradleVersion#version()

The following examples show how to use org.gradle.util.GradleVersion#version() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultGradleBuildInvocationSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setGradleVersion(String gradleVersion) {
    if (gradleVersion == null) {
        throw new IllegalArgumentException("gradleVersion cannot be null");
    }
    GradleVersion version = GradleVersion.version(gradleVersion);
    this.gradleVersion = version.getVersion();
}
 
Example 2
Source File: ActionAwareConsumerConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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());
}
 
Example 3
Source File: DefaultGradleBuildInvocationSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setGradleVersion(String gradleVersion) {
    if (gradleVersion == null) {
        throw new IllegalArgumentException("gradleVersion cannot be null");
    }
    GradleVersion version = GradleVersion.version(gradleVersion);
    this.gradleVersion = version.getVersion();
}
 
Example 4
Source File: ConnectionVersion4BackedConsumerConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
    }
}
 
Example 5
Source File: ModelBuilderBackedConsumerConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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());
}
 
Example 6
Source File: ConnectionVersion4BackedConsumerConnection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
    }
}
 
Example 7
Source File: ModelBuilderBackedConsumerConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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());
}
 
Example 8
Source File: DefaultGradleBuildInvocationSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setGradleVersion(String gradleVersion) {
    if (gradleVersion == null) {
        throw new IllegalArgumentException("gradleVersion cannot be null");
    }
    GradleVersion version = GradleVersion.version(gradleVersion);
    this.gradleVersion = version.getVersion();
}
 
Example 9
Source File: DefaultGradleBuildInvocationSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setGradleVersion(String gradleVersion) {
    if (gradleVersion == null) {
        throw new IllegalArgumentException("gradleVersion cannot be null");
    }
    GradleVersion version = GradleVersion.version(gradleVersion);
    this.gradleVersion = version.getVersion();
}
 
Example 10
Source File: ActionAwareConsumerConnection.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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());
}
 
Example 11
Source File: GradleDistributionManager.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private NbGradleVersion(String version, URI downloadLocation, boolean release) {
    this.version = GradleVersion.version(version);
    this.downloadLocation = downloadLocation;
    this.release = release;
}
 
Example 12
Source File: ComparableGradleBuildExecuter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleVersion getGradleVersion() {
    return GradleVersion.version(getSpec().getGradleVersion());
}
 
Example 13
Source File: DefaultGradleDistribution.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected boolean isVersion(String otherVersionString) {
    GradleVersion otherVersion = GradleVersion.version(otherVersionString);
    return version.compareTo(otherVersion) == 0 || (version.isSnapshot() && version.getBaseVersion().equals(otherVersion.getBaseVersion()));
}
 
Example 14
Source File: ComparableGradleBuildExecuter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleVersion getGradleVersion() {
    return GradleVersion.version(getSpec().getGradleVersion());
}
 
Example 15
Source File: DefaultGradleDistribution.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected boolean isVersion(String otherVersionString) {
    GradleVersion otherVersion = GradleVersion.version(otherVersionString);
    return version.compareTo(otherVersion) == 0 || (version.isSnapshot() && version.getBaseVersion().equals(otherVersion.getBaseVersion()));
}
 
Example 16
Source File: AbstractModelBuilderTest.java    From intellij-quarkus with Eclipse Public License 2.0 4 votes vote down vote up
@Before
public void setUp() throws Exception {
  assumeThat(gradleVersion, versionMatcherRule.getMatcher());

  ensureTempDirCreated();

  String methodName = name.getMethodName();
  Matcher m = TEST_METHOD_NAME_PATTERN.matcher(methodName);
  if (m.matches()) {
    methodName = m.group(1);
  }

  testDir = new File(ourTempDir, methodName);
  FileUtil.ensureExists(testDir);

  final InputStream buildScriptStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.DEFAULT_SCRIPT_NAME);
  try {
    FileUtil.writeToFile(
      new File(testDir, GradleConstants.DEFAULT_SCRIPT_NAME),
      FileUtil.loadTextAndClose(buildScriptStream)
    );
  }
  finally {
    StreamUtil.closeStream(buildScriptStream);
  }

  final InputStream settingsStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.SETTINGS_FILE_NAME);
  try {
    if(settingsStream != null) {
      FileUtil.writeToFile(
        new File(testDir, GradleConstants.SETTINGS_FILE_NAME),
        FileUtil.loadTextAndClose(settingsStream)
      );
    }
  } finally {
    StreamUtil.closeStream(settingsStream);
  }

  GradleConnector connector = GradleConnector.newConnector();

  GradleVersion _gradleVersion = GradleVersion.version(gradleVersion);
  final URI distributionUri = new DistributionLocator().getDistributionFor(_gradleVersion);
  connector.useDistribution(distributionUri);
  connector.forProjectDirectory(testDir);
  int daemonMaxIdleTime = 10;
  try {
    daemonMaxIdleTime = Integer.parseInt(System.getProperty("gradleDaemonMaxIdleTime", "10"));
  }
  catch (NumberFormatException ignore) {}

  ((DefaultGradleConnector)connector).daemonMaxIdleTime(daemonMaxIdleTime, TimeUnit.SECONDS);
  ProjectConnection connection = connector.connect();

  try {
    boolean isGradleProjectDirSupported = _gradleVersion.compareTo(GradleVersion.version("2.4")) >= 0;
    boolean isCompositeBuildsSupported = isGradleProjectDirSupported && _gradleVersion.compareTo(GradleVersion.version("3.1")) >= 0;
    final ProjectImportAction projectImportAction = new ProjectImportAction(false, isGradleProjectDirSupported,
                                                                            isCompositeBuildsSupported);
    projectImportAction.addProjectImportExtraModelProvider(new ClassSetProjectImportExtraModelProvider(getModels()));
    BuildActionExecuter<ProjectImportAction.AllModels> buildActionExecutor = connection.action(projectImportAction);
    File initScript = GradleExecutionHelper.generateInitScript(false, getToolingExtensionClasses());
    assertNotNull(initScript);
    String jdkHome = IdeaTestUtil.requireRealJdkHome();
    buildActionExecutor.setJavaHome(new File(jdkHome));
    buildActionExecutor.setJvmArguments("-Xmx128m", "-XX:MaxPermSize=64m");
    buildActionExecutor.withArguments("--info", GradleConstants.INIT_SCRIPT_CMD_OPTION, initScript.getAbsolutePath());
    allModels = buildActionExecutor.run();
    assertNotNull(allModels);
  } finally {
    connection.close();
  }
}
 
Example 17
Source File: ComparableGradleBuildExecuter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleVersion getGradleVersion() {
    return GradleVersion.version(getSpec().getGradleVersion());
}
 
Example 18
Source File: DefaultGradleDistribution.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected boolean isVersion(String otherVersionString) {
    GradleVersion otherVersion = GradleVersion.version(otherVersionString);
    return version.compareTo(otherVersion) == 0 || (version.isSnapshot() && version.getBaseVersion().equals(otherVersion.getBaseVersion()));
}
 
Example 19
Source File: ComparableGradleBuildExecuter.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GradleVersion getGradleVersion() {
    return GradleVersion.version(getSpec().getGradleVersion());
}
 
Example 20
Source File: DefaultGradleDistribution.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected boolean isVersion(String otherVersionString) {
    GradleVersion otherVersion = GradleVersion.version(otherVersionString);
    return version.compareTo(otherVersion) == 0 || (version.isSnapshot() && version.getBaseVersion().equals(otherVersion.getBaseVersion()));
}