Merge branch '2.6.x' into 2.7.x

Closes gh-32157
pull/32861/head
Phillip Webb 2 years ago
commit 5f2f6d32cf

@ -26,6 +26,7 @@ import org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask;
import org.asciidoctor.gradle.jvm.AsciidoctorJExtension; import org.asciidoctor.gradle.jvm.AsciidoctorJExtension;
import org.asciidoctor.gradle.jvm.AsciidoctorJPlugin; import org.asciidoctor.gradle.jvm.AsciidoctorJPlugin;
import org.asciidoctor.gradle.jvm.AsciidoctorTask; import org.asciidoctor.gradle.jvm.AsciidoctorTask;
import org.gradle.api.JavaVersion;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.tasks.PathSensitivity; import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.Sync; import org.gradle.api.tasks.Sync;
@ -118,6 +119,7 @@ class AsciidoctorConventions {
asciidoctorTask.configurations(EXTENSIONS_CONFIGURATION_NAME); asciidoctorTask.configurations(EXTENSIONS_CONFIGURATION_NAME);
configureCommonAttributes(project, asciidoctorTask); configureCommonAttributes(project, asciidoctorTask);
configureOptions(asciidoctorTask); configureOptions(asciidoctorTask);
configureForkOptions(asciidoctorTask);
asciidoctorTask.baseDirFollowsSourceDir(); asciidoctorTask.baseDirFollowsSourceDir();
createSyncDocumentationSourceTask(project, asciidoctorTask); createSyncDocumentationSourceTask(project, asciidoctorTask);
if (asciidoctorTask instanceof AsciidoctorTask) { if (asciidoctorTask instanceof AsciidoctorTask) {
@ -136,6 +138,14 @@ class AsciidoctorConventions {
asciidoctorTask.attributes(attributes); asciidoctorTask.attributes(attributes);
} }
// See https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/597
private void configureForkOptions(AbstractAsciidoctorTask asciidoctorTask) {
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_16)) {
asciidoctorTask.forkOptions((options) -> options.jvmArgs("--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED"));
}
}
private String determineGitHubTag(Project project) { private String determineGitHubTag(Project project) {
String version = "v" + project.getVersion(); String version = "v" + project.getVersion();
return (version.endsWith("-SNAPSHOT")) ? "2.7.x" : version; return (version.endsWith("-SNAPSHOT")) ? "2.7.x" : version;

Loading…
Cancel
Save