aboutsummaryrefslogtreecommitdiff
path: root/api/build.gradle
blob: b0eeca7df71b520433999598aef20bd369cc6204 (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
import net.fabricmc.loom.task.RemapJarTask

archivesBaseName = rootProject.name + "-" + project.name

loom {
    accessWidenerPath = gradle.rootProject.project("fabric").file("src/main/resources/roughlyenoughitems.accessWidener")
}

dependencies {
    modCompileOnly("net.fabricmc:fabric-loader:${project.fabricloader_version}")
    modApi("me.shedaniel.cloth:cloth-config:${cloth_config_version}")
    modApi("dev.architectury:architectury:${architectury_version}")
}

architectury {
    common(platforms.split(","))
}

remapJar {
    archiveClassifier = "raw"
}

task fakeJar(type: Jar, dependsOn: remapJar) {
    from remapJar.archiveFile.map { zipTree(it) }
    from(rootProject.file("fake/fabric.mod.json")) {
        into ""
    }
    archiveClassifier = null
}

task fakeForgeJar(type: Jar, dependsOn: jar) {
    from jar.archiveFile.map { zipTree(it) }
    from(rootProject.file("fake/mods.toml")) {
        into "META-INF"
    }
    ["REIPlugin", "REIPluginClient", "REIPluginCommon", "REIPluginDedicatedServer",
     "REIPluginLoader", "REIPluginLoaderClient", "REIPluginLoaderCommon", "REIPluginLoaderDedicatedServer"].each {
        from(rootProject.file("fake/${it}.class")) {
            into "me/shedaniel/rei/forge"
        }
    }
    archiveClassifier = "fake-forge"
}

artifacts {
    apiElements(fakeJar)
    runtimeElements(fakeJar)
}

afterEvaluate {
    configurations.apiElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) }
    configurations.runtimeElements.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(tasks.remapJar) }
}

publishing {
    publications {
        mavenCommon(MavenPublication) {
            artifactId = rootProject.name + "-" + project.name
            from components.java
        }
    }
}