From e956a156f3ea5de121925ac77217e7ec4fe1289a Mon Sep 17 00:00:00 2001 From: Artem Eroshenko Date: Mon, 20 Sep 2021 16:34:13 +0300 Subject: [PATCH] workflows refactoring (via #64) --- .github/release-drafter.yml | 25 ++++++++ .github/workflows/build.yml | 31 +++++++++ .github/workflows/draft-release.yml | 14 +++++ .../workflows/gradle-wrapper-validation.yml | 10 --- .github/workflows/main.yml | 43 ------------- .github/workflows/publish-release.yml | 23 +++++++ README.md | 52 +++++++-------- .../build.gradle.kts | 16 ++--- .../src/it/adapter-all/build.gradle | 4 +- .../adapter-junit5-spock-kts/build.gradle.kts | 8 +-- .../AllureExtensionAdapterExtensions.kt | 11 ++++ .../DeprecatedAllureAdapterExtensions.kt | 63 +++++++++++++++++++ .../gradle/adapter/AllureAdapterBasePlugin.kt | 14 ++--- .../gradle/adapter/AllureAdapterExtension.kt | 32 +++++----- .../gradle/adapter/AllureAdapterPlugin.kt | 48 +++++++------- .../autoconfigure/AutoconfigureRuleBuilder.kt | 2 +- .../autoconfigure/AutoconfigureRules.kt | 2 +- .../autoconfigure/BaseTrimMetaInfServices.kt | 2 +- .../DefaultAutoconfigureRuleBuilder.kt | 2 +- .../autoconfigure/DependencyDeclaration.kt | 2 +- .../autoconfigure/TrimMetaInfServices53.kt | 2 +- .../autoconfigure/TrimMetaInfServices54.kt | 2 +- .../gradle/adapter}/config/AdapterConfig.kt | 16 ++--- .../gradle/adapter}/config/AdapterHandler.kt | 2 +- .../adapter}/config/AllureJavaAdapter.kt | 6 +- .../gradle/adapter}/tasks/CopyCategories.kt | 6 +- .../allure/gradle/adapter}/AdaptersTest.kt | 2 +- .../allure/gradle/base/AllureExtension.kt | 29 +++++---- .../kotlin/AllureExtensionGatherExtensions.kt | 11 ---- .../DeprecatedAllureGatherExtensions.kt | 63 ------------------- allure-plugin/build.gradle.kts | 2 +- .../src/it/full-dsl-groovy/build.gradle | 14 ++--- .../src/it/full-dsl-kotlin/build.gradle.kts | 14 ++--- allure-plugin/src/it/junit5/build.gradle | 4 +- .../src/it/report-multi/module1/build.gradle | 2 +- .../src/it/report-multi/module2/build.gradle | 2 +- .../allure/gradle/allure/AllurePlugin.kt | 6 +- .../gradle/allure/TestNgSpiOffTest.java | 2 +- .../gradle/report/AllureReportPlugin.kt | 2 +- sandbox/dsl-groovy/build.gradle | 2 +- sandbox/dsl-kotlin/build.gradle.kts | 6 +- settings.gradle.kts | 2 +- 42 files changed, 320 insertions(+), 281 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/draft-release.yml delete mode 100644 .github/workflows/gradle-wrapper-validation.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/publish-release.yml rename {allure-gather-plugin => allure-adapter-plugin}/build.gradle.kts (52%) rename {allure-gather-plugin => allure-adapter-plugin}/src/it/adapter-all/build.gradle (62%) rename {allure-gather-plugin => allure-adapter-plugin}/src/it/adapter-junit5-spock-kts/build.gradle.kts (67%) create mode 100644 allure-adapter-plugin/src/main/kotlin/AllureExtensionAdapterExtensions.kt create mode 100644 allure-adapter-plugin/src/main/kotlin/DeprecatedAllureAdapterExtensions.kt rename allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherBasePlugin.kt => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterBasePlugin.kt (86%) rename allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherExtension.kt => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterExtension.kt (87%) rename allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherPlugin.kt => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterPlugin.kt (74%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/autoconfigure/AutoconfigureRuleBuilder.kt (96%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/autoconfigure/AutoconfigureRules.kt (96%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/autoconfigure/BaseTrimMetaInfServices.kt (96%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/autoconfigure/DefaultAutoconfigureRuleBuilder.kt (97%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/autoconfigure/DependencyDeclaration.kt (96%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/autoconfigure/TrimMetaInfServices53.kt (92%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/autoconfigure/TrimMetaInfServices54.kt (93%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/config/AdapterConfig.kt (86%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/config/AdapterHandler.kt (97%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/config/AllureJavaAdapter.kt (95%) rename {allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter}/tasks/CopyCategories.kt (91%) rename {allure-gather-plugin/src/test/kotlin/io/qameta/allure/gradle/gather => allure-adapter-plugin/src/test/kotlin/io/qameta/allure/gradle/adapter}/AdaptersTest.kt (98%) delete mode 100644 allure-gather-plugin/src/main/kotlin/AllureExtensionGatherExtensions.kt delete mode 100644 allure-gather-plugin/src/main/kotlin/DeprecatedAllureGatherExtensions.kt diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..c17d77d --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,25 @@ +name-template: '$NEXT_MINOR_VERSION' +tag-template: '$NEXT_MINOR_VERSION' +categories: + - title: '🚀 New Features' + labels: + - 'type:new feature' + - title: '🔬 Improvements' + labels: + - 'type:improvement' + - title: '🐞 Bug Fixes' + labels: + - 'type:bug' + - title: '⬆️ Dependency Updates' + labels: + - 'type:dependencies' + +change-template: '* $TITLE (via #$NUMBER) - @$AUTHOR' +exclude-labels: + - 'type:internal' +template: | + $CHANGES + + ## 👀 Links + + [Commits since $PREVIOUS_TAG](https://github.com/allure-framework/allure-java/compare/$PREVIOUS_TAG...master) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..387dfae --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build + +on: + workflow_dispatch: + pull_request: + branches: + - '*' + push: + branches: + - 'master' + +jobs: + build: + name: 'Tests (JDK ${{ matrix.jdk }}, ${{ matrix.os }})' + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + os: [ 'ubuntu', 'windows' ] + java-version: [ '8.0.x', '11.0.x' ] + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: ${{ matrix.java-version }} + + - name: Build + run: ./gradlew build diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml new file mode 100644 index 0000000..15eadef --- /dev/null +++ b/.github/workflows/draft-release.yml @@ -0,0 +1,14 @@ +name: Release Draft + +on: + push: + branches: + - master + +jobs: + update_draft_release: + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml deleted file mode 100644 index 405a2b3..0000000 --- a/.github/workflows/gradle-wrapper-validation.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: "Validate Gradle Wrapper" -on: [push, pull_request] - -jobs: - validation: - name: "Validation" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: gradle/wrapper-validation-action@v1 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index aa7c0c1..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,43 +0,0 @@ -# For more information on how to modify this file check the following link: -# https://help.github.com/en/actions/automating-your-workflow-with-github-actions - -name: CI - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -# Throw OutOfMemoryError in case less than 35% is free after full GC -# This avoids never-ending GC trashing if memory gets too low in case of a memory leak -env: - _JAVA_OPTIONS: '-XX:GCTimeLimit=90 -XX:GCHeapFreeLimit=35' - -jobs: - test: - name: 'Tests (JDK ${{ matrix.jdk }}, ${{ matrix.os }})' - runs-on: ${{ matrix.os }}-latest - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu - jdk: 11 - - os: windows - jdk: 8 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 50 - - name: 'Set up JDK ${{ matrix.jdk }}' - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.jdk }} - - uses: burrunan/gradle-cache-action@v1 - name: Test - with: - job-id: jdk${{ matrix.jdk }} - arguments: --scan --no-parallel --no-daemon build diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..8e35b85 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,23 @@ +name: Build + +on: + release: + types: [published] + +jobs: + release: + name: 'Release' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '11.0.x' + - name: Build Plugins + run: ./gradlew build -Pversion=${GITHUB_REF:10} + - name: Copy gradle.properties + run: echo ${GRADLE_PUBLISH} > ~/.gradle/gradle.properties + - name: Publish Plugins + run: ./gradlew publishPlugins -Pversion=${GITHUB_REF:10} diff --git a/README.md b/README.md index 0ad7a14..44894b4 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,14 @@ Gradle projects plugins for building [Allure](https://docs.qameta.io/allure/late ## Basic usage -`allure-gradle` plugin implements Allure data gathering (e.g. Test` tasks), and data reporting (both individual and aggregate reports). +`allure-gradle` plugin implements Allure data collecting (e.g. Test` tasks), and data reporting (both individual and aggregate reports). -Data gathering and reporting are split to different Gradle plugins, so you could apply the ones you need. +Data colecting and reporting are split to different Gradle plugins, so you could apply the ones you need. Note: 2.9+ requires Gradle 5.0+ The minimal configuration is as follows. -It would configure test tasks to gather Allure results and add `allureReport` and `allureServe` +It would configure test tasks to collect Allure results and add `allureReport` and `allureServe` tasks for report inspection. Groovy DSL: @@ -46,7 +46,7 @@ repositories { } ``` -`io.qameta.allure` is a shortcut for `io.qameta.allure-gather` + `io.qameta.allure-report`, +`io.qameta.allure` is a shortcut for `io.qameta.allure-adapter` + `io.qameta.allure-report`, so you could apply the plugins you need. ### Configuring Allure version @@ -86,19 +86,19 @@ use the following command: If you need a report only, please use `allureReport` and `allureAggregateReport`. By default, `allureAggregate*` aggregates data from the current `project` and its `subprojects`. -However, you need to apply `io.qameta.allure-gather` plugin to the relevant subprojects, so they +However, you need to apply `io.qameta.allure-adapter` plugin to the relevant subprojects, so they provide Allure results. -## Customizing data gathering +## Customizing data collecting -Data gathering is implemented via `io.qameta.allure-gather` Gradle plugin. +Data collecting is implemented via `io.qameta.allure-adapter` Gradle plugin. The values in the sample below are the defaults. The sample uses Kotlin DSL. In Groovy DSL you could use `allureJavaVersion = "2.13.9"`, however, that is the only difference. ```kotlin allure { - gather { + adapter { // Configure version for io.qameta.allure:allure-* adapters allureJavaVersion.set("2.13.9") aspectjVersion.set("1.9.5") @@ -110,7 +110,7 @@ allure { // By default, categories.json is detected in src/test/resources/../categories.json, // However, it would be better to put the file in a well-known location and configure it explicitly categoriesFile.set(layout.projectDirectory.file("config/allure/categories.json")) - adapters { + frameworks { junit5 { // Defaults to allureJavaVersion adapterVersion.set("...") @@ -140,7 +140,7 @@ allure { ### What if I have both JUnit5, JUnit4, and CucumberJVM on the classpath? By default, `allure-gradle` would detect all of them and apply all the listeners yielding 3 reports. -If you need only one or two, specify the required ones via `adapters {...}` block. +If you need only one or two, specify the required ones via `frameworks {...}` block. ### Adding custom results for reporting @@ -148,7 +148,7 @@ You could add a folder with custom results via `allureRawResultElements` Gradle ```kotlin plugins { - id("io.qameta.allure-gather-base") + id("io.qameta.allure-adapter-base") } dependencies { @@ -172,15 +172,15 @@ However, you might want to disable them and use your own ones. Here's how you disable default listeners: ```kotlin -allure.gather.adapters.junit5.autoconfigureListeners.set(false) +allure.adapter.frameworks.junit5.autoconfigureListeners.set(false) ``` An alternative syntax is as follows: ```kotlin allure { - gather { - adapters { + adapter { + frameworks { // Note: every time you mention an adapter, it is added to the classpath, // so refrain from mentioning unused adapters here junit5 { @@ -201,18 +201,18 @@ allure { ### Aggregating results from multiple projects Suppose you have a couple of modules `/module1/build.gradle.kts`, -`/module2/build.gradle.kts` that gather raw results for Allure: +`/module2/build.gradle.kts` that collect raw results for Allure: ```kotlin // Each submodule plugin { `java-library` - id("io.qameta.allure-gather") + id("io.qameta.allure-adapter") } allure { - gather { - adapters { + adapter { + frameworks { junit5 } } @@ -388,32 +388,32 @@ Extensions: `allure` extension for `project` -### io.qameta.allure-gather-base plugin +### io.qameta.allure-adapter-base plugin Extensions: -* io.qameta.allure.gradle.gather.AllureGatherExtension +* io.qameta.allure.gradle.adapter.AllureAdapterExtension - `gather` extension for `allure` + `adapter` extension for `allure` Configurations: * `allureRawResultElements` - A consumable configuration that exposes the gathered raw data for building the report + A consumable configuration that exposes the collect raw data for building the report Tasks: -* `copyCategories: io.qameta.allure.gradle.gather.tasks.CopyCategories` +* `copyCategories: io.qameta.allure.gradle.adapter.tasks.CopyCategories` Copies `categories.json` to the raw results folders. See https://github.com/allure-framework/allure2/issues/1236 -### io.qameta.allure-gather plugin +### io.qameta.allure-adapter plugin -Configures automatic gathering of raw data from test tasks, adds `allure-java` adapters to the classpath. +Configures automatic collectint of raw data from test tasks, adds `allure-java` adapters to the classpath. Configurations: * `allureAspectjWeaverAgent` - A configuration to declare AspectJ agent jar for data gathering + A configuration to declare AspectJ agent jar for data collecting ### io.qameta.allure-download plugin diff --git a/allure-gather-plugin/build.gradle.kts b/allure-adapter-plugin/build.gradle.kts similarity index 52% rename from allure-gather-plugin/build.gradle.kts rename to allure-adapter-plugin/build.gradle.kts index 7a0546c..a891c8f 100644 --- a/allure-gather-plugin/build.gradle.kts +++ b/allure-adapter-plugin/build.gradle.kts @@ -2,7 +2,7 @@ plugins { id("allure-gradle.kotlin-dsl-published-plugin") } -group = "io.qameta.allure.gradle.gather" +group = "io.qameta.allure.gradle.adapter" dependencies { implementation(project(":allure-base-plugin")) @@ -17,15 +17,15 @@ tasks.test { gradlePlugin { plugins { - create("allureCollectBasePlugin") { - id = "io.qameta.allure-gather-base" + create("allureAdapterBasePlugin") { + id = "io.qameta.allure-adapter-base" description = "Declares common configurations for producing and consuming Allure results and reports" - implementationClass = "io.qameta.allure.gradle.gather.AllureGatherBasePlugin" + implementationClass = "io.qameta.allure.gradle.adapter.AllureAdapterBasePlugin" } - create("allureCollectPlugin") { - id = "io.qameta.allure-gather" - description = "Implements autoconfiguration for gathering data for Allure" - implementationClass = "io.qameta.allure.gradle.gather.AllureGatherPlugin" + create("allureAdapterPlugin") { + id = "io.qameta.allure-adapter" + description = "Implements autoconfiguration for collecting data for Allure" + implementationClass = "io.qameta.allure.gradle.adapter.AllureAdapterPlugin" } } } diff --git a/allure-gather-plugin/src/it/adapter-all/build.gradle b/allure-adapter-plugin/src/it/adapter-all/build.gradle similarity index 62% rename from allure-gather-plugin/src/it/adapter-all/build.gradle rename to allure-adapter-plugin/src/it/adapter-all/build.gradle index e90567d..cf040c9 100644 --- a/allure-gather-plugin/src/it/adapter-all/build.gradle +++ b/allure-adapter-plugin/src/it/adapter-all/build.gradle @@ -1,6 +1,6 @@ plugins { id("java") - id("io.qameta.allure-gather") + id("io.qameta.allure-adapter") } repositories { @@ -11,7 +11,7 @@ tasks.register("printAdapters") { doLast { buildDir.mkdirs() file("$buildDir/printAdapters.txt").write( - allure.gather.adapters.toList().collect { it.toString() }.sort().toString() + allure.adapter.frameworks.toList().collect { it.toString() }.sort().toString() ) } } diff --git a/allure-gather-plugin/src/it/adapter-junit5-spock-kts/build.gradle.kts b/allure-adapter-plugin/src/it/adapter-junit5-spock-kts/build.gradle.kts similarity index 67% rename from allure-gather-plugin/src/it/adapter-junit5-spock-kts/build.gradle.kts rename to allure-adapter-plugin/src/it/adapter-junit5-spock-kts/build.gradle.kts index a48173a..c576466 100644 --- a/allure-gather-plugin/src/it/adapter-junit5-spock-kts/build.gradle.kts +++ b/allure-adapter-plugin/src/it/adapter-junit5-spock-kts/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("io.qameta.allure-gather") + id("io.qameta.allure-adapter") } repositories { @@ -7,8 +7,8 @@ repositories { } allure { - gather { - adapters { + adapter { + frameworks { junit5 { adapterVersion.set("42.0") } @@ -21,7 +21,7 @@ val printAdapters by tasks.registering { doLast { buildDir.mkdirs() file("$buildDir/printAdapters.txt").writeText( - allure.gather.adapters.toList().map { it.toString() }.sorted().toString() + allure.adapter.frameworks.toList().map { it.toString() }.sorted().toString() ) } } diff --git a/allure-adapter-plugin/src/main/kotlin/AllureExtensionAdapterExtensions.kt b/allure-adapter-plugin/src/main/kotlin/AllureExtensionAdapterExtensions.kt new file mode 100644 index 0000000..c9683f8 --- /dev/null +++ b/allure-adapter-plugin/src/main/kotlin/AllureExtensionAdapterExtensions.kt @@ -0,0 +1,11 @@ +import io.qameta.allure.gradle.base.AllureExtension +import io.qameta.allure.gradle.adapter.AllureAdapterExtension +import org.gradle.api.Action +import org.gradle.api.plugins.ExtensionAware +import org.gradle.kotlin.dsl.the + +val AllureExtension.adapter: AllureAdapterExtension get() = (this as ExtensionAware).the() + +fun AllureExtension.adapter(configureAction: Action) { + configureAction.execute(adapter) +} diff --git a/allure-adapter-plugin/src/main/kotlin/DeprecatedAllureAdapterExtensions.kt b/allure-adapter-plugin/src/main/kotlin/DeprecatedAllureAdapterExtensions.kt new file mode 100644 index 0000000..1b10ae5 --- /dev/null +++ b/allure-adapter-plugin/src/main/kotlin/DeprecatedAllureAdapterExtensions.kt @@ -0,0 +1,63 @@ +import io.qameta.allure.gradle.base.AllureExtension +import io.qameta.allure.gradle.adapter.config.AdapterConfig +import org.gradle.api.Action + +@Deprecated( + level = DeprecationLevel.WARNING, message = "Use frameworks.cucumberJvm", + replaceWith = ReplaceWith("frameworks.cucumberJvm.configure(action)") +) +fun AllureExtension.useCucumberJVM(action: Action) { + adapter.frameworks { + action.execute(cucumberJvm) + } +} + +@Deprecated( + level = DeprecationLevel.WARNING, message = "Use frameworks.cucumber2Jvm", + replaceWith = ReplaceWith("frameworks.cucumber2Jvm { }") +) +fun AllureExtension.useCucumber2JVM(action: Action) { + adapter.frameworks { + action.execute(cucumber2Jvm) + } +} + +@Deprecated( + level = DeprecationLevel.WARNING, message = "Use frameworks.junit4", + replaceWith = ReplaceWith("frameworks.junit4 { }") +) +fun AllureExtension.useJUnit4(action: Action) { + adapter.frameworks { + action.execute(junit4) + } +} + +@Deprecated( + level = DeprecationLevel.WARNING, message = "Use frameworks.junit4", + replaceWith = ReplaceWith("frameworks.junit5 { }") +) +fun AllureExtension.useJUnit5(action: Action) { + adapter.frameworks { + action.execute(junit5) + } +} + +@Deprecated( + level = DeprecationLevel.WARNING, message = "Use frameworks.testng", + replaceWith = ReplaceWith("frameworks.testng { }") +) +fun AllureExtension.useTestNG(action: Action) { + adapter.frameworks { + action.execute(testng) + } +} + +@Deprecated( + level = DeprecationLevel.WARNING, message = "Use frameworks.spock", + replaceWith = ReplaceWith("frameworks.spock { }") +) +fun AllureExtension.useSpock(action: Action) { + adapter.frameworks { + action.execute(spock) + } +} diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherBasePlugin.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterBasePlugin.kt similarity index 86% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherBasePlugin.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterBasePlugin.kt index 7815f1c..aaf3954 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherBasePlugin.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterBasePlugin.kt @@ -1,10 +1,10 @@ -package io.qameta.allure.gradle.gather +package io.qameta.allure.gradle.adapter import io.qameta.allure.gradle.base.AllureExtension import io.qameta.allure.gradle.base.dsl.extensions import io.qameta.allure.gradle.base.metadata.AllureResultType -import io.qameta.allure.gradle.gather.AllureGatherBasePlugin.Companion.ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME -import io.qameta.allure.gradle.gather.tasks.CopyCategories +import io.qameta.allure.gradle.adapter.AllureAdapterBasePlugin.Companion.ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME +import io.qameta.allure.gradle.adapter.tasks.CopyCategories import io.qameta.allure.gradle.util.categoryDocumentation import org.gradle.api.Plugin import org.gradle.api.Project @@ -15,9 +15,9 @@ import org.gradle.kotlin.dsl.* * The plugin adds [ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME] configuration so the project * can share raw Allure results for aggregation. */ -open class AllureGatherBasePlugin : Plugin { +open class AllureAdapterBasePlugin : Plugin { companion object { - const val PLUGIN_NAME = "io.qameta.allure-gather-base" + const val PLUGIN_NAME = "io.qameta.allure-adapter-base" const val ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME = "allureRawResultElements" const val ALLURE_COPY_CATEGORIES_ELEMENTS_CONFIGURATION_NAME = "allureCopyCategoriesElements" const val ALLURE_USAGE = "Allure" @@ -25,8 +25,8 @@ open class AllureGatherBasePlugin : Plugin { override fun apply(target: Project): Unit = target.run { val allureExtension = the() - allureExtension.extensions.create( - AllureGatherExtension.NAME, + allureExtension.extensions.create( + AllureAdapterExtension.NAME, project, // Gradle 5 can't inject objects yet // TODO: remove when Gradle 5 support can be dropped diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherExtension.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterExtension.kt similarity index 87% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherExtension.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterExtension.kt index f4f4ac6..b42ce75 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherExtension.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterExtension.kt @@ -1,9 +1,9 @@ -package io.qameta.allure.gradle.gather +package io.qameta.allure.gradle.adapter import groovy.json.JsonOutput import io.qameta.allure.gradle.base.tasks.ConditionalArgumentProvider import io.qameta.allure.gradle.base.tasks.JavaAgentArgumentProvider -import io.qameta.allure.gradle.gather.config.* +import io.qameta.allure.gradle.adapter.config.* import io.qameta.allure.gradle.util.conv import io.qameta.allure.gradle.util.forUseAtConfigurationTimeBackport import org.gradle.api.Action @@ -26,14 +26,14 @@ import java.nio.file.Paths import javax.inject.Inject /** - * Configures Allure raw result adapters (e.g. [junit5], [testng], ...) as `allure { gather {...` extension. + * Configures Allure raw result adapters (e.g. [junit5], [testng], ...) as `allure { adapter {...` extension. */ -open class AllureGatherExtension @Inject constructor( +open class AllureAdapterExtension @Inject constructor( private val project: Project, private val objects: ObjectFactory ) { companion object { - const val NAME = "gather" + const val NAME = "adapter" const val EXECUTOR_FILE_NAME = "executor.json" } @@ -69,7 +69,7 @@ open class AllureGatherExtension @Inject constructor( */ val categoriesFile: Property = objects.fileProperty().conv(defaultCategoriesFile(project)) - val adapters = AdapterHandler(project.container { + val frameworks = AdapterHandler(project.container { objects.newInstance(it, objects, this).also { adapter -> AllureJavaAdapter.find(it)?.apply { config.execute(adapter) @@ -77,9 +77,9 @@ open class AllureGatherExtension @Inject constructor( } }) - fun adapters(action: Action) { + fun frameworks(action: Action) { // Custom type is for better Kotlin DSL - action.execute(adapters) + action.execute(frameworks) } fun addAspectjTo(tasks: TaskCollection) = tasks.configureEach { @@ -92,31 +92,31 @@ open class AllureGatherExtension @Inject constructor( fun addAspectjTo(task: Task): Unit = task.run { if (aspectjWeaver.get() && this is JavaForkOptions) { - val aspectJAgent = project.configurations[AllureGatherPlugin.ASPECTJ_WEAVER_CONFIGURATION] + val aspectJAgent = project.configurations[AllureAdapterPlugin.ASPECTJ_WEAVER_CONFIGURATION] jvmArgumentProviders.add(JavaAgentArgumentProvider(aspectJAgent)) } } fun gatherResultsFrom(tasks: TaskCollection) { - project.apply() + project.apply() tasks.configureEach { internalGatherResultsFrom(this) } } fun gatherResultsFrom(task: TaskProvider) { - project.apply() + project.apply() task { internalGatherResultsFrom(this) } } fun gatherResultsFrom(task: Task) { - project.apply() + project.apply() internalGatherResultsFrom(task) } - // TODO: move to [AllureGatherBasePlugin] like `allure { gatherResults { fromTask(..) } } + // TODO: move to [AllureAdapterBasePlugin] like `allure { gatherResults { fromTask(..) } } private fun internalGatherResultsFrom(task: Task) { task.run { // Each task should store results in its own folder @@ -129,13 +129,13 @@ open class AllureGatherExtension @Inject constructor( // Pass the path to the task if (this is JavaForkOptions) { - systemProperty(AllureGatherPlugin.ALLURE_DIR_PROPERTY, rawResults.absolutePath) + systemProperty(AllureAdapterPlugin.ALLURE_DIR_PROPERTY, rawResults.absolutePath) // We don't know if the task will execute JUnit5 engine or not, // so we add extensions.autodetection.enabled to all the tasks if // junit5.autoconfigureListeners is enabled jvmArgumentProviders += ConditionalArgumentProvider( project.provider { - adapters.configuredAdapters[AllureJavaAdapter.junit5]?.let { + frameworks.configuredAdapters[AllureJavaAdapter.junit5]?.let { listOf( if (it.autoconfigureListeners.get()) { "-Djunit.jupiter.extensions.autodetection.enabled=true" @@ -156,7 +156,7 @@ open class AllureGatherExtension @Inject constructor( // Expose the gathered raw results val allureResults = - project.configurations[AllureGatherBasePlugin.ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME] + project.configurations[AllureAdapterBasePlugin.ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME] allureResults.outgoing.artifact(rawResults) { builtBy(task) } diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherPlugin.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterPlugin.kt similarity index 74% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherPlugin.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterPlugin.kt index 1cd799e..93ae856 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/AllureGatherPlugin.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/AllureAdapterPlugin.kt @@ -1,13 +1,13 @@ -package io.qameta.allure.gradle.gather +package io.qameta.allure.gradle.adapter -import gather +import adapter import io.qameta.allure.gradle.base.AllureBasePlugin import io.qameta.allure.gradle.base.AllureExtension -import io.qameta.allure.gradle.gather.autoconfigure.BaseTrimMetaInfServices -import io.qameta.allure.gradle.gather.autoconfigure.TrimMetaInfServices53 -import io.qameta.allure.gradle.gather.autoconfigure.TrimMetaInfServices54 -import io.qameta.allure.gradle.gather.config.AdapterHandler -import io.qameta.allure.gradle.gather.config.AllureJavaAdapter +import io.qameta.allure.gradle.adapter.autoconfigure.BaseTrimMetaInfServices +import io.qameta.allure.gradle.adapter.autoconfigure.TrimMetaInfServices53 +import io.qameta.allure.gradle.adapter.autoconfigure.TrimMetaInfServices54 +import io.qameta.allure.gradle.adapter.config.AdapterHandler +import io.qameta.allure.gradle.adapter.config.AllureJavaAdapter import io.qameta.allure.gradle.util.categoryLibrary import io.qameta.allure.gradle.util.libraryElementsJar import org.gradle.api.Plugin @@ -20,22 +20,22 @@ import org.gradle.kotlin.dsl.* import org.gradle.util.GradleVersion /** - * The plugin instruments [Test] and [JavaExec] tasks so they gather data for Allure. - * The data is gathered into [AllureGatherBasePlugin.ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME] configuration. + * The plugin instruments [Test] and [JavaExec] tasks so they collect data for Allure. + * The data is collected into [AllureAdapterBasePlugin.ALLURE_RAW_RESULT_ELEMENTS_CONFIGURATION_NAME] configuration. */ -open class AllureGatherPlugin : Plugin { +open class AllureAdapterPlugin : Plugin { companion object { - const val PLUGIN_NAME = "io.qameta.allure-gather" + const val PLUGIN_NAME = "io.qameta.allure-adapter" const val ASPECTJ_WEAVER_CONFIGURATION = "allureAspectjWeaverAgent" const val ALLURE_DIR_PROPERTY = "allure.results.directory" } override fun apply(target: Project): Unit = target.run { apply() - apply() + apply() val allureExtension = the() - val gatherExtension = allureExtension.gather + val adapterExtension = allureExtension.adapter // Configuration for AspectJ agent configurations.create(ASPECTJ_WEAVER_CONFIGURATION) { @@ -43,7 +43,7 @@ open class AllureGatherPlugin : Plugin { isCanBeResolved = true isCanBeConsumed = false defaultDependencies { - add(project.dependencies.create("org.aspectj:aspectjweaver:${gatherExtension.aspectjVersion.get()}")) + add(project.dependencies.create("org.aspectj:aspectjweaver:${adapterExtension.aspectjVersion.get()}")) } attributes { categoryLibrary(objects) @@ -52,20 +52,20 @@ open class AllureGatherPlugin : Plugin { } } - autoconfigureDependencyRules(gatherExtension) - configureTestTasks(gatherExtension) + autoconfigureDependencyRules(adapterExtension) + configureTestTasks(adapterExtension) val artifactType = Attribute.of("artifactType", String::class.java) afterEvaluate { // We don't know if the user updates autoconfigure value, so we delay the decision till afterEvaluate - gatherExtension.takeIf { it.adapters.configuredAdapters.isEmpty() }?.run { + adapterExtension.takeIf { it.frameworks.configuredAdapters.isEmpty() }?.run { for (adapter in AllureJavaAdapter.values()) { - adapters.create(adapter.name) + frameworks.create(adapter.name) } } if (GradleVersion.current() >= GradleVersion.version("6.6")) { - configureSpiOffSubstitution(gatherExtension.adapters) + configureSpiOffSubstitution(adapterExtension.frameworks) } else if (GradleVersion.current() >= GradleVersion.version("5.3")) { // Older Gradle do not have "substitute with classifier" feature // so we use ArtifactTransformation to trim META-INF/services from the jar @@ -84,9 +84,9 @@ open class AllureGatherPlugin : Plugin { } } - private fun Project.configureSpiOffSubstitution(adapters: AdapterHandler) { + private fun Project.configureSpiOffSubstitution(frameworks: AdapterHandler) { // Substitute adapter with spi-off classifier when trimServicesFromJar == true - adapters.matching { it.trimServicesFromJar.get() } + frameworks.matching { it.trimServicesFromJar.get() } .all { val adapterConfig = this configurations.all { @@ -107,9 +107,9 @@ open class AllureGatherPlugin : Plugin { } } - private fun Project.autoconfigureDependencyRules(extension: AllureGatherExtension) { + private fun Project.autoconfigureDependencyRules(extension: AllureAdapterExtension) { // We need to initialize all the adapters, so we don't need lazy evaluation configureEach - extension.adapters.all { + extension.frameworks.all { activateOn.all { val rule = this dependencies { @@ -121,7 +121,7 @@ open class AllureGatherPlugin : Plugin { } } - private fun Project.configureTestTasks(extension: AllureGatherExtension) { + private fun Project.configureTestTasks(extension: AllureAdapterExtension) { extension.run { tasks.withType().let { gatherResultsFrom(it) diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/AutoconfigureRuleBuilder.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/AutoconfigureRuleBuilder.kt similarity index 96% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/AutoconfigureRuleBuilder.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/AutoconfigureRuleBuilder.kt index bf2d357..bdadff1 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/AutoconfigureRuleBuilder.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/AutoconfigureRuleBuilder.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.autoconfigure +package io.qameta.allure.gradle.adapter.autoconfigure import org.gradle.api.Action import org.gradle.api.artifacts.DependencyMetadata diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/AutoconfigureRules.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/AutoconfigureRules.kt similarity index 96% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/AutoconfigureRules.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/AutoconfigureRules.kt index ed008d7..a7ca8dc 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/AutoconfigureRules.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/AutoconfigureRules.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.autoconfigure +package io.qameta.allure.gradle.adapter.autoconfigure import org.gradle.api.artifacts.ModuleVersionIdentifier import org.gradle.api.artifacts.dsl.ComponentMetadataHandler diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/BaseTrimMetaInfServices.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/BaseTrimMetaInfServices.kt similarity index 96% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/BaseTrimMetaInfServices.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/BaseTrimMetaInfServices.kt index 0905945..ac3082d 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/BaseTrimMetaInfServices.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/BaseTrimMetaInfServices.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.autoconfigure +package io.qameta.allure.gradle.adapter.autoconfigure import org.gradle.api.artifacts.transform.TransformAction import org.gradle.api.artifacts.transform.TransformOutputs diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/DefaultAutoconfigureRuleBuilder.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/DefaultAutoconfigureRuleBuilder.kt similarity index 97% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/DefaultAutoconfigureRuleBuilder.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/DefaultAutoconfigureRuleBuilder.kt index 308f797..36904dd 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/DefaultAutoconfigureRuleBuilder.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/DefaultAutoconfigureRuleBuilder.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.autoconfigure +package io.qameta.allure.gradle.adapter.autoconfigure import org.gradle.api.Action import org.gradle.api.artifacts.DependencyMetadata diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/DependencyDeclaration.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/DependencyDeclaration.kt similarity index 96% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/DependencyDeclaration.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/DependencyDeclaration.kt index b67cbaf..7d2e17e 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/DependencyDeclaration.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/DependencyDeclaration.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.autoconfigure +package io.qameta.allure.gradle.adapter.autoconfigure import org.gradle.api.Action import org.gradle.api.artifacts.DependenciesMetadata diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/TrimMetaInfServices53.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/TrimMetaInfServices53.kt similarity index 92% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/TrimMetaInfServices53.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/TrimMetaInfServices53.kt index fd5fa23..de79296 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/TrimMetaInfServices53.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/TrimMetaInfServices53.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.autoconfigure +package io.qameta.allure.gradle.adapter.autoconfigure import org.gradle.api.artifacts.transform.CacheableTransform import org.gradle.api.artifacts.transform.InputArtifact diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/TrimMetaInfServices54.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/TrimMetaInfServices54.kt similarity index 93% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/TrimMetaInfServices54.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/TrimMetaInfServices54.kt index f9c8e99..c360590 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/autoconfigure/TrimMetaInfServices54.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/autoconfigure/TrimMetaInfServices54.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.autoconfigure +package io.qameta.allure.gradle.adapter.autoconfigure import org.gradle.api.artifacts.transform.CacheableTransform import org.gradle.api.artifacts.transform.InputArtifact diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AdapterConfig.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AdapterConfig.kt similarity index 86% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AdapterConfig.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AdapterConfig.kt index 58d52b4..3df62fd 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AdapterConfig.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AdapterConfig.kt @@ -1,10 +1,10 @@ -package io.qameta.allure.gradle.gather.config +package io.qameta.allure.gradle.adapter.config import io.qameta.allure.gradle.base.AllureExtension -import io.qameta.allure.gradle.gather.AllureGatherExtension -import io.qameta.allure.gradle.gather.autoconfigure.AutoconfigureRule -import io.qameta.allure.gradle.gather.autoconfigure.AutoconfigureRuleBuilder -import io.qameta.allure.gradle.gather.autoconfigure.DefaultAutoconfigureRuleBuilder +import io.qameta.allure.gradle.adapter.AllureAdapterExtension +import io.qameta.allure.gradle.adapter.autoconfigure.AutoconfigureRule +import io.qameta.allure.gradle.adapter.autoconfigure.AutoconfigureRuleBuilder +import io.qameta.allure.gradle.adapter.autoconfigure.DefaultAutoconfigureRuleBuilder import io.qameta.allure.gradle.util.conv import io.qameta.allure.gradle.util.domainObjectSetBackport import io.qameta.allure.gradle.util.forUseAtConfigurationTimeBackport @@ -16,14 +16,14 @@ import javax.inject.Inject open class AdapterConfig @Inject constructor( val name: String, objects: ObjectFactory, - allureGatherExtension: AllureGatherExtension + allureAdapterExtension: AllureAdapterExtension ) { /** * Configures `allure-java` version for the current adapter. * The value defaults to [AllureExtension.allureJavaVersion] */ val adapterVersion = objects.property() - .conv(allureGatherExtension.allureJavaVersion) + .conv(allureAdapterExtension.allureJavaVersion) @Deprecated( level = DeprecationLevel.WARNING, @@ -42,7 +42,7 @@ open class AdapterConfig @Inject constructor( val autoconfigureListeners = objects.property() .forUseAtConfigurationTimeBackport() .conv( - enabled.map { it && allureGatherExtension.autoconfigureListeners.get() } + enabled.map { it && allureAdapterExtension.autoconfigureListeners.get() } ) @Deprecated( diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AdapterHandler.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AdapterHandler.kt similarity index 97% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AdapterHandler.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AdapterHandler.kt index 657bd84..a4e3f37 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AdapterHandler.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AdapterHandler.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather.config +package io.qameta.allure.gradle.adapter.config import org.gradle.api.Action import org.gradle.api.NamedDomainObjectContainer diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AllureJavaAdapter.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AllureJavaAdapter.kt similarity index 95% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AllureJavaAdapter.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AllureJavaAdapter.kt index cdc8c28..2932030 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/config/AllureJavaAdapter.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/config/AllureJavaAdapter.kt @@ -1,7 +1,7 @@ -package io.qameta.allure.gradle.gather.config +package io.qameta.allure.gradle.adapter.config -import io.qameta.allure.gradle.gather.autoconfigure.AutoconfigureRuleBuilder -import io.qameta.allure.gradle.gather.autoconfigure.BaseTrimMetaInfServices +import io.qameta.allure.gradle.adapter.autoconfigure.AutoconfigureRuleBuilder +import io.qameta.allure.gradle.adapter.autoconfigure.BaseTrimMetaInfServices import org.gradle.api.Action import org.gradle.api.artifacts.DependencyMetadata import org.gradle.api.provider.Provider diff --git a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/tasks/CopyCategories.kt b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/tasks/CopyCategories.kt similarity index 91% rename from allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/tasks/CopyCategories.kt rename to allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/tasks/CopyCategories.kt index 5b71376..3a4fcab 100644 --- a/allure-gather-plugin/src/main/kotlin/io/qameta/allure/gradle/gather/tasks/CopyCategories.kt +++ b/allure-adapter-plugin/src/main/kotlin/io/qameta/allure/gradle/adapter/tasks/CopyCategories.kt @@ -1,6 +1,6 @@ -package io.qameta.allure.gradle.gather.tasks +package io.qameta.allure.gradle.adapter.tasks -import gather +import adapter import io.qameta.allure.gradle.base.AllureExtension import io.qameta.allure.gradle.util.conv import org.gradle.api.DefaultTask @@ -17,7 +17,7 @@ open class CopyCategories @Inject constructor(objects: ObjectFactory) : DefaultT @SkipWhenEmpty @PathSensitive(PathSensitivity.NONE) val categoriesFile = objects.fileProperty() - .conv(project.the().gather.categoriesFile) + .conv(project.the().adapter.categoriesFile) @Internal val destinationDirs = objects.setProperty() diff --git a/allure-gather-plugin/src/test/kotlin/io/qameta/allure/gradle/gather/AdaptersTest.kt b/allure-adapter-plugin/src/test/kotlin/io/qameta/allure/gradle/adapter/AdaptersTest.kt similarity index 98% rename from allure-gather-plugin/src/test/kotlin/io/qameta/allure/gradle/gather/AdaptersTest.kt rename to allure-adapter-plugin/src/test/kotlin/io/qameta/allure/gradle/adapter/AdaptersTest.kt index d3409a6..b27d3df 100644 --- a/allure-gather-plugin/src/test/kotlin/io/qameta/allure/gradle/gather/AdaptersTest.kt +++ b/allure-adapter-plugin/src/test/kotlin/io/qameta/allure/gradle/adapter/AdaptersTest.kt @@ -1,4 +1,4 @@ -package io.qameta.allure.gradle.gather +package io.qameta.allure.gradle.adapter import io.qameta.allure.gradle.rule.GradleRunnerRule import org.assertj.core.api.Assertions.assertThat diff --git a/allure-base-plugin/src/main/kotlin/io/qameta/allure/gradle/base/AllureExtension.kt b/allure-base-plugin/src/main/kotlin/io/qameta/allure/gradle/base/AllureExtension.kt index 0a8a34c..1e5d28a 100644 --- a/allure-base-plugin/src/main/kotlin/io/qameta/allure/gradle/base/AllureExtension.kt +++ b/allure-base-plugin/src/main/kotlin/io/qameta/allure/gradle/base/AllureExtension.kt @@ -2,7 +2,6 @@ package io.qameta.allure.gradle.base import io.qameta.allure.gradle.util.conv import org.gradle.api.Action -import org.gradle.api.NamedDomainObjectProvider import org.gradle.api.model.ObjectFactory import org.gradle.api.plugins.ExtensionAware import org.gradle.api.provider.Property @@ -27,13 +26,13 @@ open class AllureExtension( // TODO: remove when deprecated [aspectjweaver] is removed private val aspectjWeaver by lazy { @Suppress("unchecked_cast") - gatherExtension + adapterExtension .let { it::class.java.getMethod("getAspectjWeaver").invoke(it) } as Property } - @Deprecated(level = DeprecationLevel.WARNING, message = "Use gather.aspectjWeaver") + @Deprecated(level = DeprecationLevel.WARNING, message = "Use adapter.aspectjWeaver") var aspectjweaver: Boolean get() = aspectjWeaver.get() set(value) = aspectjWeaver.set(value) @@ -41,58 +40,58 @@ open class AllureExtension( // TODO: remove when deprecated [aspectjweaver] is removed private val autoconfigureProperty by lazy { @Suppress("unchecked_cast") - gatherExtension + adapterExtension .let { it::class.java.getMethod("getAutoconfigure").invoke(it) } as Property } - @Deprecated(level = DeprecationLevel.WARNING, message = "Use gather.autoconfigure") + @Deprecated(level = DeprecationLevel.WARNING, message = "Use adapter.autoconfigure") var autoconfigure: Boolean get() = autoconfigureProperty.get() set(value) = autoconfigureProperty.set(value) // visible for Groovy DSL - @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use adapters.cucumberJvm") + @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use frameworks.cucumberJvm") fun useCucumberJVM(action: Action) { action.execute(getAdapter("getCucumberJvm")) } // visible for Groovy DSL - @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use adapters.cucumber2Jvm") + @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use frameworks.cucumber2Jvm") fun useCucumber2JVM(action: Action) { action.execute(getAdapter("getCucumber2Jvm")) } // visible for Groovy DSL - @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use adapters.junit4") + @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use frameworks.junit4") fun useJUnit4(action: Action) { action.execute(getAdapter("getJunit4")) } // visible for Groovy DSL - @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use adapters.junit5") + @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use frameworks.junit5") fun useJUnit5(action: Action) { action.execute(getAdapter("getJunit5")) } // visible for Groovy DSL - @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use adapters.testng") + @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use frameworks.testng") fun useTestNG(action: Action) { action.execute(getAdapter("getTestng")) } // visible for Groovy DSL - @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use adapters.spock") + @Deprecated(level = DeprecationLevel.HIDDEN, message = "Use frameworks.spock") fun useSpock(action: Action) { action.execute(getAdapter("getSpock")) } - private val gatherExtension: Any - get() = let { it as ExtensionAware }.extensions.getByName("gather") + private val adapterExtension: Any + get() = let { it as ExtensionAware }.extensions.getByName("adapter") private fun getAdapter(adapterName: String) = - gatherExtension - .let { it::class.java.getMethod("getAdapters").invoke(it) } + adapterExtension + .let { it::class.java.getMethod("getFrameworks").invoke(it) } .let { it::class.java.getMethod(adapterName).invoke(it) } } diff --git a/allure-gather-plugin/src/main/kotlin/AllureExtensionGatherExtensions.kt b/allure-gather-plugin/src/main/kotlin/AllureExtensionGatherExtensions.kt deleted file mode 100644 index 7beb725..0000000 --- a/allure-gather-plugin/src/main/kotlin/AllureExtensionGatherExtensions.kt +++ /dev/null @@ -1,11 +0,0 @@ -import io.qameta.allure.gradle.base.AllureExtension -import io.qameta.allure.gradle.gather.AllureGatherExtension -import org.gradle.api.Action -import org.gradle.api.plugins.ExtensionAware -import org.gradle.kotlin.dsl.the - -val AllureExtension.gather: AllureGatherExtension get() = (this as ExtensionAware).the() - -fun AllureExtension.gather(configureAction: Action) { - configureAction.execute(gather) -} diff --git a/allure-gather-plugin/src/main/kotlin/DeprecatedAllureGatherExtensions.kt b/allure-gather-plugin/src/main/kotlin/DeprecatedAllureGatherExtensions.kt deleted file mode 100644 index 9351cb0..0000000 --- a/allure-gather-plugin/src/main/kotlin/DeprecatedAllureGatherExtensions.kt +++ /dev/null @@ -1,63 +0,0 @@ -import io.qameta.allure.gradle.base.AllureExtension -import io.qameta.allure.gradle.gather.config.AdapterConfig -import org.gradle.api.Action - -@Deprecated( - level = DeprecationLevel.WARNING, message = "Use adapters.cucumberJvm", - replaceWith = ReplaceWith("adapters.cucumberJvm.configure(action)") -) -fun AllureExtension.useCucumberJVM(action: Action) { - gather.adapters { - action.execute(cucumberJvm) - } -} - -@Deprecated( - level = DeprecationLevel.WARNING, message = "Use adapters.cucumber2Jvm", - replaceWith = ReplaceWith("adapters.cucumber2Jvm { }") -) -fun AllureExtension.useCucumber2JVM(action: Action) { - gather.adapters { - action.execute(cucumber2Jvm) - } -} - -@Deprecated( - level = DeprecationLevel.WARNING, message = "Use adapters.junit4", - replaceWith = ReplaceWith("adapters.junit4 { }") -) -fun AllureExtension.useJUnit4(action: Action) { - gather.adapters { - action.execute(junit4) - } -} - -@Deprecated( - level = DeprecationLevel.WARNING, message = "Use adapters.junit4", - replaceWith = ReplaceWith("adapters.junit5 { }") -) -fun AllureExtension.useJUnit5(action: Action) { - gather.adapters { - action.execute(junit5) - } -} - -@Deprecated( - level = DeprecationLevel.WARNING, message = "Use adapters.testng", - replaceWith = ReplaceWith("adapters.testng { }") -) -fun AllureExtension.useTestNG(action: Action) { - gather.adapters { - action.execute(testng) - } -} - -@Deprecated( - level = DeprecationLevel.WARNING, message = "Use adapters.spock", - replaceWith = ReplaceWith("adapters.spock { }") -) -fun AllureExtension.useSpock(action: Action) { - gather.adapters { - action.execute(spock) - } -} diff --git a/allure-plugin/build.gradle.kts b/allure-plugin/build.gradle.kts index c60e91f..8f4277e 100644 --- a/allure-plugin/build.gradle.kts +++ b/allure-plugin/build.gradle.kts @@ -5,7 +5,7 @@ plugins { group = "io.qameta.allure.gradle.allure" dependencies { - implementation(project(":allure-gather-plugin")) + implementation(project(":allure-adapter-plugin")) implementation(project(":allure-report-plugin")) testImplementation(project(":testkit-junit4")) diff --git a/allure-plugin/src/it/full-dsl-groovy/build.gradle b/allure-plugin/src/it/full-dsl-groovy/build.gradle index dc79f22..a90b923 100644 --- a/allure-plugin/src/it/full-dsl-groovy/build.gradle +++ b/allure-plugin/src/it/full-dsl-groovy/build.gradle @@ -1,5 +1,5 @@ plugins { - id("io.qameta.allure-gather") + id("io.qameta.allure-adapter") id("io.qameta.allure-report") } @@ -7,8 +7,8 @@ plugins { allure { version = "42.0" - gather { - adapters { + adapter { + frameworks { junit5 { adapterVersion = "42.0" enabled = true @@ -28,10 +28,10 @@ allure { } } } - adapters.junit5 - adapters.junit5.enabled = false + frameworks.junit5 + frameworks.junit5.enabled = false } - gather.adapters.spock.enabled = true + adapter.frameworks.spock.enabled = true commandline { group = "com.example" module = "test" @@ -47,7 +47,7 @@ allure { report.reportDir = file("$buildDir/allure/reports") report.dependsOnTests = true } -allure.gather.adapters.cucumberJvm.enabled = true +allure.adapter.frameworks.cucumberJvm.enabled = true allure.commandline.downloadUrlPattern = "localhost" allure.report.dependsOnTests = true diff --git a/allure-plugin/src/it/full-dsl-kotlin/build.gradle.kts b/allure-plugin/src/it/full-dsl-kotlin/build.gradle.kts index ecfc5bd..dae4f20 100644 --- a/allure-plugin/src/it/full-dsl-kotlin/build.gradle.kts +++ b/allure-plugin/src/it/full-dsl-kotlin/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("io.qameta.allure-gather") + id("io.qameta.allure-adapter") id("io.qameta.allure-report") } @@ -7,8 +7,8 @@ plugins { allure { version.set("42.0") - gather { - adapters { + adapter { + frameworks { junit5 { adapterVersion.set("42.0") enabled.set(true) @@ -27,10 +27,10 @@ allure { } } } - adapters.junit5 - adapters.junit5.enabled.set(false) + frameworks.junit5 + frameworks.junit5.enabled.set(false) } - gather.adapters.spock.enabled.set(true) + adapter.frameworks.spock.enabled.set(true) commandline { group.set("com.example") module.set("test") @@ -46,7 +46,7 @@ allure { report.reportDir.set(buildDir.resolve("allure/reports")) report.dependsOnTests.set(true) } -allure.gather.adapters.cucumberJvm.enabled.set(true) +allure.adapter.frameworks.cucumberJvm.enabled.set(true) allure.commandline.downloadUrlPattern.set("localhost") allure.report.dependsOnTests.set(true) diff --git a/allure-plugin/src/it/junit5/build.gradle b/allure-plugin/src/it/junit5/build.gradle index e74e3b3..c335478 100644 --- a/allure-plugin/src/it/junit5/build.gradle +++ b/allure-plugin/src/it/junit5/build.gradle @@ -17,6 +17,6 @@ dependencies { } allure { - // Newer allure-java fail to gather data from JUnit5 :( - gather.allureJavaVersion = "2.13.5" + // Newer allure-java fail to adapter data from JUnit5 :( + adapter.allureJavaVersion = "2.13.5" } diff --git a/allure-plugin/src/it/report-multi/module1/build.gradle b/allure-plugin/src/it/report-multi/module1/build.gradle index 450db59..6ddd2f3 100644 --- a/allure-plugin/src/it/report-multi/module1/build.gradle +++ b/allure-plugin/src/it/report-multi/module1/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'io.qameta.allure-gather' + id 'io.qameta.allure-adapter' } dependencies { diff --git a/allure-plugin/src/it/report-multi/module2/build.gradle b/allure-plugin/src/it/report-multi/module2/build.gradle index 450db59..6ddd2f3 100644 --- a/allure-plugin/src/it/report-multi/module2/build.gradle +++ b/allure-plugin/src/it/report-multi/module2/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'io.qameta.allure-gather' + id 'io.qameta.allure-adapter' } dependencies { diff --git a/allure-plugin/src/main/kotlin/io/qameta/allure/gradle/allure/AllurePlugin.kt b/allure-plugin/src/main/kotlin/io/qameta/allure/gradle/allure/AllurePlugin.kt index ba82511..f260e8a 100644 --- a/allure-plugin/src/main/kotlin/io/qameta/allure/gradle/allure/AllurePlugin.kt +++ b/allure-plugin/src/main/kotlin/io/qameta/allure/gradle/allure/AllurePlugin.kt @@ -1,13 +1,13 @@ package io.qameta.allure.gradle.allure -import io.qameta.allure.gradle.gather.AllureGatherPlugin +import io.qameta.allure.gradle.adapter.AllureAdapterPlugin import io.qameta.allure.gradle.report.AllureReportPlugin import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.apply /** - * This is a shortcut for [AllureGatherPlugin.PLUGIN_NAME] and [AllureReportPlugin.PLUGIN_NAME] plugins. + * This is a shortcut for [AllureAdapterPlugin.PLUGIN_NAME] and [AllureReportPlugin.PLUGIN_NAME] plugins. * If you need an aggregate report, then use [AllureAggregateReportPlugin.PLUGIN_NAME] plugin. */ open class AllurePlugin : Plugin { @@ -16,7 +16,7 @@ open class AllurePlugin : Plugin { } override fun apply(target: Project): Unit = target.run { - apply() + apply() apply() } } diff --git a/allure-plugin/src/test/java/io/qameta/allure/gradle/allure/TestNgSpiOffTest.java b/allure-plugin/src/test/java/io/qameta/allure/gradle/allure/TestNgSpiOffTest.java index 17849e3..0f625e3 100644 --- a/allure-plugin/src/test/java/io/qameta/allure/gradle/allure/TestNgSpiOffTest.java +++ b/allure-plugin/src/test/java/io/qameta/allure/gradle/allure/TestNgSpiOffTest.java @@ -16,7 +16,7 @@ /** * Verifies that plugin properly adds `spi-off` dependency (the one without META-INF/services) - * when {@link io.qameta.allure.gradle.gather.config.AdapterConfig#getAutoconfigureListeners} is {@code false}. + * when {@link io.qameta.allure.gradle.adapter.config.AdapterConfig#getAutoconfigureListeners} is {@code false}. */ @RunWith(Parameterized.class) public class TestNgSpiOffTest { diff --git a/allure-report-plugin/src/main/kotlin/io/qameta/allure/gradle/report/AllureReportPlugin.kt b/allure-report-plugin/src/main/kotlin/io/qameta/allure/gradle/report/AllureReportPlugin.kt index 5daff5e..b39b635 100644 --- a/allure-report-plugin/src/main/kotlin/io/qameta/allure/gradle/report/AllureReportPlugin.kt +++ b/allure-report-plugin/src/main/kotlin/io/qameta/allure/gradle/report/AllureReportPlugin.kt @@ -40,7 +40,7 @@ open class AllureReportPlugin : Plugin { /** * The plugin adds tasks to aggregate Allure reports for the current project and its subprojects ( * [REPORT_TASK_NAME] and [SERVE_TASK_NAME]). - * Note: if you need to gather the data from the current project, then you need [AllureGatherPlugin.PLUGIN_NAME] + * Note: if you need to collect the data from the current project, then you need [AllureAdapterPlugin.PLUGIN_NAME] */ open class AllureAggregateReportPlugin : Plugin { companion object { diff --git a/sandbox/dsl-groovy/build.gradle b/sandbox/dsl-groovy/build.gradle index fa8e59d..9c0888a 100644 --- a/sandbox/dsl-groovy/build.gradle +++ b/sandbox/dsl-groovy/build.gradle @@ -3,7 +3,7 @@ plugins { } allure { - gather { + adapter { } report { diff --git a/sandbox/dsl-kotlin/build.gradle.kts b/sandbox/dsl-kotlin/build.gradle.kts index fcc3fbd..52d2c1d 100644 --- a/sandbox/dsl-kotlin/build.gradle.kts +++ b/sandbox/dsl-kotlin/build.gradle.kts @@ -3,10 +3,10 @@ plugins { } allure { - gather.adapters.spock.enabled.set(true) - gather { + adapter.frameworks.spock.enabled.set(true) + adapter { allureJavaVersion.set("213") - adapters { + frameworks { junit5 cucumber2Jvm { } diff --git a/settings.gradle.kts b/settings.gradle.kts index 67b213d..77eafd4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -38,7 +38,7 @@ includeBuild("build-logic-commons") includeBuild("build-logic") include("allure-base-plugin") -include("allure-gather-plugin") +include("allure-adapter-plugin") include("allure-report-plugin") include("allure-plugin") include("testkit-junit4")