diff options
author | Li Haoyi <32282535+lihaoyi-databricks@users.noreply.github.com> | 2019-01-09 19:52:06 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-01-09 19:52:06 -0800 |
commit | 4506537050d0a49cda820fc41ae0bc576dbe8d2d (patch) | |
tree | 4cc0fcc3dce55aa70680795a3331b2ab8b9b8a04 | |
parent | eb497a8f5db949ea661042371fbbc908f6524ea4 (diff) | |
download | mill-4506537050d0a49cda820fc41ae0bc576dbe8d2d.tar.gz mill-4506537050d0a49cda820fc41ae0bc576dbe8d2d.tar.bz2 mill-4506537050d0a49cda820fc41ae0bc576dbe8d2d.zip |
Allow usage of ZincWorkerImpl without hashing files (#525)
* Allow usage of ZincWorkerImpl without hashing files
This is to better support non-Mill build tools like Bazel or Make who might do their own file hashing/mtiming for change-detection
* Update ZincWorkerImpl.scala
* Update ZincWorkerImpl.scala
* Update ZincWorkerImpl.scala
-rw-r--r-- | scalalib/worker/src/ZincWorkerImpl.scala | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/scalalib/worker/src/ZincWorkerImpl.scala b/scalalib/worker/src/ZincWorkerImpl.scala index c37ef162..2ea099f5 100644 --- a/scalalib/worker/src/ZincWorkerImpl.scala +++ b/scalalib/worker/src/ZincWorkerImpl.scala @@ -121,6 +121,19 @@ class ZincWorkerImpl(compilerBridge: Either[ compileClasspath: Agg[os.Path], javacOptions: Seq[String]) (implicit ctx: ZincWorkerApi.Ctx): mill.api.Result[CompilationResult] = { + + for(res <- compileJava0( + upstreamCompileOutput, + sources, + compileClasspath, + javacOptions + )) yield CompilationResult(res._1, PathRef(res._2)) + } + def compileJava0(upstreamCompileOutput: Seq[CompilationResult], + sources: Agg[os.Path], + compileClasspath: Agg[os.Path], + javacOptions: Seq[String]) + (implicit ctx: ZincWorkerApi.Ctx): mill.api.Result[(os.Path, os.Path)] = { compileInternal( upstreamCompileOutput, sources, @@ -141,6 +154,30 @@ class ZincWorkerImpl(compilerBridge: Either[ compilerClasspath: Agg[os.Path], scalacPluginClasspath: Agg[os.Path]) (implicit ctx: ZincWorkerApi.Ctx): mill.api.Result[CompilationResult] = { + + for (res <- compileMixed0( + upstreamCompileOutput, + sources, + compileClasspath, + javacOptions, + scalaVersion, + scalaOrganization, + scalacOptions, + compilerClasspath, + scalacPluginClasspath + )) yield CompilationResult(res._1, PathRef(res._2)) + } + + def compileMixed0(upstreamCompileOutput: Seq[CompilationResult], + sources: Agg[os.Path], + compileClasspath: Agg[os.Path], + javacOptions: Seq[String], + scalaVersion: String, + scalaOrganization: String, + scalacOptions: Seq[String], + compilerClasspath: Agg[os.Path], + scalacPluginClasspath: Agg[os.Path]) + (implicit ctx: ZincWorkerApi.Ctx): mill.api.Result[(os.Path, os.Path)] = { withCompilers( scalaVersion, scalaOrganization, @@ -208,7 +245,7 @@ class ZincWorkerImpl(compilerBridge: Either[ javacOptions: Seq[String], scalacOptions: Seq[String], compilers: Compilers) - (implicit ctx: ZincWorkerApi.Ctx): mill.api.Result[CompilationResult] = { + (implicit ctx: ZincWorkerApi.Ctx): mill.api.Result[(os.Path, os.Path)] = { os.makeDir.all(ctx.dest) val logger = { @@ -281,7 +318,7 @@ class ZincWorkerImpl(compilerBridge: Either[ ) ) - mill.api.Result.Success(CompilationResult(zincFile, PathRef(classesDir))) + mill.api.Result.Success((zincFile, classesDir)) }catch{case e: CompileFailed => mill.api.Result.Failure(e.toString)} } } |