Skip to content

Commit

Permalink
apply spotless to everywhere. (#25)
Browse files Browse the repository at this point in the history
* spotless.

* apply format.

* format mroe.

* format more.
  • Loading branch information
portlek authored Jun 23, 2024
1 parent 1e966e6 commit b1699a2
Show file tree
Hide file tree
Showing 35 changed files with 546 additions and 324 deletions.
47 changes: 23 additions & 24 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
---
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
prerelease: true
template: |
# What's Changed
$CHANGES
categories:
- title: Breaking
label: breaking
- title: New
label: enhancement
- title: Bug Fixes
label: bug
- title: Maintenance
label: maintenance
- title: Documentation
label: documentation
- title: Dependency Updates
label: dependencies

- title: "Breaking"
label: "breaking"
- title: "New"
label: "enhancement"
- title: "Bug Fixes"
label: "bug"
- title: "Maintenance"
label: "maintenance"
- title: "Documentation"
label: "documentation"
- title: "Dependency Updates"
label: "dependencies"
version-resolver:
major:
labels:
- breaking
- "breaking"
minor:
labels:
- enhancement
- "enhancement"
patch:
labels:
- bug
- maintenance
- documentation
- dependencies
- security

- "bug"
- "maintenance"
- "documentation"
- "dependencies"
- "security"
exclude-labels:
- skip-changelog
- "skip-changelog"
58 changes: 27 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
name: Build

on:
---
name: "Build"
"on":
pull_request:
branches: [ master ]

branches:
- "master"
jobs:
build:
name: Build
runs-on: ubuntu-latest
name: "Build"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'

- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
chmod +x gradlew
./gradlew build
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "adopt"
java-version: "11"
- uses: "actions/cache@v4"
with:
path: "~/.gradle/caches"
key: "${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}"
restore-keys: |
${{ runner.os }}-gradle-
- uses: "actions/cache@v4"
with:
path: "~/.gradle/wrapper"
key: "${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}"
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
chmod +x gradlew
./gradlew build
24 changes: 12 additions & 12 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Update Changelog

on:
---
name: "Update Changelog"
"on":
push:
branches: [ master ]

branches:
- "master"
jobs:
changelog:
name: Update Changelog
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'skip-snapshot') }}
name: "Update Changelog"
runs-on: "ubuntu-latest"
if: "${{ !contains(github.event.head_commit.message, 'skip-snapshot') }}"
steps:
- uses: release-drafter/release-drafter@master
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: "release-drafter/release-drafter@master"
id: "release"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
57 changes: 27 additions & 30 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
name: Release
on:
---
name: "Release"
"on":
release:
types:
- released
- "released"
jobs:
build:
name: Release
runs-on: ubuntu-latest
name: "Release"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'

- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
[[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
chmod +x gradlew
./gradlew -Psign-required=true publish -Pversion="${{ github.event.release.tag_name }}" -PmavenCentralUsername="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PmavenCentralPassword="${{ secrets.MAVEN_CENTRAL_PASSWORD }}" -PsigningInMemoryKey="${{ secrets.GPG_PRIVATE_KEY_ARMORED }}" -PsigningInMemoryKeyPassword="${{ secrets.GPG_PASSPHRASE }}"
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "adopt"
java-version: "11"
- uses: "actions/cache@v4"
with:
path: "~/.gradle/caches"
key: "${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle.kts') }}"
restore-keys: |
${{ runner.os }}-gradle-
- uses: "actions/cache@v4"
with:
path: "~/.gradle/wrapper"
key: "${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}"
restore-keys: |
${{ runner.os }}-gradlew-
- run: |
[[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
chmod +x gradlew
./gradlew -Psign-required=true publish -Pversion="${{ github.event.release.tag_name }}" -PmavenCentralUsername="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PmavenCentralPassword="${{ secrets.MAVEN_CENTRAL_PASSWORD }}" -PsigningInMemoryKey="${{ secrets.GPG_PRIVATE_KEY_ARMORED }}" -PsigningInMemoryKeyPassword="${{ secrets.GPG_PASSPHRASE }}"
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
java
}
import net.infumia.gradle.spotless

subprojects {
apply<JavaPlugin>()
}
plugins { java }

subprojects { apply<JavaPlugin>() }

spotless()
9 changes: 3 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
plugins {
`kotlin-dsl`
}
plugins { `kotlin-dsl` }

repositories {
mavenCentral()
Expand All @@ -11,8 +9,7 @@ dependencies {
implementation(libs.nexus.plugin)
implementation(libs.kotlin.plugin)
implementation(libs.dokka.plugin)
implementation(libs.spotless.plugin)
}

kotlin {
jvmToolchain(11)
}
kotlin { jvmToolchain(11) }
6 changes: 1 addition & 5 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }
}
32 changes: 14 additions & 18 deletions buildSrc/src/main/kotlin/net/infumia/gradle/common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.*
import org.jetbrains.dokka.gradle.DokkaPlugin

fun Project.applyCommon(
javaVersion: Int = 8,
sources: Boolean = true,
javadoc: Boolean = true
) {
fun Project.applyCommon(javaVersion: Int = 8, sources: Boolean = true, javadoc: Boolean = true) {
apply<JavaPlugin>()

if (name.contains("kotlin")) {
Expand All @@ -23,25 +19,25 @@ fun Project.applyCommon(
repositories.mavenCentral()

extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion = JavaLanguageVersion.of(javaVersion)
}
toolchain { languageVersion = JavaLanguageVersion.of(javaVersion) }
}

if (javadoc) {
val javadocJar by tasks.creating(Jar::class) {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(javadoc)
}
val javadocJar by
tasks.creating(Jar::class) {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(javadoc)
}
}

if (sources) {
val sourceSets = extensions.getByType<JavaPluginExtension>().sourceSets
val sourcesJar by tasks.creating(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
val sourcesJar by
tasks.creating(Jar::class) {
dependsOn("classes")
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
}
}
Loading

0 comments on commit b1699a2

Please sign in to comment.