1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Support multiple MSYS2 64-bit registry names (#243)

This commit is contained in:
John Dallaway 2023-01-15 16:52:20 +00:00 committed by GitHub
parent c98aae4c6a
commit a949830dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.build.gcc.core;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Version: 2.0.100.qualifier
Bundle-Activator: org.eclipse.cdt.build.gcc.core.internal.Activator
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016 QNX Software Systems and others.
* Copyright (c) 2016, 2023 QNX Software Systems and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -7,6 +7,8 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
* Contributors:
* John Dallaway - Support multiple MSYS2 64-bit registry names (#237)
*******************************************************************************/
package org.eclipse.cdt.build.gcc.core.internal;
@ -14,6 +16,7 @@ import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
import org.eclipse.cdt.build.gcc.core.GCCToolChain;
import org.eclipse.cdt.core.build.IToolChain;
@ -27,6 +30,7 @@ import org.eclipse.core.runtime.Platform;
public class Msys2ToolChainProvider implements IToolChainProvider {
private static final String ID = "org.eclipse.cdt.build.gcc.core.msys2Provider"; //$NON-NLS-1$
private static final Set<String> MSYS2_64BIT_NAMES = Set.of("MSYS2", "MSYS2 64bit"); //$NON-NLS-1$ //$NON-NLS-2$
@Override
public String getId() {
@ -45,7 +49,7 @@ public class Msys2ToolChainProvider implements IToolChainProvider {
String compKey = uninstallKey + '\\' + subkey;
String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$
if (on64bit) {
if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$
if (MSYS2_64BIT_NAMES.contains(displayName)) {
if (addToolChain64(manager, registry, compKey)) {
key32bit = null;
break;

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2013 Andrew Gvozdev and others.
* Copyright (c) 2012, 2023 Andrew Gvozdev and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@ -10,6 +10,7 @@
*
* Contributors:
* Andrew Gvozdev - Initial API and implementation
* John Dallaway - Support multiple MSYS2 64-bit registry names (#237)
*******************************************************************************/
package org.eclipse.cdt.internal.core;
@ -18,6 +19,7 @@ import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.WeakHashMap;
import org.eclipse.cdt.core.CCorePlugin;
@ -36,6 +38,7 @@ public class MinGW {
public static final String ENV_MINGW_HOME = "MINGW_HOME"; //$NON-NLS-1$
public static final String ENV_MSYS_HOME = "MSYS_HOME"; //$NON-NLS-1$
private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
private static final Set<String> MSYS2_64BIT_NAMES = Set.of("MSYS2", "MSYS2 64bit"); //$NON-NLS-1$ //$NON-NLS-2$
private static final boolean isWindowsPlatform = Platform.getOS().equals(Platform.OS_WIN32);
@ -93,7 +96,7 @@ public class MinGW {
String compKey = uninstallKey + '\\' + subkey;
String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$
if (on64bit) {
if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$
if (MSYS2_64BIT_NAMES.contains(displayName)) {
String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$
String mingwLocation = installLocation + "\\mingw64"; //$NON-NLS-1$
File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$
@ -228,7 +231,7 @@ public class MinGW {
String compKey = uninstallKey + '\\' + subkey;
String displayName = registry.getCurrentUserValue(compKey, "DisplayName"); //$NON-NLS-1$
if (on64bit) {
if ("MSYS2 64bit".equals(displayName)) { //$NON-NLS-1$
if (MSYS2_64BIT_NAMES.contains(displayName)) {
String home = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$
if (new File(home).isDirectory()) {
msysHome = home;