Skip to content

Commit 5eace4b

Browse files
committed
prepare release 4.2.1-M2
1 parent 652008a commit 5eace4b

File tree

3 files changed

+70
-5
lines changed

3 files changed

+70
-5
lines changed

build.sbt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
ThisBuild / version := "4.2.1-M2"
2-
3-
ThisBuild / scalaVersion := "3.3.3" // use LTS
1+
lazy val reqTLangVer = "4.2.1-M2"
2+
lazy val scalaVer = "3.3.3" // use LTS only
3+
lazy val munitVer = "0.7.29"
44

5+
ThisBuild / version := reqTLangVer
6+
ThisBuild / scalaVersion := scalaVer // use LTS
57
ThisBuild / organization := "io.github.reqt"
68

79
console / initialCommands := """import reqt.*"""
810

911
Global / onChangedBuildSource := ReloadOnSourceChanges
1012

11-
libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test
13+
libraryDependencies += "org.scalameta" %% "munit" % munitVer % Test
1214

1315
lazy val nameOfThisBuild = "reqt-lang"
1416

publish.sc

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// run with `scala-cli run publish.sc`
2+
3+
//> using scala 3.4
4+
//> using toolkit default
5+
6+
println("*** Publish the reqT-lang jar to github using sbt and gh ***\n")
7+
8+
val wd = os.pwd
9+
10+
def yes(msg: String): Boolean =
11+
scala.io.StdIn.readLine(msg).headOption.map(_.toUpper) == Some('Y')
12+
13+
def getFromBuild(key: String): Option[String] = util.Try{
14+
val lines = os.read(wd / "build.sbt").split("\n").toSeq
15+
val line: String = lines.filter(_.contains(s"val $key")).head
16+
val value: String = line.split("=").toSeq.last.trim.takeWhile(!_.isWhitespace)
17+
value.stripPrefix("\"").stripSuffix("\"")
18+
}.toOption
19+
20+
extension (s: Seq[String]) def showSeq = s.mkString(" ")
21+
22+
val scalaVer = getFromBuild("scalaVer").getOrElse("")
23+
val reqTLangVer = getFromBuild("reqTLangVer").getOrElse("")
24+
25+
println("from build.sbt:")
26+
println(s"""val reqTLangVer = "$reqTLangVer"""")
27+
println(s"""val scalaVer = "$scalaVer"""")
28+
29+
println(s"""\n*** Step 1: sbt "clean; package" """)
30+
31+
if yes("Do you want a clean build (Y/n)? ") then
32+
os.proc("sbt", "clean;package").call(cwd = wd, stdout = os.Inherit)
33+
34+
35+
val dir = s"${os.pwd}/target/scala-$scalaVer"
36+
val jar = s"$dir/reqt-lang_3-$reqTLangVer.jar"
37+
38+
if !os.exists(os.Path(jar)) then
39+
println(s"Error: Missing jar-file; $jar")
40+
System.exit(1)
41+
else
42+
println(s"\n*** Step 2: publish to github using gh")
43+
if reqTLangVer.isEmpty then
44+
println("val reqTLangVer not found in build.sbt")
45+
sys.exit(1)
46+
else
47+
val preRel =
48+
if reqTLangVer.contains("-M") || reqTLangVer.contains("_RC") then Seq("--prerelease") else Seq()
49+
val assemblyCmd = Seq()
50+
val createCmd = Seq("gh", "release", "create", reqTLangVer, "--generate-notes") ++ preRel
51+
52+
val uploadCmd = Seq("gh", "release", "upload", reqTLangVer, jar)
53+
54+
val ghOpt = util.Try{os.proc("which", "gh").call(cwd = wd)}.toOption
55+
56+
if ghOpt == None then
57+
println("You need the github CLI 'gh' command on your path")
58+
println("Install from here: https://github.com/cli/cli/")
59+
60+
println("\nRun these commands in terminal:\n")
61+
println(createCmd.showSeq)
62+
println(uploadCmd.showSeq)
63+

src/test/scala/TestModelOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class TestModelOps extends munit.FunSuite:
171171
test("Model ordering "):
172172
val m = Model(
173173
Stakeholder("a"),
174-
Feature("x").has(
174+
Feature("x").has(
175175
Stakeholder("b"),
176176
Req("a") has Rank(2),
177177
Req("b") has Rank(3),

0 commit comments

Comments
 (0)