Skip to content

Commit a86caa0

Browse files
authored
Merge pull request #100 from data-catering/feature/clean-docs
Update to Gradle 9.0.0, add gradle configurations to speed up build a…
2 parents 9f9bb92 + 9bfa242 commit a86caa0

41 files changed

Lines changed: 600 additions & 214 deletions

File tree

Some content is hidden

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

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ The project uses Gradle with Kotlin DSL and follows a multi-module structure:
2020
# Build the entire project
2121
./gradlew build
2222

23+
# Build project without fat JAR tasks
24+
./gradlew clean :app:build -x :app:shadowJar -x :app:distTar -x :app:distZip
25+
2326
# Build individual modules
2427
./gradlew :app:build
2528
./gradlew :api:build

api/build.gradle.kts

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.scoverage.ScoverageExtension
2-
31
/*
42
* This file was generated by the Gradle 'init' task.
53
*
@@ -20,8 +18,17 @@ plugins {
2018
`maven-publish`
2119
signing
2220

23-
id("org.scoverage") version "8.0.3"
24-
id("com.gradleup.shadow") version "8.3.6"
21+
alias(libs.plugins.scoverage) apply false
22+
alias(libs.plugins.shadow)
23+
}
24+
25+
// Check if configuration cache is enabled
26+
val isConfigCacheEnabled = providers.gradleProperty("org.gradle.configuration-cache")
27+
.map { it.toBoolean() }.getOrElse(false)
28+
29+
// Conditionally apply Scoverage plugin when configuration cache is disabled
30+
if (!isConfigCacheEnabled) {
31+
apply(plugin = "org.scoverage")
2532
}
2633

2734
repositories {
@@ -43,11 +50,11 @@ configurations {
4350
}
4451

4552
dependencies {
46-
compileOnly("org.scala-lang:scala-library:$scalaSpecificVersion")
47-
compileOnly("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.1")
48-
compileOnly("com.fasterxml.jackson.module:jackson-module-scala_$scalaVersion:2.17.1")
53+
compileOnly(libs.scala.library)
54+
compileOnly(libs.jackson.dataformat.yaml)
55+
compileOnly(libs.jackson.module.scala)
4956

50-
api("com.softwaremill.quicklens:quicklens_$scalaVersion:1.9.7") {
57+
api(libs.quicklens) {
5158
exclude(group = "org.scala-lang")
5259
}
5360
}
@@ -58,20 +65,25 @@ testing {
5865
val test by getting(JvmTestSuite::class) {
5966
dependencies {
6067
// Use Scalatest for testing our library
61-
implementation("org.scalatest:scalatest_$scalaVersion:3.2.19")
62-
implementation("org.scalatestplus:junit-5-11_$scalaVersion:3.2.19.0")
63-
implementation("org.scalamock:scalamock_$scalaVersion:5.2.0")
68+
implementation(libs.scalatest)
69+
implementation(libs.scalatestplus.junit)
70+
implementation(libs.scalamock)
6471

6572
// Need scala-xml at test runtime
66-
runtimeOnly("org.scala-lang.modules:scala-xml_$scalaVersion:1.3.1")
73+
runtimeOnly(libs.scala.xml)
6774
}
6875
}
6976
}
7077
}
7178

7279
tasks.test {
7380
jvmArgs("-Djava.security.manager=allow", "-Djdk.module.illegalAccess=deny", "--add-opens=java.base/java.lang=ALL-UNNAMED", "--add-opens=java.base/java.lang.invoke=ALL-UNNAMED", "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED", "--add-opens=java.base/java.io=ALL-UNNAMED", "--add-opens=java.base/java.net=ALL-UNNAMED", "--add-opens=java.base/java.nio=ALL-UNNAMED", "--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.util.concurrent=ALL-UNNAMED", "--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED", "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED", "--add-opens=java.base/sun.nio.cs=ALL-UNNAMED", "--add-opens=java.base/sun.security.action=ALL-UNNAMED", "--add-opens=java.base/sun.util.calendar=ALL-UNNAMED", "--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED")
74-
finalizedBy(tasks.reportScoverage)
81+
82+
// Only finalize with Scoverage report when configuration cache is disabled
83+
if (!isConfigCacheEnabled) {
84+
finalizedBy(tasks.named("reportScoverage"))
85+
}
86+
7587
useJUnitPlatform {
7688
includeEngines("scalatest")
7789
testLogging {
@@ -120,13 +132,16 @@ tasks.jar {
120132
tasks.shadowJar {
121133
archiveBaseName.set("datacaterer")
122134
archiveAppendix.set("api")
123-
archiveVersion.set(project.version.toString())
135+
archiveVersion.set(version.toString())
124136
archiveClassifier.set("")
125137
isZip64 = true
126138
}
127139

128-
configure<ScoverageExtension> {
129-
scoverageScalaVersion.set("2.12.15")
140+
// Configure Scoverage only when it's applied (configuration cache disabled)
141+
if (!isConfigCacheEnabled) {
142+
configure<org.scoverage.ScoverageExtension> {
143+
scoverageScalaVersion.set("2.12.15")
144+
}
130145
}
131146

132147
publishing {
@@ -145,7 +160,7 @@ publishing {
145160
artifact(tasks.shadowJar)
146161
artifact(tasks["sourcesJar"])
147162
artifact(tasks["javadocJar"])
148-
groupId = project.properties["groupId"].toString()
163+
groupId = group.toString()
149164
artifactId = apiArtifactId
150165

151166
pom {

api/src/main/scala/io/github/datacatering/datacaterer/api/TaskBuilder.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ case class FieldBuilder(field: Field = Field()) {
972972
* Has no effect for non-JSON sinks or non-top-level contexts.
973973
*/
974974
def unwrapTopLevelArray(enable: Boolean): FieldBuilder =
975-
this.modify(_.field.options).setTo(getGenBuilder.unwrapTopLevel(enable).options)
975+
this.modify(_.field.options).setTo(getGenBuilder.unwrapTopLevelArray(enable).options)
976976

977977
/**
978978
* Sets the primary key flag for the current field.
@@ -1547,8 +1547,8 @@ case class GeneratorBuilder(options: Map[String, Any] = Map()) {
15471547
/**
15481548
* Instruct JSON sink to unwrap the top-level field if it is a single array field.
15491549
*/
1550-
def unwrapTopLevel(enable: Boolean): GeneratorBuilder =
1551-
this.modify(_.options)(_ ++ Map(UNWRAP_TOP_LEVEL -> enable.toString))
1550+
def unwrapTopLevelArray(enable: Boolean): GeneratorBuilder =
1551+
this.modify(_.options)(_ ++ Map(UNWRAP_TOP_LEVEL_ARRAY -> enable.toString))
15521552

15531553
/**
15541554
* Field is a primary key of the data source.

api/src/main/scala/io/github/datacatering/datacaterer/api/connection/ConnectionBuilder.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ trait ConnectionTaskBuilder[T] {
105105
this
106106
}
107107

108+
/**
109+
* Set the number of records to generate per second. Only used for real time data sources such as JMS, Kafka and HTTP
110+
* @param rowsPerSecond The number of records per second to generate
111+
* @return The connection task builder
112+
*/
113+
def rowsPerSecond(rowsPerSecond: Int): ConnectionTaskBuilder[T] = {
114+
this.step = Some(getStep.rowsPerSecond(rowsPerSecond))
115+
this
116+
}
117+
108118
/**
109119
* Generate all possible combinations of the fields. Fields with `oneOf` will be used to generate all possible combinations.
110120
*

api/src/main/scala/io/github/datacatering/datacaterer/api/model/Constants.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ object Constants {
6161
lazy val DATA_CONTRACT_FILE = "dataContractFile"
6262
lazy val DATA_CONTRACT_SCHEMA = "dataContractSchema"
6363
lazy val ROWS_PER_SECOND = "rowsPerSecond"
64-
// When applied on a top-level array field in a JSON task, instructs the sink to output a bare JSON array
65-
// instead of an object { fieldName: [...] }.
66-
lazy val UNWRAP_TOP_LEVEL = "unwrapTopLevel"
64+
lazy val UNWRAP_TOP_LEVEL_ARRAY = "unwrapTopLevelArray"
6765
lazy val HUDI_TABLE_NAME = "hoodie.table.name"
6866
lazy val ICEBERG_CATALOG_TYPE = "catalogType"
6967
lazy val ICEBERG_CATALOG_URI = "catalogUri"

0 commit comments

Comments
 (0)