Skip to content

Commit

Permalink
Prepare 4.0.0 final release
Browse files Browse the repository at this point in the history
This release filly integrates with Grolifant 2.2 and adopts the
newer JVM execution models to. This allows for better integration
with Gradle workers. THis has been so successful that the default
execution model is no a worker with classpath isolation as previously
it always has been javaexec.

JRuby: jruby-gradle plugin has been replaced with jruby-simple-plugin.
  This eliminates a number of issues with the previous plugin in
  terms of functionality and compatibiliy. It also restores
  plugin compatibility with JDK8 whereas the older plugin requires
  JDK11.

GEMs: The issues with load errors for external GEMs has been
  resolved, but eliminating the use of GEM_PATH and rather
  compiling a custom GEM Jar on the fly and placing it on the
  classpath.

Disabled plugins: Some plugins were disabled for this
  release and will probably be fixed for future releases. Due to
  their limited usage, it was thought better to get a release out
  now and fix these later. The plugins are:

  - Leanpub
  - Slides
  - Slides export

Other:

- `asciidoctorEditorConfig` is now lazy-created

Known issues:

- Supplying an extension via a configuration rather than via
  `docExtensions` does not work.
- GEM resolver test on Windows is failing.

Closes: #628, #626, #655, #658, #664, #671, #673, #684, i#692, #693
  • Loading branch information
ysb33r committed Jan 4, 2024
1 parent 719c951 commit 28f493a
Show file tree
Hide file tree
Showing 87 changed files with 864 additions and 1,220 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ jobs:
with:
arguments: --console=plain --warning-mode=all -s clean assemble
# Test
# TODO: Resolve the gem integration test issue.
- name: Test
uses: gradle/gradle-build-action@v2
with:
arguments: --console=plain --warning-mode=all -s check --no-parallel -Djava.net.preferIPv4Stack=true -x gradleTest --scan
arguments: --console=plain --warning-mode=all -s check --no-parallel -Djava.net.preferIPv4Stack=true -x gradleTest -x :asciidoctor-gradle-jvm-gems:IntTest --scan
# Stop gradlew to avoid locking issues
- name: Cleanup
uses: gradle/gradle-build-action@v2
Expand Down Expand Up @@ -88,14 +89,15 @@ jobs:
- name: Integration tests (without slides)
uses: gradle/gradle-build-action@v2
with:
arguments: -i -s --console=plain --no-build-cache test intTest remoteTest -x asciidoctor-gradle-jvm-slides:intTest
arguments: -i -s --console=plain --no-build-cache test intTest remoteTest --scan
# arguments: -i -s --console=plain --no-build-cache test intTest remoteTest -x asciidoctor-gradle-jvm-slides:intTest
# arguments: -i -s --console=plain --no-build-cache test intTest remoteTest -x asciidoctor-gradle-slides-export:intTest -x asciidoctor-gradle-jvm-slides:intTest
# - name: Integration tests (slides only)
# uses: eskatos/gradle-command-action@v1
# uses: eskatos/gradle-command-action@v2
# with:
# arguments: -i -s --console=plain --no-build-cache test asciidoctor-gradle-jvm-slides:intTest asciidoctor-gradle-slides-export:intTest
# Gradle tests
- name: Gradle tests
uses: gradle/gradle-build-action@v2
with:
arguments: -i -s --console=plain --no-build-cache gradleTest
arguments: -i -s --console=plain --no-build-cache gradleTest --scan
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= Asciidoctor Gradle Plugin
Andres Almiray <https://github.com/aalmiray[@aalmiray]>
:version: 3.3.2
:version-published: 3.3.2
:version: 4.0.0
:version-published: 4.0.0-alpha.1
:asciidoc-url: http://asciidoc.org
:asciidoctor-url: http://asciidoctor.org
:issues: https://github.com/asciidoctor/asciidoctor-maven-plugin/issues
Expand All @@ -20,7 +20,7 @@ Andres Almiray <https://github.com/aalmiray[@aalmiray]>
:plugin-name: Asciidoctor Gradle plugin
:project-name: asciidoctor-gradle-plugin
:project-full-path: asciidoctor/asciidoctor-gradle-plugin
:github-branch: development-3.x
:github-branch: development-4.x
:linkattrs:
ifndef::env-github[:icons: font]
ifdef::env-github,env-browser[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,9 @@ class AsciidoctorEditorConfigPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
ProjectOperations.maybeCreateExtension(project)
AsciidoctorEditorConfigGenerator task = project.tasks.create(
DEFAULT_TASK_NAME,
AsciidoctorEditorConfigGenerator
project.tasks.register(
DEFAULT_TASK_NAME,
AsciidoctorEditorConfigGenerator
)
configureIdea(task)
}

void configureIdea(AsciidoctorEditorConfigGenerator aecg) {
Project project = aecg.project
project.pluginManager.withPlugin('idea') {
project.tasks.getByName('ideaModule').dependsOn aecg
}
}
}
1 change: 1 addition & 0 deletions base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ configurations {
gradleTestCompile.transitive = false
}

// TODO: Use configurePlugin instead
gradlePlugin {
plugins {
basePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ import static org.asciidoctor.gradle.testfixtures.FunctionalTestSetup.getOffline
class FunctionalSpecification extends Specification {

public static final String TEST_PROJECTS_DIR = System.getProperty(
'TEST_PROJECTS_DIR',
'./asciidoctor-gradle-base/src/intTest/projects'
'TEST_PROJECTS_DIR',
'./asciidoctor-gradle-base/src/intTest/projects'
)

public static final String TEST_REPO_DIR = System.getProperty(
'OFFLINE_REPO',
'./testfixtures/offline-repo/build/repo'
'OFFLINE_REPO',
'./testfixtures/offline-repo/build/repo'
)

@TempDir
Expand All @@ -61,11 +61,11 @@ class FunctionalSpecification extends Specification {
@CompileStatic
String getOfflineRepositories(DslType dslType = GROOVY_DSL) {
dslType == GROOVY_DSL ? getOfflineRepositoriesGroovyDsl(new File(TEST_REPO_DIR)) :
getOfflineRepositoriesKotlinDsl(new File(TEST_REPO_DIR))
getOfflineRepositoriesKotlinDsl(new File(TEST_REPO_DIR))
}

File getGroovyBuildFile(String extraContent, String plugin = 'org.asciidoctor.base') {
File buildFile = new File(testProjectDir,'build.gradle')
File buildFile = new File(testProjectDir, 'build.gradle')
buildFile << """
plugins {
id '${plugin}'
Expand All @@ -79,7 +79,7 @@ class FunctionalSpecification extends Specification {
}

File getKotlinBuildFile(String extraContent, String plugin = 'org.asciidoctor.base') {
File buildFile = new File(testProjectDir,'build.gradle.kts')
File buildFile = new File(testProjectDir, 'build.gradle.kts')
buildFile << """
plugins {
id("${plugin}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.gradle.api.Project;
import org.gradle.api.UnknownDomainObjectException;
import org.gradle.api.provider.Provider;
import org.ysb33r.grolifant.api.core.ClosureUtils;
import org.ysb33r.grolifant.api.core.ProjectOperations;
import org.ysb33r.grolifant.api.core.git.AbstractCloudGit;
import org.ysb33r.grolifant.api.core.git.GitLabArchive;
Expand All @@ -40,6 +41,13 @@
* @since 2.0
*/
public abstract class AbstractDownloadableComponent<ComponentSrc, ResolvedComponent> {

protected final ProjectOperations projectOperations;
private final Map<String, Callable<ResolvedComponent>> components =
new LinkedHashMap<>();

private final Provider<File> downloadRootProvider;

/**
* Adds a component source that is available on the local filesystem.
* <p>
Expand Down Expand Up @@ -75,7 +83,9 @@ public void github(final String name, Action<AscGitHubArchive> githubConfig) {
* @param gitlabConfig Closure to configure a {@link AscGitLabArchive}.
*/
public void gitlab(final String name, @DelegatesTo(GitLabArchive.class) Closure<?> gitlabConfig) {
gitlab(name, x -> gitlabConfig.call(x));
AscGitLabArchive archive = new AscGitLabArchive(projectOperations);
ClosureUtils.configureItem(archive,gitlabConfig);
this.components.put(name, convertible(name, archive));
}

/**
Expand Down Expand Up @@ -179,9 +189,4 @@ private void addCloudGitArchive(
private String getRelativePathInsideArchive(AbstractCloudGit theme) {
return ((String) (theme.getProperty("relativePath")));
}

private final Map<String, Callable<ResolvedComponent>> components =
new LinkedHashMap<>();
private final ProjectOperations projectOperations;
private final Provider<File> downloadRootProvider;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.asciidoctor.gradle.base;

import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.OutputDirectories;

import java.io.File;
Expand Down Expand Up @@ -109,4 +110,12 @@ void copyResourcesByBackend(
* @return Output directory.
*/
File getOutputDirForBackend(final String backendName, final String language);

/**
* Access to the underlying {@link OutputOptions}.
*
* @return {@link OutputOptions} instance.
*/
@Nested
OutputOptions getOutputOptions();
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class AsciidoctorAttributes {
* @param workingSourceDir Working source directory from which source documents will be made available.
* @param seedAttributes Initial attributes set on the task.
* @param langAttributes Any language specific attributes.
* @param tdsAttributes Task-specific default attributes.
* @param attributeProviders Additional attribute providers.
* @param lang Language being processed. Can be unset if multi-language feature is not used.
* @return Attributes ready for serialisation.
Expand All @@ -101,7 +102,7 @@ class AsciidoctorAttributes {
final StringTools stringTools,
Map<String, ?> seedAttributes,
Map<String, ?> langAttributes,
Map<String, ?> taskSpecificDefaultAttributes,
Map<String, ?> tsdAttributes,
List<AsciidoctorAttributeProvider> attributeProviders,
Optional<String> lang
) {
Expand All @@ -115,7 +116,7 @@ class AsciidoctorAttributes {
Map<String, Object> defaultAttrs = prepareDefaultAttributes(
stringTools,
attrs,
taskSpecificDefaultAttributes,
tsdAttributes,
lang
)
attrs.putAll(defaultAttrs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,14 @@ class DefaultAsciidoctorOutputOptions implements AsciidoctorTaskOutputOptions {
new File(fileOperations.outputDir, "${language}/${backendName}") :
new File(fileOperations.outputDir, language)
}

/**
* Access to the underlying {@link OutputOptions}.
*
* @return {@link OutputOptions} instance.
*/
@Override
OutputOptions getOutputOptions() {
this.configuredOutputOptions
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AsciidoctorBasePluginSpec extends Specification {
noExceptionThrown()
}

@SuppressWarnings(['GetterMethodCouldBeProperty'])
static class TestTask extends AbstractAsciidoctorBaseTask {
Map<String, Object> attributes
List<AsciidoctorAttributeProvider> attributeProviders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class BaseTaskPatternSpec extends Specification {
project.tasks.create(name: name, type: PatternSpecAsciidoctorTask).configure cfg
}

@SuppressWarnings(['GetterMethodCouldBeProperty'])
static class PatternSpecAsciidoctorTask extends AbstractAsciidoctorBaseTask {
// method for accessing internal field "sourceDocumentPattern"
PatternSet getInternalSourceDocumentPattern() {
Expand Down
25 changes: 11 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
*/

plugins {
// id 'com.gradle.build-scan' version '3.11.1'
id 'net.nemerosa.versioning' version '2.6.1' apply false
id 'com.github.ben-manes.versions' version '0.17.0' apply false
id 'com.gradle.plugin-publish' version '1.2.1' apply false
id 'com.github.hierynomus.license' version '0.16.1' apply false
id 'com.github.kt3k.coveralls' version '2.8.2' apply false
id 'net.ossindex.audit' version '0.1.1' apply false
Expand All @@ -32,18 +30,6 @@ plugins {
id 'idea'
}

//buildScan {
// termsOfServiceUrl = 'https://gradle.com/terms-of-service'
// termsOfServiceAgree = 'yes'
//
// buildFinished { buildResult ->
// buildScanPublished { scan ->
// ['curl', '-s', '-d', "message=asciidoctor-gradle-plugin build scan: ${scan.buildScanUri}", 'https://webhooks.gitter.im/e/6ba348eef26407adc22a'].execute()
// }
// }
//}


import org.gradle.util.GradleVersion
import java.text.SimpleDateFormat

Expand Down Expand Up @@ -136,6 +122,17 @@ subprojects {
}
}

configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.codehaus.groovy') {
details.useVersion GroovySystem.version
details.because 'THe same version as Grodale Groovy is required'
}
}
}
}

audit {
failOnError = false
}
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ repositories {
dependencies {
implementation localGroovy()
implementation gradleApi()
implementation "com.gradle.publish:plugin-publish-plugin:${gradleProperties.pluginPublishPlugin}"
api "org.ysb33r.gradle:nodejs-gradle-plugin:${gradleProperties.nodejsGradleVersion}"
api "org.ysb33r.gradle:grolifant-herd:${gradleProperties.grolifantVersion}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class AsciidoctorGradlePluginProject implements Plugin<Project> {
project.pluginManager.identity {
apply 'maven-publish'
apply 'groovy-gradle-plugin'
apply 'java-gradle-plugin'
apply 'com.gradle.plugin-publish'
apply AsciidoctorGradleGroovyProject
}

Expand Down
39 changes: 39 additions & 0 deletions buildSrc/src/main/groovy/AsciidoctorGradleProjectExtension.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import com.gradle.publish.PluginBundleExtension
import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.plugins.ExtensionContainer
import org.gradle.api.provider.Provider
import org.gradle.plugin.devel.GradlePluginDevelopmentExtension
import org.gradle.plugin.devel.PluginDeclaration
import org.gradle.plugin.devel.tasks.PluginUnderTestMetadata
import org.ysb33r.grolifant.api.core.ProjectOperations

Expand All @@ -9,10 +14,19 @@ class AsciidoctorGradleProjectExtension {

private final ProjectOperations projectOperations
private final ConfigurationContainer configurations
private final ExtensionContainer extensions
private final Provider<String> pluginExtraTextProvider

AsciidoctorGradleProjectExtension(Project project) {
this.projectOperations = ProjectOperations.find(project)
this.configurations = project.configurations
this.extensions = project.extensions

this.pluginExtraTextProvider = projectOperations.versionProvider.map { version ->
(version.contains('-alpha') || version.contains('-beta')) ?
". (If you need a production-ready version of the AsciidoctorJ plugin for Gradle use a 3.x release of this plugin instead)."
: ''
}
}

void withOfflineTestConfigurations() {
Expand Down Expand Up @@ -47,4 +61,29 @@ class AsciidoctorGradleProjectExtension {
projectOperations.atConfigurationTime()
).get()
}

void configurePlugin(
String pluginId,
String providedDisplayName,
String providedDescription,
String implClass,
List<String> providedTags
) {
final gradlePlugin = extensions.getByType(GradlePluginDevelopmentExtension)
final pluginBundle = extensions.getByType(PluginBundleExtension)
final providedName = "${pluginId.replaceAll(~/\./, '')}Plugin".toString()
final extraText = pluginExtraTextProvider.get()
gradlePlugin.plugins.create(providedName) { PluginDeclaration pd ->
pd.tap {
id = pluginId
displayName = providedDisplayName
description = extraText ? "${providedDescription}. ${extraText}" : "${extraText}."
implementationClass = implClass
}
}
if (pluginBundle.pluginTags.isEmpty()) {
pluginBundle.pluginTags = [(providedName): (Collection<String>)(['asciidoctor'] + providedTags)]
}
pluginBundle.pluginTags.putAll([(providedName): (['asciidoctor'] + providedTags)])
}
}
2 changes: 1 addition & 1 deletion docs/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include::parts/asciidoctorj-epub-plugin.adoc[]

include::parts/asciidoctorj-revealjs-plugin.adoc[]

include::parts/asciidoctorj-leanpub-plugin.adoc[]
// include::parts/asciidoctorj-leanpub-plugin.adoc[]

include::parts/asciidoctor-diagram.adoc[]

Expand Down
Loading

0 comments on commit 28f493a

Please sign in to comment.