-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.gradle
168 lines (135 loc) · 5.24 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
import org.gradle.api.artifacts.maven.MavenDeployment
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'
archivesBaseName = 'procyon'
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 def 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
}
final def procyonVersion = getProcyonVersion()
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
buildDir = rootDir.canonicalPath + "/build/" + rootProject.relativePath(projectDir.canonicalPath)
version procyonVersion
group 'org.bitbucket.mstrobel'
sourceCompatibility = 1.7 // 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: 'signing'
archivesBaseName = 'procyon-' + 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
}
if (project.name != "Procyon.Decompiler") {
javadoc {
options.encoding = 'UTF-8'
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
sign configurations.archives
}
uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
authentication(userName: project.properties.get("sonatypeUsername"), password: project.properties.get("sonatypePassword"))
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(userName: project.properties.get("sonatypeUsername"), password: project.properties.get("sonatypePassword"))
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Procyon'
url 'https://bitbucket.org/mstrobel/procyon'
scm {
url 'https://bitbucket.org/mstrobel/procyon'
connection 'scm:hg:https://[email protected]/mstrobel/procyon'
developerConnection 'scm:hg:https://[email protected]/mstrobel/procyon'
}
issueManagement {
system 'jira'
url 'https://bitbucket.org/mstrobel/procyon/issues'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'mstrobel'
name 'Mike Strobel'
roles {
role 'owner'
role 'packager'
role 'developer'
}
}
}
dependencies {
dependency {
groupId 'junit'
artifactId 'junit'
version '4.11'
scope 'test'
// optional = true
}
}
}
}
}
}
}
}