From 4cb44b77e2cbb9aae6e156c4a13e4ff962accbed Mon Sep 17 00:00:00 2001 From: Pascal Knecht Date: Fri, 13 Sep 2024 13:38:21 +0200 Subject: [PATCH] Include model class dependency into connector plugin By removing the implementation dependency from connector-plugin to connector-model the published Gradle plugin does not require an external dependency to the model in the generated pom. This obsoletes the need to publish the connector-model separately. --- README.md | 19 ++++++++----------- connector-plugin/build.gradle.kts | 8 +++++++- gradle.properties | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e32120b..876250e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ individual modules with the help of [Mermaid](https://mermaid.js.org/). graph TD vd2a57d(app) -->|implementation| va74ad8(core) vd2a57d(app) -->|implementation| v1bc49d(importer) - va02543(connector-plugin) -->|implementation| v91bd8e(connector-model) + va02543(connector-plugin) -->|compileOnly| v91bd8e(connector-model) v1bc49d(importer) -->|implementation| v91bd8e(connector-model) v1bc49d(importer) -->|implementation| va74ad8(core) ``` @@ -78,15 +78,12 @@ Download and setup this project: git clone https://github.com/ryru/dependency-graph-analyser.git cd dependency-graph-analyser/ ./gradlew clean install -./gradlew :connector-plugin:publishToMavenLocal ``` 1. Download the GitHub code repository 2. Change into code directory -3. Make a clean installation of the application (application will be available in the - directory `./app/build/install/dga/bin/dga`) -4. Publish the Gradle tooling API plugin and its data model to Maven local (available in the - directory `~/.m2/repository/ch/addere/dga/`) +3. Make a clean installation of the application (application will be available in the directory + `./app/build/install/dga/bin/dga`) Get an overview of this project by running `dga .`: @@ -95,7 +92,7 @@ Get an overview of this project by running `dga .`: Analyse project "dependency-graph-analyser" 5 modules - 5 dependency configurations (1 unique dependency configurations) + 5 dependency configurations (2 unique dependency configurations) ``` @@ -108,12 +105,12 @@ Use `dga . --chart-mermaid` to generate a Mermaid chart of this project: Analyse project "dependency-graph-analyser" 5 modules - 5 dependency configurations (1 unique dependency configurations) + 5 dependency configurations (2 unique dependency configurations) graph TD vd2a57d(app) -->|implementation| va74ad8(core) vd2a57d(app) -->|implementation| v1bc49d(importer) - va02543(connector-plugin) -->|implementation| v91bd8e(connector-model) + va02543(connector-plugin) -->|compileOnly| v91bd8e(connector-model) v1bc49d(importer) -->|implementation| v91bd8e(connector-model) v1bc49d(importer) -->|implementation| va74ad8(core) @@ -127,9 +124,9 @@ containing the dependencies originating from the module `app`: ``` ./app/build/install/dga/bin/dga . -o app --mermaid-graph - Analyse project "dependency-graph-analyser" +Analyse project "dependency-graph-analyser" 5 modules - 5 dependency configurations (1 unique dependency configurations) + 5 dependency configurations (2 unique dependency configurations) Applying filter on data results in: 3 modules diff --git a/connector-plugin/build.gradle.kts b/connector-plugin/build.gradle.kts index a59a5fa..0861438 100644 --- a/connector-plugin/build.gradle.kts +++ b/connector-plugin/build.gradle.kts @@ -8,7 +8,13 @@ group = "ch.addere.dga.connectorplugin" version = property("connectorPluginVersion").toString() dependencies { - implementation(project(":connector-model")) + compileOnly(project(":connector-model")) +} + +/* Include the :connector-model classes into the plugin jar to make it self-contained */ +tasks.named("jar") { + from(project.sourceSets["main"].output) + from(project(":connector-model").sourceSets["main"].output) } gradlePlugin { diff --git a/gradle.properties b/gradle.properties index 759fb63..e57141e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,4 @@ # https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties org.gradle.parallel=true org.gradle.caching=true -connectorPluginVersion=0.1.3 +connectorPluginVersion=0.1.5