From fa17bbfe63ede8d995e0dbe50646e775a7baad0c Mon Sep 17 00:00:00 2001 From: Christian Stuht Date: Wed, 16 Oct 2024 16:41:05 +0200 Subject: [PATCH] re-enable slides project Resolves: #738 See also: #695 --- .tool-versions | 1 + .../DefaultAsciidoctorFileOperations.groovy | 2 +- jvm-slides/build.gradle | 48 ++++++++++++----- ...orRevealJSTaskCachingFunctionalSpec.groovy | 20 ++++--- ...ciidoctorRevealJSTaskFunctionalSpec.groovy | 29 +++++----- ...ConvertPluginsCoexistFunctionalSpec.groovy | 5 +- .../internal/FunctionalSpecification.groovy | 54 ++++++++++--------- .../slides/AsciidoctorJRevealJSTask.groovy | 41 +++++++------- .../AsciidoctorRevealJSBasePlugin.groovy | 2 +- .../slides/AsciidoctorRevealJSPlugin.groovy | 19 +++---- .../jvm/slides/LocalRevealJSPlugin.groovy | 2 +- .../jvm/slides/ResolvedRevealJSPlugin.groovy | 2 +- .../jvm/slides/RevealJSExtension.groovy | 17 +++--- .../gradle/jvm/slides/RevealJSOptions.groovy | 34 ++++++------ .../jvm/slides/RevealJSPluginExtension.groovy | 25 ++++++--- ...g.asciidoctor.jvm.revealjs.base.properties | 17 ------ .../org.asciidoctor.jvm.revealjs.properties | 17 ------ .../AsciidoctorRevealJSPluginSpec.groovy | 13 ++--- .../slides/AsciidoctorRevealJSTaskSpec.groovy | 6 +-- .../jvm/slides/RevealJSExtensionSpec.groovy | 8 +-- .../jvm/slides/RevealJSOptionsSpec.groovy | 4 +- .../slides/RevealJSPluginExtensionSpec.groovy | 13 +++-- settings.gradle | 4 +- .../testfixtures/CachingTestFixture.groovy | 4 +- 24 files changed, 200 insertions(+), 187 deletions(-) create mode 100644 .tool-versions delete mode 100644 jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.base.properties delete mode 100644 jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.properties diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..8ae179233 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +java temurin-11.0.24+8 diff --git a/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DefaultAsciidoctorFileOperations.groovy b/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DefaultAsciidoctorFileOperations.groovy index 0a6b2a156..d804b1dc5 100644 --- a/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DefaultAsciidoctorFileOperations.groovy +++ b/base/src/main/groovy/org/asciidoctor/gradle/base/internal/DefaultAsciidoctorFileOperations.groovy @@ -694,7 +694,7 @@ class DefaultAsciidoctorFileOperations implements AsciidoctorTaskFileOperations, * @param backendName Name of backend * @return Output directory. */ - protected File getOutputDirFor(final String backendName) { + File getOutputDirFor(final String backendName) { if (outputDir == null) { throw new GradleException("outputDir has not been defined for task '${taskName}'") } diff --git a/jvm-slides/build.gradle b/jvm-slides/build.gradle index 699dbf91f..95336cd01 100644 --- a/jvm-slides/build.gradle +++ b/jvm-slides/build.gradle @@ -1,29 +1,51 @@ +import org.ysb33r.gradle.gradletest.GradleTest + +agProject { + withOfflineTestConfigurations() + + configurePlugin( + 'org.asciidoctor.jvm.revealjs.base', + 'AsciidoctorJ Reveal.js Base Plugin', + 'Base plugin for all AsciidoctorJ Reveal.js tasks & extensions. Provides the revealjs and revealjsPlugins project extensions.', + 'org.asciidoctor.gradle.jvm.slides.AsciidoctorRevealJSBasePlugin', + ['asciidoctorj', 'reveal.js', 'slides'] + ) + + configurePlugin( + 'org.asciidoctor.jvm.revealjs', + 'AsciidoctorJ Reveal.js Plugin', + 'Plugin for generating Reveal.JS based slides from Asciidoc source using AsciidoctorJ. Provides the asciidoctorRevealJs task.', + 'org.asciidoctor.gradle.jvm.slides.AsciidoctorRevealJSPlugin', + ['asciidoctorj', 'reveal.js', 'slides'] + ) +} + generateModuleVersions { basename = 'revealjs-extension' propertyNames ~/^revealjs\./ } dependencies { + api project(':asciidoctor-gradle-jvm') implementation project(':asciidoctor-gradle-base') implementation project(':asciidoctor-gradle-jvm-gems') - implementation "com.github.jruby-gradle:jruby-gradle-core-plugin:${jrubyGradleVersion}" + implementation "org.ysb33r.gradle.jruby:jrubygradle-resolver:${pluginJrubySimpleVersion}" } -intTest { - enabled = !gradle.startParameter.isOffline() +tasks.named('intTest', Test) { systemProperties TEST_PROJECTS_DIR: file('src/intTest/projects') + maxParallelForks = 4 + forkEvery = 7 } -gradleTest { - enabled = !gradle.startParameter.isOffline() +tasks.named('test', Test) { + dependsOn ':testfixtures-offline-repo:buildOfflineRepositories' + systemProperties OFFLINE_REPO: offlineRepoRoot.absolutePath } -configurePlugin 'org.asciidoctor.jvm.revealjs.base', - 'AsciidoctorJ Reveal.js Base Plugin', - 'Base plugin for all AsciidoctorJ Reveal.js tasks & extensions. Provides the revealjs and revealjsPlugins project extensions.', - ['asciidoctorj', 'reveal.js', 'slides'] +tasks.named('gradleTest', GradleTest) { + systemProperties ASCIIDOCTORJ_VERSION: compileOnlyAsciidoctorJVersion + systemProperties GROOVY_VERSION: GroovySystem.version -configurePlugin 'org.asciidoctor.jvm.revealjs', - 'AsciidoctorJ Reveal.js Plugin', - 'Plugin for generating Reveal.JS based slides from Asciidoc source using AsciidoctorJ. Provides the ascidoctorRevealJs task.', - ['asciidoctorj', 'reveal.js', 'slides'] + gradleArguments '-i', '-s' +} diff --git a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskCachingFunctionalSpec.groovy b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskCachingFunctionalSpec.groovy index dc7687e9b..a34f89243 100644 --- a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskCachingFunctionalSpec.groovy +++ b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskCachingFunctionalSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,14 @@ package org.asciidoctor.gradle.jvm.slides import org.asciidoctor.gradle.jvm.slides.internal.FunctionalSpecification -import org.asciidoctor.gradle.testfixtures.CachingTest +import org.asciidoctor.gradle.testfixtures.CachingTestFixture import spock.lang.Issue import spock.lang.PendingFeature +import static java.util.Collections.emptyList import static org.asciidoctor.gradle.testfixtures.JRubyTestVersions.AJ20_SAFE_MAXIMUM -@SuppressWarnings(['UnnecessaryGetter']) -class AsciidoctorRevealJSTaskCachingFunctionalSpec extends FunctionalSpecification implements CachingTest { +class AsciidoctorRevealJSTaskCachingFunctionalSpec extends FunctionalSpecification implements CachingTestFixture { private static final String DEFAULT_TASK = 'asciidoctorRevealJs' private static final String JRUBY_TEST_VERSION = AJ20_SAFE_MAXIMUM private static final String DEFAULT_REVEALJS_PATH = 'build/docs/asciidocRevealJs' @@ -37,7 +37,7 @@ class AsciidoctorRevealJSTaskCachingFunctionalSpec extends FunctionalSpecificati @Issue('https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/485') void "Revealjs task is cacheable and relocatable"() { given: - getBuildFile() + buildFile when: assertDefaultTaskExecutes() @@ -57,7 +57,7 @@ class AsciidoctorRevealJSTaskCachingFunctionalSpec extends FunctionalSpecificati @Issue('https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/485') void "Revealjs task is cached when only output directory is changed"() { given: - getBuildFile() + buildFile when: assertDefaultTaskExecutes() @@ -84,7 +84,7 @@ class AsciidoctorRevealJSTaskCachingFunctionalSpec extends FunctionalSpecificati @Issue('https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/485') void "Revealjs task is not cached when templates are added"() { given: - getBuildFile() + buildFile when: assertDefaultTaskExecutes() @@ -195,7 +195,6 @@ class AsciidoctorRevealJSTaskCachingFunctionalSpec extends FunctionalSpecificati @Override File getBuildFile(String extraContent) { - File buildFile = testProjectDir.newFile('build.gradle') buildFile << """ plugins { id 'org.asciidoctor.jvm.revealjs' @@ -234,4 +233,9 @@ class AsciidoctorRevealJSTaskCachingFunctionalSpec extends FunctionalSpecificati String getDefaultTask() { ":${DEFAULT_TASK}" } + + @Override + List getBuildScanArguments() { + emptyList() + } } diff --git a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskFunctionalSpec.groovy b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskFunctionalSpec.groovy index c8e34caf5..10884e81f 100644 --- a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskFunctionalSpec.groovy +++ b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskFunctionalSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,12 +38,12 @@ class AsciidoctorRevealJSTaskFunctionalSpec extends FunctionalSpecification { then: verifyAll { - new File(testProjectDir.root, 'build/docs/asciidocRevealJs/revealjs.html').exists() - new File(testProjectDir.root, 'build/docs/asciidocRevealJs/subdir/revealjs2.html').exists() - new File(testProjectDir.root, "${DEFAULT_REVEALJS_PATH}/css").exists() - new File(testProjectDir.root, "${DEFAULT_REVEALJS_PATH}/lib").exists() - new File(testProjectDir.root, "${DEFAULT_REVEALJS_PATH}/plugin").exists() - new File(testProjectDir.root, "${DEFAULT_REVEALJS_PATH}/js").exists() + new File(projectDir, 'build/docs/asciidocRevealJs/revealjs.html').exists() + new File(projectDir, 'build/docs/asciidocRevealJs/subdir/revealjs2.html').exists() + new File(projectDir, "${DEFAULT_REVEALJS_PATH}/css").exists() + new File(projectDir, "${DEFAULT_REVEALJS_PATH}/lib").exists() + new File(projectDir, "${DEFAULT_REVEALJS_PATH}/plugin").exists() + new File(projectDir, "${DEFAULT_REVEALJS_PATH}/js").exists() } } @@ -64,9 +64,9 @@ class AsciidoctorRevealJSTaskFunctionalSpec extends FunctionalSpecification { then: verifyAll { - new File(testProjectDir.root, 'build/docs/asciidocRevealJs/revealjs.html').exists() - new File(testProjectDir.root, 'build/github-cache/hakimel/reveal.js/3.6.0').exists() - new File(testProjectDir.root, "${DEFAULT_REVEALJS_PATH}/js/reveal.js"). + new File(projectDir, 'build/docs/asciidocRevealJs/revealjs.html').exists() + new File(projectDir, 'build/github-cache/hakimel/reveal.js/3.6.0').exists() + new File(projectDir, "${DEFAULT_REVEALJS_PATH}/js/reveal.js"). text.contains('var VERSION = \'3.6.0\';') } } @@ -93,9 +93,9 @@ class AsciidoctorRevealJSTaskFunctionalSpec extends FunctionalSpecification { when: build() - String revealjsHtml = new File(testProjectDir.root, 'build/docs/asciidocRevealJs/revealjs.html').text - String pluginConfig = new File(testProjectDir.root, 'src/docs/asciidoc/empty-plugin-configuration.js').text - File pluginList = new File(testProjectDir.root, "${DEFAULT_REVEALJS_PATH}/revealjs-plugins.js") + String revealjsHtml = new File(projectDir, 'build/docs/asciidocRevealJs/revealjs.html').text + String pluginConfig = new File(projectDir, 'src/docs/asciidoc/empty-plugin-configuration.js').text + File pluginList = new File(projectDir, "${DEFAULT_REVEALJS_PATH}/revealjs-plugins.js") then: verifyAll { @@ -104,7 +104,7 @@ class AsciidoctorRevealJSTaskFunctionalSpec extends FunctionalSpecification { revealjsHtml.contains("src: '${REVEALJS_DIR_NAME}/plugin/print-pdf/") revealjsHtml.contains("src: '${REVEALJS_DIR_NAME}/plugin/rajgoel/chart/plugin.js'") revealjsHtml.contains(pluginConfig) - new File(testProjectDir.root, "${DEFAULT_REVEALJS_PATH}/plugin/rajgoel/chart/plugin.js").exists() + new File(projectDir, "${DEFAULT_REVEALJS_PATH}/plugin/rajgoel/chart/plugin.js").exists() } } @@ -113,7 +113,6 @@ class AsciidoctorRevealJSTaskFunctionalSpec extends FunctionalSpecification { } File getBuildFile(String extraContent) { - File buildFile = testProjectDir.newFile('build.gradle') buildFile << """ plugins { id 'org.asciidoctor.jvm.revealjs' diff --git a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorSlidesAndConvertPluginsCoexistFunctionalSpec.groovy b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorSlidesAndConvertPluginsCoexistFunctionalSpec.groovy index e95d9be0f..83ba174e6 100644 --- a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorSlidesAndConvertPluginsCoexistFunctionalSpec.groovy +++ b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorSlidesAndConvertPluginsCoexistFunctionalSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ class AsciidoctorSlidesAndConvertPluginsCoexistFunctionalSpec extends Functional then: verifyAll { - new File(testProjectDir.root, 'build/docs/asciidoc/sample.html').exists() + new File(projectDir, 'build/docs/asciidoc/sample.html').exists() } } @@ -44,7 +44,6 @@ class AsciidoctorSlidesAndConvertPluginsCoexistFunctionalSpec extends Functional } File createBuildFile(String extraContent = '') { - File buildFile = testProjectDir.newFile('build.gradle') buildFile << """ plugins { id 'org.asciidoctor.jvm.revealjs' diff --git a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/internal/FunctionalSpecification.groovy b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/internal/FunctionalSpecification.groovy index 238e85e85..aa4ea611d 100644 --- a/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/internal/FunctionalSpecification.groovy +++ b/jvm-slides/src/intTest/groovy/org/asciidoctor/gradle/jvm/slides/internal/FunctionalSpecification.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,42 +15,44 @@ */ package org.asciidoctor.gradle.jvm.slides.internal +import groovy.transform.CompileStatic import org.apache.commons.io.FileUtils +import org.asciidoctor.gradle.testfixtures.FunctionalTestFixture +import org.asciidoctor.gradle.testfixtures.FunctionalTestSetup import org.gradle.testkit.runner.GradleRunner -import org.junit.Rule -import org.junit.rules.TemporaryFolder import org.ysb33r.grolifant.api.core.OperatingSystem import spock.lang.Specification +import spock.lang.TempDir -class FunctionalSpecification extends Specification { - public static final String TEST_PROJECTS_DIR = System.getProperty( - 'TEST_PROJECTS_DIR', - './src/intTest/projects' - ) - public static final String TEST_REPO_DIR = System.getProperty( - 'OFFLINE_REPO', - '../testfixtures/offline-repo/build/repo' - ) +import static org.asciidoctor.gradle.testfixtures.DslType.GROOVY_DSL + +class FunctionalSpecification extends Specification implements FunctionalTestFixture { + + @SuppressWarnings('LineLength') + static + final String TEST_PROJECTS_DIR = System.getProperty('TEST_PROJECTS_DIR', './src/intTest/projects') + static + final String TEST_REPO_DIR = FunctionalTestSetup.offlineRepo.absolutePath public static final OperatingSystem OS = OperatingSystem.current() - @Rule - TemporaryFolder testProjectDir + @TempDir + File testProjectDir - @Rule - TemporaryFolder alternateProjectDir + @TempDir + File alternateProjectDir + + void setup() { + projectDir.mkdirs() + } - GradleRunner getGradleRunner(List taskNames) { - GradleRunner.create() - .withProjectDir(testProjectDir.root) - .withArguments(taskNames) - .withPluginClasspath() - .forwardOutput() - .withDebug(true) + @CompileStatic + GradleRunner getGradleRunner(List taskNames = ['asciidoctor']) { + FunctionalTestSetup.getGradleRunner(GROOVY_DSL, projectDir, taskNames)//.withTestKitDir(testKitDir) } @SuppressWarnings(['BuilderMethodWithSideEffects']) - void createTestProject(String docGroup) { - FileUtils.copyDirectory(new File(TEST_PROJECTS_DIR, docGroup), testProjectDir.root) + void createTestProject(String docGroup = 'normal') { + FileUtils.copyDirectory(new File(TEST_PROJECTS_DIR, docGroup), projectDir) } String getOfflineRepositories() { @@ -67,4 +69,4 @@ class FunctionalSpecification extends Specification { "apply from: '${repo.absolutePath}'" } } -} \ No newline at end of file +} diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorJRevealJSTask.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorJRevealJSTask.groovy index 082f070e1..d727a8b7d 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorJRevealJSTask.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorJRevealJSTask.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,14 +28,13 @@ import org.gradle.api.file.CopySpec @java.lang.SuppressWarnings('NoWildcardImports') import org.gradle.api.tasks.* import org.gradle.workers.WorkerExecutor -import org.ysb33r.grolifant.api.v4.StringUtils import org.ysb33r.grolifant.api.core.Version import javax.inject.Inject import static org.asciidoctor.gradle.jvm.gems.AsciidoctorGemSupportPlugin.GEMPREP_TASK +import static org.asciidoctor.gradle.jvm.gems.AsciidoctorGemSupportPlugin.JAR_TASK import static org.asciidoctor.gradle.jvm.slides.RevealJSExtension.FIRST_VERSION_WITH_PLUGIN_SUPPORT -import static org.ysb33r.grolifant.api.v4.TaskProvider.* import static org.gradle.api.tasks.PathSensitivity.RELATIVE /** @@ -45,7 +44,6 @@ import static org.gradle.api.tasks.PathSensitivity.RELATIVE @CompileStatic class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements SlidesToExportAware { - public static final String PLUGIN_CONFIGURATION_FILENAME = 'revealjs-plugin-configuration.js' public static final String PLUGIN_LIST_FILENAME = 'revealjs-plugins.js' public final static String REVEALJS_GEM = 'asciidoctor-revealjs' @@ -66,18 +64,22 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides AsciidoctorJRevealJSTask(WorkerExecutor we) { super(we) this.revealjsOptions = new RevealJSOptions(project) - configuredOutputOptions.backends = [BACKEND_NAME] + outputOptions.backends = [BACKEND_NAME] copyAllResources() - org.ysb33r.grolifant.api.v4.TaskProvider gemPrepare = taskByName(project, GEMPREP_TASK) + AsciidoctorGemPrepare gemPrepare = project.tasks.named(GEMPREP_TASK, AsciidoctorGemPrepare).get() asciidoctorj.with { requires(REVEALJS_GEM) - gemPaths { gemPrepare.get().outputDir } + dependsOn(gemPrepare) + withGemJar(JAR_TASK) } inputs.file( { RevealJSOptions opt -> opt.highlightJsThemeIfFile }.curry(this.revealjsOptions) ).optional() inputs.file( { RevealJSOptions opt -> opt.parallaxBackgroundImageIfFile }. curry(this.revealjsOptions) ).optional() + + // support cleanupPluginTempFiles() in exec() + awaitMode = true } /** Options for Reveal.JS slides. @@ -131,7 +133,7 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides */ @Input String getTemplateRelativeDir() { - StringUtils.stringize(this.templateRelativeDir) + projectOperations.stringTools.stringize(this.templateRelativeDir) } /** The physical location of the template directory @@ -205,7 +207,7 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides */ @Input List getPlugins() { - StringUtils.stringize(this.requiredPlugins) + projectOperations.stringTools.stringize(this.requiredPlugins) } /** Toggle a built-in reveal.js plugin @@ -243,10 +245,10 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides } @Override - void processAsciidocSources() { + void exec() { checkRevealJsVersion() processTemplateResources() - super.processAsciidocSources() + super.exec() cleanupPluginTempFiles() } @@ -261,14 +263,15 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides * @return A collection of default attributes. */ @Override - protected Map getTaskSpecificDefaultAttributes(File workingSourceDir) { - Map attrs = super.getTaskSpecificDefaultAttributes(workingSourceDir) + Map getTaskSpecificDefaultAttributes(File workingSourceDir) { + Map attrs = super.getTaskSpecificDefaultAttributes(workingSourceDir) as Map - attrs.putAll revealjsdir: getTemplateRelativeDir(), + attrs.putAll([revealjsdir: getTemplateRelativeDir(), revealjs_theme: getTheme(), 'source-highlighter': 'highlightjs' + ]) - attrs.putAll revealjsOptions.asAttributeMap + attrs.putAll(revealjsOptions.asAttributeMap) if (pluginSupportAvailable) { this.builtinPlugins.each { String pluginName, Boolean state -> @@ -299,7 +302,7 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides */ @Override @SuppressWarnings('UnnecessaryPackageReference') - protected CopySpec getResourceCopySpec(java.util.Optional lang) { + CopySpec getResourceCopySpec(java.util.Optional lang) { CopySpec rcs = super.getResourceCopySpec(lang) revealjsOptions.enhanceCopySpec(rcs) rcs @@ -321,7 +324,7 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides copySpec.into target copySpec.from fromSource, { CopySpec cs -> - cs.include 'js/**', 'css/**', 'lib/**', 'plugin/**' + cs.include 'js/**', 'css/**', 'dist/**', 'lib/**', 'plugin/**' } fromPlugins.each { ResolvedRevealJSPlugin plugin -> @@ -386,13 +389,13 @@ class AsciidoctorJRevealJSTask extends AbstractAsciidoctorTask implements Slides } private Set getResolvedPlugins() { - if (isPluginSupportAvailable()) { + if (pluginSupportAvailable) { final RevealJSPluginExtension pluginExtension = revealsjsPluginExtension Transform.toSet(pluginBundles) { pluginExtension.getByName(it) } } else { - [].toSet() + [].toSet() as Set } } } diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSBasePlugin.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSBasePlugin.groovy index 8e6412750..2b0077b95 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSBasePlugin.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSBasePlugin.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPlugin.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPlugin.groovy index e984dbad8..013fe78f4 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPlugin.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPlugin.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,12 @@ package org.asciidoctor.gradle.jvm.slides import groovy.transform.CompileStatic import org.asciidoctor.gradle.jvm.gems.AsciidoctorGemPrepare -import org.asciidoctor.gradle.jvm.gems.AsciidoctorGemSupportPlugin import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.tasks.TaskProvider import static org.asciidoctor.gradle.base.AsciidoctorUtils.setConvention +import static org.asciidoctor.gradle.jvm.gems.AsciidoctorGemSupportPlugin.GEMPREP_TASK /** Adds an extension and task to create Reveal.js slides. * @@ -40,13 +41,13 @@ class AsciidoctorRevealJSPlugin implements Plugin { void apply(Project project) { project.apply plugin: AsciidoctorRevealJSBasePlugin - AsciidoctorGemPrepare gemPrepare = (AsciidoctorGemPrepare)(project.tasks.getByName(AsciidoctorGemSupportPlugin.GEMPREP_TASK)) - AsciidoctorJRevealJSTask revealTask = project.tasks.create(REVEALJS_TASK, AsciidoctorJRevealJSTask) - - revealTask.with { - dependsOn gemPrepare - setConvention(project, sourceDirProperty, project.layout.projectDirectory.dir('src/docs/asciidoc')) - setConvention(outputDirProperty, project.layout.buildDirectory.dir('docs/asciidocRevealJs')) + TaskProvider gemPrepare = project.tasks.named(GEMPREP_TASK, AsciidoctorGemPrepare) + project.tasks.register(REVEALJS_TASK, AsciidoctorJRevealJSTask) { revealTask -> + revealTask.with { + dependsOn(gemPrepare) + setConvention(project, sourceDirProperty, project.layout.projectDirectory.dir('src/docs/asciidoc')) + setConvention(outputDirProperty, project.layout.buildDirectory.dir('docs/asciidocRevealJs')) + } } } } diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/LocalRevealJSPlugin.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/LocalRevealJSPlugin.groovy index e509ce276..022e4402b 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/LocalRevealJSPlugin.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/LocalRevealJSPlugin.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/ResolvedRevealJSPlugin.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/ResolvedRevealJSPlugin.groovy index 1774cd853..be9b41304 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/ResolvedRevealJSPlugin.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/ResolvedRevealJSPlugin.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtension.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtension.groovy index 5cfcc618d..3300a81cf 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtension.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtension.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +16,14 @@ package org.asciidoctor.gradle.jvm.slides import groovy.transform.CompileStatic -import org.asciidoctor.gradle.base.GitHubArchive import org.asciidoctor.gradle.base.ModuleVersionLoader import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.provider.Provider +import org.ysb33r.grolifant.api.core.ProjectOperations import org.ysb33r.grolifant.api.core.Version -import org.ysb33r.grolifant.api.v4.git.GitRepoArchiveDownloader +import org.ysb33r.grolifant.api.core.git.GitRepoArchiveDownloader +import org.ysb33r.grolifant.api.core.git.GitHubArchive import static org.asciidoctor.gradle.base.AsciidoctorUtils.executeDelegatingClosure @@ -64,13 +65,13 @@ class RevealJSExtension { } void templateGitHub(@DelegatesTo(GitHubArchive) Closure configurator) { - GitHubArchive archive = new GitHubArchive() + GitHubArchive archive = new GitHubArchive(ProjectOperations.create(project)) executeDelegatingClosure(archive, configurator) resolveViaGitHub(archive) } void templateGitHub(Action configurator) { - GitHubArchive archive = new GitHubArchive() + GitHubArchive archive = new GitHubArchive(ProjectOperations.create(project)) configurator.execute(archive) resolveViaGitHub(archive) } @@ -100,13 +101,13 @@ class RevealJSExtension { } private void resolveViaGitHub(final GitHubArchive archive) { - final GitRepoArchiveDownloader downloader = new GitRepoArchiveDownloader(archive, project) + final GitRepoArchiveDownloader downloader = new GitRepoArchiveDownloader(archive, + ProjectOperations.create(project)) resolveRevealJs = { -> downloader.downloadRoot = project.buildDir final File root = downloader.archiveRoot - final String relativePath = archive.relativePath - relativePath ? new File(root, relativePath) : root + root } as Provider } } diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptions.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptions.groovy index b74263c3a..fe3f6aad7 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptions.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptions.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,13 @@ import org.gradle.api.file.CopySpec import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.PathSensitive -import org.ysb33r.grolifant.api.v4.StringUtils +import org.ysb33r.grolifant.api.core.ProjectOperations +import org.ysb33r.grolifant.api.core.StringTools import java.nio.file.FileSystems import java.nio.file.Path import static org.gradle.api.tasks.PathSensitivity.RELATIVE -import static org.ysb33r.grolifant.api.v4.MapUtils.stringizeValues -import static org.ysb33r.grolifant.api.v4.StringUtils.stringize /** Options for Reveal.js slides. * @@ -73,6 +72,7 @@ class RevealJSOptions { private Object customThemeRelativePath = 'style' final private Project project + final private StringTools stringTools @SuppressWarnings('ClassName') enum Transition { @@ -142,6 +142,7 @@ class RevealJSOptions { RevealJSOptions(Project project) { this.project = project + this.stringTools = ProjectOperations.create(project).stringTools } /** Display controls in the bottom right corner. @@ -315,7 +316,7 @@ class RevealJSOptions { * * If not set, the Reveal.js will use an internal default of {@code SLIDE}. */ - void setTransition(RevealJSOptions.Transition tr) { + void setTransition(Transition tr) { this.transition = Optional.ofNullable(tr?.toString()?.toLowerCase()) } @@ -335,7 +336,7 @@ class RevealJSOptions { * * If not set then Reveal.js will use an interna default of {@code FADE}. */ - void setBackgroundTransition(RevealJSOptions.Transition tr) { + void setBackgroundTransition(Transition tr) { this.backgroundTransition = Optional.ofNullable(tr?.toString()?.toLowerCase()) } @@ -355,7 +356,7 @@ class RevealJSOptions { * * If not provided, Reveal.js wil use an internal default value of {@code DEFAULT}. */ - void setTransitionSpeed(RevealJSOptions.TransitionSpeed tr) { + void setTransitionSpeed(TransitionSpeed tr) { this.transitionSpeed = Optional.ofNullable(tr?.toString()?.toLowerCase()) } @@ -366,13 +367,12 @@ class RevealJSOptions { @org.gradle.api.tasks.Optional @Input String getParallaxBackgroundSize() { - this.parallaxBackgroundSize ? stringize(this.parallaxBackgroundSize) : null + this.parallaxBackgroundSize ? stringTools.stringize(this.parallaxBackgroundSize) : null } /** Set the Parallax background size. * - * @param css Anything that can be converted to a String via - * {@link org.ysb33r.grolifant.api.v4.StringUtils#stringize}. + * @param css Anything that can be converted to a String via {@link StringTools#stringize}. * Must be in CSS syntax. */ void setParallaxBackgroundSize(Object css) { @@ -392,7 +392,7 @@ class RevealJSOptions { /** If the parallax image is set as a file, this will be the relative path to which it will be copied * when resources are copied. * - * @param relPath Relative path can be anything convertible to a string using {@link StringUtils#stringize}. + * @param relPath Relative path can be anything convertible to a string using {@link StringTools#stringize}. */ void setParallaxBackgroundImageRelativePath(Object relPath) { this.parallaxBackgroundImageRelativePath = relPath @@ -404,7 +404,7 @@ class RevealJSOptions { */ @Input String getParallaxBackgroundImageRelativePath() { - StringUtils.stringize(this.parallaxBackgroundImageRelativePath) + stringTools.stringize(this.parallaxBackgroundImageRelativePath) } /** Parallax background image if it is specified as a file. @@ -477,7 +477,7 @@ class RevealJSOptions { */ @Input String getHighlightJsThemeRelativePath() { - StringUtils.stringize(this.highlightJsThemeRelativePath) + stringTools.stringize(this.highlightJsThemeRelativePath) } /** Custom.js theme location if specified as a file. @@ -526,7 +526,7 @@ class RevealJSOptions { */ @Input String getCustomThemeRelativePath() { - StringUtils.stringize(this.customThemeRelativePath) + stringTools.stringize(this.customThemeRelativePath) } /** The Reveal.js settings as a map of Asciidoctor attributes. @@ -559,10 +559,10 @@ class RevealJSOptions { revealjs_transitionSpeed : transitionSpeed, revealjs_viewDistance : viewDistance ].findAll { String k, Optional v -> - v.isPresent() + v.present } as Map - Map attrs = stringizeValues(allAttrs.collectEntries { String k, Optional v -> + Map attrs = stringTools.stringizeValues(allAttrs.collectEntries { String k, Optional v -> [k, v.get()] } as Map) @@ -655,7 +655,7 @@ class RevealJSOptions { (((String) candidate) =~ /^(?i:https?):.+/) ? ((String) candidate).toURI() : project.file(candidate) break default: - asFileOrWebUri(StringUtils.stringize(candidate)) + asFileOrWebUri(stringTools.stringize(candidate)) } } diff --git a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtension.groovy b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtension.groovy index 5ebce6d5a..ce0a2e7f2 100644 --- a/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtension.groovy +++ b/jvm-slides/src/main/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtension.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.asciidoctor.gradle.jvm.slides import groovy.transform.CompileStatic import org.asciidoctor.gradle.base.AbstractDownloadableComponent import org.gradle.api.Project -import org.ysb33r.grolifant.api.v4.StringUtils +import org.ysb33r.grolifant.api.core.ProjectOperations /** Reveal.js plugins. * @@ -29,6 +29,17 @@ class RevealJSPluginExtension extends AbstractDownloadableComponent + protected Closure convertible(LocalRevealJSPlugin component) { + { ProjectOperations projectOperations -> new ResolvedRevealJSPlugin() { @Override File getLocation() { - project1.file(component.location) + projectOperations.fsOperations.file(component.location) } @Override String getName() { - StringUtils.stringize(component.name) + projectOperations.stringTools.stringize(component.name) } } - }.curry(project) + }.curry(projectOperations) } /** Instantiates a resolved component. diff --git a/jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.base.properties b/jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.base.properties deleted file mode 100644 index 522688720..000000000 --- a/jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.base.properties +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright 2013-2023 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -implementation-class=org.asciidoctor.gradle.jvm.slides.AsciidoctorRevealJSBasePlugin \ No newline at end of file diff --git a/jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.properties b/jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.properties deleted file mode 100644 index 1954fb58b..000000000 --- a/jvm-slides/src/main/resources/META-INF/gradle-plugins/org.asciidoctor.jvm.revealjs.properties +++ /dev/null @@ -1,17 +0,0 @@ -# -# Copyright 2013-2023 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -implementation-class=org.asciidoctor.gradle.jvm.slides.AsciidoctorRevealJSPlugin \ No newline at end of file diff --git a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPluginSpec.groovy b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPluginSpec.groovy index b07e7ef3e..8c7455e3c 100644 --- a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPluginSpec.groovy +++ b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSPluginSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,16 +44,17 @@ class AsciidoctorRevealJSPluginSpec extends Specification { project.evaluate() then: 'reveal.js GEM has been added to the dependencies' - configurations.getByName(GEM_CONFIGURATION).dependencies.find { Dependency e -> + configurations.named(GEM_CONFIGURATION).get().dependencies.find { Dependency e -> e.group == 'rubygems' e.name == REVEALJS_GEM e.version == TestFixtureVersionLoader.VERSIONS['revealjs.gem'] } and: 'Revels.js Asciiidoctor task is configured' - tasks.getByName(REVEALJS_TASK).templateRelativeDir == 'reveal.js' - tasks.getByName(REVEALJS_TASK).outputDir == project.file("${project.buildDir}/docs/asciidocRevealJs") - tasks.getByName(REVEALJS_TASK).dependsOn.find { it instanceof AsciidoctorGemPrepare } + AsciidoctorJRevealJSTask revealJSTask = tasks.named(REVEALJS_TASK, AsciidoctorJRevealJSTask).get() + revealJSTask.templateRelativeDir == 'reveal.js' + revealJSTask.outputDir == project.file("${project.buildDir}/docs/asciidocRevealJs") + revealJSTask.dependsOn.find { it instanceof AsciidoctorGemPrepare } and: 'Reveal.JS extension is created' extensions.getByName(RevealJSExtension.NAME) instanceof RevealJSExtension @@ -61,4 +62,4 @@ class AsciidoctorRevealJSPluginSpec extends Specification { and: 'Reveal.JS plugine extension is created' extensions.getByName(RevealJSPluginExtension.NAME) instanceof RevealJSPluginExtension } -} \ No newline at end of file +} diff --git a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskSpec.groovy b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskSpec.groovy index b9fffacd0..2de05f9ab 100644 --- a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskSpec.groovy +++ b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/AsciidoctorRevealJSTaskSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +26,8 @@ class AsciidoctorRevealJSTaskSpec extends Specification { void 'Configure revealjs task'() { given: - project.apply plugin: 'org.asciidoctor.jvm.revealjs.base' - AsciidoctorJRevealJSTask revealjsTask = project.tasks.create('foo', AsciidoctorJRevealJSTask) + project.apply plugin: 'org.asciidoctor.jvm.revealjs' + AsciidoctorJRevealJSTask revealjsTask = project.tasks.register('foo', AsciidoctorJRevealJSTask).get() when: revealjsTask.with { diff --git a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtensionSpec.groovy b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtensionSpec.groovy index f4107fa31..96ff40964 100644 --- a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtensionSpec.groovy +++ b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSExtensionSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,14 @@ */ package org.asciidoctor.gradle.jvm.slides -import org.asciidoctor.gradle.base.GitHubArchive import org.asciidoctor.gradle.base.ModuleVersionLoader + import org.gradle.api.Action import org.gradle.api.Project -import org.gradle.api.Transformer import org.gradle.api.provider.Provider import org.gradle.testfixtures.ProjectBuilder import org.ysb33r.grolifant.api.core.ProjectOperations +import org.ysb33r.grolifant.api.core.git.GitHubArchive import spock.lang.Shared import spock.lang.Specification @@ -159,4 +159,4 @@ class RevealJSExtensionSpec extends Specification { // } // } } -} \ No newline at end of file +} diff --git a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptionsSpec.groovy b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptionsSpec.groovy index e773b784c..ef8c91033 100644 --- a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptionsSpec.groovy +++ b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSOptionsSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -382,4 +382,4 @@ class RevealJSOptionsSpec extends Specification { m[key] } -} \ No newline at end of file +} diff --git a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtensionSpec.groovy b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtensionSpec.groovy index 7a40674e4..88ba5895a 100644 --- a/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtensionSpec.groovy +++ b/jvm-slides/src/test/groovy/org/asciidoctor/gradle/jvm/slides/RevealJSPluginExtensionSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright 2013-2023 the original author or authors. + * Copyright 2013-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,11 +28,16 @@ class RevealJSPluginExtensionSpec extends Specification { Map versionMap = ModuleVersionLoader.load('revealjs-extension') Project project = ProjectBuilder.builder().build() + ProjectOperations projectOperations RevealJSPluginExtension ext void setup() { - ProjectOperations.maybeCreateExtension(project) - ext = new RevealJSPluginExtension(project) + projectOperations = ProjectOperations.maybeCreateExtension(project) + ext = project.extensions.create( + RevealJSPluginExtension.NAME, + RevealJSPluginExtension, + project + ) } void 'Can configure a local reveal.js plugin'() { @@ -44,4 +49,4 @@ class RevealJSPluginExtensionSpec extends Specification { then: ext.getByName('abc').location.name == 'abcd' } -} \ No newline at end of file +} diff --git a/settings.gradle b/settings.gradle index d853347e7..1556d3113 100644 --- a/settings.gradle +++ b/settings.gradle @@ -31,7 +31,7 @@ include 'asciidoctoreditorconfig' project(":${it}").name = "asciidoctor-gradle-${it}" } -['pdf', 'epub'/*, 'leanpub' */].each { +['pdf', 'epub'/*, 'leanpub' */, 'slides'].each { include "jvm-${it}" project(":jvm-${it}").name = "asciidoctor-gradle-jvm-${it}" } @@ -43,7 +43,7 @@ include 'asciidoctoreditorconfig' // -['gems' /*, 'slides'*/].each { +['gems'].each { include it project(":${it}").name = "asciidoctor-gradle-jvm-${it}" } diff --git a/testfixtures/jvm/src/main/groovy/org/asciidoctor/gradle/testfixtures/CachingTestFixture.groovy b/testfixtures/jvm/src/main/groovy/org/asciidoctor/gradle/testfixtures/CachingTestFixture.groovy index 74d9604b9..b55fcc56f 100644 --- a/testfixtures/jvm/src/main/groovy/org/asciidoctor/gradle/testfixtures/CachingTestFixture.groovy +++ b/testfixtures/jvm/src/main/groovy/org/asciidoctor/gradle/testfixtures/CachingTestFixture.groovy @@ -124,7 +124,5 @@ trait CachingTestFixture { abstract File getAlternateProjectDir() - abstract boolean getPerformBuildScan() - abstract List getBuildScanArguments() -} \ No newline at end of file +}