Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
lefou committed Mar 5, 2024
1 parent 1983083 commit a395c4a
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
import $ivy.`io.get-coursier::coursier-launcher:2.1.0-RC1`
import $file.ci.upload

import mill._
import scalalib._
import publish._
import mill.api.Lazy
import mill.contrib.bloop.Bloop
import mill.scalalib.api.ZincWorkerUtil._
import coursier.mavenRepositoryString
import $file.ci.upload

import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
import $ivy.`io.get-coursier::coursier-launcher:2.1.0-RC1`
import mill.define.Command
import mill.testrunner.TestResult

import scala.util.chaining.scalaUtilChainingOps
import scala.util.control.NonFatal

val ghOrg = "com-lihaoyi"
val ghRepo = "Ammonite"
Expand All @@ -29,15 +31,15 @@ val isPublishableCommit =
publishBranches.exists(suffix => x.endsWith(s"/${suffix}"))
)

val latestTaggedVersion = os.proc("git", "describe", "--abbrev=0", "--tags").call().out.trim
val latestTaggedVersion = os.proc("git", "describe", "--abbrev=0", "--tags").call().out.trim()

val gitHead = os.proc("git", "rev-parse", "HEAD").call().out.trim
val gitHead = os.proc("git", "rev-parse", "HEAD").call().out.trim()

val commitsSinceTaggedVersion = {
os.proc("git", "rev-list", gitHead, "--not", latestTaggedVersion, "--count")
.call()
.out
.trim
.trim()
.toInt
}

Expand All @@ -64,10 +66,10 @@ val (buildVersion, unstable) = scala.util.Try(
os.proc("git", "describe", "--exact-match", "--tags", "--always", gitHead)
.call()
.out
.trim
.trim()
).toOption match {
case None =>
val gitHash = os.proc("git", "rev-parse", "--short", "HEAD").call().out.trim
val gitHash = os.proc("git", "rev-parse", "--short", "HEAD").call().out.trim()
(s"$latestTaggedVersion-$commitsSinceTaggedVersion-$gitHash", true)
case Some(tagName) => (tagName, false)
}
Expand Down Expand Up @@ -281,7 +283,7 @@ trait AmmDependenciesResourceFileModule extends JavaModule {
def dependencyResourceFileName: String
def dependencyFileResources = T {
val deps0 = compileIvyDeps().map(bindDependency()) ++ transitiveIvyDeps()
val (_, res) = mill.modules.Jvm.resolveDependenciesMetadata(
val (_, res) = mill.util.Jvm.resolveDependenciesMetadata(
repositoriesTask(),
deps0.map(_.dep), // .map(resolveCoursierDependency().apply(_)),
deps0.filter(_.force).map(_.dep), // .map(resolveCoursierDependency().apply(_)),
Expand Down Expand Up @@ -402,7 +404,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions) {
val outDir = T.ctx().dest
val javadocDir = outDir / "javadoc"
os.makeDir.all(javadocDir)
mill.api.Result.Success(mill.modules.Jvm.createJar(Agg(javadocDir))(outDir))
mill.api.Result.Success(mill.util.Jvm.createJar(Agg(javadocDir))(outDir))
}
else super.docJar
def constantsSourceDir = T {
Expand Down Expand Up @@ -506,7 +508,7 @@ object amm extends Cross[MainModule](fullCrossScalaVersions) {
amm.repl.api().exposedClassPath() ++
amm.compiler().exposedClassPath() ++
Seq(compile().classes) ++
resolveDeps(T.task { compileIvyDeps().map(bindDependency()) ++ transitiveIvyDeps() })()
resolveDeps(T.task { this.compileIvyDeps().map(bindDependency()) ++ transitiveIvyDeps() })()
)
}

Expand Down Expand Up @@ -559,7 +561,7 @@ trait MainModule extends AmmModule {
externalSources()

def prependShellScript = T {
mill.modules.Jvm.launcherUniversalScript(
mill.util.Jvm.launcherUniversalScript(
mainClass().get,
Agg("$0"),
Agg("%~dpnx0"),
Expand Down Expand Up @@ -652,7 +654,7 @@ def generateApiWhitelist(replApiCp: Seq[PathRef])(implicit ctx: mill.api.Ctx.Des
val thinClasspathEntries = replApiCp.map(_.path).flatMap { cpRoot =>
if (os.isFile(cpRoot) && cpRoot.ext == "jar") {
val zip = new java.util.zip.ZipFile(cpRoot.toIO)
import collection.JavaConverters._
import scala.jdk.CollectionConverters._
for (e <- zip.entries().asScala) yield e.getName
} else if (os.isDir(cpRoot)) {
for (sub <- os.walk(cpRoot)) yield sub.relativeTo(cpRoot).toString
Expand Down Expand Up @@ -886,7 +888,7 @@ def publishDocs() = {
)
)
} catch {
case e =>
case NonFatal(e) =>
println(e)
e.printStackTrace()
throw e
Expand Down Expand Up @@ -988,11 +990,11 @@ def publishSonatype(
}
if (isPublishableCommit)
new SonatypePublisher(
"https://oss.sonatype.org/service/local",
"https://oss.sonatype.org/content/repositories/snapshots",
sys.env("SONATYPE_DEPLOY_USER") + ":" + sys.env("SONATYPE_DEPLOY_PASSWORD"),
true,
Seq(
uri = "https://oss.sonatype.org/service/local",
snapshotUri = "https://oss.sonatype.org/content/repositories/snapshots",
credentials = sys.env("SONATYPE_DEPLOY_USER") + ":" + sys.env("SONATYPE_DEPLOY_PASSWORD"),
signed = true,
gpgArgs = Seq(
"--passphrase",
sys.env("SONATYPE_PGP_PASSWORD"),
"--no-tty",
Expand All @@ -1003,10 +1005,13 @@ def publishSonatype(
"-a",
"-b"
),
600000,
600000,
T.ctx().log,
600000
readTimeout = 600000,
connectTimeout = 600000,
log = T.log,
workspace = T.workspace,
env = T.env,
awaitTimeout = 600000,
stagingRelease = true
).publishAll(
true,
x: _*
Expand Down

0 comments on commit a395c4a

Please sign in to comment.