diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..75db69e3 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,28 @@ +build: off + +init: + - git config --global core.autocrlf input + +install: + - SET JAVA_HOME=C:\Program Files\Java\jdk1.8.0 + - SET PATH=%JAVA_HOME%\bin;%PATH% + + - ps: | + Add-Type -AssemblyName System.IO.Compression.FileSystem + if (!(Test-Path -Path "C:\sbt" )) { + (new-object System.Net.WebClient).DownloadFile( + 'https://github.com/sbt/sbt/releases/download/v1.1.5/sbt-1.1.5.zip', + 'C:\sbt-bin.zip' + ) + [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\sbt-bin.zip", "C:\sbt") + } + - SET PATH=C:\sbt\sbt\bin;%PATH% + - SET SBT_VER=1.1.5 + - SET SBT_OPTS=-XX:MaxPermSize=2g -Xmx4g -Dfile.encoding=UTF8 -Dsbt.version=1.1.5 + - SET SCALA_VERSION=2.12.6 +test_script: + - sbt "++2.12.6 io/test" + +cache: + - '%USERPROFILE%\.ivy2\cache' + - '%USERPROFILE%\.sbt' diff --git a/io/src/main/scala/sbt/internal/io/Milli.scala b/io/src/main/scala/sbt/internal/io/Milli.scala index 47e041e7..22e094f1 100644 --- a/io/src/main/scala/sbt/internal/io/Milli.scala +++ b/io/src/main/scala/sbt/internal/io/Milli.scala @@ -17,7 +17,6 @@ import com.sun.jna.{ Native => JNANative } import com.sun.jna.Platform import com.sun.jna.platform.win32.Kernel32 -import com.sun.jna.platform.win32.WinNT.GENERIC_READ import com.sun.jna.platform.win32.WinNT.FILE_SHARE_READ import com.sun.jna.platform.win32.WinNT.FILE_SHARE_WRITE import com.sun.jna.platform.win32.WinNT.FILE_SHARE_DELETE @@ -30,6 +29,7 @@ import com.sun.jna.platform.win32.WinBase.INVALID_HANDLE_VALUE import com.sun.jna.platform.win32.WinBase.FILETIME import com.sun.jna.platform.win32.WinError.ERROR_FILE_NOT_FOUND import com.sun.jna.platform.win32.WinError.ERROR_PATH_NOT_FOUND +import com.sun.jna.platform.win32.WinError.ERROR_ACCESS_DENIED import sbt.io.JavaMilli import sbt.internal.io.MacJNA._ @@ -285,6 +285,8 @@ private object WinMilli extends MilliNative[FILETIME] { val err = GetLastError() if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) throw new FileNotFoundException("Not found: " + lpFileName) + else if (err == ERROR_ACCESS_DENIED) + throw new FileNotFoundException("Access denied: " + lpFileName) else throw new IOException("CreateFile() failed with error " + GetLastError()) } diff --git a/io/src/test/scala/sbt/internal/io/SourceModificationWatchSpec.scala b/io/src/test/scala/sbt/internal/io/SourceModificationWatchSpec.scala index c61841ed..fe5537ed 100644 --- a/io/src/test/scala/sbt/internal/io/SourceModificationWatchSpec.scala +++ b/io/src/test/scala/sbt/internal/io/SourceModificationWatchSpec.scala @@ -360,8 +360,10 @@ abstract class SourceModificationWatchSpec( // Longer timeout because there are many file system operations. This can be very expensive // especially in the PollingWatchSpec since both the PollingWatchService and the EventMonitor // overflow handler are hammering the file system. To minimize the conflicts, we set a long - // interval between polls in the PollingWatchService using getServiceWithPollDelay. - val deadline = 20.seconds.fromNow + // interval between polls in the PollingWatchService using getServiceWithPollDelay. The + // timeout was increased from 20.seconds to 40.seconds to address transient failures of + // this test on Appveyor windows builds. + val deadline = 40.seconds.fromNow val monitor = defaultMonitor(getServiceWithPollDelay(1.second), parentDir, tc = () => deadline.isOverdue) try {