Skip to content

Commit

Permalink
Build: Algin Jackson version w/ Spark
Browse files Browse the repository at this point in the history
  • Loading branch information
pan3793 committed Aug 4, 2022
1 parent 6299f84 commit 10536bc
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ jobs:
- run: >-
./gradlew clean test --no-daemon --refresh-dependencies
-Dscala_binary_version=${{ matrix.scala }}
-Dspark_binary_versions=${{ matrix.spark }}
-Dspark_binary_version=${{ matrix.spark }}
-PmavenCentralMirror=https://maven-central.storage-download.googleapis.com/maven2/
2 changes: 1 addition & 1 deletion .github/workflows/check-license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
java-version: 8
- run: >-
./gradlew rat --no-daemon
-Dspark_binary_versions=${{ matrix.spark }}
-Dspark_binary_version=${{ matrix.spark }}
-PmavenCentralMirror=https://maven-central.storage-download.googleapis.com/maven2/
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: >-
./gradlew clean publish --no-daemon
-Dscala_binary_version=${{ matrix.scala }}
-Dspark_binary_versions=${{ matrix.spark }}
-Dspark_binary_version=${{ matrix.spark }}
-PmavenUser='${{ secrets.NEXUS_USER }}'
-PmavenPassword='${{ secrets.NEXUS_PW }}'
-Prelease
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: >-
./gradlew clean publish --no-daemon --refresh-dependencies
-Dscala_binary_version=${{ matrix.scala }}
-Dspark_binary_versions=${{ matrix.spark }}
-Dspark_binary_version=${{ matrix.spark }}
-PmavenUser='${{ secrets.NEXUS_USER }}'
-PmavenPassword='${{ secrets.NEXUS_PW }}'
-PmavenCentralMirror=https://maven-central.storage-download.googleapis.com/maven2/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Run all test

Run all test w/ Spark 3.2 and Scala 2.13

`./gradlew clean test -Dspark_binary_versions=3.2 -Dscala_binary_version=2.13`
`./gradlew clean test -Dspark_binary_version=3.2 -Dscala_binary_version=2.13`

Run single test

Expand Down
22 changes: 3 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ plugins {
project.ext {
scala_binary_version = System.getProperty("scala_binary_version")
scala_version = scala_binary_version == "2.12" ? project.getProperty("scala_212_version") : project.getProperty("scala_213_version")
spark_binary_version = System.getProperty("spark_binary_version")
jackson_version = spark_binary_version == "3.2" ? project.getProperty("spark_32_jackson_version") : project.getProperty("spark_33_jackson_version")
}

repositories {
Expand Down Expand Up @@ -66,17 +68,6 @@ subprojects {

version = getProjectVersion()

configurations.all {
resolutionStrategy {
force "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
force "com.fasterxml.jackson.core:jackson-core:$jackson_version"
force "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
force "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
force "com.fasterxml.jackson.module:jackson-module-paranamer:$jackson_version"
force "com.fasterxml.jackson.module:jackson-module-scala_$scala_binary_version:$jackson_version"
}
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -176,12 +167,5 @@ String getProjectVersion() {
return getVersionFromFile()
}

if (System.getProperty("spark_binary_versions").split(",").contains("3.2")) {
apply from: file("spark-3.2/build.gradle")
}

if (System.getProperty("spark_binary_versions").split(",").contains("3.3")) {
apply from: file("spark-3.3/build.gradle")
}

apply from: file("spark-$spark_binary_version/build.gradle")
apply from: "deploy.gradle"
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ mavenReleasesRepo=https://oss.sonatype.org/service/local/staging/deploy/maven2/

systemProp.scala_binary_version=2.12
systemProp.known_scala_binary_versions=2.12,2.13
systemProp.spark_binary_versions=3.3
systemProp.spark_binary_version=3.3
systemProp.known_spark_binary_versions=3.2,3.3

group=com.github.housepower

scala_212_version=2.12.15
scala_213_version=2.13.8

spark_32_jackson_version=2.12.3
spark_33_jackson_version=2.13.3

# Align with Apache Spark, and don't bundle them in release jar.
antlr_version=4.8
jackson_version=2.13.3
slf4j_version=1.7.32
commons_lang3_version=3.12.0

Expand Down
43 changes: 13 additions & 30 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,41 +20,24 @@ List<String> knownScalaBinaryVersions = System.getProperty("known_scala_binary_v
String scala_binary_version = System.getProperty("scala_binary_version")

if (!knownScalaBinaryVersions.contains(scala_binary_version)) {
throw new GradleException("Found unsupported Scala version: " + scala_binary_version)
throw new GradleException("Found unsupported Scala version: $scala_binary_version")
}

List<String> knownSparkBinaryVersions = System.getProperty("known_spark_binary_versions").split(",")
String sparkBinaryVersionsString = System.getProperty("spark_binary_versions")
List<String> sparkBinaryVersions = sparkBinaryVersionsString != null && !sparkBinaryVersionsString.isEmpty() ? sparkBinaryVersionsString.split(",") : []
String spark_binary_version = System.getProperty("spark_binary_version")

if (!knownSparkBinaryVersions.containsAll(sparkBinaryVersions)) {
throw new GradleException("Found unsupported Spark versions: " + (sparkBinaryVersions - knownSparkBinaryVersions))
if (!knownSparkBinaryVersions.contains(spark_binary_version)) {
throw new GradleException("Found unsupported Spark version: $spark_binary_version")
}

if (sparkBinaryVersions.contains("3.2")) {
include ":clickhouse-spark-3.2_$scala_binary_version"
project(":clickhouse-spark-3.2_$scala_binary_version").projectDir = file('spark-3.2/clickhouse-spark')
project(":clickhouse-spark-3.2_$scala_binary_version").name = "clickhouse-spark-3.2_$scala_binary_version"
include ":clickhouse-spark-${spark_binary_version}_$scala_binary_version"
project(":clickhouse-spark-${spark_binary_version}_$scala_binary_version").projectDir = file("spark-${spark_binary_version}/clickhouse-spark")
project(":clickhouse-spark-${spark_binary_version}_$scala_binary_version").name = "clickhouse-spark-${spark_binary_version}_$scala_binary_version"

include ":clickhouse-spark-runtime-3.2_$scala_binary_version"
project(":clickhouse-spark-runtime-3.2_$scala_binary_version").projectDir = file('spark-3.2/clickhouse-spark-runtime')
project(":clickhouse-spark-runtime-3.2_$scala_binary_version").name = "clickhouse-spark-runtime-3.2_$scala_binary_version"
include ":clickhouse-spark-runtime-${spark_binary_version}_$scala_binary_version"
project(":clickhouse-spark-runtime-${spark_binary_version}_$scala_binary_version").projectDir = file("spark-${spark_binary_version}/clickhouse-spark-runtime")
project(":clickhouse-spark-runtime-${spark_binary_version}_$scala_binary_version").name = "clickhouse-spark-runtime-${spark_binary_version}_$scala_binary_version"

include ":clickhouse-spark-it-3.2_$scala_binary_version"
project(":clickhouse-spark-it-3.2_$scala_binary_version").projectDir = file('spark-3.2/clickhouse-spark-it')
project(":clickhouse-spark-it-3.2_$scala_binary_version").name = "clickhouse-spark-it-3.2_$scala_binary_version"
}

if (sparkBinaryVersions.contains("3.3")) {
include ":clickhouse-spark-3.3_$scala_binary_version"
project(":clickhouse-spark-3.3_$scala_binary_version").projectDir = file('spark-3.3/clickhouse-spark')
project(":clickhouse-spark-3.3_$scala_binary_version").name = "clickhouse-spark-3.3_$scala_binary_version"

include ":clickhouse-spark-runtime-3.3_$scala_binary_version"
project(":clickhouse-spark-runtime-3.3_$scala_binary_version").projectDir = file('spark-3.3/clickhouse-spark-runtime')
project(":clickhouse-spark-runtime-3.3_$scala_binary_version").name = "clickhouse-spark-runtime-3.3_$scala_binary_version"

include ":clickhouse-spark-it-3.3_$scala_binary_version"
project(":clickhouse-spark-it-3.3_$scala_binary_version").projectDir = file('spark-3.3/clickhouse-spark-it')
project(":clickhouse-spark-it-3.3_$scala_binary_version").name = "clickhouse-spark-it-3.3_$scala_binary_version"
}
include ":clickhouse-spark-it-${spark_binary_version}_$scala_binary_version"
project(":clickhouse-spark-it-${spark_binary_version}_$scala_binary_version").projectDir = file("spark-${spark_binary_version}/clickhouse-spark-it")
project(":clickhouse-spark-it-${spark_binary_version}_$scala_binary_version").name = "clickhouse-spark-it-${spark_binary_version}_$scala_binary_version"
8 changes: 3 additions & 5 deletions spark-3.2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ project(":clickhouse-spark-runtime-${spark_binary_version}_$scala_binary_version
exclude group: "org.slf4j", module: "slf4j-api"
exclude group: "org.apache.commons", module: "commons-lang3"
exclude group: "com.clickhouse", module: "clickhouse-jdbc"
exclude group: "com.fasterxml.jackson.core"
exclude group: "com.fasterxml.jackson.datatype"
exclude group: "com.fasterxml.jackson.module"
}
}

shadowJar {
zip64 true
classifier null

relocate "com.fasterxml.jackson", "xenon.relocated.com.fasterxml.jackson"
relocate "com.thoughtworks.paranamer", "xenon.relocated.com.thoughtworks.paranamer"

mergeServiceFiles()
}

Expand Down Expand Up @@ -80,9 +80,7 @@ project(":clickhouse-spark-it-${spark_binary_version}_$scala_binary_version") {
testImplementation "org.apache.spark:spark-catalyst_$scala_binary_version:$spark_version:tests"
testImplementation "org.apache.spark:spark-sql_$scala_binary_version:$spark_version:tests"

testImplementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
testImplementation "com.fasterxml.jackson.module:jackson-module-scala_$scala_binary_version:$jackson_version"

testImplementation("com.clickhouse:clickhouse-jdbc:$clickhouse_jdbc_version:all") { transitive = false }

Expand Down
8 changes: 3 additions & 5 deletions spark-3.3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ project(":clickhouse-spark-runtime-${spark_binary_version}_$scala_binary_version
exclude group: "org.slf4j", module: "slf4j-api"
exclude group: "org.apache.commons", module: "commons-lang3"
exclude group: "com.clickhouse", module: "clickhouse-jdbc"
exclude group: "com.fasterxml.jackson.core"
exclude group: "com.fasterxml.jackson.datatype"
exclude group: "com.fasterxml.jackson.module"
}
}

shadowJar {
zip64 true
classifier null

relocate "com.fasterxml.jackson", "xenon.relocated.com.fasterxml.jackson"
relocate "com.thoughtworks.paranamer", "xenon.relocated.com.thoughtworks.paranamer"

mergeServiceFiles()
}

Expand Down Expand Up @@ -80,9 +80,7 @@ project(":clickhouse-spark-it-${spark_binary_version}_$scala_binary_version") {
testImplementation "org.apache.spark:spark-catalyst_$scala_binary_version:$spark_version:tests"
testImplementation "org.apache.spark:spark-sql_$scala_binary_version:$spark_version:tests"

testImplementation "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
testImplementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
testImplementation "com.fasterxml.jackson.module:jackson-module-scala_$scala_binary_version:$jackson_version"

testImplementation("com.clickhouse:clickhouse-jdbc:$clickhouse_jdbc_version:all") { transitive = false }

Expand Down

0 comments on commit 10536bc

Please sign in to comment.