blob: 423604f71eaa03f5068bf8e172202d6e7a7e76e2 [file] [log] [blame]
Matthias Andreas Benkard02e10f12020-02-02 18:46:56 +01001import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
2import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
3
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +01004plugins {
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +01005 id 'java'
6 id 'io.quarkus'
Matthias Andreas Benkardf7bf7c42020-01-28 22:31:12 +01007 id "com.bmuschko.docker-remote-api" version "${dockerPluginVersion}"
Matthias Andreas Benkardf611d9e2020-01-13 05:04:52 +01008 id "com.diffplug.gradle.spotless" version "${spotlessPluginVersion}"
9 id "com.github.ben-manes.versions" version "${versionsPluginVersion}"
10 id "se.patrikerdes.use-latest-versions" version "${useLatestVersionsPluginVersion}"
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010011}
12
Matthias Andreas Benkard513deee2020-01-12 20:58:56 +010013sourceCompatibility = 11
14targetCompatibility = 11
15
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010016repositories {
17 mavenLocal()
18 mavenCentral()
19}
20
Matthias Andreas Benkardf611d9e2020-01-13 05:04:52 +010021tasks {
22 dependencyUpdates {
23 checkConstraints = true
24 gradleReleaseChannel = "current"
25 revision = "release"
26 }
27}
28
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010029dependencies {
30 implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
31
32 implementation 'io.quarkus:quarkus-agroal'
Matthias Andreas Benkardc27d1cb2020-01-26 11:11:24 +010033 implementation 'io.quarkus:quarkus-elytron-security-properties-file'
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010034 implementation 'io.quarkus:quarkus-flyway'
35 implementation 'io.quarkus:quarkus-hibernate-orm-panache'
36 implementation 'io.quarkus:quarkus-hibernate-validator'
37 implementation 'io.quarkus:quarkus-jdbc-postgresql'
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010038 implementation 'io.quarkus:quarkus-kubernetes'
39 implementation 'io.quarkus:quarkus-mailer'
Matthias Andreas Benkard24a25142020-01-24 13:25:54 +010040 implementation 'io.quarkus:quarkus-oidc'
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010041 implementation 'io.quarkus:quarkus-resteasy'
42 implementation 'io.quarkus:quarkus-resteasy-jsonb'
43 implementation 'io.quarkus:quarkus-resteasy-qute'
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010044 implementation 'io.quarkus:quarkus-scheduler'
Matthias Andreas Benkard2a1383f2020-02-01 23:53:17 +010045 implementation 'io.quarkus:quarkus-smallrye-jwt'
Matthias Andreas Benkarde5f81e52020-01-18 12:48:40 +010046
47 //implementation 'io.quarkus:quarkus-elytron-security'
48 //implementation 'io.quarkus:quarkus-elytron-security-jdbc'
49 //implementation 'io.quarkus:quarkus-elytron-security-oauth2'
50 //implementation 'io.quarkus:quarkus-keycloak-authorization'
Matthias Andreas Benkarde5f81e52020-01-18 12:48:40 +010051 //implementation 'io.quarkus:quarkus-quartz'
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010052 //implementation 'io.quarkus:quarkus-smallrye-fault-tolerance'
53 //implementation 'io.quarkus:quarkus-smallrye-health'
54 //implementation 'io.quarkus:quarkus-smallrye-metrics'
55 //implementation 'io.quarkus:quarkus-smallrye-openapi'
56
57 //implementation 'jakarta.transaction:jakarta.transaction-api'
58 //implementation 'org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec'
59 //implementation 'jakarta.persistence:jakarta.persistence-api'
60
Matthias Andreas Benkard2a1383f2020-02-01 23:53:17 +010061 implementation "org.bitbucket.b_c:jose4j"
62
Matthias Andreas Benkard5d71a9e2020-01-18 12:31:26 +010063 implementation 'org.mapstruct:mapstruct'
64 compileOnly 'org.mapstruct:mapstruct-processor'
65
66 compileOnly 'com.google.code.findbugs:jsr305'
67
Matthias Andreas Benkardf611d9e2020-01-13 05:04:52 +010068 implementation 'com.vladmihalcea:hibernate-types-52'
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010069
Matthias Andreas Benkard5d71a9e2020-01-18 12:31:26 +010070 implementation "jakarta.security.jacc:jakarta.security.jacc-api"
71 implementation "net.java.dev.jna:jna"
72
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010073 testImplementation 'io.quarkus:quarkus-junit5'
74 testImplementation 'io.rest-assured:rest-assured'
Matthias Andreas Benkardf611d9e2020-01-13 05:04:52 +010075
Matthias Andreas Benkard981f2792020-02-16 14:54:54 +010076 implementation "com.rometools:rome"
Matthias Andreas Benkard424e16e2020-02-09 18:29:56 +010077 implementation "com.vladsch.flexmark:flexmark-all"
Matthias Andreas Benkard981f2792020-02-16 14:54:54 +010078 implementation "org.jsoup:jsoup"
Matthias Andreas Benkard424e16e2020-02-09 18:29:56 +010079
Matthias Andreas Benkard404ac1d2020-02-22 11:29:37 +010080 annotationProcessor "org.hibernate:hibernate-jpamodelgen"
81
Matthias Andreas Benkardf611d9e2020-01-13 05:04:52 +010082 constraints {
Matthias Andreas Benkardf611d9e2020-01-13 05:04:52 +010083 implementation "com.vladmihalcea:hibernate-types-52:${hibernateTypesVersion}"
Matthias Andreas Benkard5d71a9e2020-01-18 12:31:26 +010084 implementation "org.mapstruct:mapstruct:${mapstructVersion}"
85 compileOnly "org.mapstruct:mapstruct-processor:${mapstructVersion}"
86 compileOnly "com.google.code.findbugs:jsr305:${findbugsJsr305Version}"
87 implementation "jakarta.security.jacc:jakarta.security.jacc-api:${jakartaJaccVersion}"
88 implementation "net.java.dev.jna:jna:${jnaVersion}"
Matthias Andreas Benkard2a1383f2020-02-01 23:53:17 +010089 implementation "org.bitbucket.b_c:jose4j:${jose4jVersion}"
Matthias Andreas Benkard424e16e2020-02-09 18:29:56 +010090 implementation "com.vladsch.flexmark:flexmark-all:${flexmarkVersion}"
Matthias Andreas Benkard06849562020-02-14 20:13:17 +010091 implementation "org.jsoup:jsoup:${jsoupVersion}"
Matthias Andreas Benkard981f2792020-02-16 14:54:54 +010092 implementation "com.rometools:rome:${romeVersion}"
Matthias Andreas Benkard404ac1d2020-02-22 11:29:37 +010093 annotationProcessor "org.hibernate:hibernate-jpamodelgen:${hibernateVersion}"
Matthias Andreas Benkardf611d9e2020-01-13 05:04:52 +010094 }
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +010095}
96
97spotless {
Matthias Andreas Benkard4be112f2020-01-12 20:29:38 +010098 java {
99 googleJavaFormat()
100 removeUnusedImports()
101 }
Matthias Andreas Benkard4c5847b2020-01-12 15:42:02 +0100102}
103
Matthias Andreas Benkardf7bf7c42020-01-28 22:31:12 +0100104group "eu.mulk"
105version "${projectVersion}"
Matthias Andreas Benkard2a107552020-01-23 10:47:52 +0100106
107task yarnInstall(type:Exec) {
Matthias Andreas Benkard02e10f12020-02-02 18:46:56 +0100108 def resourceDir = "src/main/resources/META-INF/resources"
109
Matthias Andreas Benkardc52eb742020-02-02 19:06:54 +0100110 onlyIf { !project.hasProperty('skipWeb') }
111
Matthias Andreas Benkard02e10f12020-02-02 18:46:56 +0100112 inputs.file "${resourceDir}/package.json"
113 outputs.dir "${resourceDir}/node_modules"
114 outputs.file "${resourceDir}/yarn.lock"
115
116 workingDir resourceDir
Matthias Andreas Benkard2a107552020-01-23 10:47:52 +0100117 commandLine "yarn", "install"
118}
119
120task snowpack(type:Exec) {
Matthias Andreas Benkard02e10f12020-02-02 18:46:56 +0100121 def resourceDir = "src/main/resources/META-INF/resources"
122
Matthias Andreas Benkardc52eb742020-02-02 19:06:54 +0100123 onlyIf { !project.hasProperty('skipWeb') }
124
Matthias Andreas Benkard2a107552020-01-23 10:47:52 +0100125 dependsOn yarnInstall
126
Matthias Andreas Benkard02e10f12020-02-02 18:46:56 +0100127 inputs.dir "${resourceDir}/node_modules"
128 inputs.file "${resourceDir}/yarn.lock"
129 inputs.file "${resourceDir}/package.json"
130 outputs.dir "${resourceDir}/web_modules"
131
132 workingDir resourceDir
Matthias Andreas Benkard96a28ef2020-02-15 18:39:51 +0100133 commandLine "yarn", "run", "snowpack", "--optimize"
Matthias Andreas Benkard2a107552020-01-23 10:47:52 +0100134}
135
Matthias Andreas Benkardb3a2c482020-02-15 20:40:30 +0100136task flow(type:Exec) {
137 def resourceDir = "src/main/resources/META-INF/resources"
138
139 onlyIf { !project.hasProperty('skipWeb') }
140
141 dependsOn snowpack
142
143 workingDir resourceDir
144 commandLine "yarn", "run", "flow", "--color=always"
145}
146
Matthias Andreas Benkarde5f071f2020-02-15 21:33:55 +0100147task eslint(type:Exec) {
148 def resourceDir = "src/main/resources/META-INF/resources"
149
150 onlyIf { !project.hasProperty('skipWeb') }
151
152 dependsOn snowpack
153
154 workingDir resourceDir
155 commandLine "yarn", "run", "eslint", "cms2", "bookmarks", "--color"
156}
157
Matthias Andreas Benkard2a107552020-01-23 10:47:52 +0100158task compileWeb {
159 dependsOn snowpack
Matthias Andreas Benkardb3a2c482020-02-15 20:40:30 +0100160 dependsOn flow
Matthias Andreas Benkarde5f071f2020-02-15 21:33:55 +0100161 dependsOn eslint
Matthias Andreas Benkard2a107552020-01-23 10:47:52 +0100162
163 doLast {}
164}
165
Matthias Andreas Benkardb712a012020-01-26 08:10:49 +0100166processResources {
167 exclude("META-INF/resources/node_modules/**/*")
Matthias Andreas Benkard97130f92020-01-27 21:03:39 +0100168 exclude("META-INF/resources/package.json")
169 exclude("META-INF/resources/yarn.lock")
Matthias Andreas Benkardb712a012020-01-26 08:10:49 +0100170}
171
Matthias Andreas Benkardb428e522020-01-26 08:13:04 +0100172quarkusBuild.dependsOn compileWeb
Matthias Andreas Benkardf7bf7c42020-01-28 22:31:12 +0100173
Matthias Andreas Benkard02e10f12020-02-02 18:46:56 +0100174task buildDocker(type: DockerBuildImage) {
Matthias Andreas Benkardc52eb742020-02-02 19:06:54 +0100175 onlyIf { !project.hasProperty('skipDocker') }
176
Matthias Andreas Benkardf7bf7c42020-01-28 22:31:12 +0100177 inputDir = file(".")
178 dockerFile = file("src/main/docker/Dockerfile.jvm")
179 images.add("docker.benkard.de/mulk/mulkcms2:${projectVersion}")
180}
181
182buildDocker.dependsOn quarkusBuild
183assemble.dependsOn buildDocker
184
Matthias Andreas Benkard02e10f12020-02-02 18:46:56 +0100185task pushDocker(type: DockerPushImage) {
Matthias Andreas Benkardf7bf7c42020-01-28 22:31:12 +0100186 images.add("docker.benkard.de/mulk/mulkcms2:${projectVersion}")
187}
188
189pushDocker.dependsOn buildDocker