jdaugherty commented on code in PR #14093:
URL: https://github.com/apache/grails-core/pull/14093#discussion_r2022801189


##########
build.gradle:
##########
@@ -35,570 +9,76 @@ ext {
     homeBinDir = layout.projectDirectory.dir('bin')
     homeConfDir = layout.projectDirectory.dir('conf')
     homeLibDir = layout.projectDirectory.dir('lib')
-    homeSrcDir = layout.projectDirectory.dir('src')
-}
-
-version = grailsVersion
-group = "org.grails"
-
-// Groovy is added as a dependency to both the 'groovy' and 'compile'
-// configurations, so place the dependency in a shared variable. The
-// 'compile' is required so that Groovy appears as a dependency in the
-// artifacts' POMs.
-ext.jointBuildGroovyJarProperty = System.getProperty('groovy.jar')
-ext.groovyDependency = null
 
-ext."signing.keyId" = System.getenv("SIGNING_KEY") ?: 
project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : 
null
-ext."signing.password" = System.getenv("SIGNING_PASSPHRASE") ?: 
project.hasProperty("signing.password") ? 
project.getProperty('signing.password') : null
-ext."signing.secretKeyRingFile" = 
project.hasProperty("signing.secretKeyRingFile") ? 
project.getProperty('signing.secretKeyRingFile') : null
-
-if (jointBuildGroovyJarProperty) {
-    def jointBuildGroovyJar = file(jointBuildGroovyJarProperty)
-    if (jointBuildGroovyJar.exists()) {
-        groovyDependency = dependencies.create(files(jointBuildGroovyJar))
-    } else {
-        throw new GradleException("The groovy.jar system property points to 
${jointBuildGroovyJar.absolutePath} which does not exist.")
-    }
-} else {
-    groovyDependency = 
dependencies.create("org.apache.groovy:groovy:${groovyVersion}")
-}
-
-if (isReleaseVersion) {
-    apply plugin: 'maven-publish'
-    apply plugin: "io.github.gradle-nexus.publish-plugin"
-
-    nexusPublishing {
-        repositories {
-            sonatype {
-                def ossUser = System.getenv("SONATYPE_USERNAME") ?: 
project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
-                def ossPass = System.getenv("SONATYPE_PASSWORD") ?: 
project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
-                def ossStagingProfileId = 
System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: 
project.hasProperty("sonatypeOssStagingProfileId") ? 
project.sonatypeOssStagingProfileId : ''
-                nexusUrl = uri("https://s01.oss.sonatype.org/service/local/";)
-                username = ossUser
-                password = ossPass
-                stagingProfileId = ossStagingProfileId
-            }
-        }
+    mappedArtifactIds = [
+            // The artifactIds of these projects differ from their respective 
project names
+            'grails-async-core'       : 'grails-async',
+            'grails-async-plugin'     : 'async',
+            'grails-events-core'      : 'grails-events',
+            'grails-events-plugin'    : 'events',
+            'grails-plugin-converters': 'converters'
+    ]
 
-        transitionCheckOptions {
-            maxRetries.set(40)
-            delayBetween.set(java.time.Duration.ofMillis(5000))
-        }
-    }
+    testProjectsStartWith = [
+            'grails-test-suite',
+            'grails-test-examples'
+    ]
+    testProjects = [ /* Will be populated by subprojects loop below */ ]
 }
 
 allprojects {
-    if (project.name == 'grails-bom') return
-    // FORCE UPGRADE OF GROOVY IN DEPENDENCIES TO GROOVY 4
-    // except in projects that will be run by Gradle during the build
-    if (!compiledByGradleGroovyVersion(project)) {
-        configurations.configureEach {
-            resolutionStrategy.eachDependency { DependencyResolveDetails 
details ->
-                if (details.requested.group == 'org.codehaus.groovy' && 
details.requested.name != 'groovy-bom') {
-                    details.useTarget(group: 'org.apache.groovy', name: 
details.requested.name, version: groovyVersion)
-                }
-            }
-        }
-    }
-
     repositories {
         mavenCentral()
         maven { url = 'https://repo.grails.org/grails/core' }
         maven { url = 
'https://oss.sonatype.org/content/repositories/snapshots' }
         // mavenLocal() // Keep, this will be uncommented and used by CI 
(groovy-joint-workflow)
     }
-
-    configurations {
-        all {
-            resolutionStrategy {
-                def cacheHours = isCiBuild ? 0 : 24
-                cacheDynamicVersionsFor cacheHours, 'hours'
-                cacheChangingModulesFor cacheHours, 'hours'
-                eachDependency { DependencyResolveDetails details ->
-                    //specifying a fixed version for all libraries with 
'org.gradle' group
-                    if (details.requested.group == 'org.apache.groovy') {
-                        details.useVersion(groovyVersion)
-                    }
-                    if (details.requested.group == "org.spockframework") {
-                        details.useVersion(project['spock.version'])
-                    }
-                }
-            }
-        }
-    }
-
-    [Javadoc, Groovydoc].each {
-        tasks.withType(it).all {
-            // exclude problematic jar file from javadoc classpath
-            // 
https://www.adam-bien.com/roller/abien/entry/trouble_with_crippled_java_ee
-            if (classpath) {
-                classpath -= classpath.filter { it.name == 
'javaee-web-api-6.0.jar' }
-            }
-
-            // this will apply the javadoc fix tool to all generated javadocs
-            // we use it to make sure that the javadocs are not vulnerable 
independently of the JDK used to build
-            doLast {
-                def javadocFix = new JavadocFixTool()
-                javadocFix.recursive = true
-                javadocFix.doPatch = true
-                javadocFix.searchAndPatch(destinationDir)
-            }
-        }
-
-    }
-
-    tasks.withType(Javadoc) {
-        options.addStringOption('Xdoclint:none', '-quiet')
-    }
-
-    // This added to prevent remote cache miss, because project JAR include 
manifest file with Build-By and Created-By properties which might be different 
for CI vs Local.
-    normalization {
-        runtimeClasspath {
-            metaInf {
-                ignoreAttribute("Built-By")
-                ignoreAttribute("Created-By")
-            }
-        }
-    }
-    apply from: 
rootProject.layout.projectDirectory.file('gradle/dependency-licenses.gradle')
 }
 
-apply from: "gradle/idea.gradle"
-
-subprojects { subproject ->
-
-    version = grailsVersion
-
-    ext.isTestSuite = subproject.name.startsWith('grails-test-suite')
-    ext.isExample = subproject.name.contains('grails-test-examples')
-    ext.pluginProjects = ['grails-async-plugin', 'grails-events-plugin', 
'grails-plugin-converters']
-    ext.isPlugin = subproject.name in pluginProjects
-    ext.isCiBuild = subproject.hasProperty('isCiBuild') || 
System.getenv().get('CI') as Boolean
-    ext.isAsyncProject = subproject.name.startsWith('grails-async') || 
subproject.name.startsWith('grails-events')
-
-    // Historically async mapped the core libraries to different artifact ids
-    ext.mappedArtifactIds = [
-            'grails-async-core'       : 'grails-async',
-            'grails-async-plugin'     : 'async',
-            'grails-events-core'      : 'grails-events',
-            'grails-events-plugin'    : 'events',
-            'grails-plugin-converters': 'converters'
-    ]
-
-    if(isExample) {
-        // Test projects will often include dependencies from grails-core, 
this file will ensure any dependencies included
-        // will be substituted with projects in this repository instead of 
pulling upstream
-        configurations.all {
-            resolutionStrategy {
-                dependencySubstitution {
-                    for (def possibleProject  : rootProject.subprojects) {
-                        
if(!possibleProject.name.startsWith('grails-test-suite') && 
!possibleProject.name.contains('grails-test-examples')) {
-                            def artifactId = 
mappedArtifactIds[possibleProject.name] ?: possibleProject.name
-
-                            String substitutedArtifact = 
"${possibleProject.name in pluginProjects ? 'org.grails.plugins' : 
'org.grails'}:${artifactId}"
-                            if(possibleProject.name == 'grails-bom') {
-                                substitute module(substitutedArtifact) using 
platform(project(":${possibleProject.name}"))
-                            }
-                            else {
-                                substitute module(substitutedArtifact) using 
project(":${possibleProject.name}")
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        return
-    }
-
-    if (isPlugin) {
-        group = 'org.grails.plugins'
-    } else {
-        group = 'org.grails'
-    }
-
-    ext.pomInfo = {
-        delegate.name 'GrailsĀ® framework'
-        delegate.description subproject.name == 'grails-testing-support' ? 
'Support for writing concise expressive tests for Grails artifacts' : 'Grails 
Web Application Framework'
-        delegate.url 'https://grails.org/'
+subprojects {
 
-        delegate.licenses {
-            delegate.license {
-                delegate.name 'The Apache Software License, Version 2.0'
-                delegate.url 'https://www.apache.org/licenses/LICENSE-2.0.txt'
-                delegate.distribution 'repo'
-            }
-        }
-
-        delegate.scm {
-            delegate.url 'scm:[email protected]:grails/grails-core.git'
-            delegate.connection 'scm:[email protected]:grails/grails-core.git'
-            delegate.developerConnection 
'scm:[email protected]:grails/grails-core.git'
-        }
-
-        if(subproject.name == 'grails-testing-support') {
-            delegate.developers {
-                delegate.developer {
-                    delegate.id 'jeffscottbrown'
-                    delegate.name 'Jeff Brown'
-                }
-                delegate.developer {
-                    delegate.id 'jameskleeh'
-                    delegate.name 'James Kleeh'
-                }
-            }
-        }
-        else {
-            delegate.developers {
-                delegate.developer {
-                    delegate.id 'graemerocher'
-                    delegate.name 'Graeme Rocher'
-                    delegate.email '[email protected]'
-                }
-            }
+    for (String testPrefix : testProjectsStartWith) {
+        if (name.startsWith(testPrefix)) {
+            rootProject.ext['testProjects'] << name
         }
     }
 
-    if (subproject.name != 'grails-bom') {
-        apply plugin: 'java-library'
-        apply plugin: 'groovy'
-        apply plugin: 'eclipse'
-        apply plugin: 'idea'
-        apply plugin: 'project-report'
-    }
-
-    if (!isTestSuite) {
-
-        apply plugin: 'maven-publish'
-        apply plugin: 'signing'
-
-        if (subproject.name != 'grails-bom') {
-            java {
-                withJavadocJar()
-                withSourcesJar()
-            }
-        }
-        publishing {
-            if (isGrailsRepoPublish || isGitHubRepoPublish) {
-                repositories {
-                    maven {
-                        credentials {
-                            if (isGrailsRepoPublish) {
-                                def u = 
subproject.hasProperty("artifactoryPublishUsername") ? 
subproject.getProperty('artifactoryPublishUsername') : 
System.getenv("ARTIFACTORY_USERNAME")
-                                def p = 
subproject.hasProperty("artifactoryPublishPassword") ? 
subproject.getProperty('artifactoryPublishPassword') : 
System.getenv("ARTIFACTORY_PASSWORD")
-                                username = u
-                                password = p
-                            } else {
-                                def u = System.getenv('GITHUB_USERNAME') ?: ''
-                                def p = System.getenv('GITHUB_PASSWORD') ?: ''
-                                username = u
-                                password = p
-                            }
-                        }
-                        if (isGrailsRepoPublish) {
-                            url = isPlugin ?
-                                    
uri('https://repo.grails.org/grails/plugins3-snapshots-local') :
-                                    
uri('https://repo.grails.org/grails/libs-snapshots-local')
-                        } else {
-                            
url('https://maven.pkg.github.com/grails/grails-core')
-                        }
-                    }
+    configurations.configureEach {
+        resolutionStrategy {
+            def cacheHours = isCiBuild ? 0 : 24
+            cacheDynamicVersionsFor(cacheHours, 'hours')
+            cacheChangingModulesFor(cacheHours, 'hours')
+            eachDependency { DependencyResolveDetails details ->
+                if (details.requested.group == 'org.apache.groovy') {
+                    details.useVersion(groovyVersion)
                 }
-            }
-
-            if (subproject.name == 'grails-dependencies') return
-
-            publications {
-                maven(MavenPublication) {
-                    if(mappedArtifactIds.containsKey(subproject.name)) {
-                        artifactId = mappedArtifactIds[subproject.name]
-                    }
-
-                    pom.withXml {
-                        def pomNode = asNode()
-                        pomNode.children().last() + pomInfo
-
-                        // dependency management shouldn't be included
-                        try { pomNode.dependencyManagement.replaceNode({}) } 
catch (Throwable ignore) {}
-                    }
-
-                    if (subproject.name != 'grails-bom') {
-                        from components.java
-                    }
-
-                    if(isAsyncProject) {
-                        versionMapping {
-                            usage('java-api') { 
fromResolutionOf('runtimeClasspath') }
-                            usage('java-runtime') { fromResolutionResult() }
-                        }
-                    }
+                if (details.requested.group == 'org.spockframework') {
+                    details.useVersion(findProperty('spock.version') as String)

Review Comment:
   Since we have a bom, is this required? 



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

Reply via email to