Giter VIP home page Giter VIP logo

testinggradleplugins-revised's Introduction

Testing Gradle plugins (カスタムGradleプラグインをテストする方法)

at June 2022, by kazurayam

What is this

This repository is based on the following article published by the Gradle project:

I wanted to develop a custom Gradle plugin. I wanted to know how to test it. But I did not know how to. One day I read the above article. I could easily see that the article discusses exactly what I want to learn. I read the article and tried to develop a working example. But it was not as easy as it should be. The article missed some files that comprise the project. Some codes proposed by the article failed. Unfortunately the author didn't provide a zip file of working example that works. I struggled for a few days and got a success. Here I would publish the zip of sample code of "Testing Gradle plugins" that works. Please refer to

これは何か

このレポジトリはGradle本家プロジェクトが公開している下記の記事に基づいています。

わたしはカスタムなGradleプラグインを作りたかった。自作のプラグインをちゃんとテストしたかったが、カスタムGradle Pluginの自動化テストをどう書けばいいのかわからなかった。ある日、上記の記事を見つけた。記事を読みはじめてすぐつまずいた。コピペしたコードを走らせるとエラーが発生した。サンプルコードの例示が一部欠けていた。「検証済みのサンプルコードをzipして提供してくれ!」と不満におもったが無いものは無い。別の情報源も参照しながら数日間かけて、ちゃんと動くサンプルコード一式を作るができた。オリジナル記事のサンプルコードを下敷きにしているが、直すべきところを直したのでちゃんと動く。それが取り柄です。zipファイルを公開します。

testinggradleplugins-revised's People

Contributors

kazurayam avatar

Watchers

 avatar

testinggradleplugins-revised's Issues

pluginManagement { includeBuild ... } seems not working

The document https://docs.gradle.org/current/userguide/testing_gradle_plugins.html recommends to use pluginManagement { ... }.

include-plugin-build/settings.gradle

pluginManagement {
    includeBuild '../url-verifier-plugin'
}

include-plugin-build/build.gradle

plugins {
    id 'org.myorg.url-verifier'
}
verification {
    url = 'https://www.google.com/'
}

But this does not work for me.

$ cd include-plugin-build
$ $ gradle verifyUrl

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/kazuakiurayama/tmp/url-verifier-gradle-plugin/include-plugin-build/build.gradle' line: 2

* What went wrong:
Plugin [id: 'org.myorg.url-verifier'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (None of the included builds contain this plugin)
- Plugin Repositories (plugin dependency must include a version number for this source)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 724ms

I was using Gradle v7.4.2

$ gradle -version

------------------------------------------------------------
Gradle 7.4.2
------------------------------------------------------------

Build time:   2022-03-31 15:25:29 UTC
Revision:     540473b8118064efcc264694cbcaa4b677f61041

Kotlin:       1.5.31
Groovy:       3.0.9
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          1.8.0_322 (Amazon.com Inc. 25.322-b06)
OS:           Mac OS X 12.4 x86_64


I published this as 1.0-SNAPSHOT

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.