Skip to content

Commit dc95e33

Browse files
committed
Publish for Scala 2.11
- Add publish from Github Actions - Update mill so docJar works on Scala 3 - Adapt code to be compatible with Scala 2.11
1 parent 2cfebd9 commit dc95e33

File tree

6 files changed

+55
-23
lines changed

6 files changed

+55
-23
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
on: [push, pull_request]
1+
name: ci
2+
3+
on:
4+
push:
5+
pull_request:
6+
branches:
7+
- master
28

39
jobs:
4-
build:
10+
test:
511
strategy:
612
fail-fast: false
713
matrix:
@@ -27,3 +33,36 @@ jobs:
2733
if: matrix.os != 'windows-latest'
2834
- run: ./mill.bat -i -k __.jvm.__.test
2935
if: matrix.os == 'windows-latest'
36+
37+
publish-sonatype:
38+
if: github.repository == 'com-lihaoyi/os-lib' && contains(github.ref, 'refs/tags/')
39+
needs: test
40+
runs-on: ubuntu-latest
41+
env:
42+
SONATYPE_PGP_PRIVATE_KEY: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }}
43+
SONATYPE_PGP_PRIVATE_KEY_PASSWORD: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
44+
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
45+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
46+
LANG: "en_US.UTF-8"
47+
LC_MESSAGES: "en_US.UTF-8"
48+
LC_ALL: "en_US.UTF-8"
49+
steps:
50+
- uses: actions/checkout@v2
51+
- uses: actions/setup-java@v1
52+
with:
53+
java-version: 8
54+
- name: Publish to Maven Central
55+
run: |
56+
if [[ $(git tag --points-at HEAD) != '' ]]; then
57+
echo $SONATYPE_PGP_PRIVATE_KEY | base64 --decode > gpg_key
58+
gpg --import --no-tty --batch --yes gpg_key
59+
rm gpg_key
60+
./mill -i mill.scalalib.PublishModule/publishAll \
61+
--sonatypeCreds $SONATYPE_USER:$SONATYPE_PASSWORD \
62+
--gpgArgs --passphrase=$SONATYPE_PGP_PRIVATE_KEY_PASSWORD,--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b \
63+
--publishArtifacts __.publishArtifacts \
64+
--readTimeout 600000 \
65+
--awaitTimeout 600000 \
66+
--release true \
67+
--signed true
68+
fi

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.4-29-9d1d6f
1+
0.9.5-52-ef6d5d

build.sc

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import de.tobiasroeser.mill.vcs.version.VcsVersion
1010

1111
val dottyVersions = sys.props.get("dottyVersion").toList
1212

13-
val scalaVersions = "2.12.13" :: "2.13.4" :: "3.0.0-RC1" :: dottyVersions
13+
val scalaVersions = "2.12.13" :: "2.13.4" :: "2.11.12" :: "3.0.0-RC1" :: dottyVersions
1414
val scala2Versions = scalaVersions.filter(_.startsWith("2."))
1515

1616
val scalaJSVersions = for {
@@ -98,20 +98,10 @@ trait OsLibModule extends CrossScalaModule with PublishModule{
9898
millSourcePath / "src",
9999
millSourcePath / s"src-$platformSegment"
100100
)
101-
def acyclicDep: T[Agg[Dep]] = T { if (!isDotty) Agg(ivy"com.lihaoyi::acyclic:0.2.0") else Agg() }
101+
def acyclicDep: T[Agg[Dep]] = T { if (!isDotty) Agg(ivy"com.lihaoyi::acyclic:0.2.1") else Agg() }
102102
def compileIvyDeps = acyclicDep
103103
def scalacOptions = T { if (!isDotty) Seq("-P:acyclic:force") else Seq.empty }
104104
def scalacPluginIvyDeps = acyclicDep
105-
// FIXME: scaladoc 3 is not supported by mill yet. Remove the override
106-
// once it is.
107-
override def docJar =
108-
if (crossScalaVersion.startsWith("2")) super.docJar
109-
else T {
110-
val outDir = T.ctx().dest
111-
val javadocDir = outDir / 'javadoc
112-
_root_.os.makeDir.all(javadocDir)
113-
mill.api.Result.Success(mill.modules.Jvm.createJar(Agg(javadocDir))(outDir))
114-
}
115105
}
116106

117107
trait OsLibTestModule extends ScalaModule with TestModule{
@@ -134,10 +124,9 @@ trait OsModule extends OsLibModule{
134124
def artifactName = "os-lib"
135125

136126
def ivyDeps = Agg(
137-
ivy"com.lihaoyi::geny::0.6.5"
127+
ivy"com.lihaoyi::geny::0.6.7"
138128
)
139-
//def scalacOptions = Seq("-release", "8")
140-
def scalacOptions = T{ if (scalaVersion().startsWith("3")) Seq() else Seq("-release", "8") }
129+
def scalacOptions = T{ if (scalaVersion().startsWith("3") || scalaVersion().startsWith("2.11.")) Seq() else Seq("-release", "8") }
141130
}
142131

143132
trait WatchModule extends OsLibModule{

mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This is a wrapper script, that automatically download mill from GitHub release pages
44
# You can give the required mill version with MILL_VERSION env variable
55
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
6-
DEFAULT_MILL_VERSION=0.9.4-29-9d1d6f
6+
DEFAULT_MILL_VERSION=0.9.5-52-ef6d5d
77

88
set -e
99

os/watch/src/package.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ package object watch{
3636
case osName => throw new Exception(s"watch not supported on operating system: $osName")
3737
}
3838

39-
val thread = new Thread(() => watcher.run())
39+
val thread = new Thread {
40+
override def run(): Unit = {
41+
watcher.run()
42+
}
43+
}
4044
thread.setDaemon(true)
4145
thread.start()
4246
watcher

os/watch/test/src/WatchTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ object WatchTests extends TestSuite{
88
val changedPaths = collection.mutable.Set.empty[os.Path]
99
_root_.os.watch.watch(
1010
Seq(wd),
11-
onEvent = _.foreach(changedPaths.add),
11+
onEvent = _.foreach(changedPaths.add)
1212
// (s, v) => println(s + " " + v)
1313
)
1414

@@ -75,7 +75,7 @@ object WatchTests extends TestSuite{
7575
os.sub / "folder3" / "nestedA",
7676
os.sub / "folder3" / "nestedA" / "a.txt",
7777
os.sub / "folder3" / "nestedB",
78-
os.sub / "folder3" / "nestedB" / "b.txt",
78+
os.sub / "folder3" / "nestedB" / "b.txt"
7979
)
8080
)
8181

@@ -122,7 +122,7 @@ object WatchTests extends TestSuite{
122122
Set(
123123
//os.sub / "newlink3",
124124
os.sub / "folder3" / "nestedA",
125-
os.sub / "folder3" / "nestedA" / "a.txt",
125+
os.sub / "folder3" / "nestedA" / "a.txt"
126126
)
127127
}
128128
)

0 commit comments

Comments
 (0)