Skip to content

Commit 8f2c6a2

Browse files
committed
Update to README
1 parent 657f7e2 commit 8f2c6a2

File tree

1 file changed

+106
-31
lines changed

1 file changed

+106
-31
lines changed

README.adoc

Lines changed: 106 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,120 @@
33
// TODO: we should not attach descendent nested build task if there is no system property flags
44
// TODO: Support older values as well (USE_NOKEE_VERSION, use-nokee-version, wrapper system property as well) with warning
55

6-
== Nokee version provider
6+
= Nokee Deep Integration with Gradle
77

8-
The init plugins will source the Nokee version from various places:
9-
1- (persistant) From within `buildSrc` or included build -> useful when building plugins against Nokee API
8+
To ensure an exceptional integration of the Nokee plugins with Gradle, we use an init script.
9+
Init script -> bootstrap (least work possible) (local project or system-wide)
10+
Init plugin -> deep gradle integration, version detection, repository configuration, wrapper enhancement (later build-init templates).
11+
Nokee plugins -> profits
12+
13+
A project is said to be Nokee enabled if a Nokee version is detected, see section on nokee version detection.
14+
15+
== Usage
16+
17+
Copy the init script to your home `~/.gradle/init.d` directory.
18+
You can also use the script via command line using `--init-script` (or `-I`). (less preferable)
19+
20+
== Tasks
21+
22+
=== Nokee Task
23+
entry point for querying information.
24+
Use CLI flag to control it's behaviour and query.
25+
See Nokee task CLI flags.
26+
27+
--show-help::
28+
Print helpful information on what the `nokee` task can do for you.
29+
30+
--show-version (`-Dshow-version`)::
31+
Show the Nokee version detected for the build.
32+
Due to a limitation in Gradle, use the System property flag alternative `-Dshow-version` to query the Nokee version of included builds.
33+
34+
--use-version::
35+
Write a temporary version file to use instead of the version provided inside the `gradle-wrapper.properties`.
36+
See version detection priority for more information.
37+
38+
=== Wrapper Task
39+
The init plugin will patch the Wrapper task to allow for additional wrapper task configuration.
40+
It does three additional things after the wrapper task finish executing if it detects Nokee usage:
41+
1- Writes the nokee.init.script to the project (by default in `gradle/nokee.init.gradle`
42+
2- Patches the wrapper scripts to implicitly pass the init script writen at one on every invocation using `--init-script` flag
43+
3- Adds configured Nokee version to the `gradle-wrapper.properties` file.
44+
45+
We add an extension named `nokee` that control the wrapper enhancement:
46+
47+
version::
48+
Configure to the version to use. This version will be writen to the wrapper properties.
49+
By default the version is set to what we detected according to version detection (see section)
50+
The Nokee version to use can be overridden using the `nokee-version` system property or Gradle property.
51+
+
52+
For example: `$ ./gradlew wrapper -Dnokee-version=0.4.0` will generate a wrapper using Nokee version 0.4.0 by writing the version into the `gradle-wrapper.properties` file.
53+
Upon the next execution, the version will be considered according to the version detection order (see section).
54+
55+
initScriptFile::
56+
Location where to write the nokee.init.gradle file, defaults to `gradle/nokee.init.gradle`.
57+
58+
NOTE:
1059
```
11-
dependencies {
12-
implementation platform('dev.nokee:nokee-gradle-plugins:0.4.0')
13-
}
60+
'""' is not recognized as an internal or external command,
61+
operable program or batch file.
1462
```
15-
2- (persistant) From settings `buildscript`:
16-
settings.gradle[.kts]
63+
64+
65+
== Nokee version detection
66+
67+
The init plugin will source the Nokee version from these various location, _the first one wins_:
68+
69+
1- Included plugin build runtime classpath (e.g. `buildSrc` or any plugin's `includeBuild`).
70+
Typically, in used when building convention plugins against the Nokee API.
71+
For example:
1772
```
18-
buildscript {
19-
repositories {
20-
jcenter()
21-
maven { url = 'https://repo.nokeedev.net/release' }
22-
}
23-
dependencies {
24-
classpath platform('dev.nokee:nokee-gradle-plugins:0.4.0')
25-
}
73+
plugins {
74+
id 'dev.gradleplugins.java-gradle-plugin'
75+
}
76+
77+
dependencies {
78+
implementation platform('dev.nokee:nokee-gradle-plugins:0.4.0')
2679
}
2780
```
2881

29-
3- System property `nokee-version`, i.e.
30-
- *nix/windows `./gradlew -Dnokee-version=0.4.0 nokee --show-version`
31-
4- Gradle property `nokee-version`, i.e
32-
- *nix/windows `./gradlew -Pnokee-version=0.4.0 nokee --show-version`
33-
- Works as Gradle property envionment variable: `ORG_GRADLE_PROJECT_nokee-version` (but prefer `NOKEE_VERSION` environment variable, it's shorter ;-) )
34-
5- (user persistant) Environment variable `NOKEE_VERSION`, i.e.
35-
- *nix: `NOKEE_VERSION=0.4.0 ./gradlew nokee --show-version`
82+
2- System property `nokee-version`, i.e. `./gradlew -Dnokee-version=0.4.0 nokee --show-version`.
83+
84+
WARNING: Avoid setting this value in your global `gradle.properties`.
85+
86+
3- Gradle property `nokee-version`, i.e. `./gradlew -Pnokee-version=0.4.0 nokee --show-version`.
87+
88+
WARNING: Avoid setting this value in your global `gradle.properties`.
89+
90+
NOTE: Prefer `NOKEE_VERSION` environment variable to Gradle's long form property setting through environment variable, e.g. `ORG_GRADLE_PROJECT_nokee-version`. It's shorter.
91+
92+
4- Environment variable `NOKEE_VERSION`, i.e.
93+
3694
- *nix:
3795
```
3896
$ export NOKEE_VERSION=0.4.0
3997
$ ./gradlew nokee --show-version
4098
```
99+
41100
- Windows:
42101
```
43102
> set NOKEE_VERSION=0.4.0
44103
> gradlew nokee --show-version
45104
```
46-
6- (temporary) Cache file
47-
7- (persistant) Gradle wrapper properties: `gradle/wrapper/gradle-wrapper.properties`, value: `nokeeVersion=0.4.0`
48-
49105

106+
5- Temporary version file, i.e. `./gradlew nokee --use-version=0.4.0` (or manually via `echo "0.4.0" > .gradle/nokee-version.txt`)
50107

108+
6- Gradle wrapper properties, e.g. `nokeeVersion` property in `gradle/wrapper/gradle-wrapper.properties`.
51109

52110
== Deprecation notice
111+
Previous Nokee init plugins were using slightly different System/Gradle property, environment variable, and file names.
112+
Please use the official names mentioned in the version detection section.
53113
Previous values are deprecated and should no longer be used:
54-
- use-nokee-version System/Gradle property use nokee-version instead
55-
- USE_NOKEE_VERSION environment variable use NOKEE_VERSION instead
56-
- .gradle/use-nokee-version.txt cache file use .gradle/nokee-version.txt
114+
- Instead of `use-nokee-version` System/Gradle property use `nokee-version`,
115+
- Instead of `USE_NOKEE_VERSION` environment variable use `NOKEE_VERSION`, and
116+
- Instead of `.gradle/use-nokee-version.txt` cache file use `.gradle/nokee-version.txt`.
57117

58-
59-
useNokeeVersionFromWrapper was included in Gradle wrapper, just regenerate the wrapper
118+
Previous Nokee init plugins were injecting the Nokee version as a System property (e.g. `useNokeeVersionFromWrapper`) directly inside the generated wrapper.
119+
To migrate, simply regenerate the Gradle wrapper: `./gradlew wrapper`
60120

61121
[[bintray-deprecation]]
62122
== Bintray deprecation
@@ -67,3 +127,18 @@ We are committed to offering our plugins without interruption.
67127
We already migrated all of our artifacts to our repositories.
68128
Unfortunately, the Nokee init plugin does not yet provide auto-updating functionally for the init bootstrapping script.
69129
You will need to use the link:nokee.init.gradle[latest version].
130+
131+
[[runtime-conflict]]
132+
== Runtime Plugin Conflict
133+
Under unfortunate circumstance, Gradle can end up appling multiple distinct Nokee init plugins.
134+
We try our best to recover from such scenario by soft-disabling the extra plugins.
135+
However, in some scenarios, it may not be possible to disalbe the extra plugins which will most likely result in a runtime failure.
136+
It is important to solve this issue by updating all Nokee init script to its link:nokee.init.gradle[latest version].
137+
138+
[[troubleshooting]]
139+
== Troubleshooting
140+
141+
We try our best to workaround possible failure cases.
142+
However, usage in the wild my differ from the use cases we test in our labs.
143+
Before opening an issue, please try upgrading all Nokee init script to its link:nokee.init.gradle[latest version].
144+
If the upgrade doesn't solve your issue, please link:https://github.com/nokeedev/init.nokee.dev/issues[open a new issue], and we will fix it for everyone.

0 commit comments

Comments
 (0)