Skip to content

Test Appveyor integration #5531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
72ef612
fix exception 'UnmappableCharacterException' in dottydoc on Windows
Nov 12, 2018
0f94c25
add batch scripts to build Dotty distro on Windows
Nov 12, 2018
36f6108
small improvements in batch scripts for Dotty 0.10
Nov 13, 2018
0717827
improved subcommands in build.bat
Nov 13, 2018
4e57388
move batch scripts for distro to correct directory
Nov 13, 2018
728cdff
fix goto label and help handling in batch scripts
Nov 13, 2018
52a4766
added batch scripts for sbt pack
Nov 13, 2018
89437fb
remove debug code
Nov 14, 2018
d30ef54
Merge branch 'master' of https://github.com/lampepfl/dotty
Nov 14, 2018
3455189
improved error messages in batch scripts
michelou Nov 14, 2018
28b4c04
reverted commits up to 72ef612 (PR #5430)
michelou Nov 14, 2018
6688ea6
added batch scripts for a new PR
michelou Nov 14, 2018
205fab5
removed debug code from batch scripts
michelou Nov 14, 2018
a6df702
added compile subcommand to batch script
michelou Nov 14, 2018
211ce5d
add -timer option, fix args subroutine
michelou Nov 16, 2018
221a31e
updated help text in build.bat
michelou Nov 22, 2018
09b8c18
fixed file separator in build.bat
michelou Nov 25, 2018
eb49bd2
fixed undefined variable (thanks to @liufengyun)
michelou Nov 26, 2018
3a00a89
fixed handling of jvm opts
michelou Nov 26, 2018
3ed96b8
Merge remote-tracking branch 'origin/master' into batch-files
michelou Nov 29, 2018
d789e52
Merge remote-tracking branch 'upstream/master' into batch-files
michelou Nov 30, 2018
205c693
sync tests in :cmdTests subroutine with shell script
michelou Nov 30, 2018
f96f1d7
Merge remote-tracking branch 'upstream/master' into batch-files
michelou Dec 2, 2018
169a40b
renamed variable (Oracle's JVM knows _JAVA_OPTIONS !)
michelou Dec 2, 2018
675750f
Merge remote-tracking branch 'upstream/master' into batch-files
michelou Dec 2, 2018
7f79714
fixed call instruction in bin/common.bat
michelou Dec 3, 2018
654eb22
splitted build.bat into several parts (same as bash scripts)
michelou Dec 3, 2018
b1af46c
added missing ERRORLEVEL tests
michelou Dec 3, 2018
1c721d8
Fix window path
liufengyun Dec 3, 2018
a5e60dd
Fix window path in ClassPath
liufengyun Dec 3, 2018
769233a
More fix for window path
liufengyun Dec 3, 2018
7727d51
Refactor without using JFile.separator (thanks @michelou)
liufengyun Dec 4, 2018
4b5a2bb
added missing classpath option
michelou Dec 5, 2018
0ff65a5
Address review
liufengyun Dec 5, 2018
455908a
Merge remote-tracking branch 'upstream/master' into batch-files
michelou Dec 5, 2018
0a7ffbc
More path fixes
liufengyun Dec 6, 2018
0c3e55b
Path fix for doc-tool and QuoteDriver
liufengyun Dec 9, 2018
0b84729
Add Appveyor integration
liufengyun Dec 5, 2018
eea9da9
Fix batch scripts
liufengyun Dec 9, 2018
0189587
Merge branch 'path-fix' into michelou-batch-files
liufengyun Dec 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '{build}'
os: Windows Server 2012
install:
- cmd: choco install sbt -ia "INSTALLDIR=""C:\sbt"""
- cmd: SET PATH=C:\MinGW\msys\1.0\bin;C:\sbt\bin;%JAVA_HOME%\bin;%PATH%
clone_depth: 50
build_script:
- cd %APPVEYOR_BUILD_FOLDER%
- git submodule update --init --recursive --depth 50 --jobs 3
- git show
- pwd
- sbt "dotty-bootstrapped/compile"
test_script:
- pwd
# - bash project/scripts/sbt test
# - bash project/scripts/sbt "dotty-bootstrapped/test"
# - bash project/scripts/sbt "dotty-bootstrapped/testCompilation"
# - cmd: project/scripts/cmdTests.bat
- cmd: project/scripts/bootstrapCmdTests.bat
cache:
- C:\sbt\
- C:\Users\appveyor\.ivy2
8 changes: 6 additions & 2 deletions bench/src/main/scala/Benchmarks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ object Bench {
val iterations = if (intArgs.length > 1) intArgs(1).toInt else 20
val forks = if (intArgs.length > 2) intArgs(2).toInt else 1


import File.{ separator => sep }

val args2 = args1.map { arg =>
if ((arg.endsWith(".scala") || arg.endsWith(".java")) && arg.head != '/') "../" + arg
if ((arg.endsWith(".scala") || arg.endsWith(".java")) && !(new File(arg)).isAbsolute) ".." + sep + arg
else arg
}
storeCompileOptions(args2)
Expand Down Expand Up @@ -61,9 +64,10 @@ object Bench {
val libs = if (args.contains("-with-compiler")) compiler_libs else standard_libs
var argsNorm = args.filter(_ != "-with-compiler")

import File.{ pathSeparator => sep }
var cpIndex = argsNorm.indexOf("-classpath")
if (cpIndex == -1) cpIndex = argsNorm.indexOf("-cp")
if (cpIndex != -1) argsNorm(cpIndex + 1) = argsNorm(cpIndex + 1) + java.io.File.pathSeparator + libs
if (cpIndex != -1) argsNorm(cpIndex + 1) = argsNorm(cpIndex + 1) + sep + libs
else argsNorm = argsNorm :+ "-classpath" :+ libs

val file = new File(COMPILE_OPTS_FILE)
Expand Down
115 changes: 115 additions & 0 deletions bin/common.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
@echo off
setlocal enabledelayedexpansion

rem # Wrapper for the published dotc/dotr script that check for file changes
rem # and use sbt to re build the compiler as needed.

rem ##########################################################################
rem ## Environment setup

set _BASENAME=%~n0

set _EXITCODE=0

for %%f in ("%~dp0..") do set _ROOT_DIR=%%~sf

rem # Marker file used to obtain the date of latest call to sbt-back
set _VERSION=%_ROOT_DIR%\dist-bootstrapped\target\pack\VERSION

rem ##########################################################################
rem ## Main

rem # Create the target if absent or if file changed in ROOT/compiler
call :new_files "%_VERSION%"

if exist "%_VERSION%" if %_NEW_FILES%==0 goto target
echo Building Dotty...
pushd %_ROOT%
sbt.bat "dist-bootstrapped/pack"
popd

:target
call %*

goto end

rem ##########################################################################
rem ## Subroutines

rem input parameter: %1=version file
rem Output parameter: _NEW_FILES
:new_files
set __VERSION_FILE=%~1

call :timestamp "%__VERSION_FILE%"
set __VERSION_TIMESTAMP=%_TIMESTAMP%

set __JAVA_SOURCE_FILES=
for /f %%i in ('dir /s /b "%_ROOT_DIR%compiler\*.java" 2^>NUL') do (
set __JAVA_SOURCE_FILES=!__JAVA_SOURCE_FILES! %%i
)
set __SCALA_SOURCE_FILES=
for /f %%i in ('dir /s /b "%_ROOT_DIR%compiler\*.scala" 2^>NUL') do (
set __SCALA_SOURCE_FILES=!__SCALA_SOURCE_FILES! %%i
)

call :compile_required "%__VERSION_TIMESTAMP%" "%__JAVA_SOURCE_FILES% %__SCALA_SOURCE_FILES%"
set _NEW_FILES=%_COMPILE_REQUIRED%

goto :eof

rem input parameter: 1=timestamp file 2=source files
rem output parameter: _COMPILE_REQUIRED
:compile_required
set __TIMESTAMP_FILE=%~1
set __SOURCE_FILES=%~2

set __SOURCE_TIMESTAMP=00000000000000
for %%i in (%__SOURCE_FILES%) do (
call :timestamp "%%i"
call :newer !_TIMESTAMP! !__SOURCE_TIMESTAMP!
if !_NEWER!==1 set __SOURCE_TIMESTAMP=!_TIMESTAMP!
)
if exist "%__TIMESTAMP_FILE%" ( set /p __CLASS_TIMESTAMP=<%__TIMESTAMP_FILE%
) else ( set __CLASS_TIMESTAMP=00000000000000
)

call :newer %__SOURCE_TIMESTAMP% %__CLASS_TIMESTAMP%
set _COMPILE_REQUIRED=%_NEWER%
goto :eof

rem output parameter: _NEWER
:newer
set __TIMESTAMP1=%~1
set __TIMESTAMP2=%~2

set __TIMESTAMP1_DATE=%__TIMESTAMP1:~0,8%
set __TIMESTAMP1_TIME=%__TIMESTAMP1:~-6%

set __TIMESTAMP2_DATE=%__TIMESTAMP2:~0,8%
set __TIMESTAMP2_TIME=%__TIMESTAMP2:~-6%

if %__TIMESTAMP1_DATE% gtr %__TIMESTAMP2_DATE% ( set _NEWER=1
) else if %__TIMESTAMP1_DATE% lss %__TIMESTAMP2_DATE% ( set _NEWER=0
) else if %__TIMESTAMP1_TIME% gtr %__TIMESTAMP2_TIME% ( set _NEWER=1
) else ( set _NEWER=0
)
goto :eof

rem input parameter: 1=file path
rem output parameter: _TIMESTAMP
:timestamp
set __FILE_PATH=%~1

set _TIMESTAMP=00000000000000
for /f %%i in ('powershell -C "(Get-ChildItem '%__FILE_PATH%').LastWriteTime | Get-Date -uformat %%Y%%m%%d%%H%%M%%S"') do (
set _TIMESTAMP=%%i
)
goto :eof

rem ##########################################################################
rem ## Cleanups

:end
exit /b %_EXITCODE%
endlocal
6 changes: 6 additions & 0 deletions bin/dotc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
setlocal

for %%f in ("%~dp0..") do set _ROOT_DIR=%%~sf

call %_ROOT_DIR%\bin\common.bat "%_ROOT_DIR%\dist-bootstrapped\target\pack\bin\dotc.bat" %*
6 changes: 6 additions & 0 deletions bin/dotd.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
setlocal

for %%f in ("%~dp0..") do set _ROOT_DIR=%%~sf

call %_ROOT_DIR%\bin\common.bat "%_ROOT_DIR%\dist-bootstrapped\target\pack\bin\dotd.bat" %*
6 changes: 6 additions & 0 deletions bin/dotr.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
setlocal

for %%f in ("%~dp0..") do set _ROOT_DIR=%%~sf

call %_ROOT_DIR%\bin\common.bat "%_ROOT_DIR%\dist-bootstrapped\target\pack\bin\dotr.bat" %*
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ final class JrtClassPath(fs: java.nio.file.FileSystem) extends ClassPath with No
if (inPackage == "") Nil
else {
packageToModuleBases.getOrElse(inPackage, Nil).flatMap(x =>
Files.list(x.resolve(inPackage.replace('.', '/'))).iterator().asScala.filter(_.getFileName.toString.endsWith(".class"))).map(x =>
Files.list(x.resolve(FileUtils.dirPath(inPackage))).iterator().asScala.filter(_.getFileName.toString.endsWith(".class"))).map(x =>
ClassFileEntryImpl(new PlainFile(new dotty.tools.io.File(x)))).toVector
}
}
Expand All @@ -193,7 +193,7 @@ final class JrtClassPath(fs: java.nio.file.FileSystem) extends ClassPath with No
else {
val inPackage = packageOf(className)
packageToModuleBases.getOrElse(inPackage, Nil).iterator.flatMap{x =>
val file = x.resolve(className.replace('.', '/') + ".class")
val file = x.resolve(FileUtils.dirPath(className) + ".class")
if (Files.exists(file)) new PlainFile(new dotty.tools.io.File(file)) :: Nil else Nil
}.take(1).toList.headOption
}
Expand All @@ -207,7 +207,7 @@ case class DirectoryClassPath(dir: JFile) extends JFileDirectoryLookup[ClassFile

def findClassFile(className: String): Option[AbstractFile] = {
val relativePath = FileUtils.dirPath(className)
val classFile = new JFile(s"$dir/$relativePath.class")
val classFile = new JFile(dir, relativePath + ".class")
if (classFile.exists) {
val wrappedClassFile = new dotty.tools.io.File(classFile.toPath)
val abstractClassFile = new PlainFile(wrappedClassFile)
Expand All @@ -232,7 +232,7 @@ case class DirectorySourcePath(dir: JFile) extends JFileDirectoryLookup[SourceFi
private def findSourceFile(className: String): Option[AbstractFile] = {
val relativePath = FileUtils.dirPath(className)
val sourceFile = Stream("scala", "java")
.map(ext => new JFile(s"$dir/$relativePath.$ext"))
.map(ext => new JFile(dir, relativePath + "." + ext))
.collectFirst { case file if file.exists() => file }

sourceFile.map { file =>
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/classpath/FileUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ object FileUtils {
else throw new FatalError("Unexpected source file ending: " + fileName)
}

def dirPath(forPackage: String): String = forPackage.replace('.', '/')
def dirPath(forPackage: String): String = forPackage.replace('.', JFile.separatorChar)

def endsClass(fileName: String): Boolean =
fileName.length > 6 && fileName.substring(fileName.length - 6) == ".class"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ case class VirtualDirectoryClassPath(dir: VirtualDirectory) extends ClassPath wi

protected def emptyFiles: Array[AbstractFile] = Array.empty
protected def getSubDir(packageDirName: String): Option[AbstractFile] =
Option(lookupPath(dir)(packageDirName.split('/'), directory = true))
Option(lookupPath(dir)(packageDirName.split(java.io.File.separator), directory = true))
protected def listChildren(dir: AbstractFile, filter: Option[AbstractFile => Boolean] = None): Array[F] = filter match {
case Some(f) => dir.iterator.filter(f).toArray
case _ => dir.toArray
Expand All @@ -41,7 +41,7 @@ case class VirtualDirectoryClassPath(dir: VirtualDirectory) extends ClassPath wi

def findClassFile(className: String): Option[AbstractFile] = {
val relativePath = FileUtils.dirPath(className) + ".class"
Option(lookupPath(dir)(relativePath split '/', directory = false))
Option(lookupPath(dir)(relativePath.split(java.io.File.separator), directory = false))
}

private[dotty] def classes(inPackage: String): Seq[ClassFileEntry] = files(inPackage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ trait ZipArchiveFileLookup[FileEntryType <: ClassRepresentation] extends ClassPa
}

private def findDirEntry(pkg: String): Option[archive.DirEntry] = {
val dirName = s"${FileUtils.dirPath(pkg)}/"
val dirName = pkg.replace('.', '/') + "/"
archive.allDirs.get(dirName)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ object ConsumeTasty {
}

val currentClasspath = QuoteDriver.currentClasspath
val args = "-from-tasty" +: "-classpath" +: s"$classpath:$currentClasspath" +: classes
import java.io.File.{ pathSeparator => sep }
val args = "-from-tasty" +: "-classpath" +: s"$classpath$sep$currentClasspath" +: classes
(new Consume).process(args.toArray)
}
}
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/quoted/QuoteDriver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ object QuoteDriver {
case cl: URLClassLoader =>
// Loads the classes loaded by this class loader
// When executing `run` or `test` in sbt the classpath is not in the property java.class.path
val newClasspath = cl.getURLs.map(_.getFile())
import java.nio.file.Paths
val newClasspath = cl.getURLs.map(url => Paths.get(url.toURI).toFile)
newClasspath.mkString("", java.io.File.pathSeparator, if (classpath0 == "") "" else java.io.File.pathSeparator + classpath0)
case _ => classpath0
}
Expand Down
59 changes: 59 additions & 0 deletions dist/bin/common.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
rem ##########################################################################
rem ## Code common to dotc.bat, dotd.bat and dotr.bat

if defined JAVACMD (
set _JAVACMD=%JAVACMD%
) else if defined JAVA_HOME (
set _JAVACMD=%JAVA_HOME%\bin\java.exe
) else if defined JDK_HOME (
set _JAVACMD=%JDK_HOME%\bin\java.exe
) else (
where /q java.exe
if !ERRORLEVEL!==0 (
for /f "delims=" %%i in ('where /f java.exe') do set _JAVA_BIN_DIR=%%~dpsi
rem we ignore Oracle path for java executable
if "!_JAVA_BIN_DIR!"=="!_JAVA_BIN_DIR:javapath=!" set _JAVACMD=!_JAVA_BIN_DIR!\java.exe
)
if not defined _JAVACMD (
set _PATH=C:\Progra~1\Java
for /f %%f in ('dir /ad /b "!_PATH!\jre*" 2^>NUL') do set _JAVA_HOME=!_PATH!\%%f
if not defined _JAVA_HOME (
set _PATH=C:\opt
for /f %%f in ('dir /ad /b "!_PATH!\jdk*" 2^>NUL') do set _JAVA_HOME=!_PATH!\%%f\jre
)
if defined _JAVA_HOME (
set _JAVACMD=!_JAVA_HOME!\bin\java.exe
)
)
)
if not exist "%_JAVACMD%" (
echo Error: Java executable not found ^(%_JAVACMD%^) 1>&2
set _EXITCODE=1
goto :eof
)

if defined DOTTY_HOME (
set _LIB_DIR=%DOTTY_HOME%\lib
) else (
if not defined _PROG_HOME (
for %%f in ("%~dp0..") do set _PROG_HOME=%%~sf
)
set _LIB_DIR=!_PROG_HOME!\lib
)

set _PSEP=;

for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*dotty-compiler*"') do set _DOTTY_COMP=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*dotty-interfaces*"') do set _DOTTY_INTF=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*dotty-library*"') do set _DOTTY_LIB=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala-asm*"') do set _SCALA_ASM=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala-library*"') do set _SCALA_LIB=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*scala-xml*"') do set _SCALA_XML=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*compiler-interface*"') do set _SBT_INTF=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-reader-3*"') do set _JLINE_READER=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-terminal-3*"') do set _JLINE_TERMINAL=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jline-terminal-jna-3*"') do set _JLINE_TERMINAL_JNA=%_LIB_DIR%\%%f
for /f %%f in ('dir /a-d /b "%_LIB_DIR%\*jna-4*"') do set _JNA=%_LIB_DIR%\%%f

rem debug
set _DEBUG_STR=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
Loading