org.gradle.util.VersionNumber Java Examples

The following examples show how to use org.gradle.util.VersionNumber. 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: RoutesCompilerFactory.java    From playframework with Apache License 2.0 6 votes vote down vote up
public static VersionedRoutesCompilerAdapter createAdapter(PlayPlatform playPlatform) {
    String playVersion = playPlatform.getPlayVersion().get();
    String scalaVersion = playPlatform.getScalaCompatibilityVersion().get();
    switch (PlayMajorVersion.forPlatform(playPlatform)) {
        case PLAY_2_3_X:
            return new RoutesCompilerAdapterV23X(playVersion);
        case PLAY_2_4_X:
            if (VersionNumber.parse(playVersion).getMicro() < 6 && !"2.10".equals(scalaVersion)) {
                scalaVersion = "2.10";
            }
            return new RoutesCompilerAdapterV24X(playVersion, scalaVersion);
        case PLAY_2_5_X:
        case PLAY_2_6_X:
            return new RoutesCompilerAdapterV24X(playVersion, scalaVersion);
        case PLAY_2_7_X:
        default:
            return new RoutesCompilerAdapterV27X(playVersion, scalaVersion);
    }
}
 
Example #3
Source File: DefaultVisualStudioLocator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void locateInstallInPath() {
    File compilerInPath = os.findInPath(COMPILER_FILENAME);
    if (compilerInPath == null) {
        LOGGER.debug("No visual c++ compiler found in system path.");
        return;
    }

    File visualCppDir = GFileUtils.canonicalise(compilerInPath.getParentFile().getParentFile());
    if (!isVisualCpp(visualCppDir)) {
        visualCppDir = visualCppDir.getParentFile();
        if (!isVisualCpp(visualCppDir)) {
            LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", compilerInPath);
            return;
        }
    }
    LOGGER.debug("Found Visual C++ install {} using system path", visualCppDir);

    File visualStudioDir = visualCppDir.getParentFile();
    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from system path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    pathInstall = foundInstalls.get(visualStudioDir);
}
 
Example #4
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 #5
Source File: ApiGroovyCompiler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void applyConfigurationScript(File configScript, CompilerConfiguration configuration) {
    VersionNumber version = parseGroovyVersion();
    if (version.compareTo(VersionNumber.parse("2.1")) < 0) {
        throw new GradleException("Using a Groovy compiler configuration script requires Groovy 2.1+ but found Groovy " + version + "");
    }
    Binding binding = new Binding();
    binding.setVariable("configuration", configuration);

    CompilerConfiguration configuratorConfig = new CompilerConfiguration();
    ImportCustomizer customizer = new ImportCustomizer();
    customizer.addStaticStars("org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
    configuratorConfig.addCompilationCustomizers(customizer);

    GroovyShell shell = new GroovyShell(binding, configuratorConfig);
    try {
        shell.evaluate(configScript);
    } catch (Exception e) {
        throw new GradleException("Could not execute Groovy compiler configuration script: " + configScript.getAbsolutePath(), e);
    }
}
 
Example #6
Source File: DefaultVisualStudioLocator.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void locateInstallInPath() {
    File compilerInPath = os.findInPath(COMPILER_FILENAME);
    if (compilerInPath == null) {
        LOGGER.debug("No visual c++ compiler found in system path.");
        return;
    }

    File visualCppDir = GFileUtils.canonicalise(compilerInPath.getParentFile().getParentFile());
    if (!isVisualCpp(visualCppDir)) {
        visualCppDir = visualCppDir.getParentFile();
        if (!isVisualCpp(visualCppDir)) {
            LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", compilerInPath);
            return;
        }
    }
    LOGGER.debug("Found Visual C++ install {} using system path", visualCppDir);

    File visualStudioDir = visualCppDir.getParentFile();
    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from system path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    pathInstall = foundInstalls.get(visualStudioDir);
}
 
Example #7
Source File: DefaultVisualStudioLocator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void locateInstallInPath() {
    File compilerInPath = os.findInPath(COMPILER_FILENAME);
    if (compilerInPath == null) {
        LOGGER.debug("No visual c++ compiler found in system path.");
        return;
    }

    File visualCppDir = GFileUtils.canonicalise(compilerInPath.getParentFile().getParentFile());
    if (!isVisualCpp(visualCppDir)) {
        visualCppDir = visualCppDir.getParentFile();
        if (!isVisualCpp(visualCppDir)) {
            LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", compilerInPath);
            return;
        }
    }
    LOGGER.debug("Found Visual C++ install {} using system path", visualCppDir);

    File visualStudioDir = visualCppDir.getParentFile();
    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from system path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    pathInstall = foundInstalls.get(visualStudioDir);
}
 
Example #8
Source File: ApiGroovyCompiler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void applyConfigurationScript(File configScript, CompilerConfiguration configuration) {
    VersionNumber version = parseGroovyVersion();
    if (version.compareTo(VersionNumber.parse("2.1")) < 0) {
        throw new GradleException("Using a Groovy compiler configuration script requires Groovy 2.1+ but found Groovy " + version + "");
    }
    Binding binding = new Binding();
    binding.setVariable("configuration", configuration);

    CompilerConfiguration configuratorConfig = new CompilerConfiguration();
    ImportCustomizer customizer = new ImportCustomizer();
    customizer.addStaticStars("org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
    configuratorConfig.addCompilationCustomizers(customizer);

    GroovyShell shell = new GroovyShell(binding, configuratorConfig);
    try {
        shell.evaluate(configScript);
    } catch (Exception e) {
        throw new GradleException("Could not execute Groovy compiler configuration script: " + configScript.getAbsolutePath(), e);
    }
}
 
Example #9
Source File: DefaultVisualStudioLocator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void locateInstallInPath() {
    File compilerInPath = os.findInPath(COMPILER_FILENAME);
    if (compilerInPath == null) {
        LOGGER.debug("No visual c++ compiler found in system path.");
        return;
    }

    File visualCppDir = GFileUtils.canonicalise(compilerInPath.getParentFile().getParentFile());
    if (!isVisualCpp(visualCppDir)) {
        visualCppDir = visualCppDir.getParentFile();
        if (!isVisualCpp(visualCppDir)) {
            LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", compilerInPath);
            return;
        }
    }
    LOGGER.debug("Found Visual C++ install {} using system path", visualCppDir);

    File visualStudioDir = visualCppDir.getParentFile();
    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from system path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    pathInstall = foundInstalls.get(visualStudioDir);
}
 
Example #10
Source File: DefaultVisualStudioLocator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private SearchResult locateUserSpecifiedInstall(File candidate) {
    File visualStudioDir = GFileUtils.canonicalise(candidate);
    File visualCppDir = new File(visualStudioDir, "VC");
    if (!isVisualStudio(visualStudioDir) || !isVisualCpp(visualCppDir)) {
        LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", candidate);
        return new InstallNotFound(String.format("The specified installation directory '%s' does not appear to contain a Visual Studio installation.", candidate));
    }

    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from user provided path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    return new InstallFound(foundInstalls.get(visualStudioDir));
}
 
Example #11
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 #12
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 #13
Source File: VisualCppInstall.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public VisualCppInstall(String name, VersionNumber version, Architecture defaultArchitecture,
        Map<Architecture, List<File>> paths, Map<Architecture, File> binaryPaths, Map<Architecture, File> libraryPaths,
        Map<Architecture, File> includePaths, Map<Architecture, String> assemblerFilenames,
        Map<Architecture, Map<String, String>> definitions) {
    this.paths = paths;
    this.name = name;
    this.version = version;
    this.defaultArchitecture = defaultArchitecture;
    this.binaryPaths = binaryPaths;
    this.libraryPaths = libraryPaths;
    this.includePaths = includePaths;
    this.assemblerFilenames = assemblerFilenames;
    this.definitions = definitions;
}
 
Example #14
Source File: DefaultVisualStudioLocator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private SearchResult locateUserSpecifiedInstall(File candidate) {
    File visualStudioDir = GFileUtils.canonicalise(candidate);
    File visualCppDir = new File(visualStudioDir, "VC");
    if (!isVisualStudio(visualStudioDir) || !isVisualCpp(visualCppDir)) {
        LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", candidate);
        return new InstallNotFound(String.format("The specified installation directory '%s' does not appear to contain a Visual Studio installation.", candidate));
    }

    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from user provided path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    return new InstallFound(foundInstalls.get(visualStudioDir));
}
 
Example #15
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 #16
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 #17
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 #18
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 #19
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 #20
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 #21
Source File: FindBugsClasspathValidator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void validateClasspath(Iterable<String> fileNamesOnClasspath) {
    VersionNumber v = getFindbugsVersion(fileNamesOnClasspath);
    boolean java6orLess = javaVersion.compareTo(JavaVersion.VERSION_1_7) < 0;
    boolean findbugs3orMore = v.getMajor() > 2;
    if (java6orLess && findbugs3orMore) {
        throw new FindBugsVersionTooHighException("The version of FindBugs (" + v + ") inferred from FindBugs classpath is too high to work with currently used Java version (" + javaVersion + ")."
                + " Please use lower version of FindBugs or use newer version of Java. Inspected FindBugs classpath: " + fileNamesOnClasspath);
    }
    boolean java8orMore = javaVersion.compareTo(JavaVersion.VERSION_1_7) > 0;
    boolean findbugs2orLess = v.getMajor() < 3;
    if (java8orMore && findbugs2orLess) {
        throw new FindBugsVersionTooLowException("The version of FindBugs (" + v + ") inferred from FindBugs classpath is too low to work with currently used Java version (" + javaVersion + ")."
                + " Please use higher version of FindBugs. Inspected FindBugs classpath: " + fileNamesOnClasspath);
    }
}
 
Example #22
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 #23
Source File: JvmInstallation.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public JvmInstallation(JavaVersion javaVersion, String version, File javaHome, boolean jdk, Arch arch) {
    this.javaVersion = javaVersion;
    this.version = VersionNumber.withPatchNumber().parse(version);
    this.javaHome = javaHome;
    this.jdk = jdk;
    this.arch = arch;
}
 
Example #24
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 #25
Source File: VisualCppInstall.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public VisualCppInstall(String name, VersionNumber version, Architecture defaultArchitecture,
        Map<Architecture, List<File>> paths, Map<Architecture, File> binaryPaths, Map<Architecture, File> libraryPaths,
        Map<Architecture, File> includePaths, Map<Architecture, String> assemblerFilenames,
        Map<Architecture, Map<String, String>> definitions) {
    this.paths = paths;
    this.name = name;
    this.version = version;
    this.defaultArchitecture = defaultArchitecture;
    this.binaryPaths = binaryPaths;
    this.libraryPaths = libraryPaths;
    this.includePaths = includePaths;
    this.assemblerFilenames = assemblerFilenames;
    this.definitions = definitions;
}
 
Example #26
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 #27
Source File: DefaultVisualStudioLocator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private SearchResult locateUserSpecifiedInstall(File candidate) {
    File visualStudioDir = GFileUtils.canonicalise(candidate);
    File visualCppDir = new File(visualStudioDir, "VC");
    if (!isVisualStudio(visualStudioDir) || !isVisualCpp(visualCppDir)) {
        LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", candidate);
        return new InstallNotFound(String.format("The specified installation directory '%s' does not appear to contain a Visual Studio installation.", candidate));
    }

    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from user provided path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    return new InstallFound(foundInstalls.get(visualStudioDir));
}
 
Example #28
Source File: VisualCppInstall.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public VisualCppInstall(String name, VersionNumber version, Architecture defaultArchitecture,
        Map<Architecture, List<File>> paths, Map<Architecture, File> binaryPaths, Map<Architecture, File> libraryPaths,
        Map<Architecture, File> includePaths, Map<Architecture, String> assemblerFilenames,
        Map<Architecture, Map<String, String>> definitions) {
    this.paths = paths;
    this.name = name;
    this.version = version;
    this.defaultArchitecture = defaultArchitecture;
    this.binaryPaths = binaryPaths;
    this.libraryPaths = libraryPaths;
    this.includePaths = includePaths;
    this.assemblerFilenames = assemblerFilenames;
    this.definitions = definitions;
}
 
Example #29
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 #30
Source File: DefaultVisualStudioLocator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private SearchResult locateUserSpecifiedInstall(File candidate) {
    File visualStudioDir = GFileUtils.canonicalise(candidate);
    File visualCppDir = new File(visualStudioDir, "VC");
    if (!isVisualStudio(visualStudioDir) || !isVisualCpp(visualCppDir)) {
        LOGGER.debug("Ignoring candidate Visual C++ install for {} as it does not look like a Visual C++ installation.", candidate);
        return new InstallNotFound(String.format("The specified installation directory '%s' does not appear to contain a Visual Studio installation.", candidate));
    }

    if (!foundInstalls.containsKey(visualStudioDir)) {
        VisualCppInstall visualCpp = buildVisualCppInstall("Visual C++ from user provided path", visualStudioDir, visualCppDir, VersionNumber.UNKNOWN);
        VisualStudioInstall visualStudio = new VisualStudioInstall(visualStudioDir, visualCpp);
        foundInstalls.put(visualStudioDir, visualStudio);
    }
    return new InstallFound(foundInstalls.get(visualStudioDir));
}