Skip to content

Commit

Permalink
Gradle 8.10 compatibility + use Grails Shell 6.2.1-SNAPSHOT until 7.0…
Browse files Browse the repository at this point in the history
….0-SNAPSHOT is published (+1 squashed commits)

Squashed commits:

[3e6419d] Gradle 8.10 compatibility + use Grails Shell 6.2.1-SNAPSHOT until 7.0.0-SNAPSHOT is published
  • Loading branch information
jamesfredley committed Aug 20, 2024
1 parent 9f2155d commit 57dce8a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ group "org.grails"
version project.projectVersion

repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}
Expand Down Expand Up @@ -64,11 +65,11 @@ if (isReleaseVersion) {
apply plugin: 'signing'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17


java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}

withJavadocJar()
withSourcesJar()
}
Expand All @@ -86,7 +87,7 @@ dependencies {
implementation "com.bmuschko:gradle-nexus-plugin:2.3.1"
implementation "org.grails:grails-bootstrap:$grailsVersion"
implementation "org.grails:grails-gradle-model:$grailsVersion"
implementation "org.grails:grails-shell:$grailsVersion"
implementation "org.grails:grails-shell:$grailsShellVersion"
implementation "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
implementation "org.springframework.boot:spring-boot-loader-tools:$springBootVersion"
implementation "io.spring.gradle:dependency-management-plugin:1.1.5"
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
projectVersion=7.0.0-SNAPSHOT
grailsVersion=7.0.0-SNAPSHOT
#TODO: Update to 7.0.0-SNAPSHOT when it has been published
grailsShellVersion=6.2.1-SNAPSHOT
springBootVersion=3.2.6
groovyVersion=3.0.21
org.gradle.caching=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ package org.grails.gradle.plugin.profiles
import grails.io.IOUtils
import grails.util.BuildSettings
import groovy.transform.CompileStatic
import org.gradle.api.Action
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.DependencyResolveDetails
import org.gradle.api.file.CopySpec
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact
import org.gradle.api.plugins.BasePlugin
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.bundling.Jar
import org.grails.cli.profile.commands.script.GroovyScriptCommand
import org.grails.gradle.plugin.profiles.tasks.ProfileCompilerTask


import static org.gradle.api.plugins.BasePlugin.*
import static org.gradle.api.plugins.BasePlugin.BUILD_GROUP

/**
* A plugin that is capable of compiling a Grails profile into a JAR file for distribution
Expand Down Expand Up @@ -69,7 +66,7 @@ class GrailsProfileGradlePlugin implements Plugin<Project> {
def profileYml = project.file("profile.yml")

def commandsDir = project.file("commands")
def resourcesDir = new File(project.buildDir, "resources/profile")
def resourcesDir = new File(project.layout.buildDirectory.getAsFile().get(), "resources/profile")
def templatesDir = project.file("templates")
def skeletonsDir = project.file("skeleton")
def featuresDir = project.file("features")
Expand All @@ -92,13 +89,13 @@ class GrailsProfileGradlePlugin implements Plugin<Project> {
spec.into("skeleton")
}

def processResources = project.tasks.create("processResources", Copy, (Action){ Copy c ->
def processResources = project.tasks.create("processResources", Copy, { Copy c ->
c.with(spec1, spec2, spec3, spec4)
c.into(new File(resourcesDir, "/META-INF/grails-profile"))
})

def classsesDir = new File(project.buildDir, "classes/profile")
def compileTask = project.tasks.create("compileProfile", ProfileCompilerTask, (Action) { ProfileCompilerTask task ->
def classsesDir = new File(project.layout.buildDirectory.getAsFile().get(), "classes/profile")
def compileTask = project.tasks.create("compileProfile", ProfileCompilerTask, { ProfileCompilerTask task ->
task.destinationDir = classsesDir
task.source = commandsDir
task.config = profileYml
Expand All @@ -108,19 +105,19 @@ class GrailsProfileGradlePlugin implements Plugin<Project> {
task.classpath = project.configurations.getByName(RUNTIME_CONFIGURATION) + project.files(IOUtils.findJarFile(GroovyScriptCommand))
})

def jarTask = project.tasks.create("jar", Jar, (Action) { Jar jar ->
def jarTask = project.tasks.create("jar", Jar, { Jar jar ->
jar.dependsOn(processResources, compileTask)
jar.from(resourcesDir)
jar.from(classsesDir)
jar.destinationDir = new File(project.buildDir, "libs")
jar.destinationDirectory.set(new File(project.layout.buildDirectory.getAsFile().get(), "libs"))
jar.setDescription("Assembles a jar archive containing the profile classes.")
jar.setGroup(BUILD_GROUP)

ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar)
project.artifacts.add(CONFIGURATION_NAME, jarArtifact)
// ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar)
// project.artifacts.add(CONFIGURATION_NAME, jarArtifact)
})

project.tasks.create("sourcesJar", Jar, (Action) { Jar jar ->
project.tasks.create("sourcesJar", Jar, { Jar jar ->
jar.from(commandsDir)
if(profileYml.exists()) {
jar.from(profileYml)
Expand All @@ -132,7 +129,7 @@ class GrailsProfileGradlePlugin implements Plugin<Project> {
spec.into("skeleton")
}
jar.archiveClassifier.set("sources")
jar.destinationDirectory.set(new File(project.buildDir, "libs"))
jar.destinationDirectory.set(new File(project.layout.buildDirectory.getAsFile().get(), "libs"))
jar.setDescription("Assembles a jar archive containing the profile sources.")
jar.setGroup(BUILD_GROUP)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class GrailsProfilePublishGradlePlugin extends GrailsCentralPublishGradlePlugin
super.apply(project)
final File tempReadmeForJavadoc = Files.createTempFile("README", "txt").toFile()
tempReadmeForJavadoc << "https://central.sonatype.org/publish/requirements/#supply-javadoc-and-sources"
project.tasks.create("javadocJar", Jar, (Action) { Jar jar ->
project.tasks.create("javadocJar", Jar, { Jar jar ->
jar.from(tempReadmeForJavadoc)
jar.archiveClassifier.set("javadoc")
jar.destinationDirectory.set(new File(project.buildDir, "libs"))
jar.destinationDirectory.set(new File(project.layout.buildDirectory.getAsFile().get(), "libs"))
jar.setDescription("Assembles a jar archive containing the profile javadoc.")
jar.setGroup(BUILD_GROUP)
})
Expand Down

0 comments on commit 57dce8a

Please sign in to comment.