diff options
author | Alexandra Dima <alexandra.dima@jetbrains.com> | 2019-07-16 21:25:50 +0200 |
---|---|---|
committer | Samvel Abrahamyan <samvel1024@gmail.com> | 2019-10-12 14:33:03 +0200 |
commit | e6b86afc7e765068441a1d0bb57eead199f55150 (patch) | |
tree | c5fc039837bdfe80c0f31e735bf72a5f7a61a1a5 | |
parent | d7473780f2ab9ae7c5a3b77e482fd849438f631e (diff) | |
download | mill-e6b86afc7e765068441a1d0bb57eead199f55150.tar.gz mill-e6b86afc7e765068441a1d0bb57eead199f55150.tar.bz2 mill-e6b86afc7e765068441a1d0bb57eead199f55150.zip |
Adding the scratch folder to git.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | contrib/bsp/src/mill/contrib/bsp/MillBspLogger.scala | 33 | ||||
-rw-r--r-- | scratch/.bsp/mill-bsp.json | 1 | ||||
-rw-r--r-- | scratch/benchmarks/src/main/scala/BenchmarkSource.scala | 14 | ||||
-rw-r--r-- | scratch/bsp/src/main/scala/BspSource.scala | 10 | ||||
-rw-r--r-- | scratch/bsp/src/test/scala/BspTests.scala | 8 | ||||
-rw-r--r-- | scratch/build.sc | 52 | ||||
-rw-r--r-- | scratch/core/src/main/scala/CommonObject.scala | 9 | ||||
-rw-r--r-- | scratch/core/src/test/scala/CoreTests.scala | 9 | ||||
-rw-r--r-- | scratch/test_build1.iml | 24 |
10 files changed, 160 insertions, 1 deletions
@@ -10,5 +10,4 @@ out/ contrib/bsp/mill-external-bs contrib/bsp/mill-out-bs mill.iml -scratch ./bsp
\ No newline at end of file diff --git a/contrib/bsp/src/mill/contrib/bsp/MillBspLogger.scala b/contrib/bsp/src/mill/contrib/bsp/MillBspLogger.scala new file mode 100644 index 00000000..c898926e --- /dev/null +++ b/contrib/bsp/src/mill/contrib/bsp/MillBspLogger.scala @@ -0,0 +1,33 @@ +package mill.contrib.bsp + +import java.io.{InputStream, PrintStream} + +import ch.epfl.scala.bsp4j.{BuildClient, TaskId, TaskProgressParams} +import mill.api.{BspContext, Logger} + +class MillBspLogger(client: BuildClient, taskId: Int) extends Logger { + + override def ticker(s: String): Unit = { + val progressString = s.split(" ")(0) + val progress = progressString.substring(1, progressString.length - 1).split("/") + val params = new TaskProgressParams(new TaskId(taskId.toString)) + params.setEventTime(System.currentTimeMillis()) + params.setMessage(s) + params.setUnit(s.split(" ")(1)) + params.setProgress(progress(0).toLong) + params.setTotal(progress(1).toLong) + client.onBuildTaskProgress(params) + } + + override def colored: Boolean = false + + override val errorStream: PrintStream + override val outputStream: PrintStream + override val inStream: InputStream + + override def info(s: String): Unit = {} + + override def error(s: String): Unit = {} + + override def debug(s: String): Unit = {} +} diff --git a/scratch/.bsp/mill-bsp.json b/scratch/.bsp/mill-bsp.json new file mode 100644 index 00000000..af709ea6 --- /dev/null +++ b/scratch/.bsp/mill-bsp.json @@ -0,0 +1 @@ +{"name":"mill-bsp","argv":["/home/alexandra/mill/out/dev/launcher/dest/run", "-i", "mill.contrib.MainMillBuildServer/startServer"],"version":"1.0.0","bspVersion":"2.0.0-M4","languages":["scala","java"]} diff --git a/scratch/benchmarks/src/main/scala/BenchmarkSource.scala b/scratch/benchmarks/src/main/scala/BenchmarkSource.scala new file mode 100644 index 00000000..7ee88801 --- /dev/null +++ b/scratch/benchmarks/src/main/scala/BenchmarkSource.scala @@ -0,0 +1,14 @@ +package main.scala + +import org.apache.commons.io.FileUtils +import java.io.File +//import com.williamfiset.fastjavaio.InputReader + +object BenchmarkSource { + //val reader = new InputReader() + + def main(args: Array[String]): Unit = { + val file = FileUtils.getFile("/home/alexandra/test_build1/build.sc") + println(file) + } +} diff --git a/scratch/bsp/src/main/scala/BspSource.scala b/scratch/bsp/src/main/scala/BspSource.scala new file mode 100644 index 00000000..3a2300ae --- /dev/null +++ b/scratch/bsp/src/main/scala/BspSource.scala @@ -0,0 +1,10 @@ +package main.scala +import ch.epfl.scala.bsp4j._ + +object BspSource { + val obj = CommonObject.strVal + + def main(args: Array[String]): Unit = { + println(new BuildTargetIdentifier("path")) + } +} diff --git a/scratch/bsp/src/test/scala/BspTests.scala b/scratch/bsp/src/test/scala/BspTests.scala new file mode 100644 index 00000000..596a1816 --- /dev/null +++ b/scratch/bsp/src/test/scala/BspTests.scala @@ -0,0 +1,8 @@ +package tests +import org.scalatest.FunSuite + +object BspTests extends FunSuite { + test("test 1") { + assert(CoreTests().coreValue > 0) + } +} diff --git a/scratch/build.sc b/scratch/build.sc new file mode 100644 index 00000000..97a7d1b4 --- /dev/null +++ b/scratch/build.sc @@ -0,0 +1,52 @@ +import mill.scalalib.{SbtModule, Dep, DepSyntax} +//import $ivy.`com.lihaoyi::mill-contrib-bsp:0.4.1-21-fd34d3-DIRTY61e11e70` + +trait BetterFilesModule extends SbtModule{ + def scalaVersion = "2.12.4" + def scalacOptions = Seq( + "-deprecation", // Emit warning and location for usages of deprecated APIs. + "-encoding", "utf-8", // Specify character encoding used by source files. + "-explaintypes", // Explain type errors in more detail. + "-feature", // Emit warning and location for usages of features that should be imported explicitly. + "-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`. + "-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'. + "-Ywarn-nullary-unit", // Warn when nullary methods return Unit. + "-Ywarn-numeric-widen", // Warn when numerics are widened. + "-Ywarn-unused:implicits", // Warn if an implicit parameter is unused. + "-Ywarn-unused:imports", // Warn if an import selector is not referenced. + "-Ywarn-unused:locals", // Warn if a local definition is unused. + "-Ywarn-unused:params", // Warn if a value parameter is unused. + "-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused. + "-Ywarn-unused:privates", // Warn if a private member is unused. + "-Ywarn-value-discard" // Warn when non-Unit expression results are unused. + ) + override def javacOptions = Seq("-source", "1.8", "-target", "1.8", "-Xlint") + + object test extends Tests{ + def moduleDeps = + if (this == core.test) super.moduleDeps + else super.moduleDeps ++ Seq(core.test) + def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.0.4") + def testFrameworks = Seq("org.scalatest.tools.Framework") + } +} + +object core extends BetterFilesModule + +object bsp extends BetterFilesModule{ + def moduleDeps = Seq(core) + def ivyDeps = Agg(ivy"ch.epfl.scala:bsp4j:2.0.0-M3") +} + +object benchmarks extends BetterFilesModule{ + def moduleDeps = Seq(core) + def ivyDeps = Agg( + ivy"commons-io:commons-io:2.5" + ) + def unmanagedClasspath = Agg( + mill.modules.Util.download( + "https://github.com/williamfiset/FastJavaIO/releases/download/v1.0/fastjavaio.jar", + "fastjavaio.jar" + ) + ) +}
\ No newline at end of file diff --git a/scratch/core/src/main/scala/CommonObject.scala b/scratch/core/src/main/scala/CommonObject.scala new file mode 100644 index 00000000..e10bf3a0 --- /dev/null +++ b/scratch/core/src/main/scala/CommonObject.scala @@ -0,0 +1,9 @@ +package main.scala + +object CommonObject { + val strVal: String = "" + + def hasMethod: Boolean ={ + true + } +} diff --git a/scratch/core/src/test/scala/CoreTests.scala b/scratch/core/src/test/scala/CoreTests.scala new file mode 100644 index 00000000..6a25b4a4 --- /dev/null +++ b/scratch/core/src/test/scala/CoreTests.scala @@ -0,0 +1,9 @@ +package tests +import org.scalatest.FlatSpec + +class CoreTests extends FlatSpec { + val coreValue = 1 + "This simple addition" should "equal 4" in { + assert(2 + 2 == 4) + } +} diff --git a/scratch/test_build1.iml b/scratch/test_build1.iml new file mode 100644 index 00000000..294cb691 --- /dev/null +++ b/scratch/test_build1.iml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/core/resources" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/benchmarks/resources" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/bsp/resources" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/benchmarks/test/scala" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/bsp/test/src" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/core/test/scala" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/bsp/test/scala" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/bsp/test/resources" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/core/test/resources" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/bsp/src/main/scala" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/core/src/main/scala" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/benchmarks/test/resources" type="java-resource" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="scala-sdk-2.12.8 (2)" level="application" /> + </component> +</module>
\ No newline at end of file |