Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.4+ #218

Draft
wants to merge 40 commits into
base: main
Choose a base branch
from
Draft

3.4+ #218

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cda9548
updating version range to 3.4.2 and 3.5.1
Jolanrensen Mar 17, 2024
42ba339
(re)moving some stuff from the decoupled :core module
Jolanrensen Mar 17, 2024
4896354
adding initial new KotlinTypeInference Encoder generator, this time p…
Jolanrensen Mar 17, 2024
e234f40
updating all references to the old encoder<>() function in favor of t…
Jolanrensen Mar 17, 2024
66a42ac
updating tests tests
Jolanrensen Mar 17, 2024
3e9261f
made name hack optional as it is not waterproof
Jolanrensen Mar 17, 2024
0d061b6
added tests and fixed name hack
Jolanrensen Mar 17, 2024
0c8f4b1
Map support
Jolanrensen Mar 17, 2024
9149607
disable name hack by default again, added JCP case for auto-applying …
Jolanrensen Mar 18, 2024
4364022
udt fix
Jolanrensen Mar 18, 2024
2c875ff
enabled core as scala-helpers with VarargUnwrapper. Removed name hack…
Jolanrensen Mar 20, 2024
d60e4dc
enabled core as scala-helpers with VarargUnwrapper. Removed name hack…
Jolanrensen Mar 20, 2024
4f8d874
updating some build parameters
Jolanrensen Mar 21, 2024
2a878f1
bumped to kotlin 2.0.0-Beta5, included the compiler plugin with tests…
Jolanrensen Mar 21, 2024
c0a3140
Added gradle plugin and fixed package naming errors
Jolanrensen Mar 22, 2024
1b0b316
enabling the compiler plugin on modules, sparkifying data classes
Jolanrensen Mar 22, 2024
b7c1711
bumping down to kotlin 1.9.23 to make lambda's serializable again
Jolanrensen Mar 22, 2024
7069a9a
fixing tests
Jolanrensen Mar 22, 2024
df021c0
fixing more tests. Can now remain at Kotlin 2.0 if we set -Xlambdas=c…
Jolanrensen Mar 23, 2024
4c17859
added conversion for @Sparkify'ed classes to scala.Product with tests.
Jolanrensen Mar 24, 2024
2f62d07
started WIP fir plugin, disabled for now
Jolanrensen Mar 24, 2024
770698b
disabled RddTest "Work with any number" for now: Caused by: java.lang…
Jolanrensen Mar 24, 2024
5d5fe84
Merge branch 'main' into 3.4+
Jolanrensen Mar 25, 2024
24952b7
added publishToMavenLocal for the plugins in gh actions build.yml
Jolanrensen Mar 25, 2024
ffedb29
Merge remote-tracking branch 'origin/3.4+' into 3.4+
Jolanrensen Mar 25, 2024
6b63c96
editing build so that
Jolanrensen Mar 25, 2024
4e5438b
fixing compiler-plugin tests
Jolanrensen Mar 25, 2024
723152b
fixed conversions for scala 2.12
Jolanrensen Mar 25, 2024
0db290a
small fixes, disabled jupyter module for now
Jolanrensen Mar 25, 2024
37eec64
spark 3.4/3.5 compatibility issue with ProductEncoder
Jolanrensen Mar 25, 2024
0ab212b
fixed streaming test scala 2.12
Jolanrensen Mar 25, 2024
1c34429
added checkIsSparkified warnings when building an encoder
Jolanrensen Mar 27, 2024
68e830a
updated compiler plugin to make @Sparkify classes Serializable too, p…
Jolanrensen Mar 27, 2024
48db819
added java bean class fallback support
Jolanrensen Mar 30, 2024
ab4c455
added encoding for DatePeriod, DateTimePeriod, Instant, LocalDateTime…
Jolanrensen Apr 7, 2024
e05feac
kotlin 2.0.0-RC1, enabled jupyter module. Added basic Sparkify conver…
Jolanrensen Apr 10, 2024
7fd77be
make render in jupyter use show instead
Jolanrensen Apr 10, 2024
92b699d
disabled jupyter tests relying on DISPLAY(), update jupyter to latest…
Jolanrensen May 18, 2024
eae0196
disabled unsupported rddtests
Jolanrensen May 18, 2024
22fa5ae
added spark connect example which does not yet work with kotlin-spark…
Jolanrensen Jun 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,8 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
scala: [ "2.12.17", "2.13.10" ]
spark: [ "3.3.2", "3.3.1", "3.3.0", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.3", "3.1.2", "3.1.1", "3.1.0", "3.0.3", "3.0.2", "3.0.1", "3.0.0" ]
exclude:
- scala: "2.13.10"
spark: "3.1.3"
- scala: "2.13.10"
spark: "3.1.2"
- scala: "2.13.10"
spark: "3.1.1"
- scala: "2.13.10"
spark: "3.1.0"
- scala: "2.13.10"
spark: "3.0.3"
- scala: "2.13.10"
spark: "3.0.2"
- scala: "2.13.10"
spark: "3.0.1"
- scala: "2.13.10"
spark: "3.0.0"
scala: [ "2.12.19", "2.13.13" ]
spark: [ "3.4.2", "3.5.1" ]
runs-on: ubuntu-latest

steps:
Expand All @@ -49,7 +32,7 @@ jobs:
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/jdks
key: ${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}
key: "${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}"
restore-keys: |
${{ runner.os }}-gradle-

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/jdks
key: ${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}
key: "${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}"
restore-keys: |
${{ runner.os }}-gradle-

Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/publish_dev_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,8 @@ jobs:
build-and-deploy:
strategy:
matrix:
scala: [ "2.12.17", "2.13.10" ]
spark: [ "3.3.2", "3.3.1", "3.3.0", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.3", "3.1.2", "3.1.1", "3.1.0", "3.0.3", "3.0.2", "3.0.1", "3.0.0" ]
exclude:
- scala: "2.13.10"
spark: "3.1.3"
- scala: "2.13.10"
spark: "3.1.2"
- scala: "2.13.10"
spark: "3.1.1"
- scala: "2.13.10"
spark: "3.1.0"
- scala: "2.13.10"
spark: "3.0.3"
- scala: "2.13.10"
spark: "3.0.2"
- scala: "2.13.10"
spark: "3.0.1"
- scala: "2.13.10"
spark: "3.0.0"
scala: [ "2.12.19", "2.13.13" ]
spark: [ "3.4.2", "3.5.1" ]
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -50,7 +33,7 @@ jobs:
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/jdks
key: ${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}
key: "${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}"
restore-keys: |
${{ runner.os }}-gradle-

Expand All @@ -72,7 +55,7 @@ jobs:
./gradlew
-Pspark=${{ matrix.spark }}
-Pscala=${{ matrix.scala }}
-PskipScalaTuplesInKotlin=${{ !(matrix.spark == '3.0.0' || matrix.scala == '2.13.10' && matrix.spark == '3.2.0') }}
-PskipScalaOnlyDependent=${{ matrix.spark != matrix.spark[0] }}
clean
publishMavenPublicationToGitHubPackagesRepository
--scan
Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/publish_release_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,8 @@ jobs:
build-and-deploy-mvn-central:
strategy:
matrix:
scala: [ "2.12.17", "2.13.10" ]
spark: [ "3.3.2", "3.3.1", "3.3.0", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.3", "3.1.2", "3.1.1", "3.1.0", "3.0.3", "3.0.2", "3.0.1", "3.0.0" ]
exclude:
- scala: "2.13.10"
spark: "3.1.3"
- scala: "2.13.10"
spark: "3.1.2"
- scala: "2.13.10"
spark: "3.1.1"
- scala: "2.13.10"
spark: "3.1.0"
- scala: "2.13.10"
spark: "3.0.3"
- scala: "2.13.10"
spark: "3.0.2"
- scala: "2.13.10"
spark: "3.0.1"
- scala: "2.13.10"
spark: "3.0.0"
scala: [ "2.12.19", "2.13.13" ]
spark: [ "3.4.2", "3.5.1" ]
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -49,7 +32,7 @@ jobs:
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/jdks
key: ${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}
key: "${{ runner.os }}-gradle-spark-${{ matrix.spark }}-${{ matrix.scala }}"
restore-keys: |
${{ runner.os }}-gradle-

Expand All @@ -74,7 +57,7 @@ jobs:
./gradlew
-Pspark=${{ matrix.spark }}
-Pscala=${{ matrix.scala }}
-PskipScalaTuplesInKotlin=${{ !(matrix.spark == '3.0.0' || matrix.scala == '2.13.10' && matrix.spark == '3.2.0') }}
-PskipScalaOnlyDependent=${{ matrix.spark != matrix.spark[0] }}
clean
publishMavenPublicationToMavenCentralRepository
--scan
Expand Down
63 changes: 62 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
@file:Suppress("UnstableApiUsage")

import Projects.compilerPlugin
import Projects.gradlePlugin
import com.github.gmazzo.buildconfig.BuildConfigExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile


buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath(jcp)
classpath(mavenPublish)

// Allows the project to use the gradle plugin without mavenLocal
// Kept up-to-date by :gradle-plugin:updateBootstrapVersion
classpath(files("${project.rootDir.absolutePath}/gradle/bootstraps/gradle-plugin.jar"))
}
}


plugins {
mavenPublish version Versions.mavenPublish
dokka version Versions.dokka
idea
kotlin version Versions.kotlin apply false
buildconfig version Versions.buildconfig apply false
}

group = Versions.groupID
Expand Down Expand Up @@ -114,4 +124,55 @@ allprojects {
}
}
}
}

subprojects {
afterEvaluate {
// Adding the bootstraps directory to the repositories of the subprojects, so that
// the bootstrap version of compiler-plugin.jar can be found and used by the gradle-plugin
// without mavenLocal
if (plugins.hasPlugin("org.jetbrains.kotlinx.spark.api")) {
repositories.flatDir {
dirs("${project.rootDir.absolutePath}/gradle/bootstraps")
}
tasks.withType<KotlinCompile> {
dependsOn(":compiler-plugin:updateBootstrapVersion")
dependsOn(":gradle-plugin:updateBootstrapVersion")
}
}

repositories.flatDir {
dirs("${project.rootDir.absolutePath}/gradle/bootstraps")
}
extensions.findByType<BuildConfigExtension>()?.apply {
val projectVersion = Versions.project
val groupId = Versions.groupID

val compilerPluginArtifactId = compilerPlugin.name
val gradlePluginArtifactId = gradlePlugin.name

val compilerPluginId = "$groupId.api"

val defaultSparkifyFqName = "$groupId.api.plugin.annotations.Sparkify"
val defaultColumnNameFqName = "$groupId.api.plugin.annotations.ColumnName"

val projectRoot = project.rootDir.absolutePath

packageName("$groupId.api")
className("Artifacts")

buildConfigField("compilerPluginId", compilerPluginId)
buildConfigField("groupId", groupId)
buildConfigField("gradlePluginArtifactId", gradlePluginArtifactId)
buildConfigField("projectVersion", projectVersion)
buildConfigField("compilerPluginArtifactId", compilerPluginArtifactId)

buildConfigField("defaultSparkifyFqName", defaultSparkifyFqName)
buildConfigField("defaultColumnNameFqName", defaultColumnNameFqName)
buildConfigField("projectRoot", projectRoot)

buildConfigField("scalaVersion", Versions.scala)
buildConfigField("sparkVersion", Versions.spark)
}
}
}
4 changes: 1 addition & 3 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import org.gradle.kotlin.dsl.`kotlin-dsl`
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
}
21 changes: 19 additions & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
object Dependencies {
object Dependencies : Dsl<Dependencies> {
inline val kotlinStdLib get() = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlin}"
inline val reflect get() = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}"
inline val scalaLibrary get() = "org.scala-lang:scala-library:${Versions.scala}"
inline val kotlinxHtml get() = "org.jetbrains.kotlinx:kotlinx-html-jvm:${Versions.kotlinxHtml}"
inline val sparkSql get() = "org.apache.spark:spark-sql_${Versions.scalaCompat}:${Versions.spark}"
inline val sparkSqlApi get() = "org.apache.spark:spark-sql-api_${Versions.scalaCompat}:${Versions.spark}"
inline val sparkConnectClient get() = "org.apache.spark:spark-connect-client-jvm_${Versions.scalaCompat}:${Versions.spark}"
inline val sparkMl get() = "org.apache.spark:spark-mllib_${Versions.scalaCompat}:${Versions.spark}"
inline val sparkStreaming get() = "org.apache.spark:spark-streaming_${Versions.scalaCompat}:${Versions.spark}"
inline val hadoopClient get() = "org.apache.hadoop:hadoop-client:${Versions.hadoop}"
inline val sparkRepl get() = "org.apache.spark:spark-repl_${Versions.scalaCompat}:${Versions.spark}"
inline val jupyter get() = "org.jetbrains.kotlinx:kotlin-jupyter-api:${Versions.jupyter}"
inline val junit get() = "org.junit.jupiter:junit-jupiter-engine:5.8.1"
inline val junitJupiterEngine get() = "org.junit.jupiter:junit-jupiter-engine:${Versions.junitJupiterEngine}"
// must be platform()
inline val junitBom get() = "org.junit:junit-bom:${Versions.junitJupiterEngine}"
inline val junitJupiter get() = "org.junit.jupiter:junit-jupiter"
inline val junitPlatformCommons get() = "org.junit.platform:junit-platform-commons"
inline val junitPlatformLauncher get() = "org.junit.platform:junit-platform-launcher"
inline val junitPlatformRunner get() = "org.junit.platform:junit-platform-runner"
inline val junitPlatformSuiteApi get() = "org.junit.platform:junit-platform-suite-api"

inline val junit get() = "junit:junit:${Versions.junit}"
inline val sparkStreamingKafka get() = "org.apache.spark:spark-streaming-kafka-0-10_${Versions.scalaCompat}:${Versions.spark}"
inline val kotest get() = "io.kotest:kotest-runner-junit5:${Versions.kotest}"
inline val kotestTestcontainers get() = "io.kotest.extensions:kotest-extensions-testcontainers:${Versions.kotestTestContainers}"
Expand All @@ -21,6 +32,12 @@ object Dependencies {
inline val kotlinScriptingCommon get() = "org.jetbrains.kotlin:kotlin-scripting-common"
inline val kotlinScriptingJvm get() = "org.jetbrains.kotlin:kotlin-scripting-jvm"
inline val jacksonDatabind get() = "com.fasterxml.jackson.core:jackson-databind:${Versions.jacksonDatabind}"
inline val kotlinDateTime get() = "org.jetbrains.kotlinx:kotlinx-datetime:${Versions.kotlinxDateTime}"
inline val kotlinCompiler get() = "org.jetbrains.kotlin:kotlin-compiler:${Versions.kotlin}"
inline val kotlinScriptRuntime get() = "org.jetbrains.kotlin:kotlin-script-runtime:${Versions.kotlin}"
inline val kotlinAnnotationsJvm get() = "org.jetbrains.kotlin:kotlin-annotations-jvm:${Versions.kotlin}"
inline val kotlinCompilerInternalTestFramework get() = "org.jetbrains.kotlin:kotlin-compiler-internal-test-framework:${Versions.kotlin}"
inline val kotlinGradlePlugin get() = "org.jetbrains.kotlin:kotlin-gradle-plugin"
}


Expand Down
17 changes: 16 additions & 1 deletion buildSrc/src/main/kotlin/Helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler

interface Dsl<T> {
@Suppress("UNCHECKED_CAST")
operator fun invoke(block: T.() -> Unit) = block(this as T)
}

fun DependencyHandler.testApi(vararg dependencyNotations: Any): List<Dependency?> =
dependencyNotations.map {
add("testApi", it)
Expand All @@ -18,6 +23,11 @@ fun DependencyHandler.testImplementation(vararg dependencyNotations: Any): List<
add("testImplementation", it)
}

fun DependencyHandler.testRuntimeOnly(vararg dependencyNotations: Any): List<Dependency?> =
dependencyNotations.map {
add("testRuntimeOnly", it)
}

fun DependencyHandler.implementation(vararg dependencyNotations: Any): List<Dependency?> =
dependencyNotations.map {
add("implementation", it)
Expand All @@ -28,10 +38,15 @@ fun DependencyHandler.runtimeOnly(vararg dependencyNotations: Any): List<Depende
add("runtimeOnly", it)
}

fun DependencyHandler.compileOnly(vararg dependencyNotations: Any): List<Dependency?> =
dependencyNotations.map {
add("compileOnly", it)
}

fun DependencyHandler.project(
path: String,
configuration: String? = null
): ProjectDependency = project(
if (configuration != null) mapOf("path" to path, "configuration" to configuration)
else mapOf("path" to path)
) as ProjectDependency
) as ProjectDependency
10 changes: 10 additions & 0 deletions buildSrc/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import org.gradle.plugin.use.PluginDependenciesSpec

inline val PluginDependenciesSpec.kotlinSparkApi
get() = id("org.jetbrains.kotlinx.spark.api")

inline val PluginDependenciesSpec.kotlin
get() = kotlin("jvm")
Expand Down Expand Up @@ -33,3 +35,11 @@ inline val Project.mavenPublishBase
inline val PluginDependenciesSpec.jupyter
get() = kotlin("jupyter.api") version Versions.jupyter

inline val PluginDependenciesSpec.buildconfig
get() = id("com.github.gmazzo.buildconfig")

inline val PluginDependenciesSpec.gradlePublishPlugin
get() = id("com.gradle.plugin-publish") version Versions.gradlePublishPlugin

inline val PluginDependenciesSpec.shadow
get() = id("com.github.johnrengelman.shadow") version Versions.shadow
14 changes: 9 additions & 5 deletions buildSrc/src/main/kotlin/Projects.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
@file:Suppress("NOTHING_TO_INLINE")

import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.support.delegates.ProjectDelegate

object Projects {
object Projects : Dsl<Projects> {

inline fun Project.searchProject(name: String): Project =
rootProject
Expand All @@ -17,8 +15,8 @@ object Projects {
inline val Project.kotlinSparkApi
get() = searchProject("kotlin-spark-api")

inline val Project.core
get() = searchProject("core")
inline val Project.scalaHelpers
get() = searchProject("scala-helpers")

inline val Project.examples
get() = searchProject("examples")
Expand All @@ -28,4 +26,10 @@ object Projects {

inline val Project.scalaTuplesInKotlin
get() = searchProject("scala-tuples-in-kotlin")

inline val Project.compilerPlugin
get() = searchProject("compiler-plugin")

inline val Project.gradlePlugin
get() = searchProject("gradle-plugin")
}
Loading
Loading