Giter Site home page Giter Site logo

mill-mdoc's Issues

License file?

Hi, I just realized build.sc declares the license, but the repo doesn't have one in the root directory.

licenses = Seq(License.`Apache-2.0`),

Could you add this just for clarification please?

Classpath problem in MDocModule.mdoc

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:

  • The original code uses a s"--in" but string interpolation is not used
  • We do not really need to add all of the applications classpath via the cp parameter. I think here we should just add MDoc and its dependencies.

Error: java.lang.ClassNotFoundException: mdoc.Main

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.