summaryrefslogtreecommitdiff
path: root/scalalib/src
diff options
context:
space:
mode:
authorNikolay Tatarinov <5min4eq.unity@gmail.com>2018-06-01 11:18:00 +0300
committerGitHub <noreply@github.com>2018-06-01 11:18:00 +0300
commitbaf2295c6d99d32c61d56dac38adf08388b6cc07 (patch)
treee3ec3fcef37b7f3775a71c800816902dce956cfd /scalalib/src
parent1b03026dd2009d4a6f3d25226b2f13bd5c42e8a4 (diff)
downloadmill-baf2295c6d99d32c61d56dac38adf08388b6cc07.tar.gz
mill-baf2295c6d99d32c61d56dac38adf08388b6cc07.tar.bz2
mill-baf2295c6d99d32c61d56dac38adf08388b6cc07.zip
fix #233 add append and exclude rules to assembly (#309)
* fix #233 add append and exclude rules to assembly * handle existing files and concatenation when file already exists in assembly * add assembly tests for append rules * tests for append patterns * tests for exclude patterns * make append algorithm use single map with fold over classpathIterator * move assembly rules logic to method * move grouping method to Assembly object, make assemblyRules Seq[_] rather than T[Seq[_]] * add test cases for when there are no rules * keep default parameter in createAssembly not to break CI * add one more reference.conf entry to tests
Diffstat (limited to 'scalalib/src')
-rw-r--r--scalalib/src/mill/scalalib/JavaModule.scala15
1 files changed, 11 insertions, 4 deletions
diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala
index 26c58a8b..79fad9aa 100644
--- a/scalalib/src/mill/scalalib/JavaModule.scala
+++ b/scalalib/src/mill/scalalib/JavaModule.scala
@@ -7,7 +7,7 @@ import coursier.Repository
import mill.define.Task
import mill.define.TaskModule
import mill.eval.{PathRef, Result}
-import mill.modules.Jvm
+import mill.modules.{Assembly, Jvm}
import mill.modules.Jvm.{createAssembly, createJar}
import Lib._
import mill.scalalib.publish.{Artifact, Scope}
@@ -108,6 +108,8 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
}
}
+ def assemblyRules: Seq[Assembly.Rule] = Assembly.defaultRules
+
def sources = T.sources{ millSourcePath / 'src }
def resources = T.sources{ millSourcePath / 'resources }
def generatedSources = T{ Seq.empty[PathRef] }
@@ -130,6 +132,7 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
upstreamCompileOutput()
)
}
+
def localClasspath = T{
resources() ++ Agg(compile().classes)
}
@@ -158,7 +161,11 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
* upstream dependencies do not change
*/
def upstreamAssembly = T{
- createAssembly(upstreamAssemblyClasspath().map(_.path), mainClass())
+ createAssembly(
+ upstreamAssemblyClasspath().map(_.path),
+ mainClass(),
+ assemblyRules = assemblyRules
+ )
}
def assembly = T{
@@ -166,11 +173,11 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
Agg.from(localClasspath().map(_.path)),
mainClass(),
prependShellScript(),
- Some(upstreamAssembly().path)
+ Some(upstreamAssembly().path),
+ assemblyRules
)
}
-
def jar = T{
createJar(
localClasspath().map(_.path).filter(exists),