-
Notifications
You must be signed in to change notification settings - Fork 146
JDK-8211307: Add prefix to build tools paths #283
Changes from all commits
c2d6e43
8cf1e76
2e71bfa
e915f70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,9 @@ defineProperty("MACOSX_MIN_VERSION", "10.10"); | |
setupTools("mac_tools", | ||
{ propFile -> | ||
propFile << "" | ||
if (!file(defaultSdkPath).isDirectory()) { | ||
if (project.hasProperty('setupMacTools')) { | ||
setupMacTools(propFile) | ||
} else if (!file(defaultSdkPath).isDirectory()) { | ||
// Get list of all macosx sdks | ||
ByteArrayOutputStream results = new ByteArrayOutputStream(); | ||
exec { | ||
|
@@ -126,9 +128,15 @@ def linkFlags = [ | |
"-framework", "Security", | ||
"-dynamiclib", "-lobjc"].flatten(); | ||
|
||
def toolchainDir | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can toolchainDir be String instead of def ? |
||
if (hasProperty('toolchainDir')) { | ||
toolchainDir = ext.toolchainDir + "/" | ||
} else { | ||
toolchainDir = "" | ||
} | ||
|
||
def compiler = IS_COMPILE_PARFAIT ? "parfait-clang" : "clang"; | ||
def linker = IS_COMPILE_PARFAIT ? "parfait-clang++" : "clang++"; | ||
def compiler = IS_COMPILE_PARFAIT ? "parfait-clang" : "${toolchainDir}clang"; | ||
def linker = IS_COMPILE_PARFAIT ? "parfait-clang++" : "${toolchainDir}clang++"; | ||
|
||
MAC.glass = [:] | ||
MAC.glass.javahInclude = [ | ||
|
@@ -208,4 +216,8 @@ MAC.media.compiler = "${compiler} ${ccBaseFlags.join(" ")}" | |
//MAC.media.ccFlags = ccBaseFlags | ||
MAC.media.linker = "${linker} ${commonParams.join(" ")}" | ||
//MAC.media.linkFlags = commonParams | ||
MAC.media.ar = "libtool" | ||
MAC.media.ar = "${toolchainDir}libtool" | ||
|
||
MAC.webkit = [:] | ||
MAC.webkit.compiler = compiler | ||
MAC.webkit.linker = linker |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,28 +39,34 @@ WIN.library = { name -> return "${name}.dll" as String } | |
WIN.libDest = "bin" | ||
WIN.modLibDest = "lib" | ||
|
||
def CPU_BITS = IS_64 ? "x64" : "x86" | ||
|
||
setupTools("windows_tools", | ||
{ propFile -> | ||
// Create the properties file | ||
ByteArrayOutputStream results = new ByteArrayOutputStream(); | ||
String winsdkDir = System.getenv().get("WINSDK_DIR"); | ||
exec({ | ||
environment([ | ||
"WINSDKPATH" : winsdkDir == null ? "" : winsdkDir, | ||
"CONF" : "/$CONF", // TODO does this mean the generated properties must be reset when in a different configuration? | ||
"VCARCH" : IS_64 ? "amd64" : "x86", | ||
"SDKARCH" : IS_64 ? "/x64" : "/x86", | ||
]); | ||
commandLine("cmd", "/q", "/c", "buildSrc\\genVSproperties.bat"); | ||
setStandardOutput(results); | ||
}); | ||
BufferedReader reader = new BufferedReader(new StringReader(results.toString().trim())); | ||
reader.readLine(); | ||
reader.readLine(); | ||
String line; | ||
while ((line = reader.readLine()) != null && !line.startsWith("######")) { | ||
line = line.replace("\\", "/").replace("/@@ENDOFLINE@@", "").replace("@@ENDOFLINE@@", "").replace("//", "/").replace("windows.vs.", "WINDOWS_VS_"); | ||
propFile << line << "\r\n"; | ||
if (project.hasProperty('setupWinTools')) { | ||
setupWinTools(propFile) | ||
} else { | ||
// Create the properties file | ||
ByteArrayOutputStream results = new ByteArrayOutputStream(); | ||
String winsdkDir = System.getenv().get("WINSDK_DIR"); | ||
exec({ | ||
environment([ | ||
"WINSDKPATH" : winsdkDir == null ? "" : winsdkDir, | ||
"CONF" : "/$CONF", // TODO does this mean the generated properties must be reset when in a different configuration? | ||
"VCARCH" : IS_64 ? "amd64" : "x86", | ||
"SDKARCH" : IS_64 ? "/x64" : "/x86", | ||
]); | ||
commandLine("cmd", "/q", "/c", "buildSrc\\genVSproperties.bat"); | ||
setStandardOutput(results); | ||
}); | ||
BufferedReader reader = new BufferedReader(new StringReader(results.toString().trim())); | ||
reader.readLine(); | ||
reader.readLine(); | ||
String line; | ||
while ((line = reader.readLine()) != null && !line.startsWith("######")) { | ||
line = line.replace("\\", "/").replace("/@@ENDOFLINE@@", "").replace("@@ENDOFLINE@@", "").replace("//", "/").replace("windows.vs.", "WINDOWS_VS_"); | ||
propFile << line << "\r\n"; | ||
} | ||
} | ||
}, | ||
{ properties -> | ||
|
@@ -75,6 +81,7 @@ setupTools("windows_tools", | |
defineProperty("WINDOWS_DXSDK_DIR", properties, System.getenv().get("DXSDK_DIR")) | ||
defineProperty("WINDOWS_VS_INCLUDE", properties, "$WINDOWS_VS_VCINSTALLDIR/INCLUDE;" + "$WINDOWS_SDK_DIR/include;") | ||
defineProperty("WINDOWS_VS_VER", properties, "150") | ||
defineProperty("WINDOWS_CRT_VER", properties, "150") | ||
defineProperty("WINDOWS_VS_LIB", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;" + "$WINDOWS_SDK_DIR/lib;") | ||
defineProperty("WINDOWS_VS_LIBPATH", properties, "$WINDOWS_VS_VCINSTALLDIR/LIB;") | ||
def parfaitPath = IS_COMPILE_PARFAIT ? System.getenv().get("PARFAIT_PATH") + ";" : ""; | ||
|
@@ -133,10 +140,10 @@ ext.WINDOWS_NATIVE_COMPILE_ENVIRONMENT = [ | |
]; | ||
def msvcVer = System.getenv("MSVC_VER") ?: "14.10.25017" | ||
def msvcBinDir = "" | ||
if (winVsVer == 150) { | ||
msvcBinDir = (IS_64 | ||
? "$WINDOWS_VS_VSINSTALLDIR/VC/Tools/MSVC/$msvcVer/bin/HostX64/x64" | ||
: "$WINDOWS_VS_VSINSTALLDIR/VC/Tools/MSVC/$msvcVer/bin/HostX86/x86") | ||
if (hasProperty('toolchainDir')) { | ||
msvcBinDir = "$WINDOWS_VS_VSINSTALLDIR/VC/bin/$CPU_BITS" | ||
} else if (winVsVer == 150) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can compare with WINDOWS_CRT_VER ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This would be an intrusive and possibly risky change. Let's leave it as is for now. |
||
msvcBinDir = "$WINDOWS_VS_VSINSTALLDIR/VC/Tools/MSVC/$msvcVer/bin/Host${CPU_BITS}/$CPU_BITS" | ||
} else if (winVsVer <= 120) { | ||
msvcBinDir = (IS_64 | ||
? "$WINDOWS_VS_VSINSTALLDIR/VC/BIN/amd64" | ||
|
@@ -146,16 +153,15 @@ def compiler = IS_COMPILE_PARFAIT ? "cl.exe" : cygpath("$msvcBinDir/cl.exe") | |
def linker = IS_COMPILE_PARFAIT ? "link.exe" : cygpath("$msvcBinDir/link.exe") | ||
def winSdkBinDir = "$WINDOWS_SDK_DIR/Bin" | ||
if (WINDOWS_VS_VER != "100") { | ||
winSdkBinDir += "/" + (IS_64 ? "x64" : "x86") | ||
winSdkBinDir += "/$CPU_BITS" | ||
} | ||
|
||
if (!file(cygpath("$winSdkBinDir/RC.Exe")).exists()) { | ||
winSdkBinDir = "$WINDOWS_SDK_DIR/Bin/$WINDOWS_SDK_VERSION" | ||
if (WINDOWS_VS_VER != "100") { | ||
winSdkBinDir += "/" + (IS_64 ? "x64" : "x86") | ||
winSdkBinDir += "/$CPU_BITS" | ||
} | ||
} | ||
println "winSdkBinDir=$winSdkBinDir" | ||
|
||
ext.RC = cygpath("$winSdkBinDir/rc.exe") | ||
def rcCompiler = RC | ||
|
@@ -173,20 +179,21 @@ ext.MC = cygpath("$winSdkBinDir/mt.exe") | |
if (!file(RC).exists()) throw new GradleException("FAIL: cannot find RC: " + RC) | ||
if (!file(FXC).exists()) throw new GradleException("FAIL: cannot find FXC: " + FXC) | ||
|
||
def msvcRedistVer = System.getenv("MSVC_REDIST_VER") ?: "14.10.25008" | ||
String msvcRedstDir = (IS_64 | ||
? "$WINDOWS_VS_VSINSTALLDIR/VC/Redist/MSVC/$msvcRedistVer/x64" | ||
: "$WINDOWS_VS_VSINSTALLDIR/VC/Redist/MSVC/$msvcRedistVer/x86") | ||
def msvcRedstDir | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think msvcRedstDir can be still string ? I see that msvcRedstDir is not used outside of win.gradle and no need to be a def? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, as @kevinrushforth mentioned, it is nothing to do with the scope, it is almost equvalent to C++ auto / Java's var. |
||
if (hasProperty('toolchainDir')) { | ||
msvcRedstDir = "$WINDOWS_VS_VSINSTALLDIR/VC/Redist/$CPU_BITS" | ||
} else { | ||
def msvcRedistVer = System.getenv("MSVC_REDIST_VER") ?: "14.10.25008" | ||
msvcRedstDir = "$WINDOWS_VS_VSINSTALLDIR/VC/Redist/MSVC/$msvcRedistVer/$CPU_BITS" | ||
} | ||
|
||
String winSdkDllDir = (IS_64 | ||
? "$WINDOWS_VS_WINSDKDLLINSTALLDIR/x64" | ||
: "$WINDOWS_VS_WINSDKDLLINSTALLDIR/x86") | ||
def winSdkDllDir = "$WINDOWS_VS_WINSDKDLLINSTALLDIR/$CPU_BITS" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think winSdkDllDir can be a string.. |
||
|
||
def WINDOWS_DLL_VER = WINDOWS_VS_VER | ||
ext.MSVCR = null | ||
ext.MSVCP = null | ||
|
||
def windowsCRTVer = System.getenv("WINDOWS_CRT_VER") ?: "150" | ||
def windowsCRTVer = System.getenv("WINDOWS_CRT_VER") ?: WINDOWS_CRT_VER | ||
if (WINDOWS_VS_VER == "150") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you are replacing 150 with "WINDOWS_CRT_VER", you can do this at all places like if (WINDOWS_VS_VER == WINDOWS_CRT_VER) { There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are multiple versions need to be considered, 1. VS version, 2. CRT version & 3. DLL version. What we are comparing here is VS version, it should be kept as it is, otherwise it may cause issues when using older VS variants. |
||
WINDOWS_DLL_VER = "140" | ||
ext.MSVCR = cygpath("${msvcRedstDir}/Microsoft.VC${windowsCRTVer}.CRT/vcruntime${WINDOWS_DLL_VER}.dll") | ||
|
@@ -427,6 +434,8 @@ WIN.media.linker = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-link.exe" : "lin | |
WIN.media.ar = IS_COMPILE_PARFAIT ? "${parfaitPath}/parfait-lib.exe" : "lib.exe"; | ||
|
||
WIN.webkit = [:] | ||
WIN.webkit.compiler = compiler | ||
WIN.webkit.linker = linker | ||
WIN.webkit.rcCompiler = rcCompiler | ||
WIN.webkit.rcSource = defaultRcSource | ||
WIN.webkit.rcFlags = ["/d", "JFX_FNAME=jfxwebkit.dll", "/d", "JFX_INTERNAL_NAME=webkit", rcFlags].flatten(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can toolchainDir be String instead of def ?