`gradle-plugin-runtime` is an `implementation` dependency of a plugin, so a build that uses the plugin class doesn't compile

オープン 初心者向け
#126 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java, kotlin
領域
build-system

調査の方向性

DevKitGradlePlugin の configureDependencies から始めてください。issue では gradle-plugin-runtime を追加している main.implementationConfigurationName(...) の呼び出しが引用されています。この依存関係を api 構成へ移し、apiElements に含まれるようにしてください。そのうえで、公開済みモジュールのメタデータ(またはプロジェクトの Gradle プラグインのテスト)を確認し、gradle-plugin-runtime が runtimeElements だけでなく apiElements バリアントに現れていることを確かめてください。完了の条件は、公開済みプラグインに implementation で依存する convention plugin が、Library-API-Watchdog のケースのように DevKitSupportPlugin を参照してコンパイルできることです。

索引モデルが issue の本文から書いたものです。

説明

Steps:

  1. A Gradle plugin project applies the dev kit Gradle plugin. Its plugin class extends DevKitSupportPlugin:

    public class WatchdogSupportPlugin : DevKitSupportPlugin(PluginInfo.PLUGIN_INFO)
    
  2. A convention plugin of another build depends on the published plugin with implementation and uses the plugin class:

    plugins.withType<WatchdogSupportPlugin>().configureEach { /* ... */ }
    

    The same in Java: project.getPlugins().apply(WatchdogSupportPlugin.class);

What happens: the compilation of the convention plugin fails. javac reports "cannot access DevKitSupportPlugin", and the Kotlin compiler reports "Cannot access class" for DevKitSupportPlugin.

What must happen: the convention plugin compiles. The apiElements variant of the published plugin has gradle-plugin-runtime, because the public supertype of the plugin class is in that module.

Cause: DevKitGradlePlugin.configureDependencies adds the module to implementation, so the published module metadata has it in runtimeElements only.

// 0.0.4-dev-403
main.implementationConfigurationName(
    addRuntimeDependency.ifTrue { "$DEV_KIT_GROUP:gradle-plugin-runtime:$DEV_KIT_VERSION" }
)

Versions: dev kit 0.0.4-dev-403.

Found in https://github.com/Kotlin/Library-API-Watchdog/pull/94.

主要言語
Kotlin
スター
34
フォーク
1
平均マージ
1日 9時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Kotlin/compiler-plugin-dev-kit のほかの issue

Kotlin/compiler-plugin-dev-kit の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。