-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update gradle, buildscript, license. Add publish script, maven and mo…
…drinth publishing.
- Loading branch information
1 parent
7a23d8e
commit b8f1f52
Showing
10 changed files
with
535 additions
and
756 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
//file:noinspection GroovyAssignabilityCheck | ||
plugins { | ||
id 'fabric-loom' version '0.4-SNAPSHOT' | ||
id "com.matthewprenger.cursegradle" version "1.4.0" | ||
// Dependencies | ||
id 'fabric-loom' version '0.9-SNAPSHOT' | ||
// Mod Hosting Publish | ||
id 'com.matthewprenger.cursegradle' version '1.4.0' | ||
id 'com.modrinth.minotaur' version '1.1.0' | ||
// Maven Publish | ||
id 'maven-publish' | ||
id 'signing' | ||
id 'io.codearte.nexus-staging' version '0.30.0' | ||
} | ||
|
||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
|
@@ -10,79 +18,162 @@ archivesBaseName = project.archives_base_name | |
version = project.mod_version | ||
group = project.maven_group | ||
|
||
repositories { | ||
maven { | ||
name 'Cloth Config' | ||
url 'https://maven.shedaniel.me/' | ||
} | ||
maven { | ||
name 'Terraformers Backup' | ||
url 'https://raw.githubusercontent.com/TerraformersMC/Archive/main/releases/' | ||
} | ||
flatDir { dirs 'lib' } | ||
} | ||
|
||
dependencies { | ||
//to change the versions see the gradle.properties file | ||
minecraft "com.mojang:minecraft:${project.minecraft_version}" | ||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" | ||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" | ||
|
||
// Fabric API. This is technically optional, but you probably want it anyway. | ||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" | ||
|
||
modCompileOnly "dev.the-fireplace:Fireplace-Lib:${project.fireplacelib_version}:api" | ||
modRuntime "dev.the-fireplace:Fireplace-Lib:${project.fireplacelib_version}" | ||
|
||
compile "com.google.code.findbugs:jsr305:3.0.2" | ||
} | ||
|
||
repositories { | ||
//Auto config | ||
jcenter() | ||
compileOnly "com.google.code.findbugs:jsr305:3.0.2" | ||
} | ||
|
||
processResources { | ||
inputs.property "version", project.version | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
include "fabric.mod.json" | ||
filesMatching("fabric.mod.json") { | ||
expand "version": project.version | ||
} | ||
|
||
from(sourceSets.main.resources.srcDirs) { | ||
exclude "fabric.mod.json" | ||
} | ||
} | ||
|
||
// ensure that the encoding is set to UTF-8, no matter what the system default is | ||
// this fixes some edge cases with special characters not displaying correctly | ||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html | ||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = "UTF-8" | ||
it.options.release = 8 | ||
} | ||
|
||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task | ||
// if it is present. | ||
// If you remove this task, sources will not be generated. | ||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = "sources" | ||
from sourceSets.main.allSource | ||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
jar { | ||
from "LICENSE.md" | ||
from("LICENSE") { | ||
rename { "${it}_${project.archivesBaseName}"} | ||
} | ||
} | ||
|
||
curseforge { | ||
apiKey = project.hasProperty("curseForgeApiKey") ? project.curseForgeApiKey : "empty" | ||
project { | ||
id = '408081' | ||
changelog = file('changelog.txt') | ||
releaseType = 'release' | ||
addGameVersion '1.16.3' | ||
addGameVersion '1.16.2' | ||
addGameVersion '1.16.1' | ||
addGameVersion '1.16' | ||
addGameVersion '1.16-snapshot' | ||
addGameVersion '1.15.2' | ||
addGameVersion '1.14.4' | ||
addGameVersion 'Java 8' | ||
addGameVersion 'Fabric' | ||
mainArtifact(new File(new File(buildDir, "libs"), "$archivesBaseName-${version}.jar")) { | ||
displayName = "$archivesBaseName-$version" | ||
relations { | ||
requiredDependency 'fabric-api' | ||
if (hasProperty('curseForgeApiKey')) { | ||
curseforge { | ||
apiKey = curseForgeApiKey | ||
project { | ||
id = '408081' | ||
changelog = file('changelog.txt') | ||
releaseType = project.release_type | ||
addGameVersion project.minecraft_version | ||
addGameVersion '1.16.4' | ||
addGameVersion '1.16.3' | ||
addGameVersion '1.16.2' | ||
addGameVersion '1.16.1' | ||
addGameVersion '1.16' | ||
addGameVersion '1.16-Snapshot' | ||
addGameVersion '1.15.2' | ||
addGameVersion '1.14.4' | ||
addGameVersion 'Java 8' | ||
addGameVersion 'Fabric' | ||
mainArtifact(new File(new File(buildDir, "libs"), "$archivesBaseName-${version}.jar")) { | ||
displayName = "$archivesBaseName-$version" | ||
relations { | ||
requiredDependency 'fabric-api' | ||
} | ||
} | ||
} | ||
options { | ||
javaIntegration = false | ||
forgeGradleIntegration = false | ||
} | ||
} | ||
} | ||
|
||
import com.modrinth.minotaur.TaskModrinthUpload | ||
if (hasProperty('modrinthApiKey')) { | ||
task publishModrinth(type: TaskModrinthUpload) { | ||
token = modrinthApiKey | ||
projectId = '00000000' | ||
versionNumber = version | ||
versionName = project.mod_version | ||
uploadFile = new File(new File(buildDir, "libs"), "$archivesBaseName-${version}.jar") | ||
changelog = file('changelog.txt').getText() | ||
releaseType = project.release_type | ||
addGameVersion(project.minecraft_version as String) | ||
addGameVersion('1.16.4') | ||
addGameVersion('1.16.3') | ||
addGameVersion('1.16.2') | ||
addGameVersion('1.16.1') | ||
addGameVersion('1.16') | ||
addGameVersion('1.15.2') | ||
addGameVersion('1.14.4') | ||
addLoader('fabric') | ||
} | ||
} | ||
|
||
if (hasProperty('nexusUsername')) { | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
artifact(remapJar) { | ||
builtBy remapJar | ||
} | ||
artifact(sourcesJar) { | ||
builtBy remapSourcesJar | ||
} | ||
artifact javadocJar | ||
pom { | ||
name = 'Audiobook' | ||
packaging = 'jar' | ||
description = 'A client-side Minecraft mod that allows the system narrator to read books to you.' | ||
url = 'https://www.curseforge.com/minecraft/mc-mods/audiobook' | ||
|
||
scm { | ||
connection = "scm:svn:https://github.com/The-Fireplace-Minecraft-Mods/${project.github_slug}.git" | ||
developerConnection = "scm:svn:https://github.com/The-Fireplace-Minecraft-Mods/${project.github_slug}.git" | ||
url = "https://github.com/The-Fireplace-Minecraft-Mods/${project.github_slug}" | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'Mozilla Public License 2.0' | ||
url = 'https://www.mozilla.org/en-US/MPL/2.0/' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'the_fireplace' | ||
name = 'The_Fireplace' | ||
email = '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' | ||
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
credentials { | ||
username = nexusUsername | ||
password = nexusPassword | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign publishing.publications.mavenJava | ||
} | ||
options { | ||
javaIntegration = false | ||
forgeGradleIntegration = false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
./gradlew build curseforge publishModrinth publish closeAndReleaseRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters