Skip to content

Commit

Permalink
Merge branch '1.7.0.0-branch' into dependabot/gradle/net.fabricmc-spo…
Browse files Browse the repository at this point in the history
…nge-mixin-0.15.5mixin.0.8.7
  • Loading branch information
Gamebuster19901 authored Dec 7, 2024
2 parents 25198bd + a088473 commit 2ce81c4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 22 deletions.
75 changes: 56 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,70 @@ jar {
}
}

task sourcesJar(type: Jar) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}

tasks.build {
dependsOn sourcesJar
}

tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
exclude '**/license.txt'
exclude '**/license'
exclude '**/notice.txt'
exclude '**/notice'
finalizedBy sourcesJar
exclude '**/LICENSE.txt'
exclude '**/LICENSE'
exclude '**/NOTICE.txt'
exclude '**/NOTICE'
finalizedBy sourceJar
}

ext.mavenLocalUrl = repositories.mavenLocal().url.toString()

task sourceJar(type: Jar) {
from sourceSets.main.allSource
archiveClassifier.set('sources')
}

tasks.register('checkArtifactExists') {
doLast {
def repoUrl = project.hasProperty('mavenRepoUrl') ? project.mavenRepoUrl : mavenLocalUrl
def artifactPath = "${repoUrl}/${project.group.replace('.', '/')}/${project.archivesBaseName}/${project.version}/${project.archivesBaseName}-${project.version}.jar"
logger.lifecycle("Checking if artifact exists at: $artifactPath")

if (artifactPath.startsWith('file:/')) {
// Handle file URLs
def file = new File(new URI(artifactPath))
if (file.exists()) {
throw new IllegalStateException("Artifact '${project.group}:${project.archivesBaseName}:${project.version}' already exists. Publishing aborted.")
}
} else {
// Handle HTTP URLs
def url = new URL(artifactPath)
def connection = url.openConnection()
connection.setRequestMethod('HEAD')
if (connection.responseCode == 200) {
throw new IllegalStateException("Artifact '${project.group}:${project.archivesBaseName}:${project.version}' already exists. Publishing aborted.")
}
}
logger.lifecycle("Artifact does not exist, proceeding with publish.")
}
}

artifacts {
archives jar
archives sourcesJar
tasks.named('publish') {
dependsOn 'checkArtifactExists'
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
}
}
publications {
mavenJava(MavenPublication) {
from components.java
groupId = project.group
artifactId = project.archivesBaseName
version = project.version

// Attach sources JAR to the publication
artifact sourceJar
}
}

repositories {
maven {
url = uri(project.hasProperty('mavenRepoUrl') ? project.mavenRepoUrl : mavenLocalUrl) // Default to mavenLocal if no custom URL is provided
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
providerVersion = 1.5.0.3
providerVersion = 1.6.0.0
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
fabric_loader_version = "0.16.8"
fabric_loader_version = "0.16.9"
mixin_version = "0.15.5+"
asm_version = "9.7"
asm_version = "9.7.1"
commons_lang_version = "3.14.0"

[libraries]
Expand Down

0 comments on commit 2ce81c4

Please sign in to comment.