diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index a02b297f..9930f683 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,6 +1,6 @@ plugins { `kotlin-dsl` - id("org.gradle.kotlin-dsl.ktlint-convention") version "0.4.1" + id("org.gradle.kotlin-dsl.ktlint-convention") version "0.6.0" } repositories { @@ -10,8 +10,12 @@ repositories { dependencies { implementation(kotlin("gradle-plugin")) - implementation("org.asciidoctor:asciidoctor-gradle-plugin:1.5.9.1") implementation("org.ajoberstar:gradle-git-publish:0.3.3") + + implementation("org.asciidoctor:asciidoctor-gradle-plugin:1.6.1") + constraints { + implementation("org.ysb33r.gradle:grolifant:0.12.1") + } } kotlinDslPluginOptions { diff --git a/buildSrc/src/main/kotlin/org/gradle/playframework/UserGuidePlugin.kt b/buildSrc/src/main/kotlin/org/gradle/playframework/UserGuidePlugin.kt index 6c90ee32..d440483c 100644 --- a/buildSrc/src/main/kotlin/org/gradle/playframework/UserGuidePlugin.kt +++ b/buildSrc/src/main/kotlin/org/gradle/playframework/UserGuidePlugin.kt @@ -32,9 +32,11 @@ class UserGuidePlugin : Plugin { fun Project.configureAsciidoctorTask() { val asciidoctor by tasks.existing(AsciidoctorTask::class) { sourceDir = file("src/docs/asciidoc") - sources(delegateClosureOf { - include("index.adoc") - }) + sources( + delegateClosureOf { + include("index.adoc") + } + ) attributes( mapOf( diff --git a/src/main/java/org/gradle/playframework/plugins/PlayDistributionPlugin.java b/src/main/java/org/gradle/playframework/plugins/PlayDistributionPlugin.java index 1f063590..65508e8f 100644 --- a/src/main/java/org/gradle/playframework/plugins/PlayDistributionPlugin.java +++ b/src/main/java/org/gradle/playframework/plugins/PlayDistributionPlugin.java @@ -1,9 +1,6 @@ package org.gradle.playframework.plugins; -import org.gradle.api.Action; -import org.gradle.api.Plugin; -import org.gradle.api.Project; -import org.gradle.api.Task; +import org.gradle.api.*; import org.gradle.api.artifacts.ArtifactCollection; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.component.ComponentIdentifier; @@ -122,13 +119,32 @@ private void createDistributionContentTasks(Project project, Distribution distri distSpec.into("bin", copySpec -> { copySpec.from(createStartScriptsTask); - copySpec.setFileMode(0755); + setFileMode(copySpec); }); distSpec.into("conf", copySpec -> copySpec.from("conf").exclude("routes")); distSpec.from("README"); } + private void setFileMode(CopySpec copySpec) { + try { + if (GradleVersion.current().compareTo(GradleVersion.version("8.3")) >= 0) { + copySpec.getClass().getMethod("filePermissions", Action.class) + .invoke(copySpec, (Action) filePermission -> { + try { + filePermission.getClass().getMethod("unix", String.class).invoke(filePermission, "0755"); + } catch (Exception e) { + throw new GradleException("Failed to set unix file permission", e); + } + }); + } else { + copySpec.getClass().getMethod("setFileMode", Integer.class).invoke(copySpec, 0755); + } + } catch (Exception e) { + throw new GradleException("Failed to set file permissions", e); + } + } + private String getMainClass(PlayPlatform playPlatform) { switch (PlayMajorVersion.forPlatform(playPlatform)) { case PLAY_2_3_X: @@ -238,7 +254,7 @@ public void execute(FileCopyDetails fileCopyDetails) { public String apply(File input) { calculateRenames(); String rename = renames.get(input); - if (rename!=null) { + if (rename != null) { return rename; } return input.getName();