Skip to content

Commit 519605c

Browse files
committed
added a task that generates a coursier descriptor
1 parent 69125f9 commit 519605c

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ sarif/**
1212
polystat-x86_64-pc-linux
1313
out/
1414
**.json
15+
!coursier/polystat.json
1516
hadoop_tmp

build.sbt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ homepage := Some(url("https://github.com/polystat/polystat-cli"))
99
licenses := Seq(License.MIT)
1010
organizationName := "Polystat"
1111
organization := "org.polystat"
12+
name := "polystat-cli"
1213
organizationHomepage := Some(url("https://www.polystat.org/)"))
1314
developers := List(
1415
Developer(
@@ -19,7 +20,6 @@ developers := List(
1920
)
2021
)
2122

22-
2323
sonatypeProfileName := "org.polystat"
2424
sonatypeCredentialHost := "s01.oss.sonatype.org"
2525
scmInfo :=
@@ -118,6 +118,29 @@ scalacOptions ++= Seq(
118118
"-feature",
119119
)
120120

121+
lazy val generateDescriptor =
122+
taskKey[Unit]("Generate a descriptor that is used by coursier to install polystat-cli.")
123+
124+
generateDescriptor := {
125+
val ver = version.value
126+
val org = organization.value
127+
val artifactName = name.value
128+
val descriptor =
129+
s"""|{
130+
| "repositories": [
131+
| "ivy2Local",
132+
| "central"
133+
| ],
134+
| "dependencies": [
135+
| "${org}:${artifactName}_3:${ver}"
136+
| ]
137+
|}
138+
|""".stripMargin
139+
println(descriptor)
140+
java.nio.file.Files
141+
.write(java.nio.file.Paths.get("coursier/polystat.json"), descriptor.getBytes)
142+
}
143+
121144
commands += Command.args("preRelease", "<arg>") { (state, args) =>
122145
args match {
123146
case Seq(nextVersion, pgpKeyId) =>
@@ -136,6 +159,7 @@ commands += Command.args("preRelease", "<arg>") { (state, args) =>
136159
tagRelease,
137160
releaseStepCommandAndRemaining("publishSigned"),
138161
releaseStepCommand("sonatypeBundleRelease"),
162+
releaseStepTask(generateDescriptor),
139163
pushChanges,
140164
),
141165
usePgpKeyHex(pgpKeyId),

coursier/polystat.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"repositories": [
3+
"ivy2Local",
4+
"central"
5+
],
6+
"dependencies": [
7+
"org.polystat:polystat-cli_3:0.1.11-SNAPSHOT"
8+
]
9+
}

0 commit comments

Comments
 (0)