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" && System .getenv(" NO_SENTRY" ) != " 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 )
@@ -167,20 +169,17 @@ tasks.patchPluginXml {
167
169
changeNotes = changelog.render(Changelog .OutputType .HTML )
168
170
}
169
171
170
- // Compile classes to be loaded into the Gradle VM to Java 5 to match Groovy
172
+ // Compile classes to be loaded into the Gradle VM to Java 8
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
+ options.release = 8
178
177
options.compilerArgs = listOf (" -Xlint:-options" )
179
178
}
180
179
tasks.withType<GroovyCompile >().configureEach {
181
180
options.compilerArgs = listOf (" -proc:none" )
182
- sourceCompatibility = " 1.5 "
183
- targetCompatibility = " 1.5 "
181
+ sourceCompatibility = " 1.8 "
182
+ targetCompatibility = " 1.8 "
184
183
}
185
184
186
185
tasks.processResources {
@@ -222,6 +221,7 @@ idea {
222
221
license {
223
222
val endings = listOf (" java" , " kt" , " kts" , " groovy" , " gradle.kts" , " xml" , " properties" , " html" , " flex" , " bnf" )
224
223
exclude(" META-INF/plugin.xml" ) // https://youtrack.jetbrains.com/issue/IDEA-345026
224
+ exclude(" sentry-debug-meta.properties" , " sentry-external-modules.txt" )
225
225
include(endings.map { " **/*.$it " })
226
226
227
227
val projectDir = layout.projectDirectory.asFile
@@ -338,3 +338,29 @@ tasks.runIde {
338
338
// systemProperty("user.language", "fr")
339
339
// systemProperty("user.country", "FR")
340
340
}
341
+
342
+ if (System .getenv(" CI" ) == " true" && System .getenv(" NO_SENTRY" ) != " true" ) {
343
+ configure<SentryPluginExtension > {
344
+ includeSourceContext = true
345
+ includeDependenciesReport = true
346
+ autoInstallation {
347
+ enabled = false
348
+ }
349
+
350
+ url = " https://sentry.mcdev.io/"
351
+ org = " mcdev"
352
+ projectName = " mcdev"
353
+ authToken = providers.gradleProperty(" mcdev.sentry.token" )
354
+ }
355
+
356
+ // Wire together some tasks to make Gradle happy
357
+ tasks.named(" generateSentryBundleIdJava" ) {
358
+ dependsOn(generate)
359
+ }
360
+ tasks.named(" sentryCollectSourcesJava" ) {
361
+ dependsOn(generate)
362
+ }
363
+ tasks.checkLicenseMain {
364
+ dependsOn(tasks.named(" generateSentryDebugMetaPropertiesjava" ), tasks.named(" collectExternalDependenciesForSentry" ))
365
+ }
366
+ }
0 commit comments