Skip to content

Commit

Permalink
More work on conventions plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Mar 26, 2024
1 parent d449bf2 commit c8b3843
Show file tree
Hide file tree
Showing 39 changed files with 1,630 additions and 1,738 deletions.
40 changes: 0 additions & 40 deletions .github/dependabot.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
"restore-keys": "${{ runner.os }}-gradle-"
},
"name": "Cache",
"uses": "actions/cache/restore@v3"
"uses": "actions/cache/restore@v4"
},
{
"with": {
"cache-read-only": true,
"gradle-home-cache-cleanup": true
},
"name": "Setup Gradle",
"uses": "gradle/gradle-build-action@v2"
"uses": "gradle/gradle-build-action@v3"
},
{
"name": "Build",
"run": "./gradlew checkLicenses build",
"run": "./gradlew build",
"id": "build",
"env": {
"PR_NUMBER": "${{ github.event.pull_request.number }}"
Expand Down
83 changes: 64 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"jobs": {
"build": {
"outputs": {
"version": "${{ steps.record_version_capture_version.outputs.version }}"
},
"runs-on": "ubuntu-22.04",
"permissions": {
"contents": "write"
Expand All @@ -24,14 +27,14 @@
"restore-keys": "${{ runner.os }}-gradle-"
},
"name": "Cache",
"uses": "actions/cache@v3"
"uses": "actions/cache@v4"
},
{
"with": {
"gradle-home-cache-cleanup": true
},
"name": "Setup Gradle",
"uses": "gradle/gradle-build-action@v2"
"uses": "gradle/gradle-build-action@v3"
},
{
"uses": "fregante/setup-git-user@v2"
Expand All @@ -43,43 +46,85 @@
"env": {
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}",
"RELEASE_MAVEN_PASSWORD": "${{ secrets.RELEASE_MAVEN_PASSWORD }}",
"RELEASE_MAVEN_USER": "github",
"RELEASE_MAVEN_URL": "https://maven.lukebemish.dev/releases/",
"CURSEFORGE_KEY": "${{ secrets.CURSEFORGE_KEY }}",
"MODRINTH_KEY": "${{ secrets.MODRINTH_KEY }}"
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}"
}
},
{
"name": "Build",
"run": "./gradlew checkLicenses build",
"run": "./gradlew build",
"id": "build",
"env": {
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}",
"RELEASE_MAVEN_PASSWORD": "${{ secrets.RELEASE_MAVEN_PASSWORD }}",
"RELEASE_MAVEN_USER": "github",
"RELEASE_MAVEN_URL": "https://maven.lukebemish.dev/releases/",
"CURSEFORGE_KEY": "${{ secrets.CURSEFORGE_KEY }}",
"MODRINTH_KEY": "${{ secrets.MODRINTH_KEY }}"
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}"
}
},
{
"run": "git push && git push --tags"
},
{
"name": "Record Version",
"run": "./gradlew recordVersion",
"id": "record_version",
"env": {
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}"
}
},
{
"name": "Capture Recorded Version",
"run": "echo version=$(cat build/recordVersion.txt) >> \"$GITHUB_OUTPUT\"",
"id": "record_version_capture_version"
}
]
},
"publish": {
"needs": [
"build"
],
"runs-on": "ubuntu-22.04",
"steps": [
{
"name": "Setup Java",
"run": "echo \"JAVA_HOME=$JAVA_HOME_17_X64\" >> \"$GITHUB_ENV\""
},
{
"with": {
"fetch-depth": "0",
"ref": "refs/tags/${{needs.build.outputs.version}}",
"persist-credentials": "false"
},
"name": "Checkout",
"uses": "actions/checkout@v4"
},
{
"with": {
"path": "**/.gradle/loom-cache",
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}",
"restore-keys": "${{ runner.os }}-gradle-"
},
"name": "Cache",
"uses": "actions/cache/restore@v4"
},
{
"with": {
"cache-read-only": true,
"gradle-home-cache-cleanup": true
},
"name": "Setup Gradle",
"uses": "gradle/gradle-build-action@v3"
},
{
"name": "Publish",
"run": "./gradlew publish",
"run": "./gradlew publish closeAndReleaseSonatypeStagingRepository",
"id": "publish",
"env": {
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}",
"RELEASE_MAVEN_PASSWORD": "${{ secrets.RELEASE_MAVEN_PASSWORD }}",
"RELEASE_MAVEN_USER": "github",
"RELEASE_MAVEN_URL": "https://maven.lukebemish.dev/releases/",
"SONATYPE_PASSWORD": "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USER": "${{ secrets.SONATYPE_USER }}",
"CURSEFORGE_KEY": "${{ secrets.CURSEFORGE_KEY }}",
"MODRINTH_KEY": "${{ secrets.MODRINTH_KEY }}"
}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
"restore-keys": "${{ runner.os }}-gradle-"
},
"name": "Cache",
"uses": "actions/cache/restore@v3"
"uses": "actions/cache/restore@v4"
},
{
"with": {
"cache-read-only": true,
"gradle-home-cache-cleanup": true
},
"name": "Setup Gradle",
"uses": "gradle/gradle-build-action@v2"
"uses": "gradle/gradle-build-action@v3"
},
{
"name": "Build",
"run": "./gradlew checkLicenses build",
"run": "./gradlew build",
"id": "build",
"env": {
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
Expand Down
63 changes: 16 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
plugins {
alias libs.plugins.quilt.licenser apply false
alias libs.plugins.mdg.plugin
alias libs.plugins.managedversioning
alias libs.plugins.mdg apply false
alias cLibs.plugins.managedversioning
alias libs.plugins.architectury.loom apply false
}

managedVersioning {
versionFile.set rootProject.file('version.properties')
versionFile.set project.file('version.properties')
metadataVersion.set libs.versions.minecraft
versionPRs()
versionSnapshots()
Expand All @@ -19,7 +18,7 @@ managedVersioning {
gradleJob {
buildCache()
name.set 'build'
gradlew 'Build', 'checkLicenses', 'build'
gradlew 'Build', 'build'
gradlew 'Publish', 'publish'
mavenSnapshot('github')
}
Expand All @@ -35,12 +34,19 @@ managedVersioning {
}
readOnly.set false
gradlew 'Tag Release', 'tagRelease'
gradlew 'Build', 'checkLicenses', 'build'
gradlew 'Build', 'build'
step {
run.set 'git push && git push --tags'
}
gradlew 'Publish', 'publish'
mavenRelease('github')
recordVersion 'Record Version', 'version'
}
gradleJob {
buildCache()
name.set 'publish'
needs.add('build')
tag.set('${{needs.build.outputs.version}}')
gradlew 'Publish', 'publish', 'closeAndReleaseSonatypeStagingRepository'
mavenCentral()
modPublishing()
}
}
Expand All @@ -49,7 +55,7 @@ managedVersioning {
pullRequest.set(true)
gradleJob {
name.set 'build'
gradlew 'Build', 'checkLicenses', 'build'
gradlew 'Build', 'build'
gradlew 'Publish', 'publish'
pullRequestArtifact()
}
Expand Down Expand Up @@ -80,41 +86,4 @@ artifacts {
add 'license', file("LICENSE")
}

modsDotGroovy {
dslVersion = libs.versions.mdg.dsl.get()
platform 'multiloader'
multiloader {
forge = [project(":neoforge")]
fabric = [project(":fabriquilt")]
quilt = []
}
}

subprojects { p ->
apply plugin: 'maven-publish'
apply plugin: 'java-library'
apply plugin: libs.plugins.quilt.licenser.get().pluginId

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()
java.withJavadocJar()

license {
rule rootProject.file('header.txt')
exclude '**/*.mcmeta'
exclude '**/package-info.java'
}

jar {
manifest {
attributes([
'Implementation-Commit-Time': managedVersioning.timestamp.get(),
'Implementation-Commit': managedVersioning.hash.get()
])
}
}

managedVersioning.publishing.mavenPullRequest(publishing)
managedVersioning.publishing.mavenSnapshot(publishing)
managedVersioning.publishing.mavenRelease(publishing)
}
managedVersioning.publishing.mavenCentral()
6 changes: 5 additions & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
id 'groovy-gradle-plugin'
alias cLibs.plugins.conventions.buildsrc
}

dependencies {
implementation cLibs.conventions.java
}
13 changes: 13 additions & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pluginManagement {
repositories {
maven {
name = "Luke's Maven"
url = 'https://maven.lukebemish.dev/releases'
}
gradlePluginPortal()
}
}

plugins {
id 'dev.lukebemish.conventions'
}
6 changes: 6 additions & 0 deletions buildSrc/src/main/groovy/convention.consumer.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,9 @@ tasks.named("sourcesJar", Jar) {
dependsOn(configurations.commonResources)
from(configurations.commonResources)
}

['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each {
configurations."$it".outgoing {
capability("$group:$artifact_id-common:$version")
}
}
Loading

0 comments on commit c8b3843

Please sign in to comment.