From dd96e989d81180d4bbb8b30846a53c8239dfe3ac Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Mon, 26 Sep 2016 19:57:44 +0000 Subject: Dotty plugin and example project. --- circle.yml | 2 +- examples/dotty-example/README.md | 3 + examples/dotty-example/build/build.scala | 2 + examples/dotty-example/src/Main.scala | 7 ++ stage2/plugins/Dotty.scala | 107 +++++++++++++++++++++++++++++++ test/test.scala | 2 + 6 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 examples/dotty-example/README.md create mode 100644 examples/dotty-example/build/build.scala create mode 100644 examples/dotty-example/src/Main.scala create mode 100644 stage2/plugins/Dotty.scala diff --git a/circle.yml b/circle.yml index 1615ad5..9de5b42 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: java: - version: oraclejdk7 + version: oraclejdk8 dependencies: cache_directories: diff --git a/examples/dotty-example/README.md b/examples/dotty-example/README.md new file mode 100644 index 0000000..bc0f6b0 --- /dev/null +++ b/examples/dotty-example/README.md @@ -0,0 +1,3 @@ +Dotty example project compiling hello world with the next version of Scala. + +All you need to do to enable Dotty is `extends Dotty` in your build.scala . diff --git a/examples/dotty-example/build/build.scala b/examples/dotty-example/build/build.scala new file mode 100644 index 0000000..eb67d93 --- /dev/null +++ b/examples/dotty-example/build/build.scala @@ -0,0 +1,2 @@ +import cbt._ +class Build(val context: Context) extends Dotty diff --git a/examples/dotty-example/src/Main.scala b/examples/dotty-example/src/Main.scala new file mode 100644 index 0000000..411527a --- /dev/null +++ b/examples/dotty-example/src/Main.scala @@ -0,0 +1,7 @@ +object Main extends Foo("Hello Dotty - trait parameters, yay"){ + def main(args: Array[String]) = { + println(hello) + } +} + +trait Foo(val hello: String) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala new file mode 100644 index 0000000..1e5addb --- /dev/null +++ b/stage2/plugins/Dotty.scala @@ -0,0 +1,107 @@ +package cbt +import java.io.File +import java.net.URL +import java.nio.file.Files +import java.nio.file.attribute.FileTime + +trait Dotty extends BaseBuild{ + override def scalacOptions: Seq[String] = Seq() + + private object compileCache extends Cache[Option[File]] + override def compile: Option[File] = compileCache{ + new DottyLib(logger).compile( + context.cbtHasChanged, + needsUpdate || context.parentBuild.map(_.needsUpdate).getOrElse(false), + sourceFiles, compileTarget, compileStatusFile, dependencyClasspath ++ compileClasspath, + context.paths.mavenCache, scalacOptions, context.classLoaderCache + ) + } +} + +class DottyLib(logger: Logger){ + val lib = new Lib(logger) + import lib._ + + def compile( + cbtHasChanged: Boolean, + needsRecompile: Boolean, + files: Seq[File], + compileTarget: File, + statusFile: File, + classpath: ClassPath, + mavenCache: File, + scalacOptions: Seq[String] = Seq(), + classLoaderCache: ClassLoaderCache + ): Option[File] = { + + if(classpath.files.isEmpty) + throw new Exception("Trying to compile with empty classpath. Source files: " ++ files.toString) + + if( files.isEmpty ){ + None + }else{ + if( needsRecompile ){ + def Resolver(urls: URL*) = MavenResolver(cbtHasChanged, mavenCache, urls: _*) + val dotty = Resolver(mavenCentral).bindOne( + MavenDependency("ch.epfl.lamp","dotty_2.11","0.1-20160925-b2b475d-NIGHTLY") + ) + + val cp = classpath ++ dotty.classpath + + val start = System.currentTimeMillis + + val _class = "dotty.tools.dotc.Main" + val dualArgs = + Seq( + "-d", compileTarget.toString + ) + val singleArgs = scalacOptions.map( "-S" ++ _ ) + + val code = + try{ + System.err.println("Compiling with Dotty to " ++ compileTarget.toString) + compileTarget.mkdirs + redirectOutToErr{ + lib.runMain( + _class, + dualArgs ++ singleArgs ++ Seq( + "-classpath", cp.string // let's put cp last. It so long + ) ++ files.map(_.toString), + dotty.classLoader(classLoaderCache) + ) + } + } catch { + case e: Exception => + System.err.println(red("Dotty crashed. Try running it by hand:")) + System.out.println(s""" +java -cp \\ +${dotty.classpath.strings.mkString(":\\\n")} \\ +\\ +${_class} \\ +\\ +${dualArgs.grouped(2).map(_.mkString(" ")).mkString(" \\\n")} \\ +\\ +${singleArgs.mkString(" \\\n")} \\ +\\ +-classpath \\ +${cp.strings.mkString(":\\\n")} \\ +\\ +${files.sorted.mkString(" \\\n")} +""" + ) + ExitCode.Failure + } + + if(code == ExitCode.Success){ + // write version and when last compilation started so we can trigger + // recompile if cbt version changed or newer source files are seen + write(statusFile, "")//cbtVersion.getBytes) + Files.setLastModifiedTime(statusFile.toPath, FileTime.fromMillis(start) ) + } else { + System.exit(code.integer) // FIXME: let's find a better solution for error handling. Maybe a monad after all. + } + } + Some( compileTarget ) + } + } +} diff --git a/test/test.scala b/test/test.scala index 4f0afcd..f8ba351 100644 --- a/test/test.scala +++ b/test/test.scala @@ -193,6 +193,8 @@ object Main{ compile("../examples/scalajs-react-example/js") compile("../examples/scalajs-react-example/jvm") compile("../examples/multi-project-example") + compile("../examples/dotty-example") + task("run","../examples/dotty-example") task("fastOptJS","../examples/scalajs-react-example/js") task("fullOptJS","../examples/scalajs-react-example/js") compile("../examples/uber-jar-example") -- cgit v1.2.3 From a2b34b2444401f6ecebbbfa8099459f2c949df49 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 08:41:19 -0400 Subject: make dotty-version customizable, don't use scalacOptions for dotty --- stage2/plugins/Dotty.scala | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 1e5addb..6bf910a 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -5,7 +5,9 @@ import java.nio.file.Files import java.nio.file.attribute.FileTime trait Dotty extends BaseBuild{ - override def scalacOptions: Seq[String] = Seq() + def dottyVersion: String = "0.1-20160925-b2b475d-NIGHTLY" + def dottyOptions: Seq[String] = Seq() + private object compileCache extends Cache[Option[File]] override def compile: Option[File] = compileCache{ @@ -13,7 +15,8 @@ trait Dotty extends BaseBuild{ context.cbtHasChanged, needsUpdate || context.parentBuild.map(_.needsUpdate).getOrElse(false), sourceFiles, compileTarget, compileStatusFile, dependencyClasspath ++ compileClasspath, - context.paths.mavenCache, scalacOptions, context.classLoaderCache + context.paths.mavenCache, scalacOptions, context.classLoaderCache, + dottyOptions = dottyOptions, dottyVersion = dottyVersion ) } } @@ -31,7 +34,9 @@ class DottyLib(logger: Logger){ classpath: ClassPath, mavenCache: File, scalacOptions: Seq[String] = Seq(), - classLoaderCache: ClassLoaderCache + classLoaderCache: ClassLoaderCache, + dottyOptions: Seq[String], + dottyVersion: String ): Option[File] = { if(classpath.files.isEmpty) @@ -43,7 +48,7 @@ class DottyLib(logger: Logger){ if( needsRecompile ){ def Resolver(urls: URL*) = MavenResolver(cbtHasChanged, mavenCache, urls: _*) val dotty = Resolver(mavenCentral).bindOne( - MavenDependency("ch.epfl.lamp","dotty_2.11","0.1-20160925-b2b475d-NIGHTLY") + MavenDependency("ch.epfl.lamp","dotty_2.11",dottyVersion) ) val cp = classpath ++ dotty.classpath @@ -55,7 +60,7 @@ class DottyLib(logger: Logger){ Seq( "-d", compileTarget.toString ) - val singleArgs = scalacOptions.map( "-S" ++ _ ) + val singleArgs = dottyOptions.map( "-S" ++ _ ) val code = try{ -- cgit v1.2.3 From cfa41097812e1d80ef536790fd1a130f82935ae8 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 08:45:33 -0400 Subject: add dotty sanity check as suggested by @smarter --- examples/dotty-example/src/Main.scala | 4 ++++ stage2/plugins/Dotty.scala | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/examples/dotty-example/src/Main.scala b/examples/dotty-example/src/Main.scala index 411527a..1963b51 100644 --- a/examples/dotty-example/src/Main.scala +++ b/examples/dotty-example/src/Main.scala @@ -1,6 +1,10 @@ object Main extends Foo("Hello Dotty - trait parameters, yay"){ def main(args: Array[String]) = { println(hello) + + // Sanity check the classpath: this won't run if the dotty jar is not present. + val x: Int => Int = z => z + x(1) } } diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 6bf910a..ef6246f 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -19,6 +19,10 @@ trait Dotty extends BaseBuild{ dottyOptions = dottyOptions, dottyVersion = dottyVersion ) } + + override def dependencies = Resolver(mavenCentral).bind( + ScalaDependency( "org.scala-lang.modules", "scala-java8-compat", "0.8.0-RC7" ) + ) } class DottyLib(logger: Logger){ -- cgit v1.2.3 From 88d871ba309afc80971ded2095c630f01f965cdf Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 08:46:29 -0400 Subject: move some DottyLib args to class level as preparation for adding repl --- stage2/plugins/Dotty.scala | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index ef6246f..0a5d91d 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -8,15 +8,17 @@ trait Dotty extends BaseBuild{ def dottyVersion: String = "0.1-20160925-b2b475d-NIGHTLY" def dottyOptions: Seq[String] = Seq() + private lazy val dottyLib = new DottyLib( + logger, context.cbtHasChanged, context.paths.mavenCache, + context.classLoaderCache, dottyVersion = dottyVersion + ) private object compileCache extends Cache[Option[File]] override def compile: Option[File] = compileCache{ - new DottyLib(logger).compile( - context.cbtHasChanged, + dottyLib.compile( needsUpdate || context.parentBuild.map(_.needsUpdate).getOrElse(false), sourceFiles, compileTarget, compileStatusFile, dependencyClasspath ++ compileClasspath, - context.paths.mavenCache, scalacOptions, context.classLoaderCache, - dottyOptions = dottyOptions, dottyVersion = dottyVersion + dottyOptions ) } @@ -25,22 +27,28 @@ trait Dotty extends BaseBuild{ ) } -class DottyLib(logger: Logger){ +class DottyLib( + logger: Logger, + cbtHasChanged: Boolean, + mavenCache: File, + classLoaderCache: ClassLoaderCache, + dottyVersion: String +){ val lib = new Lib(logger) import lib._ + private def Resolver(urls: URL*) = MavenResolver(cbtHasChanged, mavenCache, urls: _*) + private lazy val dottyDependency = Resolver(mavenCentral).bindOne( + MavenDependency("ch.epfl.lamp","dotty_2.11",dottyVersion) + ) + def compile( - cbtHasChanged: Boolean, needsRecompile: Boolean, files: Seq[File], compileTarget: File, statusFile: File, classpath: ClassPath, - mavenCache: File, - scalacOptions: Seq[String] = Seq(), - classLoaderCache: ClassLoaderCache, - dottyOptions: Seq[String], - dottyVersion: String + dottyOptions: Seq[String] ): Option[File] = { if(classpath.files.isEmpty) @@ -50,10 +58,7 @@ class DottyLib(logger: Logger){ None }else{ if( needsRecompile ){ - def Resolver(urls: URL*) = MavenResolver(cbtHasChanged, mavenCache, urls: _*) - val dotty = Resolver(mavenCentral).bindOne( - MavenDependency("ch.epfl.lamp","dotty_2.11",dottyVersion) - ) + val dotty = dottyDependency val cp = classpath ++ dotty.classpath -- cgit v1.2.3 From 5f8b831765ead443cf1f80078b7417c76e47e39b Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 08:46:41 -0400 Subject: add dotty repl --- stage2/plugins/Dotty.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 0a5d91d..53cff6e 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -22,6 +22,8 @@ trait Dotty extends BaseBuild{ ) } + def repl = dottyLib.repl(context.args, classpath) + override def dependencies = Resolver(mavenCentral).bind( ScalaDependency( "org.scala-lang.modules", "scala-java8-compat", "0.8.0-RC7" ) ) @@ -42,6 +44,20 @@ class DottyLib( MavenDependency("ch.epfl.lamp","dotty_2.11",dottyVersion) ) + def repl(args: Seq[String], classpath: ClassPath) = { + consoleOrFail("Use `cbt direct repl` instead") + lib.runMain( + "dotty.tools.dotc.repl.Main", + Seq( + "-bootclasspath", + dottyDependency.classpath.string, + "-classpath", + classpath.string + ) ++ args, + dottyDependency.classLoader(classLoaderCache) + ) + } + def compile( needsRecompile: Boolean, files: Seq[File], -- cgit v1.2.3 From e97b74056207410d80972f38cd2f1c2e96dfe417 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 08:58:51 -0400 Subject: Refer to dotty issue tracker on dotc crash --- stage2/plugins/Dotty.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 53cff6e..e0e8f85 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -102,7 +102,7 @@ class DottyLib( } } catch { case e: Exception => - System.err.println(red("Dotty crashed. Try running it by hand:")) + System.err.println(red("Dotty crashed. See https://github.com/lampepfl/dotty/issues. To reproduce run:")) System.out.println(s""" java -cp \\ ${dotty.classpath.strings.mkString(":\\\n")} \\ -- cgit v1.2.3 From d0e71734701ff55db1fae4bdc3cf0f40b22ceb58 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 10:35:18 -0400 Subject: upgrade dotty version --- stage2/plugins/Dotty.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index e0e8f85..2fdb895 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -5,7 +5,7 @@ import java.nio.file.Files import java.nio.file.attribute.FileTime trait Dotty extends BaseBuild{ - def dottyVersion: String = "0.1-20160925-b2b475d-NIGHTLY" + def dottyVersion: String = "0.1-20160926-ec28ea1-NIGHTLY" def dottyOptions: Seq[String] = Seq() private lazy val dottyLib = new DottyLib( -- cgit v1.2.3 From bdf5ef17cd0f03ee95ad905dea0d52b1541f5fbb Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 10:36:51 -0400 Subject: change compile target to something dotty version unique and fix cp for compiling the unique target should avoid potential problems with binary incompatibilities between scala and dotty as well as different dotty versions --- stage2/plugins/Dotty.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 2fdb895..8869860 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -7,7 +7,8 @@ import java.nio.file.attribute.FileTime trait Dotty extends BaseBuild{ def dottyVersion: String = "0.1-20160926-ec28ea1-NIGHTLY" def dottyOptions: Seq[String] = Seq() - + override def scalaTarget: File = target ++ s"/dotty-$dottyVersion" + private lazy val dottyLib = new DottyLib( logger, context.cbtHasChanged, context.paths.mavenCache, context.classLoaderCache, dottyVersion = dottyVersion @@ -17,7 +18,7 @@ trait Dotty extends BaseBuild{ override def compile: Option[File] = compileCache{ dottyLib.compile( needsUpdate || context.parentBuild.map(_.needsUpdate).getOrElse(false), - sourceFiles, compileTarget, compileStatusFile, dependencyClasspath ++ compileClasspath, + sourceFiles, compileTarget, compileStatusFile, compileClasspath, dottyOptions ) } -- cgit v1.2.3 From fc29c605ab5c7fcb671495789698e93482d3a8e5 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 10:37:15 -0400 Subject: prototype dotty doc generation, but that class does not exist --- stage2/plugins/Dotty.scala | 32 ++++++++++++++++++++++++++++++++ test/test.scala | 1 + 2 files changed, 33 insertions(+) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 8869860..5fdf066 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -23,6 +23,11 @@ trait Dotty extends BaseBuild{ ) } + def doc: ExitCode = + dottyLib.doc( + sourceFiles, compileClasspath, docTarget, dottyOptions + ) + def repl = dottyLib.repl(context.args, classpath) override def dependencies = Resolver(mavenCentral).bind( @@ -59,6 +64,33 @@ class DottyLib( ) } + def doc( + sourceFiles: Seq[File], + dependencyClasspath: ClassPath, + docTarget: File, + compileArgs: Seq[String] + ): ExitCode = { + if(sourceFiles.isEmpty){ + ExitCode.Success + } else { + docTarget.mkdirs + val args = Seq( + // FIXME: can we use compiler dependency here? + "-bootclasspath", dottyDependency.classpath.string, // FIXME: does this break for builds that don't have scalac dependencies? + "-classpath", (dependencyClasspath ++ dottyDependency.classpath).string, // FIXME: does this break for builds that don't have scalac dependencies? + "-d", docTarget.toString + ) ++ compileArgs ++ sourceFiles.map(_.toString) + logger.lib("creating docs for source files "+args.mkString(", ")) + redirectOutToErr{ + runMain( + "dotty.tools.dottydoc.DottyDoc", + args, + dottyDependency.classLoader(classLoaderCache) + ) + } + } + } + def compile( needsRecompile: Boolean, files: Seq[File], diff --git a/test/test.scala b/test/test.scala index f8ba351..ca64d99 100644 --- a/test/test.scala +++ b/test/test.scala @@ -195,6 +195,7 @@ object Main{ compile("../examples/multi-project-example") compile("../examples/dotty-example") task("run","../examples/dotty-example") + task("doc","../examples/dotty-example") task("fastOptJS","../examples/scalajs-react-example/js") task("fullOptJS","../examples/scalajs-react-example/js") compile("../examples/uber-jar-example") -- cgit v1.2.3 From 1694dd3bc3cd407c3784080d38778030385ae758 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 20:28:37 -0400 Subject: minor Dotty plugin cleanup --- stage2/plugins/Dotty.scala | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 5fdf066..c6acbcd 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -107,10 +107,6 @@ class DottyLib( None }else{ if( needsRecompile ){ - val dotty = dottyDependency - - val cp = classpath ++ dotty.classpath - val start = System.currentTimeMillis val _class = "dotty.tools.dotc.Main" @@ -128,9 +124,10 @@ class DottyLib( lib.runMain( _class, dualArgs ++ singleArgs ++ Seq( - "-classpath", cp.string // let's put cp last. It so long + "-bootclasspath", dottyDependency.classpath.string, // let's put cp last. It so long + "-classpath", classpath.string // let's put cp last. It so long ) ++ files.map(_.toString), - dotty.classLoader(classLoaderCache) + dottyDependency.classLoader(classLoaderCache) ) } } catch { @@ -138,7 +135,7 @@ class DottyLib( System.err.println(red("Dotty crashed. See https://github.com/lampepfl/dotty/issues. To reproduce run:")) System.out.println(s""" java -cp \\ -${dotty.classpath.strings.mkString(":\\\n")} \\ +${dottyDependency.classpath.strings.mkString(":\\\n")} \\ \\ ${_class} \\ \\ @@ -146,8 +143,10 @@ ${dualArgs.grouped(2).map(_.mkString(" ")).mkString(" \\\n")} \\ \\ ${singleArgs.mkString(" \\\n")} \\ \\ +-bootclasspath \\ +${dottyDependency.classpath.strings.mkString(":\\\n")} \\ -classpath \\ -${cp.strings.mkString(":\\\n")} \\ +${classpath.strings.mkString(":\\\n")} \\ \\ ${files.sorted.mkString(" \\\n")} """ -- cgit v1.2.3 From 8bd15f12236a6ce3d65952dbcbfc1d25e7a73e32 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 20:32:07 -0400 Subject: Use correct main method for Dottydoc - the java interface and work around the fact that the main method is not static (huh?) --- stage1/Stage1Lib.scala | 16 +++++++++++----- stage2/plugins/Dotty.scala | 5 +++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/stage1/Stage1Lib.scala b/stage1/Stage1Lib.scala index bbb6f7b..c427b77 100644 --- a/stage1/Stage1Lib.scala +++ b/stage1/Stage1Lib.scala @@ -101,13 +101,19 @@ class Stage1Lib( val logger: Logger ) extends BaseLib{ } else ExitCode.Success } - def runMain(cls: String, args: Seq[String], classLoader: ClassLoader ): ExitCode = { + def runMain( cls: String, args: Seq[String], classLoader: ClassLoader, fakeInstance: Boolean = false ): ExitCode = { + import java.lang.reflect.Modifier logger.lib(s"Running $cls.main($args) with classLoader: " ++ classLoader.toString) trapExitCode{ - classLoader - .loadClass(cls) - .getMethod( "main", classOf[Array[String]] ) - .invoke( null, args.toArray.asInstanceOf[AnyRef] ) + val c = classLoader.loadClass(cls) + val m = c.getMethod( "main", classOf[Array[String]] ) + val instance = + if(!fakeInstance) null else c.newInstance + assert( + fakeInstance || (m.getModifiers & java.lang.reflect.Modifier.STATIC) > 0, + "Cannot run non-static method " ++ cls+".main" + ) + m.invoke( instance, args.toArray.asInstanceOf[AnyRef] ) ExitCode.Success } } diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index c6acbcd..5700e4d 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -83,9 +83,10 @@ class DottyLib( logger.lib("creating docs for source files "+args.mkString(", ")) redirectOutToErr{ runMain( - "dotty.tools.dottydoc.DottyDoc", + "dotty.tools.dottydoc.api.java.Dottydoc", args, - dottyDependency.classLoader(classLoaderCache) + dottyDependency.classLoader(classLoaderCache), + fakeInstance = true // this is a hack as Dottydoc's main method is not static ) } } -- cgit v1.2.3 From cc451640063be53c2fd815ade017d988ab2af564 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 20:32:39 -0400 Subject: fix Dottydoc bootclasspath and make output less surprising --- stage2/plugins/Dotty.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala index 5700e4d..50255d5 100644 --- a/stage2/plugins/Dotty.scala +++ b/stage2/plugins/Dotty.scala @@ -77,11 +77,11 @@ class DottyLib( val args = Seq( // FIXME: can we use compiler dependency here? "-bootclasspath", dottyDependency.classpath.string, // FIXME: does this break for builds that don't have scalac dependencies? - "-classpath", (dependencyClasspath ++ dottyDependency.classpath).string, // FIXME: does this break for builds that don't have scalac dependencies? + "-classpath", dependencyClasspath.string, // FIXME: does this break for builds that don't have scalac dependencies? "-d", docTarget.toString ) ++ compileArgs ++ sourceFiles.map(_.toString) logger.lib("creating docs for source files "+args.mkString(", ")) - redirectOutToErr{ + val exitCode = redirectOutToErr{ runMain( "dotty.tools.dottydoc.api.java.Dottydoc", args, @@ -89,6 +89,8 @@ class DottyLib( fakeInstance = true // this is a hack as Dottydoc's main method is not static ) } + System.err.println("done") + exitCode } } -- cgit v1.2.3 From 4569e126be9970f812d725733b0ea678b4077383 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 20:49:45 -0400 Subject: set circle back to java7 to make sure cbt works there and disable dotty tests for java7, but run them otherwise, e.g. locally --- circle.yml | 2 +- test/test.scala | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index 9de5b42..1615ad5 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ machine: java: - version: oraclejdk8 + version: oraclejdk7 dependencies: cache_directories: diff --git a/test/test.scala b/test/test.scala index ca64d99..bb7e89a 100644 --- a/test/test.scala +++ b/test/test.scala @@ -193,9 +193,13 @@ object Main{ compile("../examples/scalajs-react-example/js") compile("../examples/scalajs-react-example/jvm") compile("../examples/multi-project-example") - compile("../examples/dotty-example") - task("run","../examples/dotty-example") - task("doc","../examples/dotty-example") + if(sys.props("java.version").startsWith("1.7")){ + System.err.println("\nskipping dotty tests on Java 7") + } else { + compile("../examples/dotty-example") + task("run","../examples/dotty-example") + task("doc","../examples/dotty-example") + } task("fastOptJS","../examples/scalajs-react-example/js") task("fullOptJS","../examples/scalajs-react-example/js") compile("../examples/uber-jar-example") -- cgit v1.2.3 From 9ca07ddfb052b7e3fc15154d7caddf16db5518a3 Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 20:52:24 -0400 Subject: disable test sporadically failing on circleci from circleci --- test/simple-fixed/build/build.scala | 1 - test/simple/build/build.scala | 1 - test/test.scala | 17 +++++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/simple-fixed/build/build.scala b/test/simple-fixed/build/build.scala index 3f1ff66..42130ee 100644 --- a/test/simple-fixed/build/build.scala +++ b/test/simple-fixed/build/build.scala @@ -24,7 +24,6 @@ class Build(context: cbt.Context) extends BasicBuild(context){ sonatypeSnapshots ).bind( "org.cvogt" %% "play-json-extensions" % "0.8.0", - "org.tpolecat" %% "tut-core" % "0.4.2", "ai.x" %% "lens" % "1.0.0" ) ) diff --git a/test/simple/build/build.scala b/test/simple/build/build.scala index b75d262..affe7f6 100644 --- a/test/simple/build/build.scala +++ b/test/simple/build/build.scala @@ -35,7 +35,6 @@ class Build(val context: cbt.Context) extends BaseBuild{ sonatypeSnapshots ).bind( "org.cvogt" %% "play-json-extensions" % "0.8.0", - "org.tpolecat" %% "tut-core" % "0.4.2", "ai.x" %% "lens" % "1.0.0" ) ) diff --git a/test/test.scala b/test/test.scala index bb7e89a..1701f06 100644 --- a/test/test.scala +++ b/test/test.scala @@ -147,12 +147,17 @@ object Main{ } ( - Dependencies( - Resolver( mavenCentral, bintray("tpolecat") ).bind( - lib.ScalaDependency("org.tpolecat","tut-core","0.4.2", scalaMajorVersion="2.11") - ) - ).classpath.strings - ++ + ( + if(System.getenv("CIRCLECI") == null){ + // tenporarily disable on circleci as it seems to have trouble reliably + // downloading from bintray + Dependencies( + Resolver( bintray("tpolecat") ).bind( + lib.ScalaDependency("org.tpolecat","tut-core","0.4.2", scalaMajorVersion="2.11") + ) + ).classpath.strings + } else Nil + ) ++ Dependencies( Resolver(sonatypeReleases).bind( MavenDependency("org.cvogt","play-json-extensions_2.11","0.8.0") -- cgit v1.2.3 From 9b4b9e0c7a747972229fe9dbabe4b6e546c29f4d Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Wed, 28 Sep 2016 21:00:15 -0400 Subject: another test fix for an artifact that apparently disappeared on sonatype --- test/test.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test.scala b/test/test.scala index 1701f06..dfc35d0 100644 --- a/test/test.scala +++ b/test/test.scala @@ -159,13 +159,13 @@ object Main{ } else Nil ) ++ Dependencies( - Resolver(sonatypeReleases).bind( - MavenDependency("org.cvogt","play-json-extensions_2.11","0.8.0") + Resolver( sonatypeReleases ).bind( + MavenDependency("org.cvogt","scala-extensions_2.11","0.5.1") ) ).classpath.strings ++ Dependencies( - Resolver( mavenCentral, sonatypeSnapshots ).bind( + Resolver( mavenCentral ).bind( MavenDependency("ai.x","lens_2.11","1.0.0") ) ).classpath.strings -- cgit v1.2.3