-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
94 lines (82 loc) · 1.96 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
plugins {
id 'checkstyle'
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'org.sonarqube' version '3.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
def ENV = System.getenv()
if (ENV.MAVEN_PASSWORD) {
def versionName = System.getenv("GITHUB_REF")
versionName = versionName.substring(10)
if (versionName.startsWith("v")) {
versionName = versionName.substring(1) //strip "v" in "v1.0.0" etc.
}
version = versionName
} else if (ENV.GITHUB_SHA) {
version = System.getenv("GITHUB_SHA").substring(0, 9)
} else {
version = 'LOCAL'
}
group = 'net.patchworkmc'
archivesBaseName = 'patchwork-manifest'
repositories {
mavenCentral()
}
dependencies {
implementation 'com.electronwill.night-config:toml:3.6.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.jetbrains:annotations:16.0.1'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
checkstyle {
configFile = rootProject.file("checkstyle.xml")
toolVersion = '8.25'
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
def runDir = file("run")
if (!runDir.exists() && !runDir.mkdirs()) {
throw new IOException("Failed to create run directory ${runDir.getAbsolutePath()}")
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = project.name
description = project.description
url = "https://github.com/patchworkmc/patchwork-manifest"
}
// add all the jars that should be included when publishing to maven
afterEvaluate {
artifact jar
artifact sourcesJar
}
}
}
repositories {
if (ENV.MAVEN_PASSWORD) {
maven {
url 'https://maven.patchworkmc.net/releases'
credentials {
username "patchworkmc"
password ENV.MAVEN_PASSWORD
}
}
}
}
}
sonarqube {
properties {
property "sonar.projectKey", "PatchworkMC_patchwork-manifest"
property "sonar.organization", "patchworkmc-1"
property "sonar.host.url", "https://sonarcloud.io"
}
}