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 2abe4f6
Show file tree
Hide file tree
Showing 92 changed files with 899 additions and 1,588 deletions.
11 changes: 7 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. See https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/694
- 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,16 @@ 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
# TODO: See https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/695
# - 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
19 changes: 8 additions & 11 deletions asciidoctoreditorconfig/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
agProject {
withAdditionalPluginClasspath()

configurePlugin(
'org.asciidoctor.editorconfig',
'Asciidoctor Editor Config Plugin',
'Generate .asciidoctorconfig files for use by supported IDEs',
'org.asciidoctor.gradle.editorconfig.AsciidoctorEditorConfigPlugin',
['intellij', 'idea']
)
}

dependencies {
implementation project(':asciidoctor-gradle-base')
additionalPluginClasspath project(':asciidoctor-gradle-jvm')
}

gradlePlugin {
plugins {
aecPlugin {
id = 'org.asciidoctor.editorconfig'
displayName = 'Asciidoctor Editor Config Plugin'
description = "Generate .asciidoctorconfig files for use by supported IDEs${pluginExtraText}"
// tags.set(['asciidoctor', 'intellij', 'idea'])
implementationClass = 'org.asciidoctor.gradle.editorconfig.AsciidoctorEditorConfigPlugin'
}
}
}


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
}
}
}
21 changes: 10 additions & 11 deletions base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
* limitations under the License.
*/

agProject {
configurePlugin(
'org.asciidoctor.base',
'Asciidoctor Base Plugin',
'Base plugin for all asciidoctor document conversion plugins (AsciidoctorJ & AsciidoctorJS)',
'org.asciidoctor.gradle.base.AsciidoctorBasePlugi',
[]
)
}

pluginManager.withPlugin('jacoco') {
jacocoTestReport {
executionData.setFrom(fileTree('.') { exclude '**' })
Expand All @@ -27,14 +37,3 @@ configurations {
gradleTestCompile.transitive = false
}

gradlePlugin {
plugins {
basePlugin {
id = "org.asciidoctor.base"
displayName = 'Asciidoctor Base Plugin'
description = "Base plugin for all asciidoctor document conversion plugins (AsciidoctorJ & AsciidoctorJS)${pluginExtraText}"
// tags.set(['asciidoctor'])
implementationClass = 'org.asciidoctor.gradle.base.AsciidoctorBasePlugin'
}
}
}
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 @@ -145,101 +145,7 @@ abstract class AbstractAsciidoctorBaseTask extends DefaultTask implements Asciid
DirectoryProperty getOutputDirProperty() {
this.outDir
}
//
// /** Base directory (current working directory) for a conversion.
// *
// * @return Base directory.
// */
// // IMPORTANT: Do not change this to @InputDirectory as it can lead to file locking issues on
// // Windows. In reality we do not need to track contents of the directory
// // simply the value change - we achieve that via a normal property.
// @Internal
// File getBaseDir() {
// if (!languages.empty) {
// throw new AsciidoctorMultiLanguageException('Use getBaseDir(lang) instead')
// }
// this.baseDir ? this.baseDir.baseDir : project.projectDir
// }
//
// /** Base directory (current working directory) for a conversion.
// *
// * Depending on the strateggy in use, the source language used in the conversion
// * may change the final base directory relative to the value returned by {@link #getBaseDir}.
// *
// * @param lang Language in use
// * @return Language-dependent base directory
// */
// File getBaseDir(String lang) {
// this.baseDir ? this.baseDir.getBaseDir(lang) : project.projectDir
// }
//
// /** Sets the base directory for a conversion.
// *
// * The base directory is used by AsciidoctorJ to set a current working directory for
// * a conversion.
// *
// * If never set, then {@code project.projectDir} will be assumed to be the base directory.
// *
// * @param f Base directory
// */
// void setBaseDir(Object f) {
// switch (f) {
// case BaseDirStrategy:
// this.baseDir = (BaseDirStrategy) f
// break
// case null:
// this.baseDir = BaseDirIsNull.INSTANCE
// break
// default:
// this.baseDir = new BaseDirIsFixedPath(project.providers.provider({
// project.file(f)
// } as Callable<File>))
// }
// }
//
// /** Sets the basedir to be the same directory as the root project directory.
// *
// * @return A strategy that allows the basedir to be locked to the root project.
// *
// * @since 2.2.0
// */
// void baseDirIsRootProjectDir() {
// this.baseDir = new BaseDirFollowsRootProject(project)
// }
//
// /** Sets the basedir to be the same directory as the current project directory.
// *
// * @return A strategy that allows the basedir to be locked to the current project.
// *
// * @since 2.2.0
// */
// void baseDirIsProjectDir() {
// this.baseDir = new BaseDirFollowsProject(project)
// }
//
// /** The base dir will be the same as the source directory.
// *
// * If an intermediate working directory is used, the the base dir will be where the
// * source directory is located within the temporary working directory.
// *
// * @return A strategy that allows the basedir to be locked to the current project.
// *
// * @since 2.2.0
// */
// void baseDirFollowsSourceDir() {
// this.baseDir = new BaseDirIsFixedPath(project.providers.provider({ AbstractAsciidoctorBaseTask task ->
// task.withIntermediateWorkDir ? task.intermediateWorkDir : task.sourceDir
// }.curry(this) as Callable<File>))
// }
//
// /** Sets the basedir to be the same directory as each individual source file.
// *
// * @since 3.0.0
// */
// void baseDirFollowsSourceFile() {
// this.baseDir = BaseDirIsNull.INSTANCE
// }
//

/** Configures sources.
*
* @param cfg Configuration closure. Is passed a {@link PatternSet}.
Expand Down Expand Up @@ -530,7 +436,7 @@ abstract class AbstractAsciidoctorBaseTask extends DefaultTask implements Asciid
*/
@Override
boolean hasIntermediateWorkDir() {
this.intermediateWorkDirProvider.present
this.intermediateWorkDirProvider.present
}

@Override
Expand Down Expand Up @@ -654,18 +560,13 @@ abstract class AbstractAsciidoctorBaseTask extends DefaultTask implements Asciid
Map<String, Object> getTaskSpecificDefaultAttributes(File workingSourceDir) {
Map<String, Object> attrs = [
includedir: (Object) workingSourceDir.absolutePath
// 'gradle-project-name': (Object) project.name
]

String revNumber = defaultRevNumber.get()
if (!revNumber.empty && revNumber != Project.DEFAULT_VERSION) {
attrs.put('revnumber', revNumber)
}

// if (project.group != null) {
// attrs.put('gradle-project-group', (Object) project.group)
// }

attrs
}

Expand Down Expand Up @@ -855,7 +756,11 @@ abstract class AbstractAsciidoctorBaseTask extends DefaultTask implements Asciid
* @return Source tree based upon configured pattern.
*/
protected FileTree getSourceFileTreeFrom(File dir) {
AsciidoctorUtils.getSourceFileTree(project, dir, this.sourceDocumentPattern ?: defaultSourceDocumentPattern)
AsciidoctorUtils.getSourceFileTree(
projectOperations,
dir,
this.sourceDocumentPattern ?: defaultSourceDocumentPattern
)
}

/** Obtains a secondary source tree based on patterns.
Expand Down Expand Up @@ -892,37 +797,6 @@ abstract class AbstractAsciidoctorBaseTask extends DefaultTask implements Asciid
protected PatternSet getDefaultSecondarySourceDocumentPattern() {
asciidocPatterns
}
// /** Get the output directory for a specific backend.
// *
// * @param backendName Name of backend
// * @return Output directory.
// */
// protected File getOutputDirFor(final String backendName) {
// if (outputDir == null) {
// throw new GradleException("outputDir has not been defined for task '${name}'")
// }
// if (!this.languages.empty) {
// throw new AsciidoctorMultiLanguageException('Use getOutputDir(backendname,language) instead.')
// }
// configuredOutputOptions.separateOutputDirs ? new File(outputDir, backendName) : outputDir
// }
//
// /** Get the output directory for a specific backend.
// *
// * @param backendName Name of backend
// * @param language Language for which sources are being generated.
// * @return Output directory.
// *
// * @since 3.0.0
// */
// protected File getOutputDirFor(final String backendName, final String language) {
// if (outputDir == null) {
// throw new GradleException("outputDir has not been defined for task '${name}'")
// }
// configuredOutputOptions.separateOutputDirs ?
// new File(outputDir, "${language}/${backendName}") :
// new File(outputDir, language)
// }

/** Adds an input property.
*
Expand Down
Loading

0 comments on commit 2abe4f6

Please sign in to comment.