Skip to content

Commit 4c508da

Browse files
authored
Refactor build.sbt to support cross versions (#73)
* update * update * add back * remove * refactor build.sbt * compile only * remove trigger
1 parent 593b65d commit 4c508da

File tree

2 files changed

+45
-46
lines changed

2 files changed

+45
-46
lines changed

.github/workflows/sbt.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
with:
2929
path: ~/.sbt
3030
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
31-
- name: Run tests
32-
run: sbt ^test
31+
- name: Build
32+
run: sbt compile
3333
#run: sbt ^test ^scripted

build.sbt

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,49 @@ This gives you the ability to generate client SDKs, documentation, new generator
77
specifications as part of your build. Other tasks are available as command line tasks.
88
"""
99

10-
lazy val `sbt-openapi-generator` = (project in file("."))
10+
lazy val scala212 = "2.12.20"
11+
lazy val scala3 = "3.7.2"
12+
13+
inThisBuild(
14+
List(
15+
homepage := Some(url("https://openapi-generator.tech")),
16+
17+
organization := "org.openapitools",
18+
organizationName := "OpenAPI-Generator Contributors",
19+
organizationHomepage := Some(url("https://github.com/OpenAPITools")),
20+
21+
licenses += ("The Apache Software License, Version 2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
22+
23+
developers += Developer(
24+
id = "openapitools",
25+
name = "OpenAPI-Generator Contributors",
26+
email = "team@openapitools.org",
27+
url = url("https://github.com/OpenAPITools")
28+
)
29+
)
30+
)
31+
32+
onLoadMessage := s"Welcome to sbt-openapi-generator ${version.value}"
33+
crossScalaVersions := Nil
34+
publish / skip := true // don't publish the root project
35+
36+
lazy val plugin = (project in file("."))
37+
.enablePlugins(SbtPlugin)
1138
.settings(
1239
moduleName := "sbt-openapi-generator",
13-
scalaVersion := "2.12.20",
14-
crossScalaVersions := Seq(scalaVersion.value),
15-
crossSbtVersions := List("1.11.4"),
16-
sbtPlugin := true,
17-
18-
inThisBuild(List(
19-
homepage := Some(url("https://openapi-generator.tech")),
20-
21-
organization := "org.openapitools",
22-
organizationName := "OpenAPI-Generator Contributors",
23-
organizationHomepage := Some(url("https://github.com/OpenAPITools")),
24-
25-
licenses += ("The Apache Software License, Version 2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
26-
27-
developers += Developer(
28-
id = "openapitools",
29-
name = "OpenAPI-Generator Contributors",
30-
email = "team@openapitools.org",
31-
url = url("https://github.com/OpenAPITools")
32-
)
33-
)),
34-
35-
scriptedLaunchOpts := {
36-
scriptedLaunchOpts.value ++ Seq("-Xmx1024M", "-server", "-Dplugin.version=" + version.value)
40+
crossScalaVersions := Seq(scala212, scala3),
41+
scalacOptions ++= {
42+
scalaBinaryVersion.value match {
43+
case "2.12" => "-Xsource:3" :: Nil
44+
case _ => Nil
45+
}
3746
},
38-
39-
scriptedBufferLog := false,
40-
41-
resolvers ++= Seq(
42-
Resolver.sbtPluginRepo("snapshots"),
43-
),
44-
45-
//version := "7.14.0",
46-
47-
48-
scmInfo := Some(
49-
ScmInfo(
50-
browseUrl = url("https://github.com/OpenAPITools/openapi-generator"),
51-
connection = "scm:git:git://github.com/OpenAPITools/openapi-generator.git",
52-
devConnection = "scm:git:ssh://git@github.com:OpenAPITools/openapi-generator.git")
53-
),
54-
55-
libraryDependencies += "org.openapitools" % "openapi-generator" % "7.14.0"
56-
).enablePlugins(SbtPlugin)
47+
(pluginCrossBuild / sbtVersion) := {
48+
scalaBinaryVersion.value match {
49+
case "2.12" => "1.5.8"
50+
case _ => "2.0.0-RC3"
51+
}
52+
},
53+
libraryDependencies += "org.openapitools" % "openapi-generator" % "7.14.0",
54+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.2")
55+
)

0 commit comments

Comments
 (0)