Skip to content

Commit c6c8056

Browse files
authored
Dogfood the version setting feature (#34)
2 parents 60f7875 + a99636c commit c6c8056

File tree

6 files changed

+29
-360
lines changed

6 files changed

+29
-360
lines changed

README.md

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,16 @@
22

33
<!---freshmark shields
44
output = [
5-
link(shield('Gradle plugin', 'plugins.gradle.org', 'com.diffplug.blowdryer', 'blue'), 'https://plugins.gradle.org/plugin/com.diffplug.blowdryer'),
6-
link(shield('Maven central', 'mavencentral', 'available', 'blue'), 'https://search.maven.org/classic/#search%7Cgav%7C1%7Cg%3A%22com.diffplug%22%20AND%20a%3A%22blowdryer%22'),
7-
link(shield('License Apache 2.0', 'license', 'apache-2.0', 'blue'), 'https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)'),
8-
'',
9-
link(shield('Changelog', 'changelog', versionLast, 'brightgreen'), 'CHANGELOG.md'),
10-
link(shield('Javadoc', 'javadoc', 'yes', 'brightgreen'), 'https://javadoc.io/doc/com.diffplug/blowdryer/{{versionLast}}/index.html'),
11-
link(shield('Live chat', 'gitter', 'chat', 'brightgreen'), 'https://gitter.im/diffplug/blowdryer'),
12-
link(image('CircleCI', 'https://circleci.com/gh/diffplug/blowdryer.svg?style=shield'), 'https://circleci.com/gh/diffplug/blowdryer')
5+
link(shield('Gradle plugin', 'gradle plugin', 'com.diffplug.blowdryer', 'blue'), 'https://plugins.gradle.org/plugin/com.diffplug.blowdryer'),
6+
link(shield('Changelog', 'changelog', versionLast, 'blue'), 'CHANGELOG.md'),
7+
link(shield('Maven central', 'mavencentral', 'here', 'blue'), 'https://search.maven.org/classic/#search%7Cgav%7C1%7Cg%3A%22com.diffplug%22%20AND%20a%3A%22blowdryer%22'),
8+
link(shield('Javadoc', 'javadoc', 'here', 'blue'), 'https://javadoc.io/doc/com.diffplug/blowdryer/{{versionLast}}/index.html'),
139
].join('\n');
1410
-->
15-
[![Gradle plugin](https://img.shields.io/badge/plugins.gradle.org-com.diffplug.blowdryer-blue.svg)](https://plugins.gradle.org/plugin/com.diffplug.blowdryer)
16-
[![Maven central](https://img.shields.io/badge/mavencentral-available-blue.svg)](https://search.maven.org/classic/#search%7Cgav%7C1%7Cg%3A%22com.diffplug%22%20AND%20a%3A%22blowdryer%22)
17-
[![License Apache 2.0](https://img.shields.io/badge/license-apache--2.0-blue.svg)](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))
18-
19-
[![Changelog](https://img.shields.io/badge/changelog-1.7.0-brightgreen.svg)](CHANGELOG.md)
20-
[![Javadoc](https://img.shields.io/badge/javadoc-yes-brightgreen.svg)](https://javadoc.io/doc/com.diffplug/blowdryer/1.7.0/index.html)
21-
[![Live chat](https://img.shields.io/badge/gitter-chat-brightgreen.svg)](https://gitter.im/diffplug/blowdryer)
22-
[![CircleCI](https://circleci.com/gh/diffplug/blowdryer.svg?style=shield)](https://circleci.com/gh/diffplug/blowdryer)
11+
[![Gradle plugin](https://img.shields.io/badge/gradle_plugin-com.diffplug.blowdryer-blue.svg)](https://plugins.gradle.org/plugin/com.diffplug.blowdryer)
12+
[![Changelog](https://img.shields.io/badge/changelog-1.7.0-blue.svg)](CHANGELOG.md)
13+
[![Maven central](https://img.shields.io/badge/mavencentral-here-blue.svg)](https://search.maven.org/classic/#search%7Cgav%7C1%7Cg%3A%22com.diffplug%22%20AND%20a%3A%22blowdryer%22)
14+
[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug/blowdryer/1.7.0/index.html)
2315
<!---freshmark /shields -->
2416

2517
If you have multiple loosely-related gradle projects in separate repositories, then you probably have these problems:
@@ -171,14 +163,14 @@ plugins {
171163
blowdryerSetup {
172164
github('acme/blowdryer-acme', 'tag', 'v1.4.5')
173165
setPluginsBlockTo {
174-
file('plugin.versions')
166+
it.file('plugin.versions')
175167
}
176168
}
177169
```
178170

179171
First note that every plugin has `apply false` except for `com.diffplug.blowdryerSetup`. That is on purpose. We need to apply `blowdryerSetup` so that we can use the `blowdryerSetup {}` block, and we need to do `apply false` on the other plugins because we're just putting them on the classpath, not actually using them (yet).
180172

181-
The second thing to note is `setPluginsBlockTo { file('plugin.versions') }`. That means that if you go to `github.com/acme/blowdryer-acme` and then open the `v1.4.5` tab and then go into the `src/main/resources` folder, you will find a file called `plugin.versions`. And the content of that file will be
173+
The second thing to note is `setPluginsBlockTo { it.file('plugin.versions') }`. That means that if you go to `github.com/acme/blowdryer-acme` and then open the `v1.4.5` tab and then go into the `src/main/resources` folder, you will find a file called `plugin.versions`. And the content of that file will be
182174

183175
```gradle
184176
id 'com.diffplug.blowdryerSetup' version '1.7.0'
@@ -207,11 +199,11 @@ It doesn't *have* to be called `plugin.versions`, it's just using the `干.file`
207199

208200
```gradle
209201
setPluginsBlockTo {
210-
file('plugin.versions')
211-
file('kotlin-extras.versions')
212-
add(" id 'special-plugin-for-just-this-project' version '1.0.0'")
213-
remove(" id 'acme.java' version '1.0.0' apply false")
214-
replace('1.7.20', '1.8.0') // update Kotlin version but only for this build
202+
it.file('plugin.versions')
203+
it.file('kotlin-extras.versions')
204+
it.add(" id 'special-plugin-for-just-this-project' version '1.0.0'")
205+
it.remove(" id 'acme.java' version '1.0.0' apply false")
206+
it.replace('1.7.20', '1.8.0') // update Kotlin version but only for this build
215207
}
216208
```
217209

@@ -237,9 +229,9 @@ static File 干.immutableUrl(String guaranteedImmutableUrl, String fileSuffix)
237229
// 干.immutableUrl('https://foo.org/?file=blah.foo&rev=7', '.foo') returns a file which ends in `.foo`
238230
```
239231

240-
- [javadoc `Blowdryer`](https://javadoc.io/static/com.diffplug/blowdryer/1.7.0/com/diffplug/blowdryer/Blowdryer.html)
241-
- [javadoc `BlowdryerSetup`](https://javadoc.io/static/com.diffplug/blowdryer/1.7.0/com/diffplug/blowdryer/BlowdryerSetup.html)
242-
- [javadoc `BlowdryerSetup.PluginsBlock`](https://javadoc.io/static/com.diffplug/blowdryer/1.7.0/com/diffplug/blowdryer/BlowdryerSetup.html)
232+
- [javadoc `Blowdryer`](https://javadoc.io/doc/com.diffplug/blowdryer/1.7.0/com/diffplug/blowdryer/Blowdryer.html)
233+
- [javadoc `BlowdryerSetup`](https://javadoc.io/doc/com.diffplug/blowdryer/1.7.0/com/diffplug/blowdryer/BlowdryerSetup.html)
234+
- [javadoc `BlowdryerSetup.PluginsBlock`](https://javadoc.io/doc/com.diffplug/blowdryer/latest/com/diffplug/blowdryer/BlowdryerSetup.PluginsBlock.html)
243235

244236
If you do `apply plugin: 'com.diffplug.blowdryer'` then every project gets an extension object ([code](https://github.com/diffplug/blowdryer/blob/master/src/main/java/com/diffplug/blowdryer/BlowdryerPlugin.java)) where the project field has been filled in for you, which is why we don't pass it explicitly in the examples before this section. If you don't apply the plugin, you can still call these static methods and pass `project` explicitly for the `proj()` methods.
245237

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
apply from: 干.file('base/changelog.gradle')
11-
apply from: 干.file('base/java8.gradle')
11+
apply from: 干.file('base/java.gradle')
1212
apply from: 干.file('spotless/freshmark.gradle')
1313
apply from: 干.file('spotless/java.gradle')
1414
apply from: 干.file('base/gradle-plugin.gradle')

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ maven_group=com.diffplug
44
license=apache
55
git_url=github.com/diffplug/blowdryer
66

7+
ver_java=8
78
javadoc_links=\
89
https://docs.oracle.com/javase/8/docs/api/ \
910
https://docs.gradle.org/6.0/javadoc/

0 commit comments

Comments
 (0)