From f8f9ed0c677d0584201263d69e8d4a653b29d8ab Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 14 Nov 2020 12:31:34 -0500 Subject: [PATCH 1/2] Nightly setup --- build.sbt | 33 +++++++++++++++++++++------------ project/Dependencies.scala | 3 ++- project/build.properties | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/build.sbt b/build.sbt index 3fe9fff8f..1157395d7 100644 --- a/build.sbt +++ b/build.sbt @@ -7,15 +7,6 @@ val _ = { sys.props += ("line.separator" -> "\n") } -ThisBuild / version := { - val old = (ThisBuild / version).value - nightlyVersion match { - case Some(v) => v - case _ => - if ((ThisBuild / isSnapshot).value) "1.4.0-SNAPSHOT" - else old - } -} ThisBuild / versionScheme := Some("early-semver") ThisBuild / organization := "org.scala-sbt" ThisBuild / bintrayPackage := "librarymanagement" @@ -375,11 +366,29 @@ def customCommands: Seq[Setting[_]] = Seq( } ) +ThisBuild / version := { + val old = (ThisBuild / version).value + nightlyVersion match { + case Some(v) => v + case _ => + if ((ThisBuild / isSnapshot).value) "1.4.0-SNAPSHOT" + else old + } +} +def githubPackageRegistry: Option[Resolver] = + sys.env.get("RELEASE_GITHUB_PACKAGE_REGISTRY") map { repo => + s"GitHub Package Registry ($repo)" at s"https://maven.pkg.github.com/$repo" + } ThisBuild / publishTo := { val old = (ThisBuild / publishTo).value - sys.props.get("sbt.build.localmaven") match { - case Some(path) => Some(MavenCache("local-maven", file(path))) - case _ => old + githubPackageRegistry orElse old +} +ThisBuild / resolvers ++= githubPackageRegistry.toList +ThisBuild / credentials ++= { + sys.env.get("GITHUB_TOKEN") match { + case Some(token) => + List(Credentials("GitHub Package Registry", "maven.pkg.github.com", "unused", token)) + case _ => Nil } } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index fcb7ecbbc..f4dc77eb2 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -5,7 +5,8 @@ import sbt.contraband.ContrabandPlugin.autoImport._ object Dependencies { val scala212 = "2.12.10" - def nightlyVersion: Option[String] = sys.props.get("sbt.build.version") + def nightlyVersion: Option[String] = + sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version") private val ioVersion = nightlyVersion.getOrElse("1.4.0") private val utilVersion = nightlyVersion.getOrElse("1.4.0") diff --git a/project/build.properties b/project/build.properties index ea3a73ab1..c19c768d6 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.0-RC2 +sbt.version=1.4.2 From 349a4134e5d9122cd87bf29d4bc70619ae6b8c3c Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sun, 15 Nov 2020 00:58:52 -0500 Subject: [PATCH 2/2] Use Bintray for nightly --- build.sbt | 50 +++++++++++++--------------------- project/DatatypeConfig.scala | 12 ++++---- project/HouseRulesPlugin.scala | 4 ++- project/Util.scala | 10 ++++--- 4 files changed, 34 insertions(+), 42 deletions(-) diff --git a/build.sbt b/build.sbt index 1157395d7..62640cfb8 100644 --- a/build.sbt +++ b/build.sbt @@ -7,9 +7,18 @@ val _ = { sys.props += ("line.separator" -> "\n") } +ThisBuild / version := { + val old = (ThisBuild / version).value + nightlyVersion match { + case Some(v) => v + case _ => + if ((ThisBuild / isSnapshot).value) "1.4.0-SNAPSHOT" + else old + } +} ThisBuild / versionScheme := Some("early-semver") ThisBuild / organization := "org.scala-sbt" -ThisBuild / bintrayPackage := "librarymanagement" +ThisBuild / bintrayPackage := sys.env.get("BINTRAY_PACKAGE").getOrElse("librarymanagement") ThisBuild / homepage := Some(url("https://github.com/sbt/librarymanagement")) ThisBuild / description := "Library management module for sbt" ThisBuild / scmInfo := { @@ -238,11 +247,16 @@ lazy val lmCore = (project in file("core")) exclude[ReversedMissingMethodProblem]( "sbt.librarymanagement.MavenRepository.allowInsecureProtocol" ), - exclude[IncompatibleResultTypeProblem]("sbt.librarymanagement.ResolverFunctions.validateURLRepository"), - exclude[IncompatibleResultTypeProblem]("sbt.librarymanagement.ResolverFunctions.validateMavenRepo"), - exclude[IncompatibleResultTypeProblem]("sbt.librarymanagement.ResolverFunctions.validateArtifact"), + exclude[IncompatibleResultTypeProblem]( + "sbt.librarymanagement.ResolverFunctions.validateURLRepository" + ), + exclude[IncompatibleResultTypeProblem]( + "sbt.librarymanagement.ResolverFunctions.validateMavenRepo" + ), + exclude[IncompatibleResultTypeProblem]( + "sbt.librarymanagement.ResolverFunctions.validateArtifact" + ), exclude[IncompatibleResultTypeProblem]("sbt.librarymanagement.*.validateProtocol"), - ), ) .configure(addSbtIO, addSbtUtilLogging, addSbtUtilPosition, addSbtUtilCache) @@ -366,32 +380,6 @@ def customCommands: Seq[Setting[_]] = Seq( } ) -ThisBuild / version := { - val old = (ThisBuild / version).value - nightlyVersion match { - case Some(v) => v - case _ => - if ((ThisBuild / isSnapshot).value) "1.4.0-SNAPSHOT" - else old - } -} -def githubPackageRegistry: Option[Resolver] = - sys.env.get("RELEASE_GITHUB_PACKAGE_REGISTRY") map { repo => - s"GitHub Package Registry ($repo)" at s"https://maven.pkg.github.com/$repo" - } -ThisBuild / publishTo := { - val old = (ThisBuild / publishTo).value - githubPackageRegistry orElse old -} -ThisBuild / resolvers ++= githubPackageRegistry.toList -ThisBuild / credentials ++= { - sys.env.get("GITHUB_TOKEN") match { - case Some(token) => - List(Credentials("GitHub Package Registry", "maven.pkg.github.com", "unused", token)) - case _ => Nil - } -} - inThisBuild( Seq( whitesourceProduct := "Lightbend Reactive Platform", diff --git a/project/DatatypeConfig.scala b/project/DatatypeConfig.scala index 774f77ee5..e87492601 100644 --- a/project/DatatypeConfig.scala +++ b/project/DatatypeConfig.scala @@ -44,12 +44,12 @@ object DatatypeConfig { case "sbt.librarymanagement.CrossVersion" => { _ => "sbt.librarymanagement.CrossVersionFormats" :: - "sbt.librarymanagement.DisabledFormats" :: - "sbt.librarymanagement.BinaryFormats" :: - "sbt.librarymanagement.ConstantFormats" :: - "sbt.librarymanagement.PatchFormats" :: - "sbt.librarymanagement.FullFormats" :: - Nil + "sbt.librarymanagement.DisabledFormats" :: + "sbt.librarymanagement.BinaryFormats" :: + "sbt.librarymanagement.ConstantFormats" :: + "sbt.librarymanagement.PatchFormats" :: + "sbt.librarymanagement.FullFormats" :: + Nil } // TODO: These are handled by BasicJsonProtocol, and sbt-datatype should handle them by default, imo diff --git a/project/HouseRulesPlugin.scala b/project/HouseRulesPlugin.scala index 8c8958c4f..f204ee310 100644 --- a/project/HouseRulesPlugin.scala +++ b/project/HouseRulesPlugin.scala @@ -1,3 +1,5 @@ +package lmbuild + import sbt._ import Keys._ import bintray.BintrayPlugin @@ -12,7 +14,7 @@ object HouseRulesPlugin extends AutoPlugin { lazy val baseBuildSettings: Seq[Def.Setting[_]] = Seq( bintrayOrganization := Some("sbt"), - bintrayRepository := "maven-releases", + bintrayRepository := sys.env.get("BINTRAY_REPOSITORY").getOrElse("maven-releases"), ) lazy val baseSettings: Seq[Def.Setting[_]] = Seq( diff --git a/project/Util.scala b/project/Util.scala index 3b1ead60a..172b36423 100644 --- a/project/Util.scala +++ b/project/Util.scala @@ -16,10 +16,12 @@ object Util { lastCompilation.map(_.getStartTime) getOrElse 0L } - def generateVersionFile(version: String, - dir: File, - s: TaskStreams, - analysis: CompileAnalysis): Seq[File] = { + def generateVersionFile( + version: String, + dir: File, + s: TaskStreams, + analysis: CompileAnalysis + ): Seq[File] = { import java.util.{ Date, TimeZone } val formatter = new java.text.SimpleDateFormat("yyyyMMdd'T'HHmmss") formatter.setTimeZone(TimeZone.getTimeZone("GMT"))