Skip to content

Commit fdcb056

Browse files
authored
Merge branch 'main' into gh129-lockfile
2 parents aa1f1f7 + 98cf101 commit fdcb056

18 files changed

Lines changed: 114 additions & 63 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @colindean @c-horn @samratmitra-0812
1+
* @target/data-validator-members @c-horn

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "daily"
8+
9+
# Until Dependabot provides Scala updates, they are are handed by the Scala Steward action.
10+
# https://github.com/target/data-validator/blob/master/.github/workflows/scala-steward.yaml
11+
# Check periodically for updates: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem

.github/workflows/ci.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout current branch (full)
19-
uses: actions/checkout@v3
20-
21-
- name: Setup Java and Scala
22-
uses: olafurpg/setup-scala@v14
19+
uses: actions/checkout@v4
20+
- uses: coursier/cache-action@v6
2321
with:
24-
java-version: adopt@1.8
25-
26-
- name: Cache sbt
27-
uses: actions/cache@v3
22+
extraKey: ${{ runner.os }}
23+
- uses: coursier/setup-action@v1
2824
with:
2925
path: |
3026
~/.sbt
@@ -34,6 +30,8 @@ jobs:
3430
~/AppData/Local/Coursier/Cache/v1
3531
~/Library/Caches/Coursier/v1
3632
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
37-
38-
- name: Build, test, and package project
39-
run: bin/sbt clean update dependencyLockCheck compile test package makePom
33+
jvm: adopt:1.8
34+
- name: Build, test, and package project on Spark 3.5
35+
run: bin/sbt clean update dependencyLockCheck compile test package makePom -DsparkVersion=3.5.1
36+
- name: Build and package project on "legacy" Spark
37+
run: bin/sbt clean update dependencyLockCheck compile package makePom

.github/workflows/release.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout current branch (full)
18-
uses: actions/checkout@v3
19-
20-
- name: Setup Java and Scala
21-
uses: olafurpg/setup-scala@v14
18+
uses: actions/checkout@v4
19+
- uses: coursier/cache-action@v6
2220
with:
23-
java-version: adopt@1.8
24-
25-
- name: Cache sbt
26-
uses: actions/cache@v3
21+
extraKey: ${{ runner.os }}
22+
- uses: coursier/setup-action@v1
2723
with:
2824
path: |
2925
~/.sbt
@@ -33,7 +29,9 @@ jobs:
3329
~/AppData/Local/Coursier/Cache/v1
3430
~/Library/Caches/Coursier/v1
3531
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
36-
32+
jvm: adopt:1.8
3733
# uses sbt-github-packages, see build.sbt
3834
- name: Publish with SBT
3935
run: bin/sbt dependencyLockCheck publish
36+
- name: Publish with SBT
37+
run: bin/sbt dependencyLockCheck publish -DsparkVersion=3.5.1

.github/workflows/scala-steward.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
name: Launch Scala Steward
2222
steps:
2323
- name: Install JDK for Scala Steward use
24-
uses: actions/setup-java@v3
24+
uses: actions/setup-java@v4
2525
with:
2626
distribution: 'temurin'
2727
java-version: '11'

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.7.3
1+
version = 3.8.1
22
runner.dialect = scala211
33
project.git = true
44
align.preset = none

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ Usage: data-validator [options]
6565
--help Show this help message and exit.
6666
```
6767
68+
If you want to build with Java 11 or newer, set the "MODERN_JAVA" environment variable.
69+
This may become the default in the future.
70+
6871
## Example Run
6972
7073
With the JAR directly:

bin/sbt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434

3535
set -o pipefail
3636

37-
declare -r sbt_release_version="1.6.2"
38-
declare -r sbt_unreleased_version="1.7.0-M2"
37+
declare -r sbt_release_version="1.9.9"
38+
declare -r sbt_unreleased_version="1.9.9"
3939

40-
declare -r latest_213="2.13.8"
41-
declare -r latest_212="2.12.15"
40+
declare -r latest_213="2.13.13"
41+
declare -r latest_212="2.12.19"
4242
declare -r latest_211="2.11.12"
4343
declare -r latest_210="2.10.7"
4444
declare -r latest_29="2.9.3"

build.sbt

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,42 @@
11
name := "data-validator"
22
organization := "com.target"
33

4-
scalaVersion := "2.11.12"
4+
val sparkVersion = settingKey[String]("Spark version")
55

6-
val sparkVersion = "2.3.4"
6+
sparkVersion := System.getProperty("sparkVersion", "2.3.4")
77

8-
val circeVersion = "0.11.2"
8+
scalaVersion := {
9+
if (sparkVersion.value > "3.0") {
10+
"2.12.19"
11+
} else {
12+
"2.11.12"
13+
}
14+
}
15+
16+
val sparkValidationVersion = settingKey[String]("Version of package")
17+
18+
sparkValidationVersion := "0.15.0"
19+
20+
version := sparkVersion.value + "_" + sparkValidationVersion.value
21+
22+
val circeVersion = settingKey[String]("Circe version")
23+
val circeYamlVersion = settingKey[String]("Circe YAML version")
24+
25+
circeVersion := {
26+
if (sparkVersion.value > "3.0") {
27+
"0.14.6"
28+
} else {
29+
"0.11.2"
30+
}
31+
}
32+
33+
circeYamlVersion := {
34+
if (sparkVersion.value > "3.0") {
35+
"0.15.1"
36+
} else {
37+
"0.10.1"
38+
}
39+
}
940

1041
//addDependencyTreePlugin
1142
enablePlugins(GitVersioning)
@@ -35,18 +66,28 @@ libraryDependencies ++= Seq(
3566
"com.github.scopt" %% "scopt" % "4.1.0",
3667
"com.sun.mail" % "javax.mail" % "1.6.2",
3768
"com.lihaoyi" %% "scalatags" % "0.12.0",
38-
"io.circe" %% "circe-yaml" % "0.10.1",
39-
"io.circe" %% "circe-core" % circeVersion,
40-
"io.circe" %% "circe-generic" % circeVersion,
41-
"io.circe" %% "circe-parser" % circeVersion,
42-
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided,
69+
"io.circe" %% "circe-yaml" % circeYamlVersion.value,
70+
"io.circe" %% "circe-core" % circeVersion.value,
71+
"io.circe" %% "circe-generic" % circeVersion.value,
72+
"io.circe" %% "circe-parser" % circeVersion.value,
73+
"org.apache.spark" %% "spark-sql" % sparkVersion.value % Provided,
4374
"junit" % "junit" % "4.13.2" % Test,
44-
"org.scalatest" %% "scalatest" % "3.2.15" % Test,
75+
"org.scalatest" %% "scalatest" % "3.2.18" % Test,
4576
"com.github.sbt" % "junit-interface" % "0.13.3" % Test exclude ("junit", "junit-dep")
4677
)
4778

4879
Test / fork := true
49-
javaOptions ++= Seq("-Xms512M", "-Xmx2048M", "-XX:+CMSClassUnloadingEnabled")
80+
javaOptions ++= (if (sparkVersion.value > "3.0" && System.getenv("MODERN_JAVA") == "TRUE") {
81+
// For modern Java we need to open up a lot of config options.
82+
Seq("-Xms4048M", "-Xmx4048M",
83+
// these were added in JDK 11 and newer, apparently.
84+
"-Dio.netty.tryReflectionSetAccessible=true",
85+
"--add-opens=java.base/java.lang=ALL-UNNAMED",
86+
"--add-opens=java.base/java.io=ALL-UNNAMED",
87+
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED")
88+
} else {
89+
Seq("-Xms4048M", "-Xmx4048M")
90+
})
5091
Test / parallelExecution := false
5192
// required for unit tests, but not set in some environments
5293
Test / envVars ++= Map(
@@ -57,6 +98,11 @@ Test / envVars ++= Map(
5798

5899
assembly / mainClass := Some("com.target.data_validator.Main")
59100

101+
assembly / assemblyShadeRules := Seq(
102+
ShadeRule.rename("shapeless.**" -> "new_shapeless.@1").inAll,
103+
ShadeRule.rename("cats.kernel.**" -> s"new_cats.kernel.@1").inAll
104+
)
105+
60106
// Enforces scalastyle checks
61107
val compileScalastyle = TaskKey[Unit]("compileScalastyle")
62108
scalastyleFailOnWarning := true
@@ -75,6 +121,6 @@ compileScalastyle := (Compile / scalastyle).toTask("").value
75121

76122
(Compile / runMain) := Defaults.runMainTask(Compile / fullClasspath, Compile / run / runner).evaluated
77123
TaskKey[Unit]("generateTestData") := {
78-
libraryDependencies += "org.apache.spark" %% "spark-sql" % sparkVersion
124+
libraryDependencies += "org.apache.spark" %% "spark-sql" % sparkVersion.value
79125
(Compile / runMain).toTask(" com.target.data_validator.GenTestData").value
80126
}

project/assembly.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.1.1")
1+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")

0 commit comments

Comments
 (0)