Java Code Examples for org.gradle.util.VersionNumber#parse()

The following examples show how to use org.gradle.util.VersionNumber#parse() . 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: DefaultGradleDistribution.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public VersionNumber getArtifactCacheLayoutVersion() {
    if (isSameOrNewer("1.12-rc-1")) {
        return VersionNumber.parse("2.6");
    } else if (isSameOrNewer("1.11-rc-1")) {
        return VersionNumber.parse("2.2");
    } else if (isSameOrNewer("1.9-rc-2")) {
        return VersionNumber.parse("2.1");
    } else if (isSameOrNewer("1.9-rc-1")) {
        return VersionNumber.parse("1.31");
    } else if (isSameOrNewer("1.7-rc-1")) {
        return VersionNumber.parse("0.26");
    } else if (isSameOrNewer("1.6-rc-1")) {
        return VersionNumber.parse("0.24");
    } else if (isSameOrNewer("1.4-rc-1")) {
        return VersionNumber.parse("0.23");
    } else if (isSameOrNewer("1.3")) {
        return VersionNumber.parse("0.15");
    } else {
        return VersionNumber.parse("0.1");
    }
}
 
Example 2
Source File: DefaultGradleDistribution.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public VersionNumber getArtifactCacheLayoutVersion() {
    if (isSameOrNewer("1.12-rc-1")) {
        return VersionNumber.parse("2.6");
    } else if (isSameOrNewer("1.11-rc-1")) {
        return VersionNumber.parse("2.2");
    } else if (isSameOrNewer("1.9-rc-2")) {
        return VersionNumber.parse("2.1");
    } else if (isSameOrNewer("1.9-rc-1")) {
        return VersionNumber.parse("1.31");
    } else if (isSameOrNewer("1.7-rc-1")) {
        return VersionNumber.parse("0.26");
    } else if (isSameOrNewer("1.6-rc-1")) {
        return VersionNumber.parse("0.24");
    } else if (isSameOrNewer("1.4-rc-1")) {
        return VersionNumber.parse("0.23");
    } else if (isSameOrNewer("1.3")) {
        return VersionNumber.parse("0.15");
    } else {
        return VersionNumber.parse("0.1");
    }
}
 
Example 3
Source File: DefaultGradleDistribution.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public VersionNumber getArtifactCacheLayoutVersion() {
    if (isSameOrNewer("2.2-rc-1")) {
        return VersionNumber.parse("2.14");
    } else if (isSameOrNewer("2.1-rc-3")) {
        return VersionNumber.parse("2.13");
    } else if (isSameOrNewer("2.0-rc-1")) {
        return VersionNumber.parse("2.12");
    } else if (isSameOrNewer("1.12-rc-1")) {
        return VersionNumber.parse("2.6");
    } else if (isSameOrNewer("1.11-rc-1")) {
        return VersionNumber.parse("2.2");
    } else if (isSameOrNewer("1.9-rc-2")) {
        return VersionNumber.parse("2.1");
    } else if (isSameOrNewer("1.9-rc-1")) {
        return VersionNumber.parse("1.31");
    } else if (isSameOrNewer("1.7-rc-1")) {
        return VersionNumber.parse("0.26");
    } else if (isSameOrNewer("1.6-rc-1")) {
        return VersionNumber.parse("0.24");
    } else if (isSameOrNewer("1.4-rc-1")) {
        return VersionNumber.parse("0.23");
    } else if (isSameOrNewer("1.3")) {
        return VersionNumber.parse("0.15");
    } else {
        return VersionNumber.parse("0.1");
    }
}
 
Example 4
Source File: DefaultVisualStudioLocator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void locateInstallsInRegistry(String baseKey) {
    List<String> visualCppVersions;
    try {
        visualCppVersions = windowsRegistry.getValueNames(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC);
    } catch (MissingRegistryEntryException e) {
        // No Visual Studio information available in the registry
        return;
    }

    for (String valueName : visualCppVersions) {
        if (!valueName.matches("\\d+\\.\\d+")) {
            // Ignore the other values
            continue;
        }
        File visualCppDir = new File(windowsRegistry.getStringValue(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC, valueName));
        visualCppDir = GFileUtils.canonicalise(visualCppDir);
        File visualStudioDir = visualCppDir.getParentFile();

        if (isVisualCpp(visualCppDir) && isVisualStudio(visualStudioDir)) {
            LOGGER.debug("Found Visual C++ {} at {}", valueName, visualCppDir);
            VersionNumber version = VersionNumber.parse(valueName);
            VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ " + valueName, visualStudioDir, visualCppDir, version);
            VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
            foundInstalls.put(visualStudioDir, visualStudio);
        } else {
            LOGGER.debug("Ignoring candidate Visual C++ directory {} as it does not look like a Visual C++ installation.", visualCppDir);
        }
    }
}
 
Example 5
Source File: DefaultVisualStudioLocator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void locateInstallsInRegistry(String baseKey) {
    List<String> visualCppVersions;
    try {
        visualCppVersions = windowsRegistry.getValueNames(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC);
    } catch (MissingRegistryEntryException e) {
        // No Visual Studio information available in the registry
        return;
    }

    for (String valueName : visualCppVersions) {
        if (!valueName.matches("\\d+\\.\\d+")) {
            // Ignore the other values
            continue;
        }
        File visualCppDir = new File(windowsRegistry.getStringValue(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC, valueName));
        visualCppDir = GFileUtils.canonicalise(visualCppDir);
        File visualStudioDir = visualCppDir.getParentFile();

        if (isVisualCpp(visualCppDir) && isVisualStudio(visualStudioDir)) {
            LOGGER.debug("Found Visual C++ {} at {}", valueName, visualCppDir);
            VersionNumber version = VersionNumber.parse(valueName);
            VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ " + valueName, visualStudioDir, visualCppDir, version);
            VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
            foundInstalls.put(visualStudioDir, visualStudio);
        } else {
            LOGGER.debug("Ignoring candidate Visual C++ directory {} as it does not look like a Visual C++ installation.", visualCppDir);
        }
    }
}
 
Example 6
Source File: DefaultGradleDistribution.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public VersionNumber getArtifactCacheLayoutVersion() {
    if (isSameOrNewer("2.2-rc-1")) {
        return VersionNumber.parse("2.14");
    } else if (isSameOrNewer("2.1-rc-3")) {
        return VersionNumber.parse("2.13");
    } else if (isSameOrNewer("2.0-rc-1")) {
        return VersionNumber.parse("2.12");
    } else if (isSameOrNewer("1.12-rc-1")) {
        return VersionNumber.parse("2.6");
    } else if (isSameOrNewer("1.11-rc-1")) {
        return VersionNumber.parse("2.2");
    } else if (isSameOrNewer("1.9-rc-2")) {
        return VersionNumber.parse("2.1");
    } else if (isSameOrNewer("1.9-rc-1")) {
        return VersionNumber.parse("1.31");
    } else if (isSameOrNewer("1.7-rc-1")) {
        return VersionNumber.parse("0.26");
    } else if (isSameOrNewer("1.6-rc-1")) {
        return VersionNumber.parse("0.24");
    } else if (isSameOrNewer("1.4-rc-1")) {
        return VersionNumber.parse("0.23");
    } else if (isSameOrNewer("1.3")) {
        return VersionNumber.parse("0.15");
    } else {
        return VersionNumber.parse("0.1");
    }
}
 
Example 7
Source File: FindBugsClasspathValidator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private VersionNumber getFindbugsVersion(Iterable<String> classpath) {
    for (String f: classpath) {
        Matcher m = Pattern.compile("findbugs-(.*)\\.jar").matcher(f);
        if (m.matches()) {
            return VersionNumber.parse(m.group(1));
        }
    }
    throw new GradleException("Unable to infer the version of FindBugs from currently specified FindBugs classpath: " + classpath);
}
 
Example 8
Source File: PlayApplicationPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private void failIfInjectedRouterIsUsedWithOldVersion(Boolean injectedRoutesGenerator, PlayPlatform playPlatform) {
    if (Boolean.TRUE.equals(injectedRoutesGenerator)) {
        VersionNumber minSupportedVersion = VersionNumber.parse("2.4.0");
        VersionNumber playVersion = VersionNumber.parse(playPlatform.getPlayVersion().get());
        if (playVersion.compareTo(minSupportedVersion) < 0) {
            throw new GradleException("Injected routers are only supported in Play 2.4 or newer.");
        }
    }
}
 
Example 9
Source File: TwirlCompilerAdapterV13X.java    From playframework with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public List<String> getDependencyNotation() {
    VersionNumber scalaAsVersion = VersionNumber.parse(scalaVersion);
    if (scalaAsVersion.compareTo(VersionNumber.parse("2.12")) >= 0) {
        // We need scala.util.parsing.input.Positional
        return (List<String>) CollectionUtils.flattenCollections(super.getDependencyNotation(), "org.scala-lang.modules:scala-parser-combinators_" + scalaVersion + ":1.1.2");
    } else {
        return super.getDependencyNotation();
    }
}
 
Example 10
Source File: RetrolambdaExec.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static boolean requireVersion(VersionNumber retrolambdaVersion, String version, boolean fallback) {
    if (retrolambdaVersion == null) {
        // Don't know version, assume fallback
        return fallback;
    }
    VersionNumber targetVersionNumber = VersionNumber.parse(version);
    return retrolambdaVersion.compareTo(targetVersionNumber) >= 0;
}
 
Example 11
Source File: RetrolambdaExec.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static VersionNumber retrolambdaVersion(Configuration retrolambdaConfig) {
    retrolambdaConfig.resolve();
    Dependency retrolambdaDep = retrolambdaConfig.getDependencies().iterator().next();
    if (retrolambdaDep.getVersion() == null) {
        // Don't know version
        return null;
    }
    return VersionNumber.parse(retrolambdaDep.getVersion());
}
 
Example 12
Source File: DefaultVisualStudioLocator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void locateInstallsInRegistry(String baseKey) {
    List<String> visualCppVersions;
    try {
        visualCppVersions = windowsRegistry.getValueNames(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC);
    } catch (MissingRegistryEntryException e) {
        // No Visual Studio information available in the registry
        return;
    }

    for (String valueName : visualCppVersions) {
        if (!valueName.matches("\\d+\\.\\d+")) {
            // Ignore the other values
            continue;
        }
        File visualCppDir = new File(windowsRegistry.getStringValue(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC, valueName));
        visualCppDir = GFileUtils.canonicalise(visualCppDir);
        File visualStudioDir = visualCppDir.getParentFile();

        if (isVisualCpp(visualCppDir) && isVisualStudio(visualStudioDir)) {
            LOGGER.debug("Found Visual C++ {} at {}", valueName, visualCppDir);
            VersionNumber version = VersionNumber.parse(valueName);
            VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ " + valueName, visualStudioDir, visualCppDir, version);
            VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
            foundInstalls.put(visualStudioDir, visualStudio);
        } else {
            LOGGER.debug("Ignoring candidate Visual C++ directory {} as it does not look like a Visual C++ installation.", visualCppDir);
        }
    }
}
 
Example 13
Source File: DefaultVisualStudioLocator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void locateInstallsInRegistry(String baseKey) {
    List<String> visualCppVersions;
    try {
        visualCppVersions = windowsRegistry.getValueNames(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC);
    } catch (MissingRegistryEntryException e) {
        // No Visual Studio information available in the registry
        return;
    }

    for (String valueName : visualCppVersions) {
        if (!valueName.matches("\\d+\\.\\d+")) {
            // Ignore the other values
            continue;
        }
        File visualCppDir = new File(windowsRegistry.getStringValue(WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_VC, valueName));
        visualCppDir = GFileUtils.canonicalise(visualCppDir);
        File visualStudioDir = visualCppDir.getParentFile();

        if (isVisualCpp(visualCppDir) && isVisualStudio(visualStudioDir)) {
            LOGGER.debug("Found Visual C++ {} at {}", valueName, visualCppDir);
            VersionNumber version = VersionNumber.parse(valueName);
            VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ " + valueName, visualStudioDir, visualCppDir, version);
            VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
            foundInstalls.put(visualStudioDir, visualStudio);
        } else {
            LOGGER.debug("Ignoring candidate Visual C++ directory {} as it does not look like a Visual C++ installation.", visualCppDir);
        }
    }
}
 
Example 14
Source File: FindBugsClasspathValidator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private VersionNumber getFindbugsVersion(Iterable<String> classpath) {
    for (String f: classpath) {
        Matcher m = Pattern.compile("findbugs-(.*)\\.jar").matcher(f);
        if (m.matches()) {
            return VersionNumber.parse(m.group(1));
        }
    }
    throw new GradleException("Unable to infer the version of FindBugs from currently specified FindBugs classpath: " + classpath);
}
 
Example 15
Source File: GroovyJarFile.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public VersionNumber getVersion() {
    return VersionNumber.parse(matcher.group(2));
}
 
Example 16
Source File: GroovyJarFile.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public VersionNumber getVersion() {
    return VersionNumber.parse(matcher.group(2));
}
 
Example 17
Source File: GroovyJarFile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public VersionNumber getVersion() {
    return VersionNumber.parse(matcher.group(2));
}
 
Example 18
Source File: GroovyJarFile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public VersionNumber getVersion() {
    return VersionNumber.parse(matcher.group(2));
}