From f2e4a7b107770a7b90aedc41c6503c3596da2c1d Mon Sep 17 00:00:00 2001 From: Martin Mauch Date: Wed, 4 Dec 2024 17:58:58 +0100 Subject: [PATCH] build: Fix Sonatype Central publishing --- build.mill | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/build.mill b/build.mill index b3d533b7..2fbcc301 100644 --- a/build.mill +++ b/build.mill @@ -1,10 +1,12 @@ -import $ivy.`io.chris-kipp::mill-ci-release::0.1.10` -import io.kipp.mill.ci.release.CiReleaseModule import coursier.maven.MavenRepository import mill._, scalalib._, publish._ import Assembly._ +import $ivy.`com.lihaoyi::mill-contrib-sonatypecentral:` +import mill.contrib.sonatypecentral.SonatypeCentralPublishModule +import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0` +import de.tobiasroeser.mill.vcs.version.VcsVersion -trait SparkModule extends Cross.Module2[String, String] with SbtModule with CiReleaseModule { +trait SparkModule extends Cross.Module2[String, String] with SbtModule with SonatypeCentralPublishModule { outer => override def scalaVersion = crossValue val sparkVersion = crossValue2 @@ -50,8 +52,10 @@ trait SparkModule extends Cross.Module2[String, String] with SbtModule with CiRe override def artifactName = "spark-excel" - override def publishVersion = s"${sparkVersion}_${super.publishVersion()}" - + override def publishVersion: T[String] = T { + val vcsVersion = VcsVersion.vcsState().format(untaggedSuffix = "-SNAPSHOT") + s"${sparkVersion}_${vcsVersion}" + } def pomSettings = PomSettings( description = "A Spark plugin for reading and writing Excel files", organization = "dev.mauch", @@ -69,6 +73,16 @@ trait SparkModule extends Cross.Module2[String, String] with SbtModule with CiRe override def extraPublish = Seq(PublishInfo(assembly(), classifier = None, ivyConfig = "compile")) + def publishArtifacts: T[PublishModule.PublishData] = Task { + val publishData = super.publishArtifacts() + publishData.copy( + payload = publishData.payload.filterNot { case (ref, name) => ref.toString.contains("jar.dest") } + ) + } + + override def sonatypeCentralReadTimeout: T[Int] = 600000 + override def sonatypeCentralAwaitTimeout: T[Int] = 1200 * 1000 + val sparkDeps = Agg( ivy"org.apache.spark::spark-core:$sparkVersion", ivy"org.apache.spark::spark-sql:$sparkVersion", @@ -136,16 +150,17 @@ trait SparkModule extends Cross.Module2[String, String] with SbtModule with CiRe ivy"org.scalamock::scalamock:5.2.0" ) } + } val scala213 = "2.13.15" val scala212 = "2.12.20" -val spark24 = List("2.4.1", "2.4.7", "2.4.8") -val spark30 = List("3.0.1", "3.0.3") -val spark31 = List("3.1.1", "3.1.2", "3.1.3") +val spark24 = List("2.4.8") +val spark30 = List("3.0.3") +val spark31 = List("3.1.3") val spark32 = List("3.2.4") val spark33 = List("3.3.4") -val spark34 = List("3.4.1", "3.4.4") +val spark34 = List("3.4.4") val spark35 = List("3.5.3") val sparkVersions = spark24 ++ spark30 ++ spark31 ++ spark32 ++ spark33 ++ spark34 ++ spark35 val crossMatrix =