Skip to content

Commit 0b33321

Browse files
committed
Merge remote-tracking branch 'origin/master' into community-build-2.13
2 parents f7352a2 + b4ceeaf commit 0b33321

File tree

97 files changed

+2702
-1797
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2702
-1797
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"

.github/workflows/actions.yml

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,70 @@ name: ci
22

33
on:
44
push:
5+
branches:
6+
- master
7+
tags:
8+
- '*'
59
pull_request:
610
branches:
711
- master
812

913
jobs:
1014
test:
1115
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
java: ['11', '17']
1219
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-java@v1
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-java@v3
1522
with:
16-
java-version: 8
23+
distribution: 'temurin'
24+
java-version: ${{ matrix.java }}
25+
1726
- name: Run tests
18-
run: ./mill -i all __.publishArtifacts __.test
27+
run: ./mill -i '__.{publishArtifacts,test}'
28+
1929
check-binary-compatibility:
2030
runs-on: ubuntu-latest
2131
steps:
22-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
2333
with:
2434
fetch-depth: 0
25-
- uses: actions/setup-java@v1
35+
- uses: actions/setup-java@v3
2636
with:
27-
java-version: 8
37+
distribution: 'temurin'
38+
java-version: 11
39+
2840
- name: Check Binary Compatibility
2941
run: ./mill -i __.mimaReportBinaryIssues
30-
3142
publish-sonatype:
43+
# when in master repo, publish all tags and manual runs on main
3244
if: github.repository == 'com-lihaoyi/utest' && contains(github.ref, 'refs/tags/')
33-
needs: test
3445
runs-on: ubuntu-latest
46+
47+
# only run one publish job for the same sha at the same time
48+
# e.g. when a main-branch push is also tagged
49+
concurrency: publish-sonatype-${{ github.sha }}
50+
3551
env:
36-
SONATYPE_PGP_PRIVATE_KEY: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }}
37-
SONATYPE_PGP_PRIVATE_KEY_PASSWORD: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
38-
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
39-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
52+
MILL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
53+
MILL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
54+
MILL_PGP_SECRET_BASE64: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }}
55+
MILL_PGP_PASSPHRASE: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
4056
LANG: "en_US.UTF-8"
4157
LC_MESSAGES: "en_US.UTF-8"
4258
LC_ALL: "en_US.UTF-8"
59+
4360
steps:
44-
- uses: actions/checkout@v2
45-
- uses: actions/setup-java@v1
61+
- uses: actions/checkout@v3
62+
- uses: actions/setup-java@v3
4663
with:
47-
java-version: 8
64+
distribution: 'temurin'
65+
java-version: 11
4866
- name: Publish to Maven Central
49-
run: |
50-
if [[ $(git tag --points-at HEAD) != '' ]]; then
51-
echo $SONATYPE_PGP_PRIVATE_KEY | base64 --decode > gpg_key
52-
gpg --import --no-tty --batch --yes gpg_key
53-
rm gpg_key
54-
./mill -i mill.scalalib.PublishModule/publishAll \
55-
--sonatypeCreds $SONATYPE_USER:$SONATYPE_PASSWORD \
56-
--gpgArgs --passphrase=$SONATYPE_PGP_PRIVATE_KEY_PASSWORD,--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b \
57-
--publishArtifacts __.publishArtifacts \
58-
--readTimeout 600000 \
59-
--awaitTimeout 600000 \
60-
--release true \
61-
--signed true
62-
fi
67+
run: ./mill -i mill.scalalib.SonatypeCentralPublishModule/
68+
6369
- name: Create GitHub Release
6470
id: create_gh_release
6571
uses: actions/[email protected]
@@ -68,5 +74,4 @@ jobs:
6874
with:
6975
tag_name: ${{ github.ref }}
7076
release_name: ${{ github.ref }}
71-
body:
7277
draft: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ target/
22
*.iml
33
.idea
44
out/
5+
.bsp/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) <year> <copyright holders>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21+
DEALINGS IN THE SOFTWARE.

build.mill

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
//| mill-version: 1.0.0
2+
//| mill-jvm-version: 11
3+
//| mill-opts: ["--jobs=0.5C"]
4+
//| mvnDeps:
5+
//| - com.github.lolgab::mill-mima_mill1:0.2.0
6+
//| - com.lihaoyi::mill-contrib-buildinfo:$MILL_VERSION
7+
package build
8+
import mill._, scalalib._, scalajslib._, scalanativelib._, publish._
9+
import mill.util.VcsVersion
10+
import mill.contrib.buildinfo.BuildInfo
11+
import com.github.lolgab.mill.mima._
12+
13+
val communityBuildDottyVersion = sys.props.get("dottyVersion").toList
14+
15+
val scalaVersions = "2.12.20" :: "2.13.16" :: "3.3.6" :: communityBuildDottyVersion
16+
17+
val scalaReflectVersion = "1.1.3"
18+
19+
trait MimaCheck extends Mima {
20+
def mimaPreviousVersions = VcsVersion.vcsState().lastTag.toSeq
21+
}
22+
23+
trait UtestModule extends PublishModule with MimaCheck {
24+
def artifactName = "utest"
25+
26+
def publishVersion = VcsVersion.vcsState().format()
27+
28+
def pomSettings = PomSettings(
29+
description = artifactName(),
30+
organization = "com.lihaoyi",
31+
url = "https://github.com/com-lihaoyi/utest",
32+
licenses = Seq(License.MIT),
33+
versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "utest"),
34+
developers = Seq(
35+
Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
36+
)
37+
)
38+
}
39+
trait UtestMainModule extends CrossScalaModule with UtestModule with PlatformScalaModule{
40+
def resolveUnpackShade(filtered: Seq[PathRef])(implicit ctx: mill.api.TaskCtx) = {
41+
for(jar <- filtered) os.unzip(jar.path, Task.dest)
42+
43+
for(file <- os.walk(Task.dest) if file.ext == "scala"){
44+
val text = os.read(file)
45+
if (!text.contains("package scala")){
46+
os.write.over(
47+
file,
48+
"package utest.shaded\n" +
49+
text.replace("assert(", "Predef.assert(")
50+
.replace("_root_.pprint", "_root_.utest.shaded.pprint")
51+
.replace("_root_.fansi", "_root_.utest.shaded.fansi")
52+
)
53+
}
54+
}
55+
56+
Seq(PathRef(Task.dest))
57+
}
58+
59+
def generatedSources = Task{
60+
// Locally-build and shade versions of pprint and fansi to avoid classpath
61+
// conflicts and circular dependencies between utest and those projects
62+
resolveUnpackShade(
63+
defaultResolver().classpath(
64+
Seq(
65+
mvn"com.lihaoyi::pprint:0.9.3",
66+
mvn"com.lihaoyi::fansi:0.5.1",
67+
mvn"app.tulz::stringdiff:0.3.4"
68+
),
69+
sources = true
70+
).filter(_.path.last match{
71+
case s"fansi$versionSuffix.jar" => true
72+
case s"pprint$versionSuffix.jar" => true
73+
case s"stringdiff$versionSuffix.jar" => true
74+
case _ => false
75+
})
76+
)
77+
}
78+
}
79+
80+
81+
trait UtestTestModule extends BuildInfo with TestModule {
82+
def scalaVersion: T[String]
83+
def testFramework = "test.utest.CustomFramework"
84+
85+
val buildInfoPackageName = "test.utest"
86+
87+
def buildInfoMembers = Seq(BuildInfo.Value("scalaVersion", scalaVersion()))
88+
}
89+
90+
object utest extends Module {
91+
object jvm extends Cross[JvmUtestModule](scalaVersions)
92+
trait JvmUtestModule
93+
extends UtestMainModule {
94+
def compileMvnDeps =
95+
if (crossScalaVersion.startsWith("2")) Seq(
96+
mvn"org.scala-lang:scala-reflect:${crossScalaVersion}",
97+
mvn"org.scala-lang:scala-compiler:${crossScalaVersion}"
98+
)
99+
else Seq.empty[Dep]
100+
101+
def mvnDeps = Seq(
102+
mvn"com.lihaoyi::sourcecode::0.4.3-M5",
103+
mvn"org.scala-sbt:test-interface::1.0",
104+
mvn"org.scala-lang.modules::scala-collection-compat::2.13.0",
105+
) ++ (if (crossScalaVersion.startsWith("2")) Seq(
106+
mvn"org.portable-scala::portable-scala-reflect::$scalaReflectVersion",
107+
mvn"org.scala-lang:scala-reflect:$crossScalaVersion"
108+
) else Seq())
109+
object test extends ScalaTests with UtestTestModule{
110+
def resources = super[UtestTestModule].resources() ++ super[ScalaTests].resources()
111+
def scalacOptions = Seq("-Yrangepos")
112+
}
113+
}
114+
115+
object js extends Cross[JsUtestModule](scalaVersions)
116+
trait JsUtestModule extends UtestMainModule with ScalaJSModule{
117+
def compileMvnDeps =
118+
if (crossScalaVersion.startsWith("2")) Seq(
119+
mvn"org.scala-lang:scala-reflect:${crossScalaVersion}",
120+
mvn"org.scala-lang:scala-compiler:${crossScalaVersion}"
121+
)
122+
else Seq.empty[Dep]
123+
def mvnDeps = Seq(
124+
mvn"com.lihaoyi::sourcecode::0.4.3-M5",
125+
mvn"org.scala-js::scalajs-test-interface:${scalaJSVersion()}".withDottyCompat(crossScalaVersion),
126+
mvn"org.portable-scala::portable-scala-reflect::$scalaReflectVersion".withDottyCompat(crossScalaVersion),
127+
mvn"org.scala-lang.modules::scala-collection-compat::2.13.0",
128+
) ++ (if(crossScalaVersion.startsWith("2")) Seq(
129+
mvn"org.scala-lang:scala-reflect:$crossScalaVersion"
130+
) else Seq())
131+
def scalaJSVersion = "1.19.0"
132+
object test extends ScalaJSTests with UtestTestModule{
133+
def resources = super[UtestTestModule].resources() ++ super[ScalaJSTests].resources()
134+
def scalacOptions = Seq("-Yrangepos")
135+
}
136+
}
137+
138+
object native extends Cross[NativeUtestModule](scalaVersions)
139+
trait NativeUtestModule extends UtestMainModule with ScalaNativeModule {
140+
def compileMvnDeps =
141+
if (crossScalaVersion.startsWith("2")) Seq(
142+
mvn"org.scala-lang:scala-reflect:${crossScalaVersion}",
143+
mvn"org.scala-lang:scala-compiler:${crossScalaVersion}"
144+
)
145+
else Seq.empty[Dep]
146+
def mvnDeps = Seq(
147+
mvn"com.lihaoyi::sourcecode::0.4.3-M5",
148+
mvn"org.scala-native::test-interface::${scalaNativeVersion()}",
149+
mvn"org.scala-lang.modules::scala-collection-compat::2.13.0",
150+
)
151+
152+
def scalaNativeVersion = "0.5.8"
153+
object test extends ScalaNativeTests with UtestTestModule{
154+
def resources = super[UtestTestModule].resources() ++ super[ScalaNativeTests].resources()
155+
def scalacOptions = Seq("-Yrangepos")
156+
}
157+
}
158+
}

0 commit comments

Comments
 (0)