diff options
author | 2023-04-08 22:56:44 +0200 | |
---|---|---|
committer | 2023-04-08 22:58:21 +0200 | |
commit | 561fac70fd3dc3ebe1cfbc50146757495fb828d5 (patch) | |
tree | 20aa72bbe438aaa70c8de264ff0d366758e7772d /buildSrc/src/main/groovy/refinery-java-conventions.gradle | |
parent | refactor: remove TupleLike (diff) | |
download | refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.tar.gz refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.tar.zst refinery-561fac70fd3dc3ebe1cfbc50146757495fb828d5.zip |
build: convert Gradle scripts to Kotlin
Improves IDE support build scripts in IntelliJ.
There is no Eclipse IDE support, but Eclipse didn't have support for Groovy
either, so there is no degradation of functionality.
Diffstat (limited to 'buildSrc/src/main/groovy/refinery-java-conventions.gradle')
-rw-r--r-- | buildSrc/src/main/groovy/refinery-java-conventions.gradle | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/buildSrc/src/main/groovy/refinery-java-conventions.gradle b/buildSrc/src/main/groovy/refinery-java-conventions.gradle deleted file mode 100644 index fdf5818a..00000000 --- a/buildSrc/src/main/groovy/refinery-java-conventions.gradle +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | plugins { | ||
2 | id 'jacoco' | ||
3 | id 'java' | ||
4 | id 'refinery-eclipse' | ||
5 | } | ||
6 | |||
7 | repositories { | ||
8 | mavenCentral() | ||
9 | maven { | ||
10 | url 'https://repo.eclipse.org/content/groups/releases/' | ||
11 | } | ||
12 | } | ||
13 | |||
14 | dependencies { | ||
15 | compileOnly libs.jetbrainsAnnotations | ||
16 | testCompileOnly libs.jetbrainsAnnotations | ||
17 | testImplementation libs.hamcrest | ||
18 | testImplementation libs.junit.api | ||
19 | testRuntimeOnly libs.junit.engine | ||
20 | testImplementation libs.junit.params | ||
21 | testImplementation libs.mockito.core | ||
22 | testImplementation libs.mockito.junit | ||
23 | } | ||
24 | |||
25 | java.toolchain { | ||
26 | languageVersion = JavaLanguageVersion.of(19) | ||
27 | } | ||
28 | |||
29 | tasks.withType(JavaCompile) { | ||
30 | options.release.set(17) | ||
31 | } | ||
32 | |||
33 | def jacocoTestReport = tasks.named('jacocoTestReport') | ||
34 | jacocoTestReport.configure { | ||
35 | dependsOn test | ||
36 | reports { | ||
37 | xml.required = true | ||
38 | } | ||
39 | } | ||
40 | |||
41 | tasks.named('test') { | ||
42 | useJUnitPlatform { | ||
43 | excludeTags 'slow' | ||
44 | } | ||
45 | finalizedBy jacocoTestReport | ||
46 | } | ||
47 | |||
48 | tasks.register('slowTest', Test) { | ||
49 | useJUnitPlatform() | ||
50 | finalizedBy jacocoTestReport | ||
51 | } | ||
52 | |||
53 | tasks.named('jar') { | ||
54 | manifest { | ||
55 | attributes( | ||
56 | 'Bundle-SymbolicName': "${project.group}.${project.name}", | ||
57 | 'Bundle-Version': project.version | ||
58 | ) | ||
59 | } | ||
60 | } | ||
61 | |||
62 | def generateEclipseSourceFolders = tasks.register('generateEclipseSourceFolders') | ||
63 | |||
64 | tasks.register('prepareEclipse') { | ||
65 | dependsOn generateEclipseSourceFolders | ||
66 | dependsOn tasks.named('eclipseJdt') | ||
67 | } | ||
68 | |||
69 | tasks.named('eclipseClasspath') { | ||
70 | dependsOn generateEclipseSourceFolders | ||
71 | } | ||
72 | |||
73 | eclipse { | ||
74 | classpath.file.whenMerged { | ||
75 | for (entry in entries) { | ||
76 | if (entry.path.endsWith('-gen')) { | ||
77 | entry.entryAttributes['ignore_optional_problems'] = true | ||
78 | } | ||
79 | // If a project has a main dependency on a project and an test dependency on the testFixtures of a project, | ||
80 | // it will be erroneously added as a test-only dependency to Eclipse. | ||
81 | // As a workaround, we add all project dependencies as main dependencies | ||
82 | // (we do not deliberately use test-only project dependencies). | ||
83 | if (entry in org.gradle.plugins.ide.eclipse.model.ProjectDependency) { | ||
84 | entry.entryAttributes.remove('test') | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | |||
89 | jdt.file.withProperties { properties -> | ||
90 | // Allow @SuppressWarnings to suppress SonarLint warnings | ||
91 | properties['org.eclipse.jdt.core.compiler.problem.unhandledWarningToken'] = 'ignore' | ||
92 | } | ||
93 | } | ||