Skip to content

Commit 3a2698b

Browse files
committed
feat: Sbt v2 support
1 parent 68e3488 commit 3a2698b

File tree

6 files changed

+79
-98
lines changed

6 files changed

+79
-98
lines changed

build.sbt

Lines changed: 71 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import org.latestbit.sbt.gcs.GcsPublishFilePolicy
1+
lazy val ScalaVersions = Seq( "3.6.2", "2.12.20" )
22

33
ThisBuild / organization := "org.latestbit"
44

@@ -15,22 +15,22 @@ ThisBuild / scalacOptions ++= Seq(
1515
"-Xlint",
1616
"-deprecation",
1717
"-feature",
18-
"-language:_",
1918
"-unchecked"
2019
)
2120

22-
lazy val sbtGcsPlaygroundToPublish = project
23-
.in( file( "playground-publish" ) )
21+
lazy val testGoogleArtifactRegistry = "europe-north1-maven.pkg.dev/latestbit/latestbit-artifacts-snapshots"
22+
23+
lazy val sbtGcsPlaygroundToPublish = ( projectMatrix in file( "playground-publish" ) )
2424
.settings(
2525
name := "sbt-gcs-plugin-playground-publish",
2626
version := "0.0.7",
2727
crossScalaVersions := Nil,
2828
publishTo := Some( "Custom Releases" at "gs://private-artifacts" ),
2929
logLevel := Level.Debug
3030
)
31+
.jvmPlatform( scalaVersions = ScalaVersions )
3132

32-
lazy val sbtGcsPlaygroundToResolve = project
33-
.in( file( "playground-resolve" ) )
33+
lazy val sbtGcsPlaygroundToResolve = ( projectMatrix in file( "playground-resolve" ) )
3434
.settings(
3535
name := "sbt-gcs-plugin-playground-resolve",
3636
crossScalaVersions := Nil,
@@ -40,37 +40,76 @@ lazy val sbtGcsPlaygroundToResolve = project
4040
),
4141
logLevel := Level.Debug
4242
)
43+
.jvmPlatform( scalaVersions = ScalaVersions )
4344

44-
lazy val sbtGcsArtifactRepositoryPlaygroundToPublish = project
45-
.in( file( "playground-publish-artifact-repository" ) )
46-
.settings(
47-
name := "sbt-gcs-plugin-playground-artifact-publish",
48-
version := "0.0.25-SNAPSHOT",
49-
crossScalaVersions := Nil,
50-
publishTo := Some(
51-
"Custom Releases" at "artifactregistry://europe-north1-maven.pkg.dev/latestbit/latestbit-artifacts-snapshots"
52-
),
53-
logLevel := Level.Debug
54-
)
45+
lazy val sbtGcsArtifactRepositoryPlaygroundToPublish =
46+
( projectMatrix in file( "playground-publish-artifact-repository" ) )
47+
.settings(
48+
name := "sbt-gcs-plugin-playground-artifact-publish",
49+
version := "0.0.25-SNAPSHOT",
50+
crossScalaVersions := Nil,
51+
publishTo := Some(
52+
"Custom Releases" at s"artifactregistry://${testGoogleArtifactRegistry}"
53+
),
54+
logLevel := Level.Debug
55+
)
56+
.jvmPlatform( scalaVersions = ScalaVersions )
57+
58+
lazy val sbtGcsArtifactRepositoryPlaygroundToResolve =
59+
( projectMatrix in file( "playground-resolve-artifact-repository" ) )
60+
.settings(
61+
name := "sbt-gcs-plugin-playground-artifact-resolve",
62+
crossScalaVersions := Nil,
63+
resolvers += "Custom Releases" at s"artifactregistry://${testGoogleArtifactRegistry}",
64+
libraryDependencies ++= Seq(
65+
"org.latestbit" %% "sbt-gcs-plugin-playground-artifact-publish" % "0.0.25-SNAPSHOT"
66+
),
67+
logLevel := Level.Debug
68+
)
69+
.jvmPlatform( scalaVersions = ScalaVersions )
5570

56-
lazy val sbtGcsArtifactRepositoryPlaygroundToResolve = project
57-
.in( file( "playground-resolve-artifact-repository" ) )
71+
lazy val plugin = ( projectMatrix in file( "sbt-gcs-plugin" ) )
72+
.enablePlugins( GitVersioning, SbtPlugin )
5873
.settings(
59-
name := "sbt-gcs-plugin-playground-artifact-resolve",
60-
crossScalaVersions := Nil,
61-
resolvers += "Custom Releases" at "artifactregistry://europe-north1-maven.pkg.dev/latestbit/latestbit-artifacts-snapshots",
62-
libraryDependencies ++= Seq(
63-
"org.latestbit" %% "sbt-gcs-plugin-playground-artifact-publish" % "0.0.25-SNAPSHOT"
74+
name := "sbt-gcs-plugin",
75+
description := "A SBT plugin for Google Cloud Storage (GCS) and Google Artifact Registry",
76+
organization := "org.latestbit",
77+
homepage := Some( url( "http://latestbit.com" ) ),
78+
licenses += ( "Apache-2.0", url( "https://www.apache.org/licenses/LICENSE-2.0.html" ) ),
79+
scmInfo := Some(
80+
ScmInfo(
81+
url("https://github.com/abdolence/sbt-gcs-resolver"),
82+
"scm:git@github.com:abdolence/sbt-gcs-resolver.git"
83+
)
6484
),
65-
logLevel := Level.Debug
85+
developers := List(
86+
Developer(
87+
id = "abdolence",
88+
name = "Abdulla Abdurakhmanov",
89+
email = "me@abdolence.dev",
90+
url = url("http://abdolence.dev")
91+
)
92+
),
93+
publishTo := {
94+
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
95+
if version.value.endsWith("-SNAPSHOT") then Some("central-snapshots" at centralSnapshots)
96+
else localStaging.value
97+
},
98+
sbtPlugin := true,
99+
publishMavenStyle := true,
100+
credentials += Credentials(Path.userHome / ".sbt" / "sonatype_central_credentials"),
101+
scalaVersion := "2.12.20",
102+
libraryDependencies ++= Seq(
103+
"org.scala-lang" % "scala-library" % scalaVersion.value,
104+
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
105+
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
106+
"org.apache.ivy" % "ivy" % "2.4.0",
107+
"com.google.cloud" % "google-cloud-storage" % "2.62.0"
108+
)
66109
)
110+
.jvmPlatform( scalaVersions = ScalaVersions )
67111

68-
lazy val plugin = project
69-
.in( file( "sbt-gcs-plugin" ) )
70-
.enablePlugins( GitVersioning )
71-
72-
lazy val sbtGcsRoot = project
73-
.in( file( "." ) )
112+
lazy val sbtGcsRoot = ( projectMatrix in file( "." ) )
74113
.settings(
75114
name := "sbt-gcs-plugin-root",
76115
crossScalaVersions := Nil,
@@ -79,6 +118,4 @@ lazy val sbtGcsRoot = project
79118
publishArtifact := false,
80119
logLevel := Level.Debug
81120
)
82-
.aggregate( sbtGcsPlaygroundToPublish )
83-
84-
Global / gcsPublishFilePolicy := GcsPublishFilePolicy.InheritedFromBucket
121+
.jvmPlatform( scalaVersions = ScalaVersions )

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.12.0
1+
sbt.version=2.0.0-RC8

project/plugins.sbt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
lazy val root = ( project in file( "." ) ) dependsOn sbtGcsPlugin
1+
addSbtPlugin( "org.scalameta" % "sbt-scalafmt" % "2.5.6" )
22

3-
lazy val sbtGcsPlugin = ProjectRef( file( "../sbt-gcs-plugin" ), "sbt-gcs-plugin" )
4-
5-
addSbtPlugin( "org.latestbit" % "sbt-gcs-plugin" % "1.16.1" )
6-
7-
addSbtPlugin( "org.scalameta" % "sbt-scalafmt" % "2.5.4" )
8-
9-
addSbtPlugin( "com.typesafe.sbt" % "sbt-git" % "1.0.2" )
10-
11-
addSbtPlugin( "org.xerial.sbt" % "sbt-sonatype" % "3.12.2" )
3+
addSbtPlugin( "com.github.sbt" % "sbt-git" % "2.1.0" )

sbt-gcs-plugin/build.sbt

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
sbt.version=1.12.0
1+
sbt.version=2.0.0-RC8
2+

sbt-gcs-plugin/project/plugins.sbt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
addSbtPlugin( "org.xerial.sbt" % "sbt-sonatype" % "3.12.2" )
2-
addSbtPlugin( "com.github.sbt" % "sbt-pgp" % "2.3.1" )
1+
addSbtPlugin( "com.github.sbt" % "sbt-pgp" % "2.3.1" )
32

4-
addSbtPlugin( "org.scalameta" % "sbt-scalafmt" % "2.5.4" )
3+
addSbtPlugin( "org.scalameta" % "sbt-scalafmt" % "2.5.6" )
54

6-
addSbtPlugin( "com.typesafe.sbt" % "sbt-git" % "1.0.2" )
5+
addSbtPlugin( "com.github.sbt" % "sbt-git" % "2.1.0" )

0 commit comments

Comments
 (0)