summaryrefslogtreecommitdiff
path: root/forgewrapper/build.gradle
blob: 244e0555aed8ac1b4849e46fc2cf3df911533b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import java.text.SimpleDateFormat

plugins {
    id "java"
    id "eclipse"
    id "maven-publish"
}

sourceCompatibility = targetCompatibility = 1.8
compileJava {
    sourceCompatibility = targetCompatibility = 1.8
}

version = "${fw_version}${-> getVersionSuffix()}"
group = "io.github.zekerzhayard"
archivesBaseName = rootProject.name

configurations {
    multirelase {
        implementation.extendsFrom multirelase
    }
}

repositories {
    mavenCentral()
    maven {
        name = "forge"
        url = "https://maven.minecraftforge.net/"
    }
}

dependencies {
    compileOnly "com.google.code.gson:gson:2.8.7"
    compileOnly "cpw.mods:modlauncher:8.0.9"
    compileOnly "net.minecraftforge:installer:2.2.7"
    compileOnly "net.sf.jopt-simple:jopt-simple:5.0.4"

    multirelase project(":jigsaw")
}

java {
    withSourcesJar()
}

jar {
    manifest.attributes([
        "Specification-Title": "${project.name}",
        "Specification-Vendor": "ZekerZhayard",
        "Specification-Version": "${project.version}".split("-")[0],
        "Implementation-Title": "${project.name}",
        "Implementation-Version": "${project.version}",
        "Implementation-Vendor" :"ZekerZhayard",
        "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
        "Automatic-Module-Name": "${project.group}.${project.archivesBaseName}".toString().toLowerCase(),
        "Multi-Release": "true",
        "GitCommit": String.valueOf(System.getenv("GITHUB_SHA"))
    ])

    into "META-INF/versions/9", {
        from configurations.multirelase.files.collect {
            zipTree(it)
        }
        exclude "META-INF/**"
    }
}

publishing {
    publications {
        maven(MavenPublication) {
            groupId "${project.group}"
            artifactId "${project.archivesBaseName}"
            version "${project.version}"

            from components.java
        }
    }
    repositories {
        maven {
            url = layout.buildDirectory.dir("maven")
        }
    }
}
tasks.publish.dependsOn build

static String getVersionSuffix() {
    if (System.getenv("IS_PUBLICATION") != null || System.getenv("GITHUB_ACTIONS") == "true")
        return new SimpleDateFormat("-yyyy-MM-dd").format(new Date())

    return "-LOCAL"
}