Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR Publication 1.20.6 #1

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/

# Repos
/repo
/snapshot

### IntelliJ IDEA ###
.idea

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Minecraft Dependencies for Gradle

Creates Gradle module metadata files to enable depending on the libraries used by a
specific version of Minecraft.

Pass `-PminecraftVersion=` to run this for a specific version of Minecraft.

28 changes: 11 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
id 'de.undercouch.download'
id 'maven-publish'
id 'net.neoforged.gradleutils' version '3.0.0-alpha.13'
}

repositories {
mavenCentral()
}


import groovy.json.JsonSlurper
import net.neoforged.minecraftdependencies.*

Expand All @@ -33,19 +33,6 @@ tasks.register('downloadJson', DownloadWithVersion) {
quiet true
}

tasks.register('downloadClientJar', DownloadWithVersion) {
dependsOn tasks.downloadJson
def versionJson = tasks.downloadJson.dest
inputs.file versionJson
src {
new JsonSlurper().parse(versionJson).downloads.client.url
}
dest layout.buildDirectory.file(moduleVersion.map { "versions/$it/client.jar"})
useETag 'all'
onlyIfModified true
quiet true
}

tasks.register('downloadServerJar', DownloadWithVersion) {
dependsOn tasks.downloadJson
def versionJson = tasks.downloadJson.dest
Expand All @@ -61,11 +48,9 @@ tasks.register('downloadServerJar', DownloadWithVersion) {

tasks.register('makeModuleMetadata', GenerateModuleMetadata) {
dependsOn tasks.downloadJson
dependsOn tasks.downloadClientJar
dependsOn tasks.downloadServerJar

meta = tasks.downloadJson.dest
clientJar = tasks.downloadClientJar.dest
serverJar = tasks.downloadServerJar.dest

moduleGroup = project.group
Expand All @@ -81,6 +66,7 @@ def moduleMetadataArtifact = artifacts.add('moduleMetadata', tasks.makeModuleMet
builtBy tasks.makeModuleMetadata
}

import net.neoforged.gradleutils.GradleUtils
publishing {
publications {
timed(MavenPublication) {
Expand All @@ -94,6 +80,14 @@ publishing {
elem.insertBefore(comment, elem.getFirstChild())
}
}
repositories {
maven(GradleUtils.setupSnapshotCompatiblePublishing(
project.providers.gradleProperty('minecraftVersion'),
'https://maven.neoforged.net/mojang-meta/',
file('repo'),
file('snapshot')
))
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ abstract class GenerateModuleMetadata extends DefaultTask implements HasMinecraf
@PathSensitive(PathSensitivity.NONE)
abstract RegularFileProperty getServerJar()

@InputFile
@PathSensitive(PathSensitivity.NONE)
abstract RegularFileProperty getClientJar()

@Input
abstract Property<String> getModuleGroup()

Expand Down
Loading