Skip to content

Commit ea116e8

Browse files
committed
improve dependency version resolution
upgrade dependency versions move to the latest scalatest runner instead of of helmethair (which is no longer maintained) termSymbolDirect is deprecated, move to termSymbol instead (2 test cases have to be updated for it)
1 parent 4b05a29 commit ea116e8

File tree

7 files changed

+50
-32
lines changed

7 files changed

+50
-32
lines changed

build.gradle.kts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
}
1313

1414
dependencies {
15-
classpath("ch.epfl.scala:gradle-bloop_2.12:1.6.3") // suffix is always 2.12, weird
15+
classpath("ch.epfl.scala:gradle-bloop_2.12:1.6.4") // suffix is always 2.12, weird
1616
}
1717
}
1818

@@ -33,9 +33,9 @@ plugins {
3333
`maven-publish`
3434
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
3535

36-
id("com.github.ben-manes.versions") version "0.52.0"
36+
id("com.github.ben-manes.versions") version "0.53.0"
3737

38-
id("io.github.cosmicsilence.scalafix") version "0.2.4"
38+
id("io.github.cosmicsilence.scalafix") version "0.2.6"
3939
}
4040

4141
val sonatypeApiUser = providers.gradleProperty("sonatypeApiUser")
@@ -112,7 +112,7 @@ allprojects {
112112
}
113113
}
114114

115-
val vn = VersionNumber.parse(vs.scalaV)
115+
val vn = VersionNumber.parse(vs.scala.v)
116116
val supportedPatchVs = 7..12
117117

118118
for (from in supportedPatchVs) {
@@ -132,19 +132,22 @@ allprojects {
132132

133133
constraints {}
134134

135-
// see https://github.com/gradle/gradle/issues/13067
136-
// fun bothImpl(constraintNotation: Any) {
137-
// implementation(constraintNotation)
138-
// testFixturesImplementation(constraintNotation)
139-
// }
140-
141-
implementation("${vs.scalaGroup}:scala-library:${vs.scalaV}")
135+
implementation("${vs.scala.group}:scala-library:${vs.scala.v}")
142136

143137
val scalaTestV = "3.2.11"
144-
testFixturesApi("org.scalatest:scalatest_${vs.scalaBinaryV}:${scalaTestV}")
145-
testImplementation("org.junit.jupiter:junit-jupiter:5.11.2")
146-
147-
testRuntimeOnly("co.helmethair:scalatest-junit-runner:0.2.0")
138+
testFixturesApi("org.scalatest:scalatest_${vs.scala.artifactSuffix}:${scalaTestV}")
139+
testImplementation("org.scalatest:scalatest_${vs.scala.artifactSuffix}:${scalaTestV}")
140+
// testFixturesApi("org.scalatest:scalatest-core_${vs.scala.artifactSuffix}:${vs.scalaTestV}")
141+
142+
val jUnitV = "5.13.4"
143+
val jUnitPlatformV = "1.13.4"
144+
145+
testRuntimeOnly("org.junit.platform:junit-platform-engine:$jUnitPlatformV")
146+
testRuntimeOnly("org.junit.platform:junit-platform-launcher:$jUnitPlatformV")
147+
testImplementation("org.junit.jupiter:junit-jupiter:${jUnitV}")
148+
// testRuntimeOnly("org.scalatestplus:junit-5-13_${vs.scala.artifactSuffix}:3.2.19.0")
149+
testRuntimeOnly("ai.acyclic.scalatestplus:junit-5-13_${vs.scala.artifactSuffix}:3.2.19.2")
150+
// testRuntimeOnly("ai.acyclic.scalatestplus:junit-5-13_${vs.scala.artifactSuffix}:3.3.0.0")
148151
}
149152

150153
tasks.register("dependencyTree") {
@@ -236,7 +239,7 @@ allprojects {
236239
apply(plugin = "io.github.cosmicsilence.scalafix")
237240
scalafix {
238241
semanticdb.autoConfigure.set(true)
239-
semanticdb.version.set("4.8.11")
242+
semanticdb.version.set("4.9.0")
240243
}
241244

242245
idea {
@@ -286,7 +289,7 @@ subprojects {
286289
}
287290

288291
publishing {
289-
val suffix = "_" + vs.scalaV
292+
val suffix = "_" + vs.scala.v
290293

291294
val rootID = vs.projectRootID
292295

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import org.gradle.api.Project
22

3-
class Versions(self: Project) {
3+
class Versions(private val project: Project) {
44

55
// TODO : how to group them?
66
val projectGroup = "io.tryp"
@@ -9,12 +9,25 @@ class Versions(self: Project) {
99
val projectVMajor = "1.2.0"
1010
val projectV = projectVMajor + "-SNAPSHOT"
1111

12-
val scalaGroup: String = self.properties.get("scalaGroup").toString()
12+
inner class Scala {
13+
val group: String = project.properties["scalaGroup"]?.toString() ?: "org.scala-lang"
1314

14-
val scalaV: String = self.properties.get("scalaVersion").toString()
15+
val v: String = project.properties["scalaVersion"].toString()
16+
protected val vParts: List<String> = v.split('.').also { parts ->
17+
require(parts.size == 3) { "Scala version must be in format 'X.Y.Z' but was: $v" }
18+
}
1519

16-
protected val scalaVParts = scalaV.split('.')
20+
val majorV: String = vParts[0]
21+
val binaryV: String = vParts.subList(0, 2).joinToString(".")
22+
val patchV: String = vParts[2]
1723

18-
val scalaBinaryV: String = scalaVParts.subList(0, 2).joinToString(".")
19-
val scalaMinorV: String = scalaVParts[2]
24+
val artifactSuffix = run {
25+
if (majorV == "3") majorV
26+
else binaryV
27+
}
28+
29+
val jsV: String? = project.properties.get("scalaJSVersion")?.toString()
30+
}
31+
32+
val scala: Scala by lazy { Scala() }
2033
}

core/build.gradle.kts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ dependencies {
88
testFixturesImplementation(constraintNotation)
99
}
1010

11-
bothImpl("${vs.scalaGroup}:scala-compiler:${vs.scalaV}")
11+
bothImpl("${vs.scala.group}:scala-compiler:${vs.scala.v}")
1212

13-
// testImplementation("${vs.scalaGroup}:scala-library:${vs.scalaV}")
14-
testFixturesApi("com.chuusai:shapeless_${vs.scalaBinaryV}:2.3.7")
13+
testFixturesApi("com.chuusai:shapeless_${vs.scala.binaryV}:2.3.7")
1514

16-
testFixturesApi("dev.zio:zio_${vs.scalaBinaryV}:1.0.18")
15+
testFixturesApi("dev.zio:zio_${vs.scala.binaryV}:1.0.18")
1716

1817
testFixturesApi("org.slf4j:slf4j-api:2.0.9")
1918
testRuntimeOnly("org.slf4j:slf4j-simple:2.0.9")

core/src/main/scala-2.13.7+/latest/splain/TyperCompatViews.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ trait TyperCompatViews {
4242

4343
self match {
4444
case tt: SingletonType =>
45-
tt.termSymbolDirect
45+
tt.termSymbol
4646
case _ =>
4747
self.typeSymbolDirect
4848
}

core/src/test/resources/splain/plugin/VTypeDetailSpec/__direct/check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ newSource1.scala:16: error: implicit error;
4949
newSource1.scala:15: error: type mismatch;
5050
Test.F[
5151
found : Test.a.type (with underlying type Test.A)
52+
――(defined at newSource1.scala:10:11)
5253
━━━━━━━━:
5354
required: a.type (with underlying type a.type) where val a: Test.A
5455
――(defined at newSource1.scala:13:18)
@@ -70,6 +71,7 @@ newSource1.scala:16: error: implicit error;
7071
newSource1.scala:15: error: type mismatch;
7172
Test.F[
7273
found : Test.a.type (with underlying type Test.A)
74+
――(defined at newSource1.scala:10:11)
7375
━━━━━━━━:
7476
required: a.type (with underlying type a.type) where val a: Test.A
7577
――(defined at newSource1.scala:13:18)

gradle/wrapper/gradle-wrapper.jar

-181 Bytes
Binary file not shown.

gradlew

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90+
' "$PWD" ) || exit
9091

9192
# Use the maximum available, or set MAX_FD != -1 to use that value.
9293
MAX_FD=maximum
@@ -114,7 +115,7 @@ case "$( uname )" in #(
114115
NONSTOP* ) nonstop=true ;;
115116
esac
116117

117-
CLASSPATH="\\\"\\\""
118+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118119

119120

120121
# Determine the Java command to use to start the JVM.
@@ -205,15 +206,15 @@ fi
205206
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206207

207208
# Collect all arguments for the java command:
208-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209210
# and any embedded shellness will be escaped.
210211
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211212
# treated as '${Hostname}' itself on the command line.
212213

213214
set -- \
214215
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215216
-classpath "$CLASSPATH" \
216-
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217+
org.gradle.wrapper.GradleWrapperMain \
217218
"$@"
218219

219220
# Stop when "xargs" is not available.

0 commit comments

Comments
 (0)