changeset 11169:b74c8b1663d4

Merge
author kcr
date Tue, 20 Nov 2018 08:28:24 -0800
parents 4c654ceb8691 6859462e6792
children e73298e8e943 8d0b833ea001
files
diffstat 14 files changed, 149 insertions(+), 124 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Nov 01 06:19:10 2018 -0700
+++ b/.hgtags	Tue Nov 20 08:28:24 2018 -0800
@@ -512,3 +512,4 @@
 5815764071f022f4595e3fb69ae7f79c6edd4fc1 11+25
 9b5708c95686aedd1f7722ccda602dce4a4b2417 11+26
 2ad71d6fd12f5a1f485562fa2807e091b7296e05 12+1
+8ce178fd5f6f103b10f6e8f5f4f161a2e0831242 12+2
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/area/audio/AudioAreaChartApp.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/area/audio/AudioAreaChartApp.java	Tue Nov 20 08:28:24 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates.
  * All rights reserved. Use is subject to license terms.
  *
  * This file is available and licensed under the following license:
@@ -67,7 +67,7 @@
     private XYChart.Data<Number, Number>[] series1Data;
     private AudioSpectrumListener audioSpectrumListener;
     private static final String AUDIO_URI = System.getProperty("demo.audio.url",
-            "http://download.oracle.com/otndocs/javafx/JavaRap_Audio.mp4");
+            "https://download.oracle.com/otndocs/javafx/JavaRap_Audio.mp4");
     private MediaPlayer audioMediaPlayer;
     private static final boolean PLAY_AUDIO = Boolean.parseBoolean(
             System.getProperty("demo.play.audio", "true"));
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/bar/audio/AudioBarChartApp.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/charts/bar/audio/AudioBarChartApp.java	Tue Nov 20 08:28:24 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates.
  * All rights reserved. Use is subject to license terms.
  *
  * This file is available and licensed under the following license:
@@ -72,7 +72,7 @@
     private AudioSpectrumListener audioSpectrumListener;
     private static final String AUDIO_URI =
         System.getProperty("demo.audio.url",
-            "http://download.oracle.com/otndocs/products/javafx/oow2010-2.mp4");
+            "https://download.oracle.com/otndocs/products/javafx/oow2010-2.mp4");
     private MediaPlayer audioMediaPlayer;
     private static final boolean PLAY_AUDIO = Boolean.parseBoolean(
             System.getProperty("demo.play.audio", "true"));
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/advancedmedia/AdvancedMediaApp.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/advancedmedia/AdvancedMediaApp.java	Tue Nov 20 08:28:24 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates.
  * All rights reserved. Use is subject to license terms.
  *
  * This file is available and licensed under the following license:
@@ -55,7 +55,7 @@
 public class AdvancedMediaApp extends Application {
 
     private static final String MEDIA_URL =
-        "http://download.oracle.com/otndocs/products/javafx/oow2010-2.mp4";
+        "https://download.oracle.com/otndocs/products/javafx/oow2010-2.mp4";
 
     private MediaPlayer mediaPlayer;
     private MediaControl mediaControl;
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/overlaymediaplayer/OverlayMediaPlayerApp.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/overlaymediaplayer/OverlayMediaPlayerApp.java	Tue Nov 20 08:28:24 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates.
  * All rights reserved. Use is subject to license terms.
  *
  * This file is available and licensed under the following license:
@@ -60,7 +60,7 @@
 
     public Parent createContent() {
         final String MEDIA_URL =
-            "http://download.oracle.com/otndocs/javafx/" +
+            "https://download.oracle.com/otndocs/javafx/" +
             "JavaRap_ProRes_H264_768kbit_Widescreen.mp4";
         final String overlayMediaPlayerCss =
             getClass().getResource("OverlayMediaPlayer.css").toExternalForm();
--- a/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/streamingmediaplayer/StreamingMediaPlayerApp.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/apps/samples/Ensemble8/src/samples/java/ensemble/samples/media/streamingmediaplayer/StreamingMediaPlayerApp.java	Tue Nov 20 08:28:24 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates.
  * All rights reserved. Use is subject to license terms.
  *
  * This file is available and licensed under the following license:
@@ -59,7 +59,7 @@
 
     public Parent createContent() {
         final String MEDIA_URL =
-            "http://download.oracle.com/otndocs/javafx/" +
+            "https://download.oracle.com/otndocs/javafx/" +
             "JavaRap_ProRes_H264_768kbit_Widescreen.mp4";
         final String streamingMediaPlayerCss =
             getClass().getResource("StreamingMediaPlayer.css").toExternalForm();
--- a/apps/toys/Hello/src/main/java/hello/HelloMedia.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/apps/toys/Hello/src/main/java/hello/HelloMedia.java	Tue Nov 20 08:28:24 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 
 public class HelloMedia extends Application {
     private static final String DEFAULT_SOURCE =
-        "http://download.oracle.com/otndocs/products/javafx/oow2010-2.mp4";
+        "https://download.oracle.com/otndocs/products/javafx/oow2010-2.mp4";
     private static String argSource = null;
 
     @Override
--- a/modules/javafx.graphics/src/main/native-glass/mac/GlassTouches.m	Thu Nov 01 06:19:10 2018 -0700
+++ b/modules/javafx.graphics/src/main/native-glass/mac/GlassTouches.m	Tue Nov 20 08:28:24 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,21 +107,30 @@
 static CGEventRef listenTouchEvents(CGEventTapProxy proxy, CGEventType type,
                              CGEventRef event, void* refcon)
 {
-    if (type == kCGEventTapDisabledByTimeout)
-    {   // OS may disable event tap if it handles events too slowly.
+    if (type == kCGEventTapDisabledByTimeout ||
+        type == kCGEventTapDisabledByUserInput)
+    {
+        // OS may disable event tap if it handles events too slowly
+        // or for some other reason based on user input.
         // This is undesirable, so enable event tap after such a reset.
         [glassTouches enableTouchInputEventTap];
-        LOG("TOUCHES: listenTouchEvents: recover after timeout\n");
+        LOG("TOUCHES: listenTouchEvents: re-enable event tap, type = %d\n", type);
         return event;
     }
 
-    NSEvent* theEvent = [NSEvent eventWithCGEvent:event];
-    if (theEvent)
+    if (type == NSEventTypeGesture)
     {
-        if (glassTouches)
+        LOG("TOUCHES: listenTouchEvents: process NSEventTypeGesture\n");
+        NSEvent* theEvent = [NSEvent eventWithCGEvent:event];
+        if (theEvent)
         {
-            [glassTouches sendJavaTouchEvent:theEvent];
+            if (glassTouches)
+            {
+                [glassTouches sendJavaTouchEvent:theEvent];
+            }
         }
+    } else {
+        LOG("TOUCHES: listenTouchEvents: unknown event ignored, type = %d\n", type);
     }
 
     return event;
--- a/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m	Thu Nov 01 06:19:10 2018 -0700
+++ b/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m	Tue Nov 20 08:28:24 2018 -0800
@@ -425,8 +425,8 @@
     jdouble rotationY = 0.0;
     if (type == com_sun_glass_events_MouseEvent_WHEEL)
     {
-        rotationX = (jdouble)[theEvent deltaX];
-        rotationY = (jdouble)[theEvent deltaY];
+        rotationX = (jdouble)[theEvent scrollingDeltaX] * 0.1;
+        rotationY = (jdouble)[theEvent scrollingDeltaY] * 0.1;
 
         //XXX: check for equality for doubles???
         if (rotationX == 0.0 && rotationY == 0.0)
--- a/modules/javafx.web/src/main/native/Source/WebCore/platform/network/java/URLLoader.cpp	Thu Nov 01 06:19:10 2018 -0700
+++ b/modules/javafx.web/src/main/native/Source/WebCore/platform/network/java/URLLoader.cpp	Tue Nov 20 08:28:24 2018 -0800
@@ -419,12 +419,11 @@
         response.setHTTPStatusCode(status);
     }
 
-    // Fix for RT-13802: If the mime type is not specified
-    // and the expected content length is 0 or not specified,
+    // Fix for RT-13802: If the mime type is not specified,
     // set the mime type to "text/html" as e.g. the CF port
     // does
     String contentTypeString(env, contentType);
-    if (contentTypeString.isEmpty() && contentLength <= 0) {
+    if (contentTypeString.isEmpty()) {
         contentTypeString = "text/html";
     }
     if (!contentTypeString.isEmpty()) {
--- a/tests/system/src/test/java/test/javafx/scene/web/HTMLEditorTest.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/tests/system/src/test/java/test/javafx/scene/web/HTMLEditorTest.java	Tue Nov 20 08:28:24 2018 -0800
@@ -25,7 +25,7 @@
 
 package test.javafx.scene.web;
 
-import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import javafx.application.Application;
@@ -38,17 +38,16 @@
 import javafx.scene.web.WebView;
 import javafx.stage.Stage;
 import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 import test.util.Util;
 
 import static javafx.concurrent.Worker.State.SUCCEEDED;
-import static junit.framework.TestCase.fail;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static test.util.Util.TIMEOUT;
 
 public class HTMLEditorTest {
     private static final CountDownLatch launchLatch = new CountDownLatch(1);
@@ -85,14 +84,7 @@
         new Thread(() -> Application.launch(HTMLEditorTestApp.class,
             (String[]) null)).start();
 
-        try {
-            if (!launchLatch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
-                fail("Timeout waiting for FX runtime to start");
-            }
-        } catch (InterruptedException exception) {
-            fail("Unexpected exception: " + exception);
-        }
-
+        assertTrue("Timeout waiting for FX runtime to start", Util.await(launchLatch));
     }
 
     @AfterClass
@@ -100,6 +92,22 @@
         Platform.exit();
     }
 
+    @Before
+    public void setupTestObjects() {
+        Platform.runLater(() -> {
+            htmlEditor = new HTMLEditor();
+            Scene scene = new Scene(htmlEditor);
+            htmlEditorTestApp.primaryStage.setScene(scene);
+            htmlEditorTestApp.primaryStage.show();
+
+            webView = (WebView) htmlEditor.lookup(".web-view");
+            assertNotNull(webView);
+            // Cancel the existing load to make our stateProperty listener
+            // usable
+            webView.getEngine().getLoadWorker().cancel();
+        });
+    }
+
     /**
      * @test
      * @bug 8090011
@@ -110,14 +118,21 @@
     // re-enabling this test case.
     @Test @Ignore("JDK-8202542")
     public void checkFocusChange() throws Exception {
-        final CountDownLatch editorStateLatch = new CountDownLatch(2);
-        final AtomicBoolean result = new AtomicBoolean(false);
+        final CountDownLatch editorStateLatch = new CountDownLatch(1);
+        final AtomicReference<String> result = new AtomicReference<>();
         Platform.runLater(() -> {
-            HTMLEditor htmlEditor = new HTMLEditor();
-            Scene scene = new Scene(htmlEditor);
-            htmlEditorTestApp.primaryStage.setScene(scene);
-            WebView webView = (WebView)htmlEditor.lookup(".web-view");
-            assertNotNull(webView);
+            webView.getEngine().getLoadWorker().stateProperty().
+                addListener((observable, oldValue, newValue) -> {
+                if (newValue == SUCCEEDED) {
+                    webView.getEngine().executeScript(
+                        "document.body.style.backgroundColor='red';" +
+                        "document.body.onfocusout = function() {" +
+                        "document.body.style.backgroundColor = 'yellow';" +
+                        "}");
+                    htmlEditor.requestFocus();
+                }
+            });
+            htmlEditor.setHtmlText(htmlEditor.getHtmlText());
 
             KeyEvent tabKeyEvent = new KeyEvent(null, webView,
                                 KeyEvent.KEY_PRESSED, "", "",
@@ -132,36 +147,18 @@
                     for (int i = 0; i < 10; ++i) {
                         Event.fireEvent(webView, tabKeyEvent);
                     }
-                    result.set("red".equals(webView.getEngine().
+                    result.set(webView.getEngine().
                         executeScript("document.body.style.backgroundColor").
-                        toString()));
+                        toString());
                     htmlEditorTestApp.primaryStage.hide();
                     editorStateLatch.countDown();
                 }
             });
 
-            webView.getEngine().getLoadWorker().stateProperty().
-                addListener((observable, oldValue, newValue) -> {
-                if (newValue == SUCCEEDED) {
-                    webView.getEngine().executeScript(
-                        "document.body.style.backgroundColor='red';" +
-                        "document.body.onfocusout = function() {" +
-                        "document.body.style.backgroundColor = 'yellow';" +
-                        "}");
-                    htmlEditor.requestFocus();
-                    editorStateLatch.countDown();
-                }
-            });
-            htmlEditorTestApp.primaryStage.show();
         });
 
-        try {
-            editorStateLatch.await(TIMEOUT, TimeUnit.MILLISECONDS);
-        } catch (InterruptedException ex) {
-            throw new AssertionError(ex);
-        } finally {
-            assertTrue("Focus Change with design mode enabled ", result.get());
-        }
+        assertTrue("Timeout when waiting for focus change ", Util.await(editorStateLatch));
+        assertEquals("Focus Change with design mode enabled ", "red", result.get());
     }
 
     /**
@@ -171,7 +168,7 @@
      */
     @Test
     public void checkStyleWithCSS() throws Exception {
-        final CountDownLatch editorStateLatch = new CountDownLatch(2);
+        final CountDownLatch editorStateLatch = new CountDownLatch(1);
         final String editorCommand1 =
             "document.execCommand('bold', false, 'true');" +
             "document.execCommand('italic', false, 'true');" +
@@ -192,10 +189,13 @@
             "font-style: italic;\">Hello World</span></body></html>";
 
         Util.runAndWait(() -> {
-            htmlEditor = new HTMLEditor();
-            Scene scene = new Scene(htmlEditor);
-            htmlEditorTestApp.primaryStage.setScene(scene);
-            webView = (WebView)htmlEditor.lookup(".web-view");
+            webView.getEngine().getLoadWorker().stateProperty().
+                addListener((observable, oldValue, newValue) -> {
+                if (newValue == SUCCEEDED) {
+                    htmlEditor.requestFocus();
+                }
+            });
+            htmlEditor.setHtmlText(htmlEditor.getHtmlText());
             assertNotNull(webView);
 
             webView.focusedProperty().
@@ -205,23 +205,9 @@
                 }
             });
 
-            webView.getEngine().getLoadWorker().stateProperty().
-                addListener((observable, oldValue, newValue) -> {
-                if (newValue == SUCCEEDED) {
-                    htmlEditor.requestFocus();
-                    editorStateLatch.countDown();
-                }
-            });
-            htmlEditorTestApp.primaryStage.show();
         });
 
-        try {
-            if (!editorStateLatch.await(TIMEOUT, TimeUnit.MILLISECONDS)) {
-                throw new AssertionError("Timeout waiting for callbacks");
-            }
-        } catch (InterruptedException ex) {
-            throw new AssertionError(ex);
-        }
+        assertTrue("Timeout when waiting for focus change ", Util.await(editorStateLatch));
 
         Util.runAndWait(() -> {
             webView.getEngine().executeScript("document.body.focus();");
@@ -274,23 +260,17 @@
      */
     @Test
     public void checkStyleProperty() throws Exception {
-        final CountDownLatch editorStateLatch = new CountDownLatch(2);
-        final AtomicBoolean result = new AtomicBoolean(false);
-        Platform.runLater(() -> {
-            HTMLEditor htmlEditor = new HTMLEditor();
-            Scene scene = new Scene(htmlEditor);
-            htmlEditorTestApp.primaryStage.setScene(scene);
-            htmlEditor.setHtmlText("<html>" +
-                "<head>" +
-                "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" +
-                "</head>" +
-                "<body style=\"font-weight: bold\">" +
-                "<p>Test</p>" +
-                "</body>" +
-                "</html>");
+        final CountDownLatch editorStateLatch = new CountDownLatch(1);
+        final AtomicReference<String> result = new AtomicReference<>();
+        Util.runAndWait(() -> {
+            webView.getEngine().getLoadWorker().stateProperty().
+                addListener((observable, oldValue, newValue) -> {
+                if (newValue == SUCCEEDED) {
+                    htmlEditor.requestFocus();
+                }
+            });
 
-            WebView webView = (WebView)htmlEditor.lookup(".web-view");
-            assertNotNull(webView);
+            htmlEditor.setHtmlText("<body style='font-weight: bold'> <p> Test </p> </body>");
 
             webView.focusedProperty().
                 addListener((observable, oldValue, newValue) -> {
@@ -301,30 +281,17 @@
                         executeScript("document.execCommand('selectAll', false, 'true');");
                     webView.getEngine().
                         executeScript("document.execCommand('removeFormat', false, null);");
-                    result.set("bold".equals(webView.getEngine().
+                    result.set(webView.getEngine().
                         executeScript("document.body.style.fontWeight").
-                        toString()));
-                    htmlEditorTestApp.primaryStage.hide();
+                        toString());
                     editorStateLatch.countDown();
                 }
             });
 
-            webView.getEngine().getLoadWorker().stateProperty().
-                addListener((observable, oldValue, newValue) -> {
-                if (newValue == SUCCEEDED) {
-                    htmlEditor.requestFocus();
-                    editorStateLatch.countDown();
-                }
-            });
-            htmlEditorTestApp.primaryStage.show();
         });
 
-        try {
-            editorStateLatch.await(TIMEOUT, TimeUnit.MILLISECONDS);
-        } catch (InterruptedException ex) {
-            throw new AssertionError(ex);
-        } finally {
-            assertTrue("check Style Property with removeFormat ", result.get());
-        }
+        assertTrue("Timeout when waiting for focus change ", Util.await(editorStateLatch));
+        assertNotNull("result must have a valid reference ", result.get());
+        assertEquals("document.body.style.fontWeight must be bold ", "bold", result.get());
     }
 }
--- a/tests/system/src/test/java/test/robot/javafx/web/TooltipFXTest.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/tests/system/src/test/java/test/robot/javafx/web/TooltipFXTest.java	Tue Nov 20 08:28:24 2018 -0800
@@ -31,6 +31,7 @@
 import javafx.application.Application;
 import javafx.application.Platform;
 import javafx.concurrent.Worker;
+import javafx.scene.input.MouseButton;
 import javafx.scene.layout.BorderPane;
 import javafx.scene.paint.Color;
 import javafx.scene.Scene;
@@ -144,7 +145,11 @@
         }
 
         Util.runAndWait(() -> {
-            robot.mouseMove(0, 0);
+            // Note that we need to click somewhere in the Stage to make sure
+            // we will get focus on the Windows platform.
+            robot.mouseMove((int)(scene.getWindow().getX() + scene.getX()),
+                (int)(scene.getWindow().getY() + scene.getY()));
+            robot.mouseClick(MouseButton.PRIMARY);
         });
 
         Util.sleep(SLEEP_TIME);
--- a/tests/system/src/test/java/test/util/Util.java	Thu Nov 01 06:19:10 2018 -0700
+++ b/tests/system/src/test/java/test/util/Util.java	Tue Nov 20 08:28:24 2018 -0800
@@ -76,6 +76,14 @@
         } catch (InterruptedException ex) {}
     }
 
+    public static boolean await(final CountDownLatch latch) {
+        try {
+            return latch.await(TIMEOUT, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException ex) {
+            throw new AssertionError(ex);
+        }
+    }
+
     private static Future submit(final Runnable r, final CountDownLatch delayLatch) {
         final Throwable[] testError = new Throwable[1];
         final CountDownLatch latch = new CountDownLatch(1);
--- a/tools/scripts/build.ps1	Thu Nov 01 06:19:10 2018 -0700
+++ b/tools/scripts/build.ps1	Tue Nov 20 08:28:24 2018 -0800
@@ -1,14 +1,51 @@
 choco install ant
 choco install vswhere
 choco install zip
-$env:WINSDK_DIR = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots").KitsRoot10
-$env:VCINSTALLDIR = "$(vswhere -legacy -latest -property installationPath)\VC\Auxiliary\Build"
+
+$vsRoot = "$(vswhere -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath)"
+if ([string]::IsNullOrWhitespace($vsRoot)) {
+  $vs = "$(vswhere -latest -property installationPath)"
+  if ([string]::IsNullOrWhitespace($vs)) {
+    choco install visualstudio2017community
+    choco install visualstudio2017-workload-nativedesktop
+  }
+  else {
+    choco install visualstudio2017-workload-nativedesktop
+  }
+  $vsRoot = "$(vswhere -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath)"
+}
+
+$winSdk = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots").KitsRoot10 2>$null
+if ([string]::IsNullOrWhitespace($winSdk)) {
+  choco install windows-sdk-7.1
+  $winSdk = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots" -ErrorAction Stop).KitsRoot10) 
+}
+
+# Cygwin required for chmod
+$cygwinPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Cygwin\setup").rootdir 2>$null
+if ([string]::IsNullOrWhitespace($cygwinPath)) {
+  choco install cygwin
+  $cygwinPath = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Cygwin\setup"  -ErrorAction Stop).rootdir
+}
+
+if ($env:Path -NotLike "*$($cygwinPath)*") {
+  $env:Path += ";$($cygwinPath)\bin"
+}
+$env:WINSDK_DIR = $winSdk
+$env:VCINSTALLDIR = "$($vsRoot)\VC\Auxiliary\Build"
+
 $msvcToolsVer = Get-Content "$env:VCINSTALLDIR\Microsoft.VCToolsVersion.default.txt"
+$msvcRedistVer = Get-Content "$env:VCINSTALLDIR\Microsoft.VCRedistVersion.default.txt"
 if ([string]::IsNullOrWhitespace($msvcToolsVer)) {
   # The MSVC tools version file can have txt *or* props extension.
   $msvcToolsVer = Get-Content "$env:VCINSTALLDIR\Microsoft.VCToolsVersion.default.props"
 }
 $env:MSVC_VER = $msvcToolsVer
+$env:MSVC_REDIST_VER = $msvcRedistVer
+
+$files = Get-ChildItem "$($vsRoot)\VC\Redist\MSVC\$($msvcRedistVer)\x86\*.CRT\"
+$env:WINDOWS_CRT_VER = $files[0].Name.replace("Microsoft.VC","").replace(".CRT","")
+
 $env:VS150COMNTOOLS = $env:VCINSTALLDIR
 $env:VSVARS32FILE = "$env:VCINSTALLDIR\vcvars32.bat"
 refreshenv
@@ -18,6 +55,5 @@
     exit $lastexitcode
   }
 } else {
-  .\gradlew all test -PCOMPILE_WEBKIT=false -PCONF=DebugNative --stacktrace -x :web:test --info
+  .\gradlew all test -PCOMPILE_WEBKIT=false -PCONF=Debug --stacktrace -x :web:test --info --no-daemon
 }
-