Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Jan 22, 2025
1 parent 0cd3a69 commit 7d3beb8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scala.collection.immutable.SortedMap

trait BuildGenBase[M, D] {
type C
def convertWriteOut(cfg: C, shared: BuildGenUtil.Config, input: Tree[Node[M]]) = {
def convertWriteOut(cfg: C, shared: BuildGenUtil.Config, input: Tree[Node[M]]): Unit = {
val output = convert(input, cfg, shared)
writeBuildObject(if (shared.merge.value) compactBuildTree(output) else output)
}
Expand Down
5 changes: 3 additions & 2 deletions main/init/buildgen/src/mill/main/buildgen/BuildGenUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import mill.main.client.CodeGenConstants.{
}
import mill.main.client.OutFiles
import mill.runner.FileImportGraph.backtickWrap
import scala.collection.immutable.SortedSet

@mill.api.internal
object BuildGenUtil {
Expand Down Expand Up @@ -115,7 +116,7 @@ object BuildGenUtil {
os.sub / dirs / name
}

def renderImports(baseModule: Option[String], isNested: Boolean, packagesSize: Int) = {
def renderImports(baseModule: Option[String], isNested: Boolean, packagesSize: Int): SortedSet[String] = {
scala.collection.immutable.SortedSet("mill._", "mill.javalib._", "mill.javalib.publish._") ++
(if (isNested) baseModule.map(name => s"$$file.$name")
else if (packagesSize > 1) Seq("$packages._")
Expand Down Expand Up @@ -433,7 +434,7 @@ object BuildGenUtil {
}
}

def renderTestModuleDecl(testModule: String, testModuleType: Option[String]) = {
def renderTestModuleDecl(testModule: String, testModuleType: Option[String]): String = {
val name = backtickWrap(testModule)
testModuleType match {
case Some(supertype) => s"object $name extends MavenTests with $supertype"
Expand Down
11 changes: 6 additions & 5 deletions main/init/gradle/src/mill/main/gradle/GradleBuildGenMain.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mill.main.gradle

import mainargs.{Flag, ParserForClass, arg, main}
import mainargs.{ParserForClass, arg, main}
import mill.main.buildgen.BuildGenUtil.*
import mill.main.buildgen.{
IrBaseInfo,
Expand All @@ -21,6 +21,7 @@ import org.gradle.api.plugins.JavaPlugin
import org.gradle.tooling.GradleConnector

import scala.jdk.CollectionConverters.*
import os.Path

/**
* Converts a Gradle build to Mill by generating Mill build file(s).
Expand Down Expand Up @@ -176,15 +177,15 @@ object GradleBuildGenMain extends BuildGenBase[ProjectModel, JavaModel.Dep] {
)
}

def getModuleSupertypes(cfg: Config) = Seq(cfg.shared.baseModule.getOrElse("MavenModule"))
def getModuleSupertypes(cfg: Config): Seq[String] = Seq(cfg.shared.baseModule.getOrElse("MavenModule"))

def getPackage(project: ProjectModel): (String, String, String) = {
(project.group(), project.name(), project.version())
}

def getArtifactId(model: ProjectModel): String = model.name()
def getMillSourcePath(model: ProjectModel) = os.Path(model.directory())
def getSuperTypes(cfg: Config, baseInfo: IrBaseInfo, build: Node[ProjectModel]) = {
def getMillSourcePath(model: ProjectModel): Path = os.Path(model.directory())
def getSuperTypes(cfg: Config, baseInfo: IrBaseInfo, build: Node[ProjectModel]): Seq[String] = {
Seq("RootModule") ++
Option.when(null != build.value.maven().pom() && baseInfo.noPom) { "PublishModule" } ++
Option.when(build.dirs.nonEmpty || os.exists(getMillSourcePath(build.value) / "src")) {
Expand Down Expand Up @@ -240,7 +241,7 @@ object GradleBuildGenMain extends BuildGenBase[ProjectModel, JavaModel.Dep] {
project: ProjectModel,
packages: PartialFunction[(String, String, String), String],
cfg: Config
) = {
): IrScopedDeps = {
var sd = IrScopedDeps()
val hasTest = os.exists(os.Path(project.directory()) / "src/test")
val _java = project._java()
Expand Down
5 changes: 3 additions & 2 deletions main/init/maven/src/mill/main/maven/MavenBuildGenMain.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import mill.main.buildgen.{
import org.apache.maven.model.{Dependency, Model, Parent}

import scala.jdk.CollectionConverters.*
import os.{ Path, SubPath }

/**
* Converts a Maven build to Mill by generating Mill build file(s) from POM file(s).
Expand Down Expand Up @@ -133,7 +134,7 @@ object MavenBuildGenMain extends BuildGenBase[Model, Dependency] {
}

def getArtifactId(model: Model): String = model.getArtifactId
def getMillSourcePath(model: Model) = os.Path(model.getProjectDirectory)
def getMillSourcePath(model: Model): Path = os.Path(model.getProjectDirectory)

def getSuperTypes(cfg: Config, baseInfo: IrBaseInfo, build: Node[Model]): Seq[String] = {
Seq("RootModule") ++
Expand All @@ -143,7 +144,7 @@ object MavenBuildGenMain extends BuildGenBase[Model, Dependency] {
def processResources(
input: java.util.List[org.apache.maven.model.Resource],
millSourcePath: os.Path
) = input
): Seq[SubPath] = input
.asScala
.map(_.getDirectory)
.map(os.Path(_).subRelativeTo(millSourcePath))
Expand Down

0 comments on commit 7d3beb8

Please sign in to comment.