18
18
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
*/
20
20
21
- import org.gradle.internal.jvm.Jvm
21
+ import io.sentry.android.gradle.extensions.SentryPluginExtension
22
+ import org.gradle.kotlin.dsl.configure
22
23
import org.jetbrains.changelog.Changelog
23
24
import org.jetbrains.gradle.ext.settings
24
25
import org.jetbrains.gradle.ext.taskTriggers
@@ -32,6 +33,7 @@ plugins {
32
33
`mcdev- core`
33
34
`mcdev- parsing`
34
35
`mcdev- publishing`
36
+ alias(libs.plugins.sentry) apply (System .getenv(" CI" ) == " true" )
35
37
}
36
38
37
39
val coreVersion: String by project
@@ -43,32 +45,32 @@ val testLibs: Configuration by configurations.creating {
43
45
44
46
group = " com.demonwav.mcdev"
45
47
46
- val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create(" gradle-tooling-extension" ) {
48
+ val gradleToolingExtensionSourceSet: SourceSet = sourceSets.create(" gradle-tooling-extension" , Action < SourceSet > {
47
49
configurations.named(compileOnlyConfigurationName) {
48
50
extendsFrom(gradleToolingExtension)
49
51
}
50
- }
52
+ })
51
53
val gradleToolingExtensionJar = tasks.register<Jar >(gradleToolingExtensionSourceSet.jarTaskName) {
52
54
from(gradleToolingExtensionSourceSet.output)
53
55
archiveClassifier.set(" gradle-tooling-extension" )
54
56
exclude(" META-INF/plugin.xml" )
55
57
}
56
58
57
- val templatesSourceSet: SourceSet = sourceSets.create(" templates" ) {
59
+ val templatesSourceSet: SourceSet = sourceSets.create(" templates" , Action < SourceSet > {
58
60
resources {
59
61
srcDir(" templates" )
60
62
compileClasspath + = sourceSets.main.get().output
61
63
}
62
- }
64
+ })
63
65
64
66
val templateSourceSets: List <SourceSet > = (file(" templates" ).listFiles() ? : emptyArray()).mapNotNull { file ->
65
67
if (file.isDirectory() && (file.listFiles() ? : emptyArray()).any { it.name.endsWith(" .mcdev.template.json" ) }) {
66
- sourceSets.create(" templates-${file.name} " ) {
68
+ sourceSets.create(" templates-${file.name} " , Action < SourceSet > {
67
69
resources {
68
70
srcDir(file)
69
71
compileClasspath + = sourceSets.main.get().output
70
72
}
71
- }
73
+ })
72
74
} else {
73
75
null
74
76
}
@@ -81,9 +83,6 @@ val externalAnnotationsJar = tasks.register<Jar>("externalAnnotationsJar") {
81
83
}
82
84
83
85
dependencies {
84
- // Add tools.jar for the JDI API
85
- implementation(files(Jvm .current().toolsJar))
86
-
87
86
implementation(files(gradleToolingExtensionJar))
88
87
89
88
implementation(libs.mixinExtras.expressions) {
@@ -96,6 +95,9 @@ dependencies {
96
95
implementation(libs.bundles.asm)
97
96
98
97
implementation(libs.bundles.fuel)
98
+ implementation(libs.sentry) {
99
+ exclude(group = " org.slf4j" )
100
+ }
99
101
100
102
intellijPlatform {
101
103
intellijIdeaCommunity(libs.versions.intellij.ide, useInstaller = false )
@@ -171,10 +173,12 @@ tasks.patchPluginXml {
171
173
// This is for maximum compatibility, these classes will be loaded into every Gradle import on all
172
174
// projects (not just Minecraft), so we don't want to break that with an incompatible class version.
173
175
tasks.named(gradleToolingExtensionSourceSet.compileJavaTaskName, JavaCompile ::class ) {
174
- val java7Compiler = javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion .of(11 )) }
175
- javaCompiler.set(java7Compiler)
176
- options.release.set(6 )
177
- options.bootstrapClasspath = files(java7Compiler.map { it.metadata.installationPath.file(" jre/lib/rt.jar" ) })
176
+ val java8Compiler = javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion .of(8 )) }
177
+ javaCompiler.set(java8Compiler)
178
+ sourceCompatibility = " 1.5"
179
+ targetCompatibility = " 1.5"
180
+ options.release.unset()
181
+ options.bootstrapClasspath = files(java8Compiler.map { it.metadata.installationPath.file(" jre/lib/rt.jar" ) })
178
182
options.compilerArgs = listOf (" -Xlint:-options" )
179
183
}
180
184
tasks.withType<GroovyCompile >().configureEach {
@@ -222,6 +226,7 @@ idea {
222
226
license {
223
227
val endings = listOf (" java" , " kt" , " kts" , " groovy" , " gradle.kts" , " xml" , " properties" , " html" , " flex" , " bnf" )
224
228
exclude(" META-INF/plugin.xml" ) // https://youtrack.jetbrains.com/issue/IDEA-345026
229
+ exclude(" sentry-debug-meta.properties" , " sentry-external-modules.txt" )
225
230
include(endings.map { " **/*.$it " })
226
231
227
232
val projectDir = layout.projectDirectory.asFile
@@ -338,3 +343,29 @@ tasks.runIde {
338
343
// systemProperty("user.language", "fr")
339
344
// systemProperty("user.country", "FR")
340
345
}
346
+
347
+ if (System .getenv(" CI" ) == " true" ) {
348
+ configure<SentryPluginExtension > {
349
+ includeSourceContext = true
350
+ includeDependenciesReport = true
351
+ autoInstallation {
352
+ enabled = false
353
+ }
354
+
355
+ url = " https://sentry.mcdev.io/"
356
+ org = " mcdev"
357
+ projectName = " mcdev"
358
+ authToken = providers.gradleProperty(" mcdev.sentry.token" )
359
+ }
360
+
361
+ // Wire together some tasks to make Gradle happy
362
+ tasks.named(" generateSentryBundleIdJava" ) {
363
+ dependsOn(generate)
364
+ }
365
+ tasks.named(" sentryCollectSourcesJava" ) {
366
+ dependsOn(generate)
367
+ }
368
+ tasks.checkLicenseMain {
369
+ dependsOn(tasks.named(" generateSentryDebugMetaPropertiesjava" ), tasks.named(" collectExternalDependenciesForSentry" ))
370
+ }
371
+ }
0 commit comments