This repository has been archived by the owner on Jun 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.gradle
116 lines (95 loc) · 2.53 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
/*
* Forge Kotlin Adapter build file.
*/
//================================================
// Pre-execute
buildscript {
ext.kotlin_version = '1.0.0-rc-1036'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VER"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VER"
}
}
repositories {
maven {
name 'Forge'
url 'http://files.minecraftforge.net/maven'
}
mavenCentral()
}
apply plugin: 'kotlin'
apply plugin: 'idea'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VER"
compile "net.minecraftforge:forge:$MC_VER-$FORGE_VER:universal"
compile "org.apache.logging.log4j:log4j-api:$L4J2_VER"
compile "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VER"
}
//================================================
// Jar data
// Grab system env
def env = System.getenv()
group = "io.drakon.forge"
archivesBaseName = "kotlin-adapter"
version = "$KOTLIN_VER+$MC_VER"
// Drone manifest
def droneManifest = manifest {
if (env.DRONE != null) {
attributes("Drone-Build": "true", "Drone-Build-ID": env.DRONE_BUILD_NUMBER, "Drone-Commit": env.DRONE_COMMIT,
"Drone-Branch": env.DRONE_BRANCH, "Drone-Repo-Slug": env.DRONE_REPO_SLUG)
version += "-d${env.DRONE_BUILD_NUMBER}"
} else {
attributes("Drone-Build": "false")
}
}
// Version manifest
def verManifest = manifest {
attributes("Forge-Version": MC_VER + "-" + FORGE_VER, "Kotlin-Version": KOTLIN_VER)
}
//================================================
// Jar tasks
// Disable Javadoc doclint on JVM 1.8
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
jar {
// Merge Jenkins and Git manifests to form final manifest in final release jar
manifest {
from droneManifest, verManifest
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
//================================================
// Maven deployment
apply plugin: 'maven'
if (!project.hasProperty("DEPLOY_DIR")) {
ext.DEPLOY_DIR = null
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file://$DEPLOY_DIR")
}
}
}
uploadArchives.onlyIf { return DEPLOY_DIR != null }
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}