aboutsummaryrefslogtreecommitdiff
path: root/spark-fabric/build.gradle
blob: 23ebf319ecd1605d333f8c56f1d5f08a344ff020 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import net.fabricmc.loom.task.RemapJarTask

plugins {
    id 'fabric-loom' version '1.1-SNAPSHOT'
    id 'com.github.johnrengelman.shadow' version '7.0.0'
}

tasks.withType(JavaCompile) {
    // override, compile targeting J17
    options.release = 17
}

repositories {
    maven { url 'https://maven.fabricmc.net/' }
    maven {
        url 'https://maven.nucleoid.xyz/'
        content {
            includeGroup('eu.pb4')
        }
    }
    mavenLocal()
}

configurations {
    shade
    implementation.extendsFrom shade
}

dependencies {
    // https://modmuss50.me/fabric.html
    minecraft 'com.mojang:minecraft:1.19.4'
    mappings 'net.fabricmc:yarn:1.19.4+build.1:v2'
    modImplementation 'net.fabricmc:fabric-loader:0.14.17'

    Set<String> apiModules = [
            "fabric-api-base",
            "fabric-command-api-v2",
            "fabric-lifecycle-events-v1"
    ]

    // Add each module as a dependency
    apiModules.forEach {
        modImplementation(fabricApi.module(it, '0.76.0+1.19.4'))
    }

    include(modImplementation('me.lucko:fabric-permissions-api:0.1-SNAPSHOT'))

    modImplementation('eu.pb4:placeholder-api:2.0.0-beta.4+1.19')

    shade project(':spark-common')
}

processResources {
    inputs.property 'version', project.version

    from(sourceSets.main.resources.srcDirs) {
        include 'fabric.mod.json'
        expand (
                'pluginVersion': project.pluginVersion,
                'pluginDescription': project.pluginDescription
        )
    }

    from(sourceSets.main.resources.srcDirs) {
        exclude 'fabric.mod.json'
    }
}

license {
    exclude '**/smap/SourceMap.java'
}

shadowJar {
    archiveFileName = "spark-fabric-${project.pluginVersion}-dev.jar"
    configurations = [project.configurations.shade]

    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 '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'
    relocate 'me.lucko.bytesocks.client', 'me.lucko.spark.lib.bytesocks'

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

    dependencies {
        exclude(dependency('org.ow2.asm::'))
    }
}

task remappedShadowJar(type: RemapJarTask) {
    dependsOn tasks.shadowJar
    input = tasks.shadowJar.archiveFile
    addNestedDependencies = true
    archiveFileName = "spark-${project.pluginVersion}-fabric.jar"
}

tasks.assemble.dependsOn tasks.remappedShadowJar

artifacts {
    archives remappedShadowJar
    shadow shadowJar
}