Gradle plugin which gathers project dependencies and exports them in Markdown
/JSON
format.
Apply the plugin in your build.gradle
:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.vgaidarji:dependencies-overview:<VERSION>'
}
}
apply plugin: 'dependencies.overview'
Full list of available configuration properties can be found in DependenciesOverviewExtension.
dependenciesOverview {
output.json = true
output.markdown = true
output.folder = "build/reports/dependencies" // by default `= null` (project root)
}
Once everything configured, you can generate dependencies overview report by executing appropriate Gradle task:
./gradlew dependenciesOverview
You can find sample reports in repository root:
JSON
{
"dependencies": [
{
"group": "com.android.support",
"version": "25.3.1",
"name": "animated-vector-drawable",
"module": {
"group": "com.android.support",
"name": "animated-vector-drawable"
}
},
{
"group": "com.android.support",
"version": "25.3.1",
"name": "appcompat-v7",
"module": {
"group": "com.android.support",
"name": "appcompat-v7"
}
},
{
"group": "joda-time",
"version": "2.3",
"name": "joda-time",
"module": {
"group": "joda-time",
"name": "joda-time"
}
},
{
"group": "org.slf4j",
"version": "1.7.7",
"name": "slf4j-android",
"module": {
"group": "org.slf4j",
"name": "slf4j-android"
}
}
]
}
Markdown
Group | Name | Version |
---|---|---|
com.android.support | animated-vector-drawable | 25.3.1 |
com.android.support | appcompat-v7 | 25.3.1 |
joda-time | joda-time | 2.3 |
org.slf4j | slf4j-android | 1.7.7 |
On a sample Android project with ~40 compile time dependencies
JSON
& Markdown
reports generation takes up to ~70 milliseconds, which is very insignificant.
This project is written mainly in Kotlin and uses ktlint linter.
build-install.sh
and build-install-run.sh
scripts can be used during local development.
They contain sequence of Gradle
commands which help building/installing/running plugin.
- build-install.sh builds the plugin and installs it into local repository (
repo
folder in project root) - build-install-run.sh uses build-install.sh + runs plugin on sample projects.
How to release
Plugin is published to and Maven Central repository (Gradle guide).
maven-publishing.gradle contains necessary configurations.
We need to specify few mandatory properties in global ~/.gradle/gradle.properties
file:
signing.keyId=
signing.password=
signing.secretKeyRingFile=
SONATYPE_USERNAME=
SONATYPE_PASSWORD=
Follow Signatory credentials for more details.
As per https://circleci.com/blog/publishing-java-android-libraries/, following environment variables should be added to Circle CI project environment variables:
ORG_GRADLE_PROJECT_SONATYPE_USERNAME
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD
publishToMavenLocal
task can be used to perform a dry run publishing to local maven repository.
For automatic publishing from Sonatype Nexus staging repository to release https://github.com/gradle-nexus/publish-plugin/ plugin is used.
./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository
command is used to upload signed plugin artifact to Maven Central.
Publishing may take some time, check https://oss.sonatype.org for newly published version.
- Veaceslav Gaidarji - [email protected]
- Add more sample integrations projects (Java application, project with modules)
- Divide dependencies into groups by project module
- Introduce task parameter
should_print_to_console
- Support other project configurations (currently
compile
configuration is analysed)
Copyright 2017 Veaceslav Gaidarji
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.