diff options
author | 2021-11-17 03:56:45 +0100 | |
---|---|---|
committer | 2021-11-17 03:56:45 +0100 | |
commit | 2457f042578634478965212067df82bef2cb8eb4 (patch) | |
tree | cd5e45280f0792333f782109325d04739c86bcb3 /buildSrc/src/main/groovy/refinery-java-conventions.gradle | |
parent | build: merge java and junit conventions (diff) | |
download | refinery-2457f042578634478965212067df82bef2cb8eb4.tar.gz refinery-2457f042578634478965212067df82bef2cb8eb4.tar.zst refinery-2457f042578634478965212067df82bef2cb8eb4.zip |
build: library and application convetion plugins
Diffstat (limited to 'buildSrc/src/main/groovy/refinery-java-conventions.gradle')
-rw-r--r-- | buildSrc/src/main/groovy/refinery-java-conventions.gradle | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/buildSrc/src/main/groovy/refinery-java-conventions.gradle b/buildSrc/src/main/groovy/refinery-java-conventions.gradle new file mode 100644 index 00000000..fcdc8ea9 --- /dev/null +++ b/buildSrc/src/main/groovy/refinery-java-conventions.gradle | |||
@@ -0,0 +1,76 @@ | |||
1 | plugins { | ||
2 | id 'eclipse' | ||
3 | id 'jacoco' | ||
4 | id 'java' | ||
5 | } | ||
6 | |||
7 | repositories { | ||
8 | mavenCentral() | ||
9 | maven { | ||
10 | url 'https://repo.eclipse.org/content/groups/releases/' | ||
11 | } | ||
12 | } | ||
13 | |||
14 | dependencies { | ||
15 | testImplementation libs.hamcrest | ||
16 | testImplementation libs.junit.api | ||
17 | testRuntimeOnly libs.junit.engine | ||
18 | testImplementation libs.junit.params | ||
19 | testImplementation libs.mockito.core | ||
20 | testImplementation libs.mockito.junit | ||
21 | } | ||
22 | |||
23 | sourceCompatibility = '17' | ||
24 | targetCompatibility = '17' | ||
25 | |||
26 | def jacocoTestReport = tasks.named('jacocoTestReport') | ||
27 | jacocoTestReport.configure { | ||
28 | dependsOn test | ||
29 | reports { | ||
30 | xml.required = true | ||
31 | } | ||
32 | } | ||
33 | |||
34 | tasks.named('test') { | ||
35 | useJUnitPlatform { | ||
36 | excludeTags 'slow' | ||
37 | } | ||
38 | finalizedBy jacocoTestReport | ||
39 | } | ||
40 | |||
41 | tasks.register('slowTest', Test) { | ||
42 | useJUnitPlatform() | ||
43 | finalizedBy jacocoTestReport | ||
44 | } | ||
45 | |||
46 | tasks.named('jar') { | ||
47 | manifest { | ||
48 | attributes 'Bundle-SymbolicName': project.name | ||
49 | } | ||
50 | } | ||
51 | |||
52 | def generateEclipseSourceFolders = tasks.register('generateEclipseSourceFolders') | ||
53 | |||
54 | tasks.register('prepareEclipse') { | ||
55 | dependsOn generateEclipseSourceFolders | ||
56 | dependsOn tasks.named('eclipseJdt') | ||
57 | } | ||
58 | |||
59 | tasks.named('eclipseClasspath') { | ||
60 | dependsOn generateEclipseSourceFolders | ||
61 | } | ||
62 | |||
63 | eclipse { | ||
64 | classpath.file.whenMerged { | ||
65 | for (entry in entries) { | ||
66 | if (entry.path.endsWith('-gen')) { | ||
67 | entry.entryAttributes['ignore_optional_problems'] = true | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
72 | jdt.file.withProperties { properties -> | ||
73 | // Allow @SupperessWarnings to suppress SonarLint warnings | ||
74 | properties['org.eclipse.jdt.core.compiler.problem.unhandledWarningToken'] = 'ignore' | ||
75 | } | ||
76 | } | ||