RussellSpitzer commented on code in PR #15857:
URL: https://github.com/apache/iceberg/pull/15857#discussion_r3024680671


##########
build.gradle:
##########
@@ -128,6 +138,147 @@ subprojects {
 
   apply plugin: 'java-library'
 
+  // Helper closure to truncate version to major.minor
+  ext.truncateVersion = { String version ->
+    if (version == null || version.isEmpty()) {
+      return version
+    }
+
+    // Remove any build metadata or qualifiers first (e.g., +something, 
-SNAPSHOT)
+    def cleanVersion = version.replaceAll(/[+-].*$/, '')
+
+    // Split by dots and take first two parts
+    def parts = cleanVersion.split(/\./)
+    if (parts.length >= 2) {
+      return "${parts[0]}.${parts[1]}"
+    } else if (parts.length == 1) {
+      return parts[0]
+    }
+
+    return version
+  }
+
+  // Helper closure to resolve dependencies for a configuration
+  ext.resolveDependencies = { String configuration ->
+    def dependencies = new TreeSet<String>()
+
+    try {
+      def config = configurations.findByName(configuration)
+      if (config != null && config.canBeResolved) {
+        config.resolvedConfiguration.resolvedArtifacts.each { artifact ->
+          def id = artifact.moduleVersion.id
+          def groupId = id.group
+          def artifactId = id.name
+          def version = id.version
+
+          // Truncate version to major.minor (remove patch and beyond)
+          def truncatedVersion = truncateVersion(version)
+
+          
dependencies.add("${groupId}:${artifactId}:${truncatedVersion}".toString())
+        }
+      } else {
+        throw new GradleException("Configuration '${configuration}' not found 
or cannot be resolved")
+      }
+    } catch (Exception e) {
+      throw new GradleException("Could not resolve ${configuration}: 
${e.message}", e)
+    }
+
+    return dependencies
+  }
+
+  // Task to generate a dependency list for this module
+  // Usage: ./gradlew :iceberg-core:generateDependencyList
+  // Usage with custom config: ./gradlew :iceberg-core:generateDependencyList 
-Pconfiguration=compileClasspath
+  // Generates a file at <module-root>/dependencies-<configuration>.txt

Review Comment:
   We'll need a rat exclusion for these



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to