Skip to content

Commit 59ca863

Browse files
authored
Update README.md
1 parent 34ffb0b commit 59ca863

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

README.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
1-
# GitHub Dependency Extractor
1+
# GitHub Dependency Graph Gradle Plugin
22

3-
A Gradle plugin for extracting dependencies from a Gradle build to feed the GitHub Dependency API.
3+
A Gradle plugin for generating a GitHub dependency graph for a Gradle build, which can be uploaded to the [GitHub Dependency Submission API](https://docs.github.com/en/rest/dependency-graph/dependency-submission).
44

5-
This project is currently just a proof of concept, but ideally, this plugin would be automatically applied to any Gradle
6-
project using the GitHub Action [gradle-build-action](https://github.com/marketplace/actions/gradle-build-action).
5+
## Usage
6+
This plugin is designed to be used in a GitHub Actions workflow, with support coming in a future release of the [Gradle Build Action](https://github.com/gradle/gradle-build-action).
77

8-
This plugin leverages the same internal API's used by the Gradle Build Scan Plugin.
8+
For other uses, the [core plugin](https://plugins.gradle.org/plugin/org.gradle.github-dependency-graph-gradle-plugin) (`org.gradle.github.GitHubDependencyGraphPlugin`)
9+
should be applied to the `Gradle` instance via a Gradle init script as follows:
910

10-
This plugin is intended to implement the proposed API for the GitHub Build-Time Dependency Graph API found
11-
[here](https://docs.google.com/document/d/1TjxJJwgPavw-TFzK3110iH-CWstgdcVdb2JYiRy2GVs/edit?usp=sharing)
12-
and this
13-
[JSON Schema](https://gist.github.com/reiddraper/7b47d553382fd3867cc1d0b5474bd6c7).
11+
```
12+
import org.gradle.github.GitHubDependencyGraphPlugin
13+
initscript {
14+
repositories {
15+
maven {
16+
url = uri("https://plugins.gradle.org/m2/")
17+
}
18+
}
19+
dependencies {
20+
classpath("org.gradle:github-dependency-graph-gradle-plugin:+")
21+
}
22+
}
23+
apply plugin: GitHubDependencyGraphPlugin
24+
```
25+
26+
This causes 2 separate plugins to be applied, that can be used independently:
27+
- `GitHubDependencyExtractorPlugin` collects all dependencies that are resolved during a build execution and writes these to a file. The output file can be found at `<root>/build/reports/github-depenency-graph-gradle-plugin/github-dependency-snapshot.json`.
28+
- `ForceDependencyResolutionPlugin` creates a `GitHubDependencyGraphPlugin_generateDependencyGraph` task that will attempt to resolve all dependencies for a Gradle build, by simply invoking `dependencies` on all projects.
1429

1530
## Building/Testing
1631

17-
To test this plugin, run the following task:
32+
To build and test this plugin, run the following task:
1833
```shell
19-
./gradlew test
34+
./gradlew check
2035
```
2136

22-
Self testing this plugin is also possible.
23-
In order to do this, you'll need a
24-
[GitHub API token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
25-
set to the environment variable `GITHUB_TOKEN`.
26-
27-
To run the self-test, run the following:
37+
To self-test this plugin and generate a dependency graph for this repository, run:
2838
```shell
29-
./gradlew build
3039
./plugin-self-test-local
3140
```
41+
42+
The generated dependency graph will be submitted to GitHub only if you supply a
43+
[GitHub API token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
44+
via the environment variable `GITHUB_TOKEN`.

0 commit comments

Comments
 (0)