tkaymak commented on code in PR #38233:
URL: https://github.com/apache/beam/pull/38233#discussion_r3103219537
##########
runners/spark/spark_runner.gradle:
##########
@@ -89,38 +89,102 @@ def hadoopVersions = [
hadoopVersions.each { kv -> configurations.create("hadoopVersion$kv.key") }
-def sourceBase = "${project.projectDir}/../src"
-def sourceBaseCopy = "${project.buildDir}/sourcebase/src"
-
-def useCopiedSourceSet = { scope, type, trigger ->
- def taskName = "copy${scope.capitalize()}${type.capitalize()}"
- trigger.dependsOn tasks.register(taskName, Copy) {
- from "$sourceBase/$scope/$type"
- into "$sourceBaseCopy/$scope/$type"
- duplicatesStrategy DuplicatesStrategy.INCLUDE
+/*
+ * Per-version source overrides (mirrors runners/flink/flink_runner.gradle).
+ *
+ * Layout:
+ * runners/spark/src/ -- shared base (lowest supported
version uses these directly)
+ * runners/spark/<major>/src/ -- version-specific overrides (later
overrides win)
+ *
+ * The lowest supported `spark_major` builds straight from the shared base.
+ * Higher versions copy <shared> + <previous majors> + <current> into a single
+ * source-overrides directory using DuplicatesStrategy.INCLUDE so the current
+ * version's files override earlier ones.
+ */
+def base_path = ".."
+
+def overrides = { versions, type, group = 'java' ->
+ // order matters: later entries override earlier ones during the Copy
+ ["${base_path}/src/${type}/${group}"] +
+ versions.collect { "${base_path}/${it}/src/${type}/${group}" } +
+ ["./src/${type}/${group}"]
+}
+
+def all_versions = spark_versions.split(",").collect { it.trim() }
+// Determine version order by list position rather than string comparison so
two-digit
+// majors (e.g. "10") still sort after single-digit ones.
Review Comment:
Agreed. This should be a separate PR, I assume?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]