This repository has been archived by the owner on Jun 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
165 lines (133 loc) · 4.58 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.gradle.api.artifacts.maven.MavenDeployment
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'
archivesBaseName = 'procyon-fabric'
ext.getProcyonVersion = { ->
final def fallbackVersion = "1.0-SNAPSHOT"
final def versionFilePath = rootDir.canonicalPath + "/Procyon.Core/src/main/java/com/strobel/Procyon.java"
final def versionFile = new File(versionFilePath)
if (versionFile.exists()) {
try {
final String fileContents = new File(versionFilePath).getText('UTF-8')
final def matcher = fileContents =~ /VERSION\s*=\s*"([^"]+)"/
if (matcher.find()) {
return matcher.group(1).trim()
}
}
catch (final Throwable ignored) {
}
}
logger.warn("wARNING: Could not resolve version from source; falling back to '$fallbackVersion'.")
return fallbackVersion
}
// fabric says otherwise
ext.getProcyonVersion = { ->
return "0.5.35"
}
def ENV = System.getenv()
final def procyonVersion = getProcyonVersion() + "." + (ENV.BUILD_NUMBER ?: "local")
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
buildDir = rootDir.canonicalPath + "/build/" + rootProject.relativePath(projectDir.canonicalPath)
version procyonVersion
group 'net.fabricmc'
sourceCompatibility = 1.8 // JDK version
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.11'
}
}
//
// The root project is empty and doesn't need any tasks.
//
rootProject.tasks.each { it.enabled = false }
subprojects {
apply plugin: 'maven'
apply plugin: 'maven-publish'
archivesBaseName = 'procyon-fabric-' + it.name.split("\\.")[1].toLowerCase()
jar {
metaInf {
from 'License.txt'
from 'README.md'
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug.with {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length() - 2
logger.lifecycle('\n' + '+' + ('-' * repeatLength) + '+' + '\n' + startItem + output + endItem + '\n' + '+' + ('-' * repeatLength) + '+')
}
}
}
}
if (project.name != "Procyon.Decompiler") {
javadoc {
options.encoding = 'UTF-8'
}
publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
from components.java
artifact javadocJar {
classifier "javadoc"
}
artifact sourcesJar {
classifier "sources"
}
}
}
repositories {
maven {
url "http://mavenupload.modmuss50.me/"
if (project.hasProperty('mavenPass')) {
credentials {
username 'buildslave'
password project.getProperty('mavenPass')
}
}
}
}
}
}
}