aboutsummaryrefslogtreecommitdiff
path: root/spark-forge/build.gradle
blob: 98b70d4c11a698bf0cabc72425afba1b889cebd7 (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
buildscript {
    repositories {
        maven { url = "https://files.minecraftforge.net/maven" }
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
    }
}

plugins {
    id 'com.github.johnrengelman.shadow' version '7.0.0'
}

apply plugin: 'net.minecraftforge.gradle'

compileJava {
    // override, compile targeting J16
    options.compilerArgs.removeAll(['--release', '8'])
    options.compilerArgs.addAll(['--release', '16'])
}

minecraft {
    mappings channel: 'official', version: '1.17.1'
    accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
}

configurations {
    shade
    implementation.extendsFrom shade
}

dependencies {
    minecraft 'net.minecraftforge:forge:1.17.1-37.0.1'
    shade project(':spark-common')
}

processResources {
    from(sourceSets.main.resources.srcDirs) {
        include 'META-INF/mods.toml'
        expand (
                'pluginVersion': project.pluginVersion,
                'pluginDescription': project.pluginDescription
        )
    }

    from(sourceSets.main.resources.srcDirs) {
        exclude 'META-INF/mods.toml'
    }
}

shadowJar {
    archiveName = 'spark-forge.jar'
    configurations = [project.configurations.shade]

    relocate 'okio', 'me.lucko.spark.lib.okio'
    relocate 'okhttp3', 'me.lucko.spark.lib.okhttp3'
    relocate 'net.kyori.adventure', 'me.lucko.spark.lib.adventure'
    relocate 'net.kyori.examination', 'me.lucko.spark.lib.adventure.examination'
    relocate 'net.bytebuddy', 'me.lucko.spark.lib.bytebuddy'
    relocate 'org.tukaani.xz', 'me.lucko.spark.lib.xz'
    relocate 'com.google.protobuf', 'me.lucko.spark.lib.protobuf'
    relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm'
    relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler'

    exclude 'module-info.class'
    exclude 'META-INF/maven/**'
    exclude 'META-INF/proguard/**'
}

artifacts {
    archives shadowJar
    shadow shadowJar
}

reobf {
    shadowJar {
        dependsOn createMcpToSrg
        mappings = createMcpToSrg.outputs.files.singleFile
    }
}