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

Use all known Scala versions when -DallVersions set #10478

Conversation

findepi
Copy link
Member

@findepi findepi commented Jun 10, 2024

Relates to #6167

@findepi
Copy link
Member Author

findepi commented Jun 10, 2024

Can these interfere with

iceberg/build.gradle

Lines 1040 to 1066 in 75b3a05

// The Iceberg-Build builds for only one Scala version at a time, so the BOM would also
// only contain artifacts for that single Scala version. The following code ensures that
// the BOM references the artifacts for all Scala versions.
def sparkScalaPattern = ~"(.*)-([0-9][.][0-9]+)_([0-9][.][0-9]+)"
def sparkScalaVersions = [
"3.3": ["2.12", "2.13"],
"3.4": ["2.12", "2.13"],
"3.5": ["2.12", "2.13"],
]
rootProject.allprojects.forEach {
// Do not include ':iceberg-spark', the bom itself and the root project.
if (it.name != 'iceberg-bom' && it != rootProject && it.childProjects.isEmpty()) {
if (it.name.startsWith("iceberg-spark-")) {
def sparkScalaMatcher = sparkScalaPattern.matcher(it.name)
if (!sparkScalaMatcher.find()) {
throw new GradleException("Expected a Spark/Scala version combination in Gradle project name ${it.name}")
}
def prjName = sparkScalaMatcher.group(1)
def sparkVer = sparkScalaMatcher.group(2)
for (def scalaVer in sparkScalaVersions[sparkVer]) {
add("api", "${it.group}:$prjName-${sparkVer}_$scalaVer:${it.version}")
}
} else {
add("api", project(it.path))
}
}
}
?

@@ -72,6 +72,7 @@ project(':open-api').name = 'iceberg-open-api'

if (null != System.getProperty("allVersions")) {
System.setProperty("flinkVersions", System.getProperty("knownFlinkVersions"))
System.setProperty("scalaVersions", System.getProperty("knownScalaVersions"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would interfere with a few other places where allVersions is being used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we then document why scala is left out and rename allVersions to avoid people assuming something incorrectly?

for exemple one could assume that ./gradlew -DallVersions=true spotlessApply will reformat all of the code, but i don't think it would

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./gradlew -DallVersions=true spotlessApply will re-format all the code. Code formatting is independent from the underlying Scala version

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for proving my example wrong. i do think the basic idea still holds though. the "all versions" property is not quite "all versions"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the purpose when I added allVersions was to reflect all module versions that we release but I see how this can cause confusion with Scala versions (which only apply for Flink and Spark).

I still don't think we can blindly just include all Scala versions, because they would only apply across Spark modules and will most likely cause issues with Flink modules when you pass Scala 2.13 when building Flink versions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it help if we called this allModules?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine calling this allModules(we just need to make sure we properly reflect this in docs and any other place where allVersions is currently used.

Do you see a specific use case where you'd like to build all modules across all supported scala versions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example to check the code compiles correctly, but i understand now this may not be needed and that scala version config is more for CI that for building.
Thanks, will rename to allModules!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@findepi findepi closed this Jun 15, 2024
@findepi findepi deleted the findepi/main/use-all-known-scala-versions-when-dallversions-set-7e2ddf branch June 15, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants