Skip to content

Commit 6d18de6

Browse files
committed
basic docs
1 parent ea153a2 commit 6d18de6

File tree

11 files changed

+212
-202
lines changed

11 files changed

+212
-202
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies {
1919
}
2020

2121
gradlePlugin {
22-
website.set("https://semantic-version.gradle.poolside.dev")
22+
website.set("https://github.com/countableSet/semantic-version-plugin")
2323
vcsUrl.set("https://github.com/countableSet/semantic-version-plugin")
2424

2525
plugins {

docs/README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!-- Generated with https://github.com/thlorenz/doctoc -->
2+
<!-- doctoc docs/README.md >
3+
4+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
5+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6+
**Table of Contents**
7+
8+
- [Change Log](#change-log)
9+
- [Usage](#usage)
10+
- [Auto mode](#auto-mode)
11+
- [Manual mode](#manual-mode)
12+
- [Gradle Version Requirement](#gradle-version-requirement)
13+
14+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
15+
16+
Gradle plugin to auto-increments the patch version on each call to the `publish` task by looking up the most recent version published in the publishing maven repository and adds it by one.
17+
18+
Tested to work in the following scenarios:
19+
20+
* Single root project publication
21+
* Single and multiple subprojects publication
22+
* BOM references via `api(platform(project(":bom")))` and `java-platform` plugin
23+
* Manual versioning, prevents the task from publishing if the version isn't different from the one in maven
24+
25+
![example](semantic-version-plugin.svg)
26+
27+
## Change Log
28+
29+
See [releases](https://github.com/countableSet/semantic-version-plugin/releases) for changes.
30+
31+
* 0.2.x compatible with Java 11
32+
** 0.2.0 set compatability to Java 11, bump dependency versions, and upgrade gradle to 8.1
33+
* 0.1.x compatible with Java 8
34+
** 0.1.5 fix bug when the plugin wasn't applying correct to root projects without jars
35+
** 0.1.4 fix bug when major or minor version was bump was computed incorrectly
36+
** 0.1.3 adds manual mode flag to skip publishing when artifact already exists
37+
** 0.1.2 fix bug with version finder
38+
** 0.1.1 unknown
39+
** 0.1.0 unknown
40+
41+
## Usage
42+
43+
[Plugins Portal](https://plugins.gradle.org/plugin/dev.poolside.gradle.semantic-version)
44+
45+
```kotlin
46+
plugins {
47+
`maven-publish`
48+
id("dev.poolside.gradle.semantic-version") version "{version}"
49+
}
50+
```
51+
52+
```sh
53+
$ ./gradlw publish
54+
[...]
55+
> Task :semanticVersion
56+
Resolved published version of 'dev.poolside.test:my-library:0.1.4' to '0.1.5'
57+
[...]
58+
```
59+
60+
### Auto mode
61+
62+
Basic full example, but it can also be used for subprojects and bom subprojects. However, make sure the publication version number is in the format of `[\d]+\.[\d]+`.
63+
64+
```kotlin
65+
plugins {
66+
java
67+
`maven-publish`
68+
id("dev.poolside.gradle.semantic-version") version "{version}"
69+
}
70+
repositories {
71+
mavenCentral()
72+
}
73+
74+
group = "dev.poolside.test"
75+
version = "0.1"
76+
77+
publishing {
78+
publications {
79+
create<MavenPublication>("mavenJava") {
80+
artifactId = "my-library"
81+
from(components["java"])
82+
}
83+
}
84+
}
85+
```
86+
87+
### Manual mode
88+
89+
If there's a scenario in which you want to manually increment the semantic version. Therefore, the plugin will disable publishing if the version already exists in the repository.
90+
91+
```kotlin
92+
semanticVersion {
93+
manual = true
94+
}
95+
```
96+
97+
## Gradle Version Requirement
98+
99+
The plugin now requires Gradle version 8.11+ to access new access.
100+
101+
```sh
102+
❯ gr semanticVersion
103+
> Task :client:semanticVersion FAILED
104+
105+
FAILURE: Build failed with an exception.
106+
107+
* What went wrong:
108+
Execution failed for task ':client:semanticVersion'.
109+
> org/gradle/api/internal/initialization/StandaloneDomainObjectContext
110+
111+
* Try:
112+
> Run with --stacktrace option to get the stack trace.
113+
> Run with --info or --debug option to get more log output.
114+
> Run with --scan to get full insights.
115+
> Get more help at https://help.gradle.org.
116+
117+
BUILD FAILED in 1s
118+
2 actionable tasks: 2 executed
119+
```

docs/antora.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/development.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<!-- Generated with https://github.com/thlorenz/doctoc -->
2+
<!-- doctoc docs/development.md >
3+
4+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
5+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
6+
**Table of Contents**
7+
8+
- [Development](#development)
9+
- [Gradle Plugin Publishing](#gradle-plugin-publishing)
10+
- [References](#references)
11+
- [General](#general)
12+
- [pom.withXml](#pomwithxml)
13+
14+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
15+
16+
## Development
17+
18+
[Gradle docs](https://docs.gradle.org/current/userguide/writing_plugins.html) on writing plugins.
19+
20+
Publish to mavenLocal
21+
22+
```sh
23+
❯ gr publishToMavenLocal
24+
25+
BUILD SUCCESSFUL in 5s
26+
11 actionable tasks: 8 executed, 3 up-to-date
27+
```
28+
29+
Add to `settings.gradle` file in client project and change the version `id 'dev.poolside.gradle.semantic-version' version '1.0.0'`
30+
31+
```groovy
32+
pluginManagement {
33+
repositories {
34+
mavenLocal()
35+
}
36+
}
37+
```
38+
39+
## Gradle Plugin Publishing
40+
41+
* [plugin docs](https://plugins.gradle.org/docs/publish-plugin-new)
42+
* [user account](https://plugins.gradle.org/u/poolside)
43+
44+
45+
It's easier to set up credentials via the login task then doing it manually in the gradle.properties file
46+
47+
```sh
48+
❯ gr login
49+
```
50+
51+
Then run the publishing task:
52+
53+
```sh
54+
❯ gr publishPlugins
55+
56+
> Task :publishPlugins
57+
Publishing plugin dev.poolside.gradle.semantic-version version 0.1.0
58+
Thank you. Your new plugin dev.poolside.gradle.semantic-version has been submitted for approval by Gradle engineers. The request should be processed within the next few days, at which point you will be contacted via email.
59+
Publishing artifact build/publications/pluginMaven/module.json
60+
Publishing artifact build/publications/pluginMaven/pom-default.xml
61+
Publishing artifact build/libs/semantic-version-plugin-0.1.0.jar
62+
Publishing artifact build/libs/semantic-version-plugin-0.1.0-sources.jar
63+
Publishing artifact build/libs/semantic-version-plugin-0.1.0-javadoc.jar
64+
Activating plugin dev.poolside.gradle.semantic-version version 0.1.0
65+
66+
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
67+
68+
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
69+
70+
See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
71+
72+
BUILD SUCCESSFUL in 5s
73+
10 actionable tasks: 7 executed, 3 up-to-date
74+
```
75+
76+
## References
77+
78+
Information that I found helpful when writing this plugin
79+
80+
### General
81+
82+
* https://github.com/nebula-plugins/nebula-publishing-plugin
83+
* [MavenResolvedDependenciesPlugin](https://github.com/nebula-plugins/nebula-publishing-plugin/blob/aee3fb093c622e7b7c9eb75cb6dc2838c2bcf340/src/main/groovy/nebula/plugin/publishing/maven/MavenResolvedDependenciesPlugin.groovy)
84+
* [editing pom info](https://stackoverflow.com/questions/20959558/in-gradle-how-can-i-generate-a-pom-file-with-dynamic-dependencies-resolved-to-t)
85+
86+
### pom.withXml
87+
88+
Editing groovy dom nodes/nodelists/etc is a pain in kotlin. I found these links helpful.
89+
90+
* [kotlinx.dom](https://github.com/Kotlin/kotlinx.dom/blob/0fe219d942047468b361dc0594f1c443ebcf26c3/src/main/kotlin/Dom.kt)
91+
* [kotlin-dsl-sample issue](https://github.com/gradle/kotlin-dsl-samples/issues/225)
92+
* [groovy example](https://github.com/nebula-plugins/nebula-publishing-plugin/blob/575b55c72151e0fae35c4aea69ff77ae8db57455/src/main/groovy/nebula/plugin/publishing/maven/MavenRemoveInvalidDependenciesPlugin.groovy)

docs/modules/ROOT/nav.adoc

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/modules/ROOT/pages/index.adoc

Lines changed: 0 additions & 112 deletions
This file was deleted.

docs/modules/research/nav.adoc

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/modules/research/pages/development.adoc

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)