File tree 2 files changed +41
-9
lines changed
2 files changed +41
-9
lines changed Original file line number Diff line number Diff line change @@ -26,30 +26,52 @@ Small plugins to reduce boilerplate in Gradle build scripts.
26
26
27
27
## Installation
28
28
29
- Add rpository to ` settings.gradle ` :
29
+ Add repositories to ` settings.gradle.kts ` :
30
30
``` kotlin
31
31
pluginManagement {
32
32
repositories {
33
33
google()
34
34
gradlePluginPortal()
35
-
36
- // If you want to use SNAPSHOTs
37
- maven {
38
- name = " GitHubPackages"
39
- setUrl(" https://maven.pkg.github.com/RedMadRobot/gradle-infrastructure" )
40
- credentials(PasswordCredentials ::class )
41
- }
35
+ maven(url = " https://dl.bintray.com/redmadrobot-opensource/android" )
42
36
}
43
37
}
44
38
```
45
39
46
40
Then you can apply any of plugins where you need:
47
41
``` kotlin
48
42
plugins {
43
+ id(" redmadrobot.kotlin-library" ) version " 0.2"
44
+ id(" redmadrobot.publish" ) version " 0.2"
49
45
id(" redmadrobot.detekt" ) version " 0.2"
50
46
}
51
47
```
52
48
49
+ <details >
50
+ <summary >Alternatively you can specify plugin resolution strategy and set infrastructure version there</summary >
51
+
52
+ ``` kotlin
53
+ // settings.gradle.kts
54
+ pluginManagement {
55
+ // ...
56
+
57
+ resolutionStrategy {
58
+ eachPlugin {
59
+ if (requested.id.namespace == " redmadrobot" ) {
60
+ useModule(" com.redmadrobot.build:infrastructure:0.2" )
61
+ }
62
+ }
63
+ }
64
+ }
65
+
66
+ // build.gradle.kts
67
+ plugins {
68
+ id(" redmadrobot.kotlin-library" )
69
+ id(" redmadrobot.publish" )
70
+ id(" redmadrobot.detekt" )
71
+ }
72
+ ```
73
+ </details >
74
+
53
75
## Plugins
54
76
55
77
### kotlin-library
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ plugins {
4
4
}
5
5
6
6
group = " com.redmadrobot.build"
7
- version = " 0.2-SNAPSHOT"
7
+ description = " Small plugins to reduce boilerplate in Gradle build scripts."
8
+ version = " 0.2"
8
9
9
10
kotlinDslPluginOptions {
10
11
experimentalWarning.set(false )
@@ -56,12 +57,21 @@ java {
56
57
withSourcesJar()
57
58
}
58
59
60
+ val publishToBintray = " bintrayUsername" in properties && " bintrayPassword" in properties
61
+ val isSnapshot = version.toString().endsWith(" -SNAPSHOT" )
59
62
publishing {
60
63
repositories {
61
64
maven {
62
65
name = " GitHubPackages"
63
66
setUrl(" https://maven.pkg.github.com/RedMadRobot/gradle-infrastructure" )
64
67
credentials(PasswordCredentials ::class )
65
68
}
69
+ if (publishToBintray && ! isSnapshot) {
70
+ maven {
71
+ name = " bintray"
72
+ setUrl(" https://api.bintray.com/maven/redmadrobot-opensource/android/infrastructure/" )
73
+ credentials(PasswordCredentials ::class )
74
+ }
75
+ }
66
76
}
67
77
}
You can’t perform that action at this time.
0 commit comments