Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
639b1ed
[skip tests] fix RAT config for gitattribute nesting
jdaugherty Jun 4, 2025
8b5b61a
[skip tests] apply license audit in verification script
jdaugherty Jun 4, 2025
531c081
[skip tests] do not fail the entire script on reproducible since it w…
jdaugherty Jun 4, 2025
20d9f09
The IdeaModule.testSourceDirs property has been deprecated
jdaugherty Jun 4, 2025
80d4def
CopyProcessingSpec.setFileMode(Integer) & CopyProcessingSpec.setDirMo…
jdaugherty Jun 4, 2025
299f11e
Merge branch '7.0.x' into gradle-deprecations
jdaugherty Jun 11, 2025
c2f193d
feedback - switch to int variant
jdaugherty Jun 12, 2025
ac4e502
remove gradle deprecation
jdaugherty Jun 12, 2025
de36ed4
Remove duplicate source file
jdaugherty Jun 12, 2025
d3c813d
remove project usages from extract dependencies task
jdaugherty Jun 12, 2025
6b11a93
remove project usages from ProfileCompilerTask
jdaugherty Jun 12, 2025
a0737af
rework the FindMainClassTask to no longer use deprecated gradle features
jdaugherty Jun 12, 2025
62f76cc
remove .project usage
jdaugherty Jun 12, 2025
3d8c5f5
Ensure the FindMainTask runs when a file was not produced, and handle…
jdaugherty Jun 12, 2025
4a9f2b4
remove project calls from profile compile task
jdaugherty Jun 12, 2025
74951f4
remove project calls from startScript task action
jdaugherty Jun 12, 2025
025edd5
fix publish guide task from using project inside of a task action
jdaugherty Jun 12, 2025
cdc49ca
remove project usage from task action
jdaugherty Jun 12, 2025
27288de
instead of deleting, redefine the resources to avoid project usage in…
jdaugherty Jun 12, 2025
e02c512
remove project usage from task actions
jdaugherty Jun 12, 2025
eee488a
move convention to parent abstract task
jdaugherty Jun 12, 2025
02e873f
Change title & vendor to meet ASF requirements
jdaugherty Jun 12, 2025
7c004fb
fix: adapt to changed jar `Implementation-Title`
matrei Jun 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions gradle/java-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ tasks.withType(GroovyCompile).configureEach {
// Note: we exclude attributes such as Built-By, Build-Jdk, Created-By to ensure the build is reproducible.
tasks.withType(Jar).configureEach {
manifest.attributes(
'Implementation-Title': 'Grails',
'Implementation-Title': 'Apache Grails',
'Implementation-Version': grailsVersion,
'Implementation-Vendor': 'grails.org'
'Implementation-Vendor': 'grails.apache.org'
)
}

Expand All @@ -56,7 +56,12 @@ tasks.withType(Jar).configureEach {
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false // to prevent timestamp mismatches
reproducibleFileOrder = true // to keep the same ordering
dirMode = 0755 // To avoid platform specific defaults
fileMode = 0644 // to avoid platform specific defaults
// to avoid platform specific defaults, set the permissions consistently
filePermissions { permissions ->
permissions.unix(0644)
}
dirPermissions { permissions ->
permissions.unix(0755)
}
}

9 changes: 9 additions & 0 deletions grails-bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ tasks.register('extractConstraints', ExtractDependenciesTask).configure { Extrac
it.platformDefinitions = combinedPlatforms
it.definitions = combinedDependencies
it.versions = combinedVersions
Map<String, String> artifactIdMappings = [:]
rootProject.subprojects.each { p ->
evaluationDependsOn(p.path)
String artifactId = p.findProperty('pomArtifactId')
if(artifactId) {
artifactIdMappings[p.name] = artifactId
}
}
it.projectArtifactIds.set(artifactIdMappings)

it.dependsOn(project.tasks.named('generateMetadataFileForMavenPublication'), project.tasks.named('generatePomFileForMavenPublication'))
}
Expand Down
3 changes: 2 additions & 1 deletion grails-data-docs/stage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ tasks.register('copyGuides').configure { Task task ->

Set<Project> dataHeaderGuides = rootProject.subprojects.findAll { it.name.startsWith('grails-data-docs-guide-') }
task.dependsOn(dataHeaderGuides.tasks*.named('asciidoctor'))
def guideDataDirectory = project.layout.buildDirectory.dir('guides/grails-data')
doLast {
copy {
for (Project subproject : dataHeaderGuides) {
Expand All @@ -132,7 +133,7 @@ tasks.register('copyGuides').configure { Task task ->
}
}

into(project.layout.buildDirectory.dir('guides/grails-data'))
into(guideDataDirectory)
}
}
}
Expand Down
11 changes: 7 additions & 4 deletions grails-doc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -225,22 +225,25 @@ tasks.register('generateBomDocumentation').configure { Task it ->
it.inputs.files(project(':grails-bom').layout.projectDirectory.asFileTree)
it.outputs.file(project.layout.projectDirectory.file('src/en/ref/Versions/Grails BOM.adoc'))

def versionsDir = project.layout.projectDirectory.dir('src/en/ref/Versions')
it.doFirst {
project.layout.projectDirectory.dir('src/en/ref/Versions').asFile.mkdirs()
versionsDir.asFile.mkdirs()
}

def bomDocumentFile = project.layout.projectDirectory.file('src/en/ref/Versions/Grails BOM.adoc')
def grailsBomConstraintFile = project(':grails-bom').layout.buildDirectory.file('grails-bom-constraints.adoc')
it.doLast {
def bomDocument = project.layout.projectDirectory.file('src/en/ref/Versions/Grails BOM.adoc').asFile
def bomDocument = bomDocumentFile.asFile
bomDocument.withWriter { writer ->
writer.writeLine '== Grails BOM Dependencies'
writer.writeLine ''
writer.writeLine 'This document provides information about the dependencies defined in the Grails BOM - also known as `org.apache.grails:grails-bom`. It includes the artifact coordinates, where in the hierarchy the coordinate was defined, and the maven property that defines the version.'
writer.writeLine ''
writer.write(project(':grails-bom').layout.buildDirectory.file('grails-bom-constraints.adoc').get().asFile.text)
writer.write(grailsBomConstraintFile.get().asFile.text)
writer.writeLine ''
}

project.logger.lifecycle "BOM Dependency Page generated to: ${bomDocument.absolutePath}"
it.logger.lifecycle "BOM Dependency Page generated to: ${bomDocument.absolutePath}"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.AntBuilder
import org.gradle.api.tasks.*

import javax.inject.Inject
Expand Down Expand Up @@ -80,8 +81,11 @@ class PublishGuide extends DefaultTask {
@OutputDirectory
final DirectoryProperty targetDir

private final AntBuilder ant

@Inject
PublishGuide(ObjectFactory objects, Project project) {
this.ant = project.ant
language = objects.property(String).convention(null as String)
sourceRepo = objects.property(String)
properties = objects.mapProperty(String, Object).convention([:])
Expand Down Expand Up @@ -120,7 +124,7 @@ class PublishGuide extends DefaultTask {
apiDir.mkdirs()

def publisher = new DocPublisher(sourceDir.get().asFile, apiDir)
publisher.ant = project.ant
publisher.ant = ant
publisher.asciidoc = asciidoc
publisher.workDir = workDir.get().asFile
publisher.apiDir = apiDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ abstract class ExtractDependenciesTask extends DefaultTask {
@Input
abstract MapProperty<String, String> getPlatformDefinitions()

@Input
abstract MapProperty<String, String> getProjectArtifactIds()

@Input
abstract MapProperty<String, String> getDefinitions()

Expand Down Expand Up @@ -121,19 +124,21 @@ abstract class ExtractDependenciesTask extends DefaultTask {
private populateExplicitConstraints(Configuration configuration,
Map<CoordinateHolder, ExtractedDependencyConstraint> constraints,
PropertyNameCalculator propertyNameCalculator) {
Map<String, String> artifactIdMappings = getProjectArtifactIds().get()
configuration.getAllDependencyConstraints().all { DependencyConstraint constraint ->
String groupId = constraint.module.group as String
String artifactId = constraint.module.name as String
String artifactVersion = constraint.version as String

//TODO: need to look for project property ? or manually find the project?
if (constraint instanceof DefaultProjectDependencyConstraint) {
DefaultProjectDependencyConstraint pConstraint = (DefaultProjectDependencyConstraint) constraint
artifactId = pConstraint.projectDependency.dependencyProject.findProperty('pomArtifactId') ?: artifactId
if(artifactIdMappings.containsKey(constraint.name)) {
artifactId = artifactIdMappings.get(constraint.name)
}
}

ExtractedDependencyConstraint extractConstraint = propertyNameCalculator.calculate(groupId, artifactId, artifactVersion, false) ?: new ExtractedDependencyConstraint(groupId: groupId, artifactId: artifactId, version: artifactVersion)
extractConstraint.source = project.name
extractConstraint.source = constraint.name // this will be the project name
constraints.put(new CoordinateHolder(groupId: extractConstraint.groupId, artifactId: extractConstraint.artifactId), extractConstraint)
}
}
Expand Down
9 changes: 7 additions & 2 deletions grails-gradle/gradle/docs-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ tasks.named('javadoc').configure {
tasks.named('javadocJar', Jar).configure { Jar jar ->
jar.reproducibleFileOrder = true
jar.preserveFileTimestamps = false
jar.dirMode = 0755 // To avoid platform specific defaults
jar.fileMode = 0644 // to avoid platform specific defaults
// to avoid platform specific defaults, set the permissions consistently
jar.filePermissions { permissions ->
permissions.unix(0644)
}
jar.dirPermissions { permissions ->
permissions.unix(0755)
}

jar.dependsOn(groovydocTask)

Expand Down
23 changes: 17 additions & 6 deletions grails-gradle/gradle/java-config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ tasks.named('sourcesJar', Jar).configure { Jar jar ->
SourceSetContainer sourceSets = project.extensions.getByType(JavaPluginExtension).sourceSets
jar.reproducibleFileOrder = true
jar.preserveFileTimestamps = false
jar.dirMode = 0755 // To avoid platform specific defaults
jar.fileMode = 0644 // to avoid platform specific defaults
// to avoid platform specific defaults, set the permissions consistently
jar.filePermissions { permissions ->
permissions.unix(0644)
}
jar.dirPermissions { permissions ->
permissions.unix(0755)
}

jar.duplicatesStrategy = DuplicatesStrategy.EXCLUDE

// don't only include main, but any source set
Expand All @@ -53,9 +59,9 @@ tasks.withType(GroovyCompile).configureEach {
// Note: we exclude attributes such as Built-By, Build-Jdk, Created-By to ensure the build is reproducible.
tasks.withType(Jar).configureEach {
manifest.attributes(
'Implementation-Title': 'Grails',
'Implementation-Title': 'Apache Grails',
'Implementation-Version': projectVersion,
'Implementation-Vendor': 'grails.org'
'Implementation-Vendor': 'grails.apache.org'
)
}

Expand All @@ -64,6 +70,11 @@ tasks.withType(Jar).configureEach {
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false // to prevent timestamp mismatches
reproducibleFileOrder = true // to keep the same ordering
dirMode = 0755 // To avoid platform specific defaults
fileMode = 0644 // to avoid platform specific defaults
// to avoid platform specific defaults, set the permissions consistently
filePermissions { permissions ->
permissions.unix(0644)
}
dirPermissions { permissions ->
permissions.unix(0755)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ enum Environment {
private static Boolean RELOADING_AGENT_ENABLED = null
private static boolean initializingState = false

private static final String GRAILS_IMPLEMENTATION_TITLE = "Grails"
private static final String GRAILS_IMPLEMENTATION_TITLE = "Apache Grails"
private static final String GRAILS_VERSION
private static final boolean STANDALONE_DEPLOYED
private static final boolean WAR_DEPLOYED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class MainClassFinder {

private static final String MAIN_METHOD_NAME = "main"

static final Map<String, String> mainClasses = new ConcurrentHashMap<>()
static final Map<String, MainClassHolder> mainClasses = new ConcurrentHashMap<>()

public static final String ROOT_FOLDER_PATH = "build/classes/main"

/**
Expand All @@ -53,14 +54,13 @@ class MainClassFinder {
* @return The name of the main class
*/
static String searchMainClass(URI path) {

if (!path) {
return null
}

def pathStr = path.toString()
if (mainClasses.containsKey(pathStr)) {
return mainClasses.get(pathStr)
return mainClasses.get(pathStr).className
}

try {
Expand All @@ -87,16 +87,17 @@ class MainClassFinder {
}
}

String mainClass = null

MainClassHolder holder = null
for (File dir in searchDirs) {
mainClass = findMainClass(dir)
if (mainClass) break
holder = findMainClass(dir)
if (holder) break
}
if (mainClass != null) {
mainClasses.put(pathStr, mainClass)

if (holder != null) {
mainClasses.put(pathStr, holder)
}
return mainClass

return holder.className
} catch (Throwable e) {
return null
}
Expand All @@ -117,13 +118,12 @@ class MainClassFinder {
return null
}

static String findMainClass(File rootFolder = BuildSettings.CLASSES_DIR) {
static MainClassHolder findMainClass(File rootFolder = BuildSettings.CLASSES_DIR) {
if (rootFolder == null) {
// try current directory
rootFolder = new File(ROOT_FOLDER_PATH)
}


if (!rootFolder.exists()) {
return null // nothing to do
}
Expand All @@ -146,9 +146,13 @@ class MainClassFinder {
try {
def classReader = new ClassReader(inputStream)
if (isMainClass(classReader)) {
def mainClassName = classReader.getClassName().replace('/', '.').replace('\\', '.')
mainClasses.put(rootFolderCanonicalPath, mainClassName)
return mainClassName
MainClassHolder holder = new MainClassHolder()
holder.className = classReader.getClassName().replace('/', '.').replace('\\', '.')
holder.classFile = file

mainClasses.put(rootFolderCanonicalPath, holder)

return holder
}
} finally {
inputStream?.close()
Expand Down Expand Up @@ -206,5 +210,4 @@ class MainClassFinder {
return !requiredOpsCodes.any { int requiredOpsCode -> (access & requiredOpsCode) == 0 }
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.grails.io.support

import groovy.transform.CompileStatic

@CompileStatic
class MainClassHolder {
File classFile
String className
}
Loading
Loading