Code Monkey home page Code Monkey logo

tutteli-gradle-plugins's Introduction

Gradle Plugin Portal Apache license Build Status Ubuntu Build Status Windows Coverage

Tutteli gradle plugin

A set of gradle plugins which provide utility tasks and functions which I often use in my projects.

You want to use one of them as well?

Sweet ๐Ÿ˜„ the following sections will cover a few features. They are most probably not complete (and maybe out-dated, bear with me, as far as I know I am the only one using them).

Please open an issue, if you find a bug or need some help.

The following sections give brief information what the different plugins offer.

ch.tutteli.gradle.plugins.dokka ๐Ÿ”—

Applies the dokka-plugin and defines a sourceLink per dokkaSourceSet. If the project version follows the pattern x.y.z, then an externalDocumentationLink per dokkaSourceSet is defined in addition. The url used for the sourceLink and the externalDocumentationLink is based on a given githubUser. Last but not least, it automatically configures dokka to look in test folder for *Samples.kt files for samples linked in KDoc.

ch.tutteli.gradle.plugins.junitjacoco ๐Ÿ”—

Applies the junit-platform-gradle-plugin as well as the jacoco-plugin and applies some default configuration.

This plugin does not set up a junit engine and you need to define it yourself. Have a look at build.gradle for an example.

ch.tutteli.gradle.plugins.kotlin.module.info ๐Ÿ”—

Intended to be used in a kotlin project where either module-info.java is the single java source file or where >= jdk 11 is used. It sets up compileJava accordingly and configures JavaCompile tasks to use jdk 11 for sourceCompatibility/targetCompatibility if not already set or higher.

Per default, it reads the module name (which is used for --patch-module) from the defined module-info.java. You can speed up this process (in case you have many java files) by defining moduleName on project.extra.

ch.tutteli.gradle.plugins.publish ๐Ÿ”—

Applies the maven-publish and signing plugin and configures them based on given license(s), a github user and a few other information. It exposes the tutteliPublish extension which lets you specify those information and refine default conventions. Have a look at the example in the tests for more information.

If not set, it automatically propagates version and group from rootProject to subprojects (group of subprojects are set to "" when plugin is applied, would default to rootProject.name).

If no MavenPublication is defined, then it creates one which:

  • automatically uses project.components.java if available.
  • includes all Jar Tasks into the publication (you can use an artifactFilter to exclude some)

Regardless if there was one or several existing MavenPublications or one was created by the plugin. All Jar Tasks are modified in a way that they include the LICENSE(.txt) file located in the root of the rootProject and augments the manifest file with information such as Vendor, Kotlin-version used etc.

Last but not least, it augments the pom-file with license, developer and scm information (can be configured via the tutteliPublish extension)

The conventions:

  • Apache 2.0 is used as default license
  • project.group, project.description and project.version is used in publishing
  • configures singing to useGpgCmd

ch.tutteli.gradle.plugins.spek ๐Ÿ”—

-> will most likely be removed with 6.0.0 (spek is no longer a reliable test runner IMO regarding maintenance)

Applies the junitjacoco plugin (which itself applies the junit and jacoco plugin, see two sections above) and sets up Spek as junit engine. Requires that a JVM compliant kotlin plugin is applied first. Moreover, it adds mavenCentral() to the repositories and sets up kotlin dependencies: kotlin-stdlib as implementation and kotlin-reflect as testImplementation dependency -- kotlin-reflect is required by spek.

License

All tutteli gradle plugins are licensed under Apache 2.0.

tutteli-gradle-plugins's People

Contributors

dependabot-preview[bot] avatar jgleitz avatar renovate-bot avatar renovate[bot] avatar robstoll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jgleitz balao7

tutteli-gradle-plugins's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.


Warning

Renovate failed to look up the following dependencies: Failed to look up maven package jacoco:junit.

Files affected: tutteli-gradle-junitjacoco/build.gradle.kts


Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/build-ubuntu.yml
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/gradle-build-action v3.1.0
  • codecov/codecov-action v4.0.2
.github/workflows/build-windows.yml
  • actions/checkout v4
  • actions/setup-java v4
  • gradle/gradle-build-action v3.1.0
  • codecov/codecov-action v4.0.2
.github/workflows/gradle-wrapper-validation.yml
  • actions/checkout v4
  • gradle/wrapper-validation-action v2.1.1
gradle
gradle.properties
settings.gradle.kts
build.gradle.kts
gradle/buildLibs.versions.toml
  • com.gradle.publish:plugin-publish-plugin 1.2.1
  • com.dorongold.plugins:task-tree 2.1.1
  • com.github.vlsi.crlf:com.github.vlsi.crlf.gradle.plugin 1.90
  • com.github.vlsi.gradle-extensions:com.github.vlsi.gradle-extensions.gradle.plugin 1.90
  • org.gradlex.build-parameters 1.4.3
gradle/libs.versions.toml
  • ch.tutteli.atrium:atrium-api-fluent 1.1.0
  • org.jetbrains.dokka:org.jetbrains.dokka.gradle.plugin 1.9.10
  • com.jayway.jsonpath:json-path-assert 2.9.0
  • org.junit.jupiter:junit-jupiter-api 5.10.2
  • org.junit.jupiter:junit-jupiter-engine 5.10.2
  • org.junit.jupiter:junit-jupiter-params 5.10.2
  • org.apache.maven:maven-model 3.9.6
  • org.mockito:mockito-core 5.10.0
gradle/build-logic/settings.gradle.kts
gradle/build-logic/build.gradle.kts
gradle/build-logic-conventions/settings.gradle.kts
gradle/build-logic-conventions/build.gradle.kts
gradle/build-logic-conventions/src/main/kotlin/build-logic.kotlin-dsl-gradle-plugin.gradle.kts
gradle/build-logic/basics/build.gradle.kts
gradle/build-logic/basics/src/main/kotlin/build-logic.gradle-conventions.gradle.kts
gradle/build-logic/build-parameters/build.gradle.kts
gradle/build-logic/dev/build.gradle.kts
gradle/build-logic/dev/src/main/kotlin/build-logic.gradle-plugin.gradle.kts
gradle/build-logic/dev/src/main/kotlin/build-logic.java.gradle.kts
gradle/build-logic/dev/src/main/kotlin/build-logic.kotlin-conventions.gradle.kts
gradle/build-logic/dev/src/main/kotlin/build-logic.kotlin-jvm.gradle.kts
gradle/build-logic/publishing/build.gradle.kts
gradle/build-logic/publishing/src/main/kotlin/build-logic.published-gradle-plugin.gradle.kts
gradle/build-logic/root-build/build.gradle.kts
gradle/build-logic/root-build/src/main/kotlin/build-logic.root-build.gradle.kts
gradle/scripts/localRepo.gradle
test-utils/build.gradle.kts
tutteli-gradle-dokka/build.gradle.kts
tutteli-gradle-junitjacoco/build.gradle.kts
  • jacoco:junit junit5
tutteli-gradle-kotlin-module-info/build.gradle.kts
tutteli-gradle-publish/build.gradle.kts
tutteli-gradle-spek/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.1.1

  • Check this box to trigger a request for Renovate to run again on this repository

ch.tutteli.gradle.plugins.spek does not support Kotlin 1.7+

Here's a stacktrace:

        groovy.lang.MissingMethodException: No signature of method:
org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper.getKotlinPluginVersion() is applicable for argument types: () values: []
            at ch.tutteli.gradle.plugins.spek.SpekPlugin.getKotlinVersion(SpekPlugin.groovy:77)
            at ch.tutteli.gradle.plugins.spek.SpekPlugin.configureForJvm(SpekPlugin.groovy:44)
            at ch.tutteli.gradle.plugins.spek.SpekPlugin$_apply_closure2.doCall(SpekPlugin.groovy:37)

Push SonarQube coverage

Hello !

I can't manage to push test coverage to sonarQube.

Any idea ?

Thanks

junitJacoco {
    jacocoVersion = '0.8.5' // type String
    includeNoLocationClasses = false
    includeInstrumentationCoverageInMergedReport = false // type boolean
}
sonarqube {
        properties {
            property "sonar.sourceEncoding", "UTF-8"
            property "sonar.jacoco.xmlReportPaths", "build/reports/jacocoCombined/debug/jacoco.xml"
            property "sonar.projectName", "olx-android-lurker-android"
            property "sonar.projectVersion", "$System.env.CI_COMMIT_SHORT_SHA"
            property "sonar.androidVariant", "debug"
        }

    }

ch.tutteli.gradle.plugins.publish fails when used as a precompiled script plugin

Consider https://docs.gradle.org/current/userguide/structuring_software_products.html

Consider user creates build-logic.published-to-central.gradle.kts plugin:

plugins {
    id("ch.tutteli.gradle.plugins.dokka")
    id("ch.tutteli.gradle.plugins.publish")
}

project.extensions.getByType<ch.tutteli.gradle.plugins.publish.PublishPluginExtension>().apply {
    resetLicenses("EUPL-1.2")
}

Then, it fails as follows since Grade applies build-logic.published-to-central to a temporary gradle-kotlin-dsl-accessors project in order to precompile the accessors.

I suggest moving the verification to afterEvaluate so the users can apply kotlin plugin after ch.tutteli.gradle.plugins.publish, and I suggest skipping the verification for gradle-kotlin-dsl-accessors:

if (!project.hasProperty("sourceSets")) throw IllegalStateException(
"The project ${project.name} does not have any sources. We currently require a project to have sources in order to publish it." +
"\nPlease make sure you do not apply the ch.tutteli.$EXTENSION_NAME plugin before the plugin which provides the sourceSets (e.g. kotlin or java and the like)" +
"\nPlease open an issue if you would like to publish projects without sources: https://github.com/robstoll/tutteli-gradle-plugins/issues/new"
)

An alternative option could be removing the verification altogether.

 Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'ch.tutteli.gradle.plugins.publish'.
                at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:173)
                at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:137)
                at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$applyPlugin$1(DefaultPluginRequestApplicator.java:148)
                at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:199)
                ... 133 more
                Caused by: java.lang.IllegalStateException: The project gradle-kotlin-dsl-accessors does not have any sources. We currently require a project to have sources in order to publish it.
                Please make sure you do not apply the ch.tutteli.tutteliPublish plugin before the plugin which provides the sourceSets (e.g. kotlin or java and the like)
                Please open an issue if you would like to publish projects without sources: https://github.com/robstoll/tutteli-gradle-plugins/issues/new
                    at ch.tutteli.gradle.plugins.publish.PublishPlugin.apply(PublishPlugin.kt:40)
                    at ch.tutteli.gradle.plugins.publish.PublishPlugin.apply(PublishPlugin.kt:23)
                    at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:43)
                    at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:51)
                    at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:187)
                    at org.gradle.api.internal.plugins.DefaultPluginManager.access$100(DefaultPluginManager.java:52)
                    at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:282)
                    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
                    at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
                    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
                    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
                    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
                    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
                    at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
                    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
                    at org.gradle.api.internal.plugins.DefaultPluginManager.lambda$doApply$0(DefaultPluginManager.java:167)
                    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44)
                    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:166)
                    ... 136 more

Remove ch.tutteli.junitjacoco

As far as I can see, the plugin serves no purpose anymore. The JUnit Platform Plugin is deprecated and all settings the plugin applies can can easliy be done through gradle or the jacoco plugin.

Or is there any reason to keep this plugin?

ch.tutteli.gradle.plugins.spek declares repositories which goes agains the best practices of configuring the repositories in settings

Here's the stacktrace:

Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by plugin 'ch.tutteli.gradle.plugins.spek'
        at org.gradle.internal.management.DefaultDependencyResolutionManagement.repoMutationDisallowedOnProject(DefaultDependencyResolutionManagement.java:199)
        at org.gradle.internal.ImmutableActionSet$SetWithFewActions.execute(ImmutableActionSet.java:285)
        at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:262)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection.doAdd(DefaultNamedDomainObjectCollection.java:113)
        at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:251)
        at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.access$101(DefaultArtifactRepositoryContainer.java:35)
        at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.lambda$new$0(DefaultArtifactRepositoryContainer.java:38)
        at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addWithUniqueName(DefaultArtifactRepositoryContainer.java:101)
        at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addRepository(DefaultArtifactRepositoryContainer.java:89)
        at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.addRepository(DefaultArtifactRepositoryContainer.java:84)
        at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.mavenCentral(DefaultRepositoryHandler.java:103)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:489)
        at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:196)
        at org.gradle.internal.metaobject.CompositeDynamicObject.tryInvokeMethod(CompositeDynamicObject.java:98)
        at org.gradle.internal.extensibility.MixInClosurePropertiesAsMethodsDynamicObject.tryInvokeMethod(MixInClosurePropertiesAsMethodsDynamicObject.java:36)
        at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:61)
        at ch.tutteli.gradle.plugins.spek.SpekPlugin$_apply_closure1.doCall(SpekPlugin.groovy:24)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.util.internal.ClosureBackedAction.execute(ClosureBackedAction.java:73)
        at org.gradle.util.internal.ConfigureUtil.configureTarget(ConfigureUtil.java:155)
        at org.gradle.util.internal.ConfigureUtil.configureSelf(ConfigureUtil.java:131)
        at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.configure(DefaultArtifactRepositoryContainer.java:65)
        at org.gradle.api.internal.artifacts.DefaultArtifactRepositoryContainer.configure(DefaultArtifactRepositoryContainer.java:35)
        at org.gradle.util.internal.ConfigureUtil.configure(ConfigureUtil.java:104)
        at org.gradle.api.internal.project.DefaultProject.repositories(DefaultProject.java:1286)
        at org.gradle.api.Project$repositories.call(Unknown Source)
        at ch.tutteli.gradle.plugins.spek.SpekPlugin.apply(SpekPlugin.groovy:23)
        at ch.tutteli.gradle.plugins.spek.SpekPlugin.apply(SpekPlugin.groovy)

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

validateBeforePublish is too agressive: it requires GPG_PASSPHRASE even for generatePomFileForJvmPublication

  1. Clone Atrium
  2. cd translations/atrium-translations-de_CH
  3. ../../gradlew generatePomFileForJvmPublication
> Task :atrium-translations-de_CH:validateBeforePublish FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':atrium-translations-de_CH:validateBeforePublish'.
> You need to define property with name gpgPassphrase or System.env variable with name GPG_PASSPHRASE for publishing (empty or blank is considered to be undefined)

I don't see why I need a GPG_PASSPHRASE for generating a pom file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.