-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
160 lines (138 loc) · 5.23 KB
/
build.gradle
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.0.9'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50"
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'idea'
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: 'kotlin'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
version = "1.1.3"
group = "me.yrf.mcmods" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "capabilityadapter"
ext.kotlin_version = '1.3.50'
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.5.2768"
runDir = "run"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "stable_39"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
repositories {
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "Local"
url = "dependencies"
}
maven { url = "http://maven.cil.li/" }
maven {
name = "CurseMaven"
url = "https://cursemaven.com"
}
maven {
name "Modmaven"
url "https://modmaven.dev/"
}
jcenter()
maven {
url "http://maven.shadowfacts.net/"
}
}
configurations {
embed
compile.extendsFrom embed
}
dependencies {
compile 'net.shadowfacts:Forgelin:1.8.4'
deobfCompile 'curse.maven:ae2-applied-energistics-2:2747063'
compileOnly 'appeng:appliedenergistics2:rv6-stable-7:api'
compileOnly "li.cil.oc:OpenComputers:MC1.12.1-1.7.0.+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
from(sourceSets.main.allSource.srcDirs) {
include 'me/yrf/mcmods/capadapter/Constants.java'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task generateMetaFiles {
// Code for execution after the whole buildscript was parsed and loaded
doLast {
// Clear the dependencyMeta directory since we don't want old dependencies to still be listed in there
file("${buildDir}/dependencyMeta/").deleteDir()
configurations.embed.resolvedConfiguration.resolvedArtifacts.each {
// Create a meta file for each dependency in a specified directory
def metaFile = file("${buildDir}/dependencyMeta/${it.file.name}.meta")
metaFile.parentFile.mkdirs()
// Use the Gradle notation provided by the API ('group:artifact:version') for the meta file...
def artifactRef = it.moduleVersion.toString()
// ...and append the classifier if present
if (it.classifier != null) {
artifactRef += ":${it.classifier}"
}
// Write the artifact information to the meta file, to be used by the
metaFile.text = "Maven-Artifact: $artifactRef"
}
}
}
// Use the standard JAR task as container for the main jar and the contained dependencies (from the embed configuration)
jar {
into('/META-INF/libraries/') {
// Add all of the dependency JARs to the main JAR for later extraction
from configurations.embed
// Also include all dependency meta files
from "${buildDir}/dependencyMeta/"
}
manifest {
// The crucial manifest attribute: Make Forge extract the contained JARs
attributes 'Maven-Artifact': "com.yrf.mcmods:capabilityadapter:${project.version}"
if (!configurations.embed.isEmpty())
attributes 'ContainedDeps': configurations.embed.collect { it.name }.join(' ')
}
// Only run the main jar task after the meta files were built
dependsOn generateMetaFiles
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}