atooni / mill-mdoc Goto Github PK
View Code? Open in Web Editor NEWSimple MDoc runner for mill
Simple MDoc runner for mill
I conclude this isn't supported right now?
Hi, I just realized build.sc declares the license, but the repo doesn't have one in the root directory.
Line 77 in 2f8b5e3
Could you add this just for clarification please?
While trying to use this module I got an error in the imports. After some some searching I noticed that MDoc's --classpath
is not being used in the call to Jvm.runLocal
. More concretely the command line arguments should be changed.
Here is my working version that I use as an override:
override def mdoc : T[PathRef] = T {
val cp = runClasspath().map(_.path)
val separator = java.io.File.pathSeparatorChar
val dir = T.dest.toIO.getAbsolutePath
val dirParams = mdocSources().map(pr => Seq(
"--classpath", cp.mkString(s"$separator"),
"--in", pr.path.toIO.getAbsolutePath,
"--out", dir)
).iterator.flatten.toSeq
Jvm.runLocal("mdoc.Main", cp, dirParams)
PathRef(T.dest)
}
Two additional notes:
cp
parameter. I think here we should just add MDoc and its dependencies.I have set-up a simple build.sc
to use mdoc but am getting the error.
Compiling /home/hmf/VSCodeProjects/stensorflow/build.sc
[40/40] tutorial.mdoc
1 targets failed
tutorial.mdoc java.lang.ClassNotFoundException: mdoc.Main
java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
mill.api.ClassLoader$$anon$1.findClass(ClassLoader.scala:47)
java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
mill.modules.Jvm$.getMainMethod(Jvm.scala:268)
mill.modules.Jvm$.$anonfun$runLocal$1(Jvm.scala:262)
mill.util.Jvm$.inprocess(Jvm.scala:30)
mill.modules.Jvm$.inprocess(Jvm.scala:288)
mill.modules.Jvm$.runLocal(Jvm.scala:256)
de.wayofquality.mill.mdoc.MDocModule.$anonfun$mdoc$2(MDocModule.scala:23)
mill.define.Task$TraverseCtx.evaluate(Task.scala:380)
I am using:
import mill._
import mill.api.Loose
import mill.define.{Target, Task}
import scalalib._
import coursier.core.Resolution
import java.io.File
// Import JavaCPP to get host OS name
import $ivy.`org.bytedeco:javacpp:1.5.7`
// Add simple mdoc support for mill
// https://mvnrepository.com/artifact/org.scalameta/mdoc
import $ivy.`org.scalameta::mdoc:2.3.3`
//import $ivy.`org.scalameta::mdoc:2.2.4`
import $ivy.`de.wayofquality.blended::de.wayofquality.blended.mill.mdoc::0.0.4-2-2f8b5e`
import de.wayofquality.mill.mdoc.MDocModule
val ScalaVersion = "3.2.1-RC2" // "3.1.3"
val mUnitVersion = "1.0.0-M6"
val javaCPPVersion = "1.5.7"
val tensorflowVersion = "0.4.1" // TF:2.7.1
object tutorial extends ScalaModule with MDocModule {
// Also used by mill-mdoc
override def scalaVersion = T{ ScalaVersion }
override def javacOptions = T{ Seq("-source", "17", "-target", "17", "-Xlint") }
override def scalacOptions = T{ Seq("-deprecation", "-feature") }
// mdoc
override def scalaMdocVersion = "2.3.3" // "2.2.4"
override def mdocSources = T.sources{ T.workspace / "docs" }
def javaCPPPlatform = T{ org.bytedeco.javacpp.Loader.Detector.getPlatform }
override def ivyDeps = Agg(
ivy"org.tensorflow:tensorflow-core-api:${tensorflowVersion}",
ivy"org.tensorflow:tensorflow-core-api:${tensorflowVersion};classifier=${javaCPPPlatform()}"
)
object test extends Tests with TestModule.Munit {
def ivyDeps = Agg(ivyMunit)
def testFramework = ivyMunitInterface
}
}
I have tried versions of mdoc "2.3.3" and the examples "2.2.4" and get the same error. I found this. Can this be an issue with using Scala 3.x? I did find that SBT now works with the version 3 compiler.
EDIT: I also tried it with and without the line
import $ivy.`org.scalameta::mdoc:2.3.3`
but got the same result.
I also looked at the source code and googled and cannot figure out were/how mdoc can set the compiler version. Where is this done here?
TIA
All mill plugin have that tag to allow easy search on Github via https://github.com/search?q=mill-plugin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.