summaryrefslogtreecommitdiff
path: root/scalalib/src
diff options
context:
space:
mode:
authorAndrew Richards <richards.aj@gmail.com>2019-07-29 13:56:01 +0100
committerTobias Roeser <le.petit.fou@web.de>2019-07-29 14:56:01 +0200
commitca1def4d6f5c829701e04f86dacb720bb57f036f (patch)
treeafbf8c216e8c310d7297455e2f44d8f7234c7504 /scalalib/src
parent1a05b8d392e5d2eef36fc0ea4fd1e43b10cebd36 (diff)
downloadmill-ca1def4d6f5c829701e04f86dacb720bb57f036f.tar.gz
mill-ca1def4d6f5c829701e04f86dacb720bb57f036f.tar.bz2
mill-ca1def4d6f5c829701e04f86dacb720bb57f036f.zip
add ability to define jar manifest (#634)
* add capability to define jar manifest * Don't use the custom manifest for doc-only jars This is to pass test mill.scalalib.HelloWorldTests.scalaDocOptions * Add JarManifest.Default and fix the build rebase fix
Diffstat (limited to 'scalalib/src')
-rw-r--r--scalalib/src/JavaModule.scala20
1 files changed, 15 insertions, 5 deletions
diff --git a/scalalib/src/JavaModule.scala b/scalalib/src/JavaModule.scala
index 7b373650..c7066d15 100644
--- a/scalalib/src/JavaModule.scala
+++ b/scalalib/src/JavaModule.scala
@@ -1,6 +1,9 @@
package mill
package scalalib
+import java.io.ByteArrayInputStream
+import java.io.ByteArrayOutputStream
+
import coursier.Repository
import mill.define.Task
import mill.define.TaskModule
@@ -257,6 +260,14 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
}
/**
+ * Creates a manifest representation which can be modifed or replaced
+ * The default implementation just adds the `Manifest-Version`, `Main-Class` and `Created-By` attributes
+ */
+ def manifest = T{
+ Jvm.createManifest(finalMainClassOpt().toOption)
+ }
+
+ /**
* Build the assembly for upstream dependencies separate from the current
* classpath
*
@@ -266,7 +277,7 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
def upstreamAssembly = T{
createAssembly(
upstreamAssemblyClasspath().map(_.path),
- mainClass(),
+ manifest(),
assemblyRules = assemblyRules
)
}
@@ -278,7 +289,7 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
def assembly = T{
createAssembly(
Agg.from(localClasspath().map(_.path)),
- finalMainClassOpt().toOption,
+ manifest(),
prependShellScript(),
Some(upstreamAssembly().path),
assemblyRules
@@ -292,7 +303,7 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
def jar = T{
createJar(
localClasspath().map(_.path).filter(os.exists),
- mainClass()
+ manifest()
)
}
@@ -345,7 +356,7 @@ trait JavaModule extends mill.Module with TaskModule { outer =>
* The source jar, containing only source code for publishing to Maven Central
*/
def sourceJar = T {
- createJar((allSources() ++ resources()).map(_.path).filter(os.exists))
+ createJar((allSources() ++ resources()).map(_.path).filter(os.exists), manifest())
}
/**
@@ -626,4 +637,3 @@ object TestModule{
}
}
}
-