-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
119 lines (104 loc) · 3.61 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
plugins {
id 'org.ajoberstar.grgit' version '4.1.0'
id 'com.github.ben-manes.versions' version '0.38.0'
id 'org.javamodularity.moduleplugin' version '1.8.3' apply false
}
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'org.javamodularity.moduleplugin'
repositories {
mavenCentral()
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
dependencyUpdates {
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
test {
useJUnitPlatform()
}
group = 'cpw.mods'
version = grgit.describe(longDescr: true).split('-').with { "${it[0]}.${it[1]}" }
dependencies {
implementation("org.apache.logging.log4j:log4j-api:2.14.1")
implementation("org.apache.logging.log4j:log4j-core:2.14.1")
testImplementation("org.powermock:powermock-core:2.0.+")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.+")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.+")
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
moduleOptions {
addExports = ['java.base/sun.security.util': 'cpw.mods.grossjava9hacks']
}
}
jar {
manifest {
attributes([
'Specification-Title': 'grossjava9hacks',
'Specification-Vendor': 'forge',
'Specification-Version': '1', // We are version 1 of ourselves
'Implementation-Title': project.name,
'Implementation-Version': "${project.version}+${System.getenv("BUILD_NUMBER")?:0}+${grgit.branch.current().getName()}.${grgit.head().abbreviatedId}",
'Implementation-Vendor':'forge',
'Implementation-Timestamp': java.time.Instant.now().toString(),
'Git-Commit': grgit.head().abbreviatedId,
'Git-Branch': grgit.branch.current().getName(),
'Build-Number': "${System.getenv("BUILD_NUMBER")?:0}",
])
}
}
artifacts {
archives jar
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
pom {
name = 'Grotesque Java 9 Hacks'
description = 'Grotesque Java 9 Hacks to allow modlauncher to function'
url = 'https://github.com/cpw/grossjava9classpathhacks'
scm {
url = 'https://github.com/cpw/grossjava9classpathhacks'
connection = 'scm:git:git://github.com/cpw/grossjava9classpathhacks.git'
developerConnection = 'scm:git:git@github.com:cpw/grossjava9classpathhacks.git'
}
issueManagement {
system = 'github'
url = 'https://github.com/cpw/grossjava9classpathhacks/issues'
}
developers {
developer {
id = 'cpw'
name = 'cpw'
}
}
}
}
}
repositories {
maven {
authentication {
basic(BasicAuthentication)
}
credentials {
username = System.env.MAVEN_USER ?: 'not'
password = System.env.MAVEN_PASSWORD ?: 'set'
}
url 'https://maven.minecraftforge.net/releases'
}
}
}