-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
181 lines (158 loc) · 5.12 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
169
170
171
172
173
174
175
176
177
178
179
180
181
import org.groovymc.groovybundler.bundle.Bundler
import org.groovymc.modsdotgroovy.types.core.Platform
import org.groovymc.modsdotgroovy.gradle.tasks.AbstractGatherPlatformDetailsTask
import org.groovymc.modsdotgroovy.gradle.tasks.AbstractMDGConvertTask
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
alias libs.plugins.mdg
alias libs.plugins.nexuspublish
}
apply from: 'version.gradle'
modsDotGroovy {
multiplatform {
expose()
}
platforms.set([Platform.FABRIC])
inferGather.set false
enable()
apply()
}
tasks.withType(AbstractMDGConvertTask).configureEach {
dependsOn configurations.bundle
buildProperties.put 'bundled', provider {
configurations.bundle.resolvedConfiguration.resolvedArtifacts.collect { "${it.moduleVersion.id.name}-${it.moduleVersion.id.version}.jar" as String }
}
}
tasks.withType(AbstractGatherPlatformDetailsTask).configureEach {
minecraftVersion = '0.0.0'
platformVersion = 'unspecified'
}
group = 'org.groovymc'
repositories {
mavenCentral()
}
configurations {
jacksonResolve
bundle
bundleApi
api.extendsFrom(bundleApi)
bundle.extendsFrom(bundleApi)
bundleDependency
bundle.extendsFrom(bundleDependency)
bundle {
exclude(group: 'org.ow2.asm')
}
}
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.version == '<jackson-resolve>') {
details.useVersion configurations.jacksonResolve.resolvedConfiguration.resolvedArtifacts.find {
it.moduleVersion.id.group == details.requested.group && it.moduleVersion.id.name == details.requested.name
}.moduleVersion.id.version
}
}
}
processResources {
exclude 'mods.groovy'
from(rootProject.file('LICENSE')) {
into 'META-INF'
}
}
tasks.register('bundle', Bundler) {
dependsOn configurations.bundle
bundleConfiguration = configurations.bundle
outputDirectory = layout.buildDirectory.dir("bundler")
modType = 'LIBRARY'
modulePrefix = 'org.groovymc.groovybundler.jij'
}
dependencies {
jacksonResolve libs.groovy.toml
bundleApi libs.groovy.core
bundleApi libs.groovy.contracts
bundleApi libs.groovy.datetime
bundleApi libs.groovy.nio
bundleApi libs.groovy.macro.core
bundleApi libs.groovy.macro.library
bundleApi libs.groovy.templates
bundleApi libs.groovy.xml
bundleApi libs.groovy.typecheckers
bundleApi libs.groovy.dateutil
bundleApi libs.groovy.ginq
bundleApi libs.groovy.toml
bundleApi libs.groovy.json
bundleDependency libs.jackson.core
bundleDependency libs.jackson.annotations
bundleDependency libs.jackson.databind
bundleDependency libs.jackson.dataformat.toml
bundleApi libs.opensesame.groovy
bundleApi libs.opensesame.core
bundleDependency libs.opensesame.compile
// So that groovy can find it
compileOnlyApi libs.opensesame.compile
}
jar {
dependsOn tasks.bundle
from(bundle.outputDirectory)
manifest {
attributes(
'FMLModType': 'LIBRARY',
'Automatic-Module-Name': "${project.group}.${project.name}",
'Specification-Version': project.version,
'Implementation-Commit-Time': versioning.getGitCommitDate(),
'Implementation-Commit': versioning.getGitCommit(),
)
}
}
java.withSourcesJar()
java.withJavadocJar()
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = "GroovyBundler"
packaging = 'jar'
description = 'Bundles groovy and other library versions to be used in common throughout GroovyMC projects'
url = 'https://github.com/GroovyMC/GroovyBundler'
inceptionYear = '2023'
licenses {
license {
name = 'BSD 3-Clause'
url = 'https://opensource.org/license/bsd-3-clause/'
}
}
developers {
developer {
id = 'groovymc'
name = 'GroovyMC'
email = '[email protected]'
url = 'https://github.com/GroovyMC/'
}
}
scm {
connection='scm:git:git://github.com/GroovyMC/GroovyBundler.git'
url='https://github.com/GroovyMC/GroovyBundler'
}
}
}
}
}
nexusPublishing {
repositories {
sonatype {
username.set(System.getenv('SONATYPE_USER') ?: '')
password.set(System.getenv('SONATYPE_PASSWORD') ?: '')
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
}
}
}
if (System.getenv('SONATYPE_USER')) {
signing {
final signingKey = System.getenv('SIGNING_KEY') ?: ''
final signingPassword = System.getenv('SIGNING_PASSWORD') ?: ''
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
}