This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch javax
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git

commit b5c510be138b7337e4dc542e46b0050d38dec85a
Author: Thiago H. de Paula Figueiredo <thi...@arsmachina.com.br>
AuthorDate: Tue Aug 6 00:10:46 2024 -0300

    TAP5-2785: suffixing jakarta.servlet artifacts
    
    First pass at creating suffixed artifacts for javax branch
    
    Notice that, for now, it just skips creating the
    non-jakarta.servlet-affected subprojects. The actual
    suffixing of artifact ids still needs to be done,
    but it's stubbed out at line 316
    
    First pass at creating suffixed artifacts for javax branch
    
    Trying to create shared logic between javax and master
    
    Fixing artifact name
---
 build.gradle | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/build.gradle b/build.gradle
index dfcef221e..df80a109c 100755
--- a/build.gradle
+++ b/build.gradle
@@ -28,6 +28,13 @@ project.ext.versions = [
     webdriverManager: "5.3.1"
 ]
 
+def artifactSuffix = ""
+
+// Artifacts that have both an unsuffixed artifact from the javax branch
+// and a suffixed one from the master branch
+def suffixedArtifactNames = ["tapestry-core", "tapestry-http", "tapestry-test",
+        "tapestry-runner", "tapestry-spring"]
+
 ext.continuousIntegrationBuild = Boolean.getBoolean("ci")
 
 // Provided so that the CI server can override the normal version number for 
nightly builds.
@@ -289,9 +296,13 @@ subprojects {
             mavenJava(MavenPublication) {
                 version = parent.version
                 groupId = "org.apache.tapestry"
+                if (suffixedArtifactNames.contains(project.name)) {
+                    artifactId = project.name + artifactSuffix
+                }
                 from components.java
                 artifact sourcesJar
                 
+                
                 pom {
                     name = project.name
                     // TODO: find some way to get the subproject description 
here.
@@ -308,6 +319,22 @@ subprojects {
                                 developerConnection = 
'scm:git://gitbox.apache.org/repos/asf/tapestry-5.git'
                                 url = 
'https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;a=summary'
                     }
+                    // Changes the generated pom.xml so its dependencies on 
suffixed artifacts
+                    // get properly updated with suffixed artifact ids
+                    withXml {
+                        def artifactIdQName = new groovy.namespace.QName(
+                                "http://maven.apache.org/POM/4.0.0";, 
"artifactId")
+                        def node = asNode();
+                        def dependencies = node.get("dependencies")[0]
+                        if (dependencies != null) {
+                            dependencies.'*'.forEach {
+                                def artifactIdNode = 
it.getAt(artifactIdQName)[0]
+                                if 
(suffixedArtifactNames.contains(artifactIdNode.text())) {
+                                    artifactIdNode.value = 
artifactIdNode.text() + artifactSuffix
+                                }
+                            }
+                        }
+                    }
                 }
                 matching {
                     it.name.endsWith(".jar") || it.name.endsWith(".pom")
@@ -348,6 +375,13 @@ subprojects {
             sign publishing.publications.mavenJava
         }
     }
+    
+    def actuallyPublish = !artifactSuffix.isEmpty() || 
suffixedArtifactNames.contains(project.name)
+    // println "XXXXXX Actually publish? " + actuallyPublish + " project " + 
project.name + " " + "!artifactSuffix.isEmpty() " + !artifactSuffix.isEmpty()
+    if (!actuallyPublish) {
+        tasks.withType(PublishToMavenRepository).configureEach { it.enabled = 
false }
+        tasks.withType(PublishToMavenLocal).configureEach { it.enabled = false 
}
+    }
 
     task uploadPublished {
 

Reply via email to