summaryrefslogtreecommitdiff
path: root/scalalib/src/mill/scalalib/ScalaModule.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-09-20 14:15:50 +0800
committerGitHub <noreply@github.com>2018-09-20 14:15:50 +0800
commitd551ee9d751201491a1d64e4da76ab03e3815df6 (patch)
tree60471609f0957401fa1a7002578ad8c1acd6bc75 /scalalib/src/mill/scalalib/ScalaModule.scala
parentc8fd6bd9e1dc18c24e64147fcd221e0bf91c2d06 (diff)
downloadmill-d551ee9d751201491a1d64e4da76ab03e3815df6.tar.gz
mill-d551ee9d751201491a1d64e4da76ab03e3815df6.tar.bz2
mill-d551ee9d751201491a1d64e4da76ab03e3815df6.zip
Include scaladoc as part of mill inspect (#435)
Diffstat (limited to 'scalalib/src/mill/scalalib/ScalaModule.scala')
-rw-r--r--scalalib/src/mill/scalalib/ScalaModule.scala49
1 files changed, 46 insertions, 3 deletions
diff --git a/scalalib/src/mill/scalalib/ScalaModule.scala b/scalalib/src/mill/scalalib/ScalaModule.scala
index 3a4a9d45..74656818 100644
--- a/scalalib/src/mill/scalalib/ScalaModule.scala
+++ b/scalalib/src/mill/scalalib/ScalaModule.scala
@@ -27,6 +27,10 @@ trait ScalaModule extends JavaModule { outer =>
override def moduleDeps: Seq[JavaModule] = Seq(outer)
}
+ /**
+ * What Scala organization to use
+ * @return
+ */
def scalaOrganization: T[String] = T {
if (isDotty(scalaVersion()))
"ch.epfl.lamp"
@@ -34,6 +38,9 @@ trait ScalaModule extends JavaModule { outer =>
"org.scala-lang"
}
+ /**
+ * What version of Scala to use
+ */
def scalaVersion: T[String]
override def mapDependencies = T.task{ d: coursier.Dependency =>
@@ -59,10 +66,16 @@ trait ScalaModule extends JavaModule { outer =>
)
}
+ /**
+ * Allows you to make use of Scala compiler plugins from maven central
+ */
def scalacPluginIvyDeps = T{ Agg.empty[Dep] }
def scalaDocPluginIvyDeps = T{ scalacPluginIvyDeps() }
+ /**
+ * Command-line options to pass to the Scala compiler
+ */
def scalacOptions = T{ Seq.empty[String] }
def scalaDocOptions = T{ scalacOptions() }
@@ -98,22 +111,33 @@ trait ScalaModule extends JavaModule { outer =>
)
}
+ /**
+ * The local classpath of Scala compiler plugins on-disk; you can add
+ * additional jars here if you have some copiler plugin that isn't present
+ * on maven central
+ */
def scalacPluginClasspath: T[Agg[PathRef]] = T {
resolveDeps(scalacPluginIvyDeps)()
}
+ /**
+ * The ivy coordinates of Scala's own standard library
+ */
def scalaDocPluginClasspath: T[Agg[PathRef]] = T {
resolveDeps(scalaDocPluginIvyDeps)()
}
def scalaLibraryIvyDeps = T{ scalaRuntimeIvyDeps(scalaOrganization(), scalaVersion()) }
+
/**
* Classpath of the Scala Compiler & any compiler plugins
*/
def scalaCompilerClasspath: T[Agg[PathRef]] = T{
resolveDeps(
- T.task{scalaCompilerIvyDeps(scalaOrganization(), scalaVersion()) ++
- scalaRuntimeIvyDeps(scalaOrganization(), scalaVersion())}
+ T.task{
+ scalaCompilerIvyDeps(scalaOrganization(), scalaVersion()) ++
+ scalaRuntimeIvyDeps(scalaOrganization(), scalaVersion())
+ }
)()
}
override def compileClasspath = T{
@@ -168,6 +192,10 @@ trait ScalaModule extends JavaModule { outer =>
createJar(Agg(javadocDir))(outDir)
}
+ /**
+ * Opens up a Scala console with your module and all dependencies present,
+ * for you to test and operate your code interactively
+ */
def console() = T.command{
if (T.ctx().log.inStream == DummyInputStream){
Result.Failure("repl needs to be run with the -i/--interactive flag")
@@ -186,6 +214,9 @@ trait ScalaModule extends JavaModule { outer =>
}
}
+ /**
+ * Dependencies that are necessary to run the Ammonite Scala REPL
+ */
def ammoniteReplClasspath = T{
localClasspath() ++
transitiveLocalClasspath() ++
@@ -196,6 +227,10 @@ trait ScalaModule extends JavaModule { outer =>
})()
}
+ /**
+ * Opens up an Ammonite Scala REPL with your module and all dependencies present,
+ * for you to test and operate your code interactively
+ */
def repl(replOptions: String*) = T.command{
if (T.ctx().log.inStream == DummyInputStream){
Result.Failure("repl needs to be run with the -i/--interactive flag")
@@ -211,14 +246,22 @@ trait ScalaModule extends JavaModule { outer =>
}
- // publish artifact with name "mill_2.12.4" instead of "mill_2.12"
+ /**
+ * Whether to publish artifacts with name "mill_2.12.4" instead of "mill_2.12"
+ */
def crossFullScalaVersion: T[Boolean] = false
+ /**
+ * What Scala version string to use when publishing
+ */
def artifactScalaVersion: T[String] = T {
if (crossFullScalaVersion()) scalaVersion()
else Lib.scalaBinaryVersion(scalaVersion())
}
+ /**
+ * The suffix appended to the artifact IDs during publishing
+ */
def artifactSuffix: T[String] = s"_${artifactScalaVersion()}"
override def artifactId: T[String] = artifactName() + artifactSuffix()