forked from FabricMC/MappingPoet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
112 lines (96 loc) · 2.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
plugins {
id 'java'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
}
group 'net.fabricmc'
version '0.2.8'
def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
repositories {
mavenCentral()
maven {
name = 'Fabric'
url = 'https://maven.modmuss50.me/'
}
maven {
name = "GitHub"
url = uri("https://maven.pkg.github.com/liachmodded/javapoet")
credentials {
// any user can generate an access token at https://github.com/settings/tokens as password
// just need the read:packages permission
username = findProperty('github_user') ?: ENV.GITHUB_ACTOR
password = findProperty('github_read_key') ?: ENV.GITHUB_TOKEN
}
}
}
dependencies {
//implementation 'com.squareup:javapoet:1.13.0'
implementation 'com.github.liachmodded:javapoet:0.0.3'
implementation 'net.fabricmc:tiny-mappings-parser:0.3.0+build.17'
runtimeOnly 'com.google.guava:guava:30.1.1-jre'
implementation 'org.ow2.asm:asm:9.2'
implementation 'org.ow2.asm:asm-analysis:9.2'
implementation 'org.ow2.asm:asm-commons:9.2'
implementation 'org.ow2.asm:asm-tree:9.2'
implementation 'org.ow2.asm:asm-util:9.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.1'
}
java {
withSourcesJar()
}
tasks.withType(JavaCompile) {
options.release = 17
options.encoding = "UTF-8"
}
test {
useJUnitPlatform()
}
tasks.withType(Jar) {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
jar {
manifest {
attributes 'Implementation-Title': 'MappingPoet',
'Implementation-Version': archiveVersion,
'Main-Class': "net.fabricmc.mappingpoet.Main"
}
}
license {
header file("HEADER")
include '**/*.java'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// select the repositories you want to publish to
repositories {
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}
// A task to ensure that the version being released has not already been released.
task checkVersion {
doFirst {
def xml = new URL("https://maven.fabricmc.net/net/fabricmc/mappingpoet/maven-metadata.xml").text
def metadata = new XmlSlurper().parseText(xml)
def versions = metadata.versioning.versions.version*.text();
if (versions.contains(version)) {
throw new RuntimeException("${version} has already been released!")
}
}
}
publish.mustRunAfter checkVersion