Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.gradle.internal.os.OperatingSystem
- plugins {
- id 'fabric-loom' version '0.2.0-SNAPSHOT'
- }
- apply plugin: 'maven'
- sourceCompatibility = targetCompatibility = 1.8
- def getVersionFromJava() {
- def ver = 0.0, patch = 0
- def versionClass = file("src/main/java/me/deftware/client/framework/FrameworkConstants.java").text
- (versionClass =~ ~/double\s+([_a-zA-Z\u0024][_a-zA-Z0-9\u0024]*)\s+=\s+(([0-9]+)\.([0-9]+))/).each {
- ver = it[2]
- }
- (versionClass =~ ~/int\s+([_a-zA-Z$][_a-zA-Z0-9$]*)\s+=\s+([0-9]+)/).each {
- if (it[1].toString() == "PATCH") {
- patch = it[2]
- }
- }
- return "${ver}.${patch}".toString()
- }
- def minecraftRoot = System.getenv('APPDATA') + "/.minecraft"
- if (OperatingSystem.current().isMacOsX()) {
- minecraftRoot = System.getenv('HOME') + "/Library/Application Support/minecraft"
- }
- def mcVersion = "${project.minecraftVersion}"
- def mappingsVer = "${mcVersion}${project.mappingsVer}"
- archivesBaseName = "EMC"
- version = getVersionFromJava()
- repositories {
- mavenCentral()
- }
- dependencies {
- minecraft "com.mojang:minecraft:${mcVersion}"
- mappings "net.fabricmc:yarn:${mappingsVer}"
- modCompile "net.fabricmc:fabric-loader:0.4.4+build.139"
- //compile files("${minecraftRoot}/versions/1.13.2/1.13.2.jar")
- }
- //noinspection GroovyAssignabilityCheck
- task createPom {
- doLast {
- pom {
- //noinspection GroovyAssignabilityCheck
- project {
- groupId "me.deftware"
- artifactId "EMC-F"
- version "${version}-${mcVersion}"
- }
- }.writeTo("maven/me/deftware/EMC-F/${version}-${mcVersion}/EMC-F-${version}-${mcVersion}.pom")
- }
- }
- //noinspection GroovyAssignabilityCheck
- task generateApiDocumentation(type: Javadoc) {
- source = ['src/main/java/me/deftware/client']
- title = "EMC Framework Documentation"
- destinationDir = file("docs")
- failOnError false
- }
- //noinspection GroovyAssignabilityCheck
- task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- from sourceSets.main.allSource
- }
- //noinspection GroovyAssignabilityCheck
- task copyBuilds(type: Copy) {
- from "$rootDir/build/libs/EMC-${version}.jar"
- into "$rootDir/maven/me/deftware/EMC-F/${version}-${mcVersion}/"
- rename { String fileName ->
- fileName.replace("${version}", "${version}-${mcVersion}").replace("EMC", "EMC-F")
- }
- doLast {
- project.ant.checksum(file: "$rootDir/maven/me/deftware/EMC-F/${version}-${mcVersion}/EMC-F-${version}-${mcVersion}.jar", algorithm: "sha1", todir: "$rootDir/maven/me/deftware/EMC-F/${version}-${mcVersion}/")
- }
- }
- //noinspection GroovyAssignabilityCheck
- task copyToMinecraft(type: Copy) {
- from "$rootDir/build/libs/EMC-${version}.jar"
- into "${minecraftRoot}/libraries/me/deftware/EMC-F/${version}-${mcVersion}/"
- rename { String fileName ->
- fileName.replace("${version}", "${version}-${mcVersion}").replace("EMC", "EMC-F")
- }
- }
- build.dependsOn(createPom)
- build.finalizedBy(copyBuilds)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement