From 17c10c5c450fc0e4431227e2eb3298e0fb1b4b23 Mon Sep 17 00:00:00 2001 From: astrelsky Date: Wed, 1 May 2019 17:13:53 -0400 Subject: [PATCH] Fixed detection of VS SDK and VCTools Versions --- GPL/nativeBuildProperties.gradle | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradle index f00b28b2c4..1394e8fc8c 100644 --- a/GPL/nativeBuildProperties.gradle +++ b/GPL/nativeBuildProperties.gradle @@ -20,25 +20,6 @@ apply plugin: 'c' project.ext.VISUAL_STUDIO_BASE_DIR = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017" project.ext.WINDOWS_KITS_DIR = "C:\\Program Files (x86)\\Windows Kits\\10" -/**************************************************************************** - * Method for extracting value from = pairs - ****************************************************************************/ -ext.getEnvironmentValue = { envLines, name -> - String assignment = name + "=" - for (String line : envLines) { - if (line.startsWith(assignment)) { - String[] parts = line.split("=") - String value = parts[1].trim() - // remove trailing \ if present - if (value.endsWith("\\")) { - value = value.substring(0, value.length()-1) - } - return value - } - } - return null -} - project.ext.VISUAL_STUDIO_INSTALL_DIR = "/" project.ext.VISUAL_STUDIO_VCVARS_CMD = "UNKNOWN" project.ext.MSVC_SDK_VERSION = "UNKNOWN" @@ -62,12 +43,10 @@ if (org.gradle.internal.os.OperatingSystem.current().isWindows()) { project.ext.WINVER = "0x0601" // Rely on vcvars script to supply SDK versions - def c = VISUAL_STUDIO_VCVARS_CMD + " && env" - String envText = c.execute().text - String[] envLines = c.execute().text.split("\n") - project.ext.MSVC_SDK_VERSION = getEnvironmentValue(envLines, "WINDOWSSDKVERSION") + def COMMAND = "cmd /c ${VISUAL_STUDIO_VCVARS_CMD} > nul && cmd /c echo" + project.ext.MSVC_SDK_VERSION = "${COMMAND} %WINDOWSSDKVERSION%".execute().text.replace('\\', '') println "Visual Studio SDK Version: ${MSVC_SDK_VERSION}" - project.ext.MSVC_TOOLS_VERSION = getEnvironmentValue(envLines, "VCTOOLSVERSION") + project.ext.MSVC_TOOLS_VERSION = "${COMMAND} %VCTOOLSVERSION%".execute().text.replace('\\', '') println "Visual Studio VCTools Version: ${MSVC_TOOLS_VERSION}" } }