-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
143 lines (121 loc) · 4.08 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
buildscript {
repositories {
maven { url 'https://files.minecraftforge.net/maven' }
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.72'
id 'org.jetbrains.dokka' version '0.10.1'
id 'maven-publish'
id 'java-library'
}
apply plugin: 'net.minecraftforge.gradle'
String packagesToken = new String(package_public_token.decodeBase64())
version = module_version
group = "com.projectessentials.core"
archivesBaseName = module_name
configurations {
internal
implementation.extendsFrom internal
}
minecraft {
accessTransformer = file 'src/main/resources/META-INF/accesstransformer.cfg'
mappings channel: forge_mappings_channel_type, version: forge_mappings_channel_version
}
repositories {
maven { url 'https://libraries.minecraft.net' }
mavenCentral()
jcenter()
}
dependencies {
minecraft "net.minecraftforge:forge:$forge_version"
internal "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlinx_serialization_version"
internal "org.jetbrains.kotlin:kotlin-stdlib-$kotlin_jdk_version_target:$kotlin_version"
internal "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_version"
internal "org.json:json:$json_version"
}
dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/libs/docs"
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task dokkaJar(type: Jar) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
classifier = 'javadoc'
from tasks.dokka as Object
}
task modJar(type: Jar) {
with tasks.jar
from configurations.internal.collect { it.isDirectory() ? it : zipTree(it) }
manifest {
attributes([
"Specification-Title" : module_name,
"Specification-Vendor" : module_version,
"Specification-Version" : module_vendor,
"Implementation-Title" : module_name,
"Implementation-Version" : module_version,
"Implementation-Vendor" : module_vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
baseName = module_name + '-MOD'
}
jar {
manifest {
attributes([
"Specification-Title" : module_name,
"Specification-Vendor" : module_vendor,
"Specification-Version" : module_version,
"Implementation-Title" : module_name,
"Implementation-Version" : module_version,
"Implementation-Vendor" : module_vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
baseName = module_name + '-NoRT'
}
reobf {
modJar {
dependsOn jar
mappings = createMcpToSrg.outputs.files.singleFile
}
}
project.tasks['jar'].dependsOn project.tasks['dokka']
project.tasks['modJar'].dependsOn project.tasks['jar']
sourceCompatibility = targetCompatibility =
compileJava.sourceCompatibility =
compileJava.targetCompatibility = project_jvm_version_target
compileKotlin.kotlinOptions.jvmTarget =
compileTestKotlin.kotlinOptions.jvmTarget = project_jvm_version_target
publishing {
repositories {
maven {
name = 'GitHubPackages'
url = uri 'https://maven.pkg.github.com/projectessentials/projectessentials-core'
credentials {
username = System.getenv('GradleUser')
password = System.getenv('GradlePass')
}
}
}
publications {
gpr(MavenPublication) {
version = (module_version as String).split('\\+')[0]
from components.java
artifact sourcesJar
artifact dokkaJar
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
}
}