Skip to content

Commit 7b66dbc

Browse files
jwharmbbhtt
authored andcommitted
Add link and documentation for Gradle plugin
1 parent d2fa57a commit 7b66dbc

File tree

1 file changed

+77
-1
lines changed

1 file changed

+77
-1
lines changed

gradle/README.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,80 @@
1-
# Flatpak Gradle Generator
1+
There are two alternative methods to generate a Flatpak sources file for a
2+
Gradle project:
3+
4+
1. Using a Gradle plugin
5+
2. Using the `flatpak-gradle-generator.py` script
6+
7+
# Gradle plugin
8+
9+
Available on the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/io.github.jwharm.flatpak-gradle-generator).
10+
11+
Add the plugin to your build:
12+
13+
```groovy
14+
plugins {
15+
id "io.github.jwharm.flatpak-gradle-generator" version "1.5.0"
16+
}
17+
```
18+
19+
Configure the `flatpakGradleGenerator` task:
20+
21+
```groovy
22+
tasks.flatpakGradleGenerator {
23+
outputFile = file("flatpak-sources.json")
24+
downloadDirectory = "./offline-repository"
25+
excludeConfigurations = ["testCompileClasspath", "testRuntimeClasspath"]
26+
}
27+
```
28+
29+
The `outputFile` is the Flatpak sources file containing the download urls of
30+
all dependency artifacts. Flatpak-builder will download these files in the
31+
`downloadDirectory` location. This directory will have a standard Maven
32+
repository layout. Add it to your project `repositories`:
33+
34+
```groovy
35+
repositories {
36+
mavenCentral()
37+
maven { url "./offline-repository" }
38+
}
39+
```
40+
41+
With this setup, Gradle will use the normal repositories such as Maven Central
42+
during regular ("online") builds, and the "offline repository" in the
43+
flatpak-builder sandbox environment.
44+
45+
Run the `flatpakGeneratorTask` to generate the "flatpak-sources.json" file.
46+
When done, commit the file to your project repository and add it to the flatpak
47+
manifest.
48+
49+
## Modular builds
50+
51+
Gradle plugins are not allowed to resolve configurations of other Gradle
52+
(sub)projects. In a modular Gradle build, configure a `flatpakGradleGenerator`
53+
task for each subproject individually.
54+
55+
## Plugin dependencies
56+
57+
Add the offline repository in the `settings.gradle` file to use it as a
58+
plugin repository:
59+
60+
```groovy
61+
pluginManagement {
62+
repositories {
63+
maven { url "./offline-repository" }
64+
}
65+
}
66+
```
67+
68+
This is necessary for all plugins that are not included in the Gradle
69+
distribution directly, such as (for example) the Kotlin JVM plugin.
70+
71+
## Issues and contributions
72+
73+
Please log issues and contributions for the plugin in the GitHub
74+
[jwharm/flatpak-gradle-generator](https://github.com/jwharm/flatpak-gradle-generator/)
75+
repository.
76+
77+
# Flatpak Gradle Generator script
278

379
Tool to automatically generate a `flatpak-builder` sources file from a Gradle log.
480

0 commit comments

Comments
 (0)