|
1 | 1 | package mill.init |
2 | 2 |
|
3 | | -import coursier.LocalRepositories |
4 | | -import coursier.core.Repository |
5 | | -import coursier.maven.MavenRepository |
6 | 3 | import mill.api.{PathRef, Result} |
7 | 4 | import mill.main.buildgen.BuildGenUtil |
| 5 | +import mill.scalalib.{CoursierModule, Dep} |
8 | 6 | import mill.scalalib.scalafmt.ScalafmtWorkerModule |
9 | | -import mill.util.{Jvm, MillModuleUtil} |
| 7 | +import mill.util.Jvm |
10 | 8 | import mill.{Command, T, Task, TaskModule} |
11 | 9 |
|
12 | | -import scala.util.control.NoStackTrace |
13 | | - |
14 | 10 | @mill.api.experimental |
15 | | -trait BuildGenModule extends TaskModule { |
| 11 | +trait BuildGenModule extends CoursierModule with TaskModule { |
16 | 12 |
|
17 | 13 | def defaultCommandName(): String = "init" |
18 | 14 |
|
19 | | - def buildGenClasspath: T[Seq[PathRef]] |
| 15 | + def buildGenDeps: T[Seq[Dep]] = Task { Seq.empty[Dep] } |
| 16 | + |
| 17 | + def buildGenClasspath: T[Seq[PathRef]] = Task { |
| 18 | + defaultResolver().classpath(buildGenDeps()) |
| 19 | + } |
20 | 20 |
|
21 | 21 | def buildGenMainClass: T[String] |
22 | 22 |
|
@@ -48,18 +48,3 @@ trait BuildGenModule extends TaskModule { |
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
51 | | -@mill.api.experimental |
52 | | -object BuildGenModule { |
53 | | - |
54 | | - def millModule(artifact: String): Result[Seq[PathRef]] = |
55 | | - MillModuleUtil.millProjectModule(artifact, millRepositories) |
56 | | - |
57 | | - def millRepositories: Seq[Repository] = Seq( |
58 | | - LocalRepositories.ivy2Local, |
59 | | - MavenRepository("https://repo1.maven.org/maven2"), |
60 | | - MavenRepository("https://oss.sonatype.org/content/repositories/releases") |
61 | | - ) |
62 | | -} |
63 | | - |
64 | | -@mill.api.experimental |
65 | | -case class BuildGenException(message: String) extends Exception(message) with NoStackTrace |
0 commit comments