This repository has been archived by the owner on Jul 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
175 lines (141 loc) · 4.21 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
plugins {
id "com.jfrog.bintray" version "1.4"
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven-publish'
group 'org.squiddev'
version '1.5.0-pr4'
targetCompatibility = sourceCompatibility = 1.6
compileTestJava.sourceCompatibility = compileTestJava.targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url = "https://cc.crzd.me/maven/" }
maven {
name = "squiddev"
url = "https://dl.bintray.com/squiddev/maven"
}
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
configurations {
shade
patch
provided
compile.extendsFrom shade
}
dependencies {
provided "com.google.code.findbugs:jsr305:3.0.2"
provided "dan200.computercraft:ComputerCraft:1.80pr1-build3"
compile 'com.google.guava:guava:19.0'
shade "org.ow2.asm:asm-debug-all:5.0.4"
shade 'org.squiddev:Patcher:1.2.4'
shade 'org.squiddev:Cobalt:0.2.4'
shade 'io.netty:netty-all:4.0.23.Final'
patch('org.squiddev:luaj.luajc:1.0.9') {
// We provide a custom LuaJ source with ComputerCraft
exclude group: 'org.luaj'
}
provided 'org.squiddev:ConfigGen:1.2.6'
testCompile 'junit:junit:4.11'
testCompile 'org.apache.logging.log4j:log4j-core:2.8.2'
testRuntime "org.apache.commons:commons-lang3:3.5"
}
sourceSets.main.compileClasspath += configurations.provided
sourceSets.test.compileClasspath += configurations.provided
idea { module { scopes.PROVIDED.plus += [configurations.provided] } }
def versions = [
('1.80pr0-build12'): 'http://cc.crzd.me/maven/dan200/computercraft/ComputerCraft/1.80pr0-build12/ComputerCraft-1.80pr0-build12.jar',
('1.80pr1-build0'): 'http://cc.crzd.me/maven/dan200/computercraft/ComputerCraft/1.80pr1-build0/ComputerCraft-1.80pr1-build0.jar',
('1.80pr1-build3'): 'http://cc.crzd.me/maven/dan200/computercraft/ComputerCraft/1.80pr1-build3/ComputerCraft-1.80pr1-build3.jar',
]
task getVersions(type: Task) {
versions.each { key, value ->
def f = file('lib/ComputerCraft-' + key + '.jar')
if (!f.exists()) {
f.parentFile.mkdirs();
def connection = new URL(value).openConnection();
connection.setRequestProperty("User-Agent", "CCTweaks file downloader");
connection.connect();
def i = connection.getInputStream();
f.withOutputStream { it << i }
i.close()
}
}
}
compileTestJava.dependsOn getVersions
jar {
// Package all luaj patches in luaj.luajc
from(configurations.patch.collect { (it.isDirectory() ? it : zipTree(it)) })
{
include "org/luaj/**"
include "org/squiddev/luaj/luajc/IGetPrototype.class"
}
// Package the patch files into a patch/ folder
filesMatching("org/luaj/**", {
it.path = "patch/" + it.path
})
}
// Build a non-obfuscated jar
task combineJar(type: Jar) {
from sourceSets.main.output
// Package all the org.squiddev dependencies into one file
from configurations.shade
.collect { it.isDirectory() ? it : zipTree(it) }
// Package all luaj patches in luaj.luajc.
from(configurations.patch.collect { (it.isDirectory() ? it : zipTree(it)) })
{
include "org/luaj/**"
include "org/squiddev/luaj/luajc/IGetPrototype.class"
}
// Package the patch files into a patch/ folder
filesMatching("org/luaj/**", {
it.path = "patch/" + it.path
})
classifier = 'complete'
}
assemble.dependsOn += combineJar
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['mavenJava']
publish = true
pkg {
repo = 'maven'
name = 'cctweaks-lua'
licenses = ['MIT']
vcsUrl = 'https://github.com/SquidDev-CC/CCTweaks-Lua'
version {
name = project.version
desc = 'Standalone modifications to ComputerCraft'
released = new Date()
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
}
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint" << "-Xlint:-processing" // << "-X:-annotations"
}
tasks.withType(Jar) {
exclude "**/*.java"
}
}
test {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}