External dependencies: better defining target arch on Windows

This commit is contained in:
Alexander Zolotov
2017-04-06 10:36:59 +03:00
parent f98dfd01e7
commit 3087bf2cd0
2 changed files with 4 additions and 3 deletions

View File

@@ -26,7 +26,7 @@ project.ext.targetOs = "${System.getProperty("intellij.build.target.os", "all")}
task downloadJdk18 { task downloadJdk18 {
def os = org.gradle.internal.os.OperatingSystem.current() def os = org.gradle.internal.os.OperatingSystem.current()
def arch = !os.isWindows() || !os.nativePrefix.endsWith('x86') ? 'x64' : 'x86' def arch = !os.isWindows() || System.getenv("ProgramFiles(x86)") != null ? 'x64' : 'x86'
def platform = currentPlatformName() def platform = currentPlatformName()
def artifactName = "jbsdk8${jdkBuild}_${platform}_${arch}.tar.gz" def artifactName = "jbsdk8${jdkBuild}_${platform}_${arch}.tar.gz"
@@ -132,7 +132,7 @@ def intellijProjectDir() {
static def jdk16Version() { static def jdk16Version() {
def os = org.gradle.internal.os.OperatingSystem.current() def os = org.gradle.internal.os.OperatingSystem.current()
if (os.isWindows()) { if (os.isWindows()) {
def suffix = os.nativePrefix.endsWith('x86') ? "i586" : "x64" def suffix = System.getenv("ProgramFiles(x86)") != null ? "x64" : "i586"
return "6.45:windows_$suffix" return "6.45:windows_$suffix"
} }
else if (os.isMacOsX()) { else if (os.isMacOsX()) {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import org.apache.tools.ant.BuildException
target(default: "Unpack JDKs") { target(default: "Unpack JDKs") {
def workingDirectory = getDependenciesProjectDir() def workingDirectory = getDependenciesProjectDir()
@@ -24,7 +25,7 @@ target(default: "Unpack JDKs") {
process.consumeProcessErrorStream((OutputStream)System.err) process.consumeProcessErrorStream((OutputStream)System.err)
process.waitFor() process.waitFor()
if (process.exitValue() != 0) { if (process.exitValue() != 0) {
projectBuilder.error("Cannot unpack JDK") throw new BuildException("Cannot unpack JDK")
} }
} }