Ghidra is a software reverse engineering (SRE) framework
GT-3304: Do not require Visual Studio do be installed to get past configuration phase.
Ryan Kurtz0a58b856a2cb
diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradleindex 75ee3492d0..759e2c0ceb 100644--- a/GPL/nativeBuildProperties.gradle+++ b/GPL/nativeBuildProperties.gradle@@ -49,11 +49,9 @@ task CheckToolChain {// Native C/Cpp plugins will trigger failure if no tool chain founddoFirst {if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {- // ensure that required MS Visual Studio is installed where expected- String msg = "Microsoft Visual Studio install not found: ${VISUAL_STUDIO_INSTALL_DIR}\n" +- "Adjust path in Ghidra/GPL/vsconfig.gradle if needed."- if (!file(VISUAL_STUDIO_INSTALL_DIR).exists()) {- throw new GradleException(msg);+ // ensure that required MS Visual Studio is installed+ if (!VISUAL_STUDIO_INSTALL_DIR) {+ throw new GradleException("Visual Studio not found!");}}}diff --git a/GPL/vsconfig.gradle b/GPL/vsconfig.gradleindex 4fee5e68cf..a3e4d3c6d8 100644--- a/GPL/vsconfig.gradle+++ b/GPL/vsconfig.gradle@@ -13,17 +13,27 @@ if (!hasProperty("VISUAL_STUDIO_INSTALL_DIR")) {def configureVisualStudio() {if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {++ // Initialize variables+ rootProject.ext.VISUAL_STUDIO_INSTALL_DIR = ""+ rootProject.ext.VISUAL_STUDIO_TOOLS_VERSION_DEFAULT = ""+ rootProject.ext.VISUAL_STUDIO_SDK_DIR_DEFAULT = ""+ rootProject.ext.VISUAL_STUDIO_SDK_VERSION_DEFAULT = ""+ rootProject.ext.VISUAL_STUDIO_SDK_VERSION_OVERRIDE = ""+ rootProject.ext.VISUAL_STUDIO_VCVARS_CMD = ""// Use vswhere.exe to search for latest Visual Studio installationprintln "Searching for latest Visual Studio and required components..."def vswherePath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe"if (!file(vswherePath).exists()) {- throw new GradleException("Required file does not exist: " + vswherePath);+ println "Visual Studio not found!"+ return}def vswhereOutput = "${vswherePath} -latest -format json".execute().text.trim()def vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput);if (vswhereJson.isEmpty()) {- throw new GradleException("Failed to find Visual Studio!")+ println "Visual Studio not found!"+ return}def vsInstallDir = vswhereJson[0].installationPathprintln " -> Installation Directory: ${vsInstallDir}"diff --git a/Ghidra/Features/PDB/build.gradle b/Ghidra/Features/PDB/build.gradleindex 9e4e4d4d88..8afedd266e 100644--- a/Ghidra/Features/PDB/build.gradle+++ b/Ghidra/Features/PDB/build.gradle@@ -43,19 +43,21 @@ if ("win64".equals(getCurrentPlatformName())) {String makeName = "win64PDBMake"task(type: Exec, makeName) {-+def projectPath = projectDir.toString()def solutionBatchFilePath = projectPath + "/build/buildSolution.bat"-def projectPathWindows = projectPath.replace("/", File.separator)def solutionPathWindows = "${projectPathWindows}\\src\\pdb\\pdb.sln"- def platformToolset = 'v' + VISUAL_STUDIO_TOOLS_VERSION_DEFAULT.substring(0, 4).replace('.', '');- def windowsTargetPlatformVersion = VISUAL_STUDIO_SDK_VERSION_OVERRIDE ?: VISUAL_STUDIO_SDK_VERSION_DEFAULTdoFirst {file("build/os/win64").mkdirs()++ def platformToolset = 'v' + VISUAL_STUDIO_TOOLS_VERSION_DEFAULT.substring(0, 4).replace('.', '');+ def windowsTargetPlatformVersion = VISUAL_STUDIO_SDK_VERSION_OVERRIDE ?: VISUAL_STUDIO_SDK_VERSION_DEFAULTdef msbuildCmd = "msbuild ${solutionPathWindows} /p:Configuration=Release /p:PlatformToolset=${platformToolset} /p:WindowsTargetPlatformVersion=${windowsTargetPlatformVersion}"+println "Executing: " + msbuildCmd+new File(solutionBatchFilePath).withWriter { out ->out.println "call " + VISUAL_STUDIO_VCVARS_CMDout.println msbuildCmd