From 6c7a42eac6a05746eca96c648b55a50af2587a3b Mon Sep 17 00:00:00 2001 From: "Carlos A. Rueda" Date: Sun, 22 Sep 2019 13:20:29 -0700 Subject: Add JBuildInfo (#697) * Add JBuildInfo * Update JBuildInfo 0.1.2 now generates getter methods instead --- docs/pages/10 - Thirdparty Modules.md | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/docs/pages/10 - Thirdparty Modules.md b/docs/pages/10 - Thirdparty Modules.md index 58aaf558..a6b87b81 100644 --- a/docs/pages/10 - Thirdparty Modules.md +++ b/docs/pages/10 - Thirdparty Modules.md @@ -352,3 +352,56 @@ Publishing to custom local Maven repository Publishing to /tmp/m2repo ``` +## JBuildInfo + +This is a [mill](https://www.lihaoyi.com/mill/) module similar to +[BuildInfo](https://www.lihaoyi.com/mill/page/contrib-modules.html#buildinfo) +but for Java. +It will generate a Java class containing information from your build. + +Project home: https://github.com/carueda/mill-jbuildinfo + +To declare a module that uses this plugin, extend the +`com.github.carueda.mill.JBuildInfo` trait and provide +the desired information via the `buildInfoMembers` method: + +```scala +// build.sc +import $ivy.`com.github.carueda::jbuildinfo:0.1.2` +import com.github.carueda.mill.JBuildInfo +import mill.T + +object project extends JBuildInfo { + def buildInfoMembers: T[Map[String, String]] = T { + Map( + "name" -> "some name", + "version" -> "x.y.z" + ) + } +} +``` + +This will generate: + +```java +// BuildInfo.java +public class BuildInfo { + public static final String getName() { return "some name"; } + public static final String getVersion() { return "x.y.z"; } +} +``` + +### Configuration options + +* `def buildInfoMembers: T[Map[String, String]]` + + The map containing all member names and values for the generated class. + +* `def buildInfoClassName: String`, default: `BuildInfo` + + The name of the class that will contain all the members from + `buildInfoMembers`. + +* `def buildInfoPackageName: Option[String]`, default: `None` + + The package name for the generated class. -- cgit v1.2.3