mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-05 04:38:10 +08:00
1099 lines
33 KiB
Groovy
1099 lines
33 KiB
Groovy
/*
|
|
* Copyright (c) 2008-2016 Haulmont.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
*/
|
|
|
|
buildscript {
|
|
ext.cubaVersion = '6.10-SNAPSHOT'
|
|
ext.cubaVersion = rootProject.hasProperty('buildVersion') ? rootProject['buildVersion'] : cubaVersion
|
|
|
|
println("CUBA Platform Version ${ext.cubaVersion}")
|
|
println("")
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
maven {
|
|
credentials {
|
|
username System.getenv('HAULMONT_REPOSITORY_USER') ?: 'cuba'
|
|
password System.getenv('HAULMONT_REPOSITORY_PASSWORD') ?: 'cuba123'
|
|
}
|
|
url System.getenv('HAULMONT_REPOSITORY_URL') ?: 'https://repo.cuba-platform.com/content/groups/work'
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath group: 'com.haulmont.gradle', name: 'cuba-plugin', version: cubaVersion
|
|
}
|
|
}
|
|
|
|
apply(plugin: 'base')
|
|
apply(plugin: 'maven')
|
|
apply(plugin: 'idea')
|
|
apply(plugin: 'cuba')
|
|
|
|
bom.load file('modules/global/src/com/haulmont/cuba/bom.properties')
|
|
|
|
cuba {
|
|
artifact {
|
|
group = 'com.haulmont.cuba'
|
|
version = project.cubaVersion.replace('-SNAPSHOT', '')
|
|
isSnapshot = project.cubaVersion.endsWith('-SNAPSHOT')
|
|
}
|
|
|
|
ide {
|
|
vcs = 'Git'
|
|
copyright = '''Copyright (c) 2008-$today.year Haulmont.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.'''
|
|
}
|
|
}
|
|
|
|
def sharedLibModule = project(':cuba-shared-lib')
|
|
def globalModule = project(':cuba-global')
|
|
def coreModule = project(':cuba-core')
|
|
def clientModule = project(':cuba-client')
|
|
def guiModule = project(':cuba-gui')
|
|
def desktopModule = project(':cuba-desktop')
|
|
def portalModule = project(':cuba-portal')
|
|
def restApiModule = project(':cuba-rest-api')
|
|
def webToolkitModule = project(':cuba-web-toolkit')
|
|
def webModule = project(':cuba-web')
|
|
def idpModule = project(':cuba-idp')
|
|
def uberJarModule = project(':cuba-uberjar')
|
|
def frontModule = project(':cuba-front')
|
|
|
|
def webModuleThemesModule = project(':cuba-web-themes')
|
|
def coreTestsModule = project(':cuba-core-tests')
|
|
def clientTestsModule = project(':cuba-client-tests')
|
|
|
|
configure([sharedLibModule, globalModule, coreModule, clientModule, guiModule,
|
|
webModule, desktopModule, portalModule, restApiModule, idpModule, uberJarModule, frontModule]) {
|
|
apply(plugin: 'java')
|
|
apply(plugin: 'groovy')
|
|
apply(plugin: 'idea')
|
|
apply(plugin: 'maven')
|
|
apply(plugin: 'cuba')
|
|
|
|
// code quality
|
|
apply(plugin: 'findbugs')
|
|
apply(plugin: 'pmd')
|
|
|
|
dependencies {
|
|
testCompile(bom['org.jmockit:jmockit'])
|
|
testCompile(bom['junit:junit'])
|
|
testCompile(bom['org.spockframework:spock-core']) {
|
|
exclude(group: 'org.codehaus.groovy', module: 'groovy-all')
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
test {
|
|
java {
|
|
include '**/testmodel/**'
|
|
}
|
|
groovy {
|
|
exclude '**/testmodel/**'
|
|
srcDir 'test'
|
|
}
|
|
}
|
|
}
|
|
|
|
task sourceJar(type: Jar) {
|
|
from file('src')
|
|
classifier = 'sources'
|
|
}
|
|
|
|
artifacts {
|
|
archives sourceJar
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes("Implementation-Version": cubaVersion)
|
|
}
|
|
}
|
|
|
|
test {
|
|
maxHeapSize = '256m'
|
|
}
|
|
|
|
javadoc {
|
|
// move to plugin ?
|
|
options.addStringOption("sourcepath", "")
|
|
}
|
|
|
|
findbugs {
|
|
toolVersion = "3.0.1"
|
|
ignoreFailures = false
|
|
omitVisitors = ['FindDoubleCheck']
|
|
excludeFilter = rootProject.file("findbugs/exclude-filter.xml")
|
|
effort = "max"
|
|
reportLevel = "high"
|
|
}
|
|
|
|
findbugsMain {
|
|
reports {
|
|
xml.enabled = false
|
|
html {
|
|
enabled = true
|
|
stylesheet = rootProject.resources.text.fromFile("findbugs/fancy-hist.xsl")
|
|
destination file("${project.buildDir}/reports/findbugs/${project.name}.html")
|
|
}
|
|
}
|
|
}
|
|
|
|
findbugsTest {
|
|
reports {
|
|
xml.enabled = false
|
|
html {
|
|
enabled = true
|
|
stylesheet = rootProject.resources.text.fromFile("findbugs/fancy-hist.xsl")
|
|
destination file("${project.buildDir}/reports/findbugs/test-${project.name}.html")
|
|
}
|
|
}
|
|
}
|
|
|
|
pmd {
|
|
ignoreFailures = true
|
|
sourceSets = [sourceSets.main]
|
|
reportsDir = file("${project.buildDir}/reports/pmd")
|
|
ruleSets = [
|
|
"java-basic",
|
|
"java-braces",
|
|
"java-design",
|
|
"java-unusedcode"
|
|
]
|
|
}
|
|
|
|
pmdMain {
|
|
excludes = [
|
|
"**/JPAParser.java",
|
|
"**/JPA2Parser.java"
|
|
]
|
|
reports {
|
|
xml.enabled = true
|
|
html.enabled = false
|
|
}
|
|
source project.fileTree("src")
|
|
}
|
|
|
|
task pmdReport(dependsOn: pmdMain, group: 'verification', description:
|
|
'Generates a HTML report after executing PMD checks.') {
|
|
doLast {
|
|
ant.xslt(
|
|
in: "${project.buildDir}/reports/pmd/main.xml",
|
|
style: "${rootDir}/findbugs/pmd-nicerhtml.xsl",
|
|
out: "${project.buildDir}/reports/pmd/main.html")
|
|
}
|
|
}
|
|
|
|
check {
|
|
dependsOn += ['pmdReport']
|
|
}
|
|
}
|
|
|
|
// Jacoco
|
|
configure([sharedLibModule, globalModule, coreModule, clientModule, guiModule, webModule]) {
|
|
apply(plugin: 'jacoco')
|
|
|
|
jacoco {
|
|
toolVersion = "0.8.0"
|
|
}
|
|
|
|
jacocoTestReport {
|
|
reports {
|
|
xml.enabled = true
|
|
html.enabled = true
|
|
}
|
|
|
|
afterEvaluate {
|
|
// without enhanced-classes output
|
|
classDirectories = files(new File(project.buildDir, 'classes/java/main'))
|
|
}
|
|
}
|
|
|
|
if (rootProject.hasProperty('jacocoTeamcity')) {
|
|
jacocoTestReport.doLast {
|
|
println "##teamcity[jacocoReport dataPath='modules/${project.projectDir.name}/build/jacoco/test.exec' " +
|
|
"includes='com.haulmont.cuba.*' " +
|
|
"classpath='+:modules/${project.projectDir.name}/build/classes/java/main/**']"
|
|
}
|
|
}
|
|
}
|
|
|
|
// configure web toolkit module
|
|
configure(webToolkitModule) {
|
|
apply(plugin: 'java')
|
|
apply(plugin: 'idea')
|
|
apply(plugin: 'maven')
|
|
apply(plugin: 'cuba')
|
|
|
|
task sourceJar(type: Jar) {
|
|
from file('src')
|
|
classifier = 'sources'
|
|
}
|
|
|
|
artifacts {
|
|
archives sourceJar
|
|
}
|
|
|
|
javadoc {
|
|
// move to plugin ?
|
|
options.addStringOption("sourcepath", "")
|
|
}
|
|
}
|
|
|
|
configure(sharedLibModule) {
|
|
dependencies {
|
|
compile(bom['ch.qos.logback:logback-classic'])
|
|
compile(bom['org.slf4j:log4j-over-slf4j'])
|
|
|
|
jdbc(bom['org.postgresql:postgresql'])
|
|
jdbc(bom['org.hsqldb:hsqldb'])
|
|
}
|
|
}
|
|
|
|
configure(globalModule) {
|
|
dependencies {
|
|
compile(bom['org.codehaus.groovy:groovy-all'])
|
|
|
|
compile(bom['commons-lang:commons-lang'])
|
|
compile(bom['org.apache.commons:commons-lang3']) // simplify version management with reports and bpm
|
|
compile(bom['org.apache.commons:commons-collections4'])
|
|
compile(bom['commons-io:commons-io'])
|
|
compile(bom['commons-cli:commons-cli'])
|
|
compile(bom['commons-codec:commons-codec'])
|
|
|
|
compile(bom['org.apache.httpcomponents:httpclient']) // simplify version management for selenium
|
|
compile(bom['org.apache.commons:commons-pool2'])
|
|
compile(bom['org.apache.commons:commons-compress'])
|
|
|
|
compile(bom['dom4j:dom4j'])
|
|
compile(bom['xml-apis:xml-apis']) // simplify version management with core
|
|
compile(bom['javax.activation:activation']) // simplify version management with core
|
|
compile(bom['com.sun.mail:javax.mail'])
|
|
compile(bom['ch.qos.logback:logback-classic'])
|
|
compile(bom['org.slf4j:log4j-over-slf4j'])
|
|
compile(bom['org.perf4j:perf4j'])
|
|
compile(bom['com.google.code.findbugs:jsr305'])
|
|
compile(bom['javax:javaee-api'])
|
|
compile(bom['antlr:antlr'])
|
|
compile(bom['org.antlr:antlr-runtime'])
|
|
compile(bom['com.google.guava:guava'])
|
|
|
|
compile(bom['org.eclipse.persistence:javax.persistence'])
|
|
compile(bom['org.eclipse.persistence:commonj.sdo'])
|
|
compile(bom['org.glassfish:javax.json'])
|
|
compile(bom['com.haulmont.thirdparty:eclipselink'])
|
|
|
|
compile(bom['org.freemarker:freemarker'])
|
|
compile(bom['aopalliance:aopalliance'])
|
|
compile(bom['org.springframework:spring-core'])
|
|
compile(bom['org.springframework:spring-beans'])
|
|
compile(bom['org.springframework:spring-context'])
|
|
compile(bom['org.springframework:spring-web'])
|
|
|
|
compile(bom['com.esotericsoftware:kryo-shaded'])
|
|
compile(bom['de.javakaffee:kryo-serializers']) {
|
|
exclude(group: 'com.esotericsoftware', module: 'kryo')
|
|
}
|
|
|
|
compile(bom['org.json:json'])
|
|
compile(bom['com.google.code.gson:gson'])
|
|
compile(bom['org.hibernate:hibernate-validator'])
|
|
compile(bom['org.glassfish.web:javax.el'])
|
|
|
|
provided(bom['javax.servlet:javax.servlet-api'])
|
|
}
|
|
|
|
task generateReleaseTimestamp(type: CubaReleaseTimeStamp) {
|
|
releaseTimeStampPath = "$buildDir/release-number/com/haulmont/cuba/core/global/release.timestamp"
|
|
releaseNumberPath = "$buildDir/release-number/com/haulmont/cuba/core/global/release.number"
|
|
}
|
|
// do not use classes directory, because it will break Gradle task UP-TO-DATE caching
|
|
jar {
|
|
from new File(project.buildDir, 'release-number')
|
|
}
|
|
|
|
task enhance(type: CubaEnhancing)
|
|
|
|
task filterDummyEntities {
|
|
ext.srcFile1 = file('src/base-persistence.xml')
|
|
ext.srcFile2 = file('src/cuba-persistence.xml')
|
|
ext.dstDir = file("$buildDir/tmp/filtered")
|
|
ext.dstFile1 = new File(ext.dstDir, "base-persistence.xml")
|
|
ext.dstFile2 = new File(ext.dstDir, "cuba-persistence.xml")
|
|
inputs.file srcFile1
|
|
inputs.file srcFile2
|
|
outputs.file dstFile1
|
|
outputs.file dstFile2
|
|
doLast {
|
|
dstDir.mkdirs()
|
|
dstFile1.write(srcFile1.readLines().findAll{ !it.contains('.entity.dummy.') }.join('\n'))
|
|
dstFile2.write(srcFile2.readLines().findAll{ !it.contains('.entity.dummy.') }.join('\n'))
|
|
}
|
|
}
|
|
|
|
jar {
|
|
exclude '**/entity/dummy/*'
|
|
exclude { it.file == file("$buildDir/resources/main/base-persistence.xml") }
|
|
exclude { it.file == file("$buildDir/resources/main/cuba-persistence.xml") }
|
|
from "$buildDir/tmp/filtered"
|
|
|
|
manifest {
|
|
attributes('App-Component-Id': cuba.artifact.group)
|
|
attributes('App-Component-Version': cubaVersion)
|
|
}
|
|
}
|
|
jar.dependsOn filterDummyEntities
|
|
|
|
sourceJar {
|
|
exclude '**/entity/dummy/*'
|
|
exclude {
|
|
(it.file.name == 'base-persistence.xml' || it.file.name == 'cuba-persistence.xml') && sourceSets.main.java.srcDirs.contains(it.file.parentFile)
|
|
}
|
|
from "$buildDir/tmp/filtered"
|
|
}
|
|
sourceJar.dependsOn filterDummyEntities
|
|
|
|
findbugsMain {
|
|
classes = classes.filter {
|
|
!it.path.contains(new File("com/haulmont/cuba/core/global/release.").path)
|
|
}
|
|
}
|
|
}
|
|
|
|
configure(coreModule) {
|
|
configurations {
|
|
dbscripts
|
|
}
|
|
|
|
dependencies {
|
|
compile(globalModule)
|
|
compile(sharedLibModule)
|
|
|
|
compile(bom['javax.validation:validation-api'])
|
|
compile(bom['com.thoughtworks.xstream:xstream'])
|
|
compile(bom['org.jgroups:jgroups'])
|
|
compile(bom['org.aspectj:aspectjrt'])
|
|
compile(bom['org.aspectj:aspectjweaver'])
|
|
compile(bom['org.mybatis:mybatis'])
|
|
compile(bom['org.mybatis:mybatis-spring'])
|
|
|
|
compile(bom['org.springframework:spring-context-support'])
|
|
compile(bom['org.springframework:spring-orm'])
|
|
compile(bom['org.springframework:spring-tx'])
|
|
compile(bom['org.springframework:spring-webmvc'])
|
|
|
|
compile(bom['org.apache.poi:poi']) // POI is actually not required by core, but remains here to simplify dependencies for reports project
|
|
|
|
compile(bom['org.jsoup:jsoup']) // simplify version management for fts
|
|
|
|
provided(bom['javax.servlet:javax.servlet-api'])
|
|
|
|
jdbc(bom['org.postgresql:postgresql'])
|
|
jdbc(bom['org.hsqldb:hsqldb'])
|
|
|
|
testCompile(bom['org.apache.commons:commons-dbcp2'])
|
|
testRuntime(bom['javax.servlet:javax.servlet-api'])
|
|
testRuntime(bom['org.hsqldb:hsqldb'])
|
|
testRuntime(bom['org.postgresql:postgresql'])
|
|
}
|
|
|
|
task enhanceTestModel(type: CubaTestEnhancing)
|
|
|
|
test {
|
|
scanForTestClasses = false
|
|
includes = ['**/*Test.class']
|
|
jvmArgs '-XX:-UseSplitVerifier'
|
|
|
|
systemProperties = [
|
|
'logback.configurationFile': System.getProperty('logback.configurationFile')
|
|
]
|
|
}
|
|
|
|
task testEntityCache(type: Test) {
|
|
scanForTestClasses = false
|
|
includes = ['com/haulmont/cuba/entity_cache/EntityCacheTestSuite.class']
|
|
}
|
|
|
|
assembleDbScripts {
|
|
moduleAlias = '10-cuba'
|
|
}
|
|
|
|
task deploy(dependsOn: assemble, type: CubaDeployment) {
|
|
appName = 'cuba-core'
|
|
appJars('cuba-global', 'cuba-core')
|
|
}
|
|
|
|
def hsqlDbName = 'cubadb'
|
|
def hsqlPort = 9111
|
|
|
|
task startDb(description: 'Starts local HSQLDB server', type: CubaHsqlStart) {
|
|
dbPort = hsqlPort
|
|
dbName = hsqlDbName
|
|
}
|
|
|
|
task stopDb(description: 'Stops local HSQLDB server', type: CubaHsqlStop) {
|
|
dbPort = hsqlPort
|
|
dbName = hsqlDbName
|
|
}
|
|
|
|
task removeDb(description: 'Removes local HSQL database', type: Delete) {
|
|
delete new File("$rootProject.projectDir/data")
|
|
}
|
|
|
|
task killDb(description: "Kill local HSQLDB server process running on port $hsqlPort", type: CubaKillProcess) {
|
|
port = hsqlPort
|
|
}
|
|
|
|
task createDb(dependsOn: assembleDbScripts, description: 'Creates local HSQL database', type: CubaDbCreation) {
|
|
dbms = 'hsql'
|
|
host = "localhost:$hsqlPort"
|
|
dbName = hsqlDbName
|
|
dbUser = 'sa'
|
|
dbPassword = ''
|
|
}
|
|
|
|
task createTestDb(dependsOn: assembleDbScripts, description: 'Creates local HSQL database', type: CubaDbCreation) {
|
|
dbms = 'hsql'
|
|
host = "localhost:$hsqlPort"
|
|
dbName = hsqlDbName
|
|
dbUser = 'sa'
|
|
dbPassword = ''
|
|
auxiliaryScript = file('test/com/haulmont/cuba/testmodel/create-db.sql')
|
|
}
|
|
}
|
|
|
|
configure(coreTestsModule) {
|
|
apply(plugin: 'java')
|
|
apply(plugin: 'maven')
|
|
apply(plugin: 'cuba')
|
|
|
|
buildDir = file('../build/core-tests')
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir '.'
|
|
|
|
include 'com/haulmont/cuba/core/CubaTestCase.java'
|
|
include 'com/haulmont/cuba/testsupport/*.java'
|
|
include '*'
|
|
}
|
|
resources {
|
|
srcDir '.'
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile(coreModule)
|
|
|
|
compile(bom['org.apache.commons:commons-dbcp2'])
|
|
compile(bom['org.jmockit:jmockit'])
|
|
compile(bom['junit:junit'])
|
|
}
|
|
|
|
task sourceJar(type: Jar) {
|
|
from file('.')
|
|
include 'com/haulmont/cuba/core/CubaTestCase*.class'
|
|
include 'com/haulmont/cuba/core/CubaTestCase*.java'
|
|
include 'com/haulmont/cuba/testsupport/*'
|
|
include '*'
|
|
classifier = 'sources'
|
|
}
|
|
|
|
artifacts {
|
|
archives sourceJar
|
|
}
|
|
}
|
|
|
|
configure(clientModule) {
|
|
dependencies {
|
|
compile(globalModule)
|
|
|
|
compile(bom['org.jsoup:jsoup']) // simplify version management for fts
|
|
}
|
|
}
|
|
|
|
configure(clientTestsModule) {
|
|
apply(plugin: 'java')
|
|
apply(plugin: 'maven')
|
|
apply(plugin: 'cuba')
|
|
|
|
buildDir = file('../build/client-tests')
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir '.'
|
|
}
|
|
resources {
|
|
srcDir '.'
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile(clientModule)
|
|
|
|
compile(bom['org.jmockit:jmockit'])
|
|
compile(bom['junit:junit'])
|
|
}
|
|
|
|
task sourceJar(type: Jar) {
|
|
from file('.')
|
|
classifier = 'sources'
|
|
}
|
|
|
|
artifacts {
|
|
archives sourceJar
|
|
}
|
|
}
|
|
|
|
configure(guiModule) {
|
|
dependencies {
|
|
compile(clientModule)
|
|
|
|
compile(bom['org.apache.poi:poi'])
|
|
|
|
testCompile(clientModule.sourceSets.test.output)
|
|
}
|
|
|
|
task enhance(type: CubaEnhancing)
|
|
|
|
test {
|
|
scanForTestClasses = false
|
|
includes = ['**/*Test.class']
|
|
|
|
exclude 'com/haulmont/cuba/gui/components/*ComponentTest.class'
|
|
exclude 'com/haulmont/cuba/gui/components/*FieldTest.class'
|
|
}
|
|
}
|
|
|
|
configure(webModule) {
|
|
configurations {
|
|
themes
|
|
}
|
|
|
|
dependencies {
|
|
compile(sharedLibModule)
|
|
compile(guiModule)
|
|
compile(restApiModule)
|
|
compile(idpModule)
|
|
|
|
compile(bom['org.springframework.ldap:spring-ldap-core']) {
|
|
exclude(group: 'org.slf4j', module: 'jcl-over-slf4j') // removed because it defines its own Log4j LogFactory via JDK services mechanism
|
|
}
|
|
// use the same spring-tx as core
|
|
compile(bom['org.springframework:spring-tx'])
|
|
|
|
compile(bom['org.springframework:spring-webmvc'])
|
|
compile(bom['commons-fileupload:commons-fileupload']) // required for Spring multipart resolver
|
|
|
|
compile(bom['com.vaadin:vaadin-push']) {
|
|
exclude(group: 'com.vaadin.external.atmosphere', module: 'atmosphere-runtime')
|
|
}
|
|
compile(bom['com.vaadin.external.atmosphere:atmosphere-runtime'])
|
|
compile(bom['com.vaadin:vaadin-shared'])
|
|
compile(bom['com.vaadin:vaadin-server']) {
|
|
exclude(group: 'com.vaadin', module: 'vaadin-sass-compiler')
|
|
}
|
|
|
|
compile(bom['org.jsoup:jsoup']) // use the same version as core
|
|
|
|
/* Vaadin addons */
|
|
compile(bom['org.vaadin.addons:popupbutton']) {
|
|
exclude(group: 'com.vaadin', module: 'vaadin-client')
|
|
exclude(group: 'com.vaadin', module: 'vaadin-server')
|
|
}
|
|
compile(bom['org.vaadin.addons:aceeditor'])
|
|
compile(bom['org.vaadin.addons:dragdroplayouts'])
|
|
compile(bom['com.vaadin.addon:vaadin-context-menu']) {
|
|
exclude(group: 'com.vaadin', module: 'vaadin-sass-compiler')
|
|
}
|
|
|
|
/* WebJar dependencies */
|
|
compile(bom['org.webjars:webjars-locator'])
|
|
compile(bom['org.webjars:jquery'])
|
|
compile(bom['org.webjars:jquery-ui'])
|
|
compile(bom['org.webjars.bower:jquery-file-upload'])
|
|
compile(bom['org.webjars:swfobject'])
|
|
compile(bom['org.webjars:swfupload'])
|
|
compile(bom['org.webjars.npm:object-fit-images'])
|
|
|
|
compile(bom['com.haulmont.cuba-resources:cuba-png-icons'])
|
|
|
|
provided(bom['javax.servlet:javax.servlet-api'])
|
|
|
|
themes(bom['com.vaadin:vaadin-themes'])
|
|
|
|
testCompile(clientModule.sourceSets.test.output)
|
|
testCompile(guiModule.sourceSets.test.output)
|
|
testRuntime(bom['javax.servlet:javax.servlet-api'])
|
|
}
|
|
|
|
task enhance(type: CubaEnhancing)
|
|
|
|
jar {
|
|
with copySpec {
|
|
from sourceSets.main.allJava
|
|
include "com/haulmont/cuba/web/toolkit/ui/client/**"
|
|
}
|
|
}
|
|
|
|
task buildScssThemes(type: CubaWebScssThemeCreation) {
|
|
themes = ['halo', 'havana']
|
|
// compress = true
|
|
// sprites = true
|
|
// cleanup = true
|
|
}
|
|
|
|
assemble.dependsOn buildScssThemes
|
|
|
|
task deployThemes(type: CubaDeployThemeTask, dependsOn: buildScssThemes) {
|
|
}
|
|
|
|
task buildHalo(type: CubaWebScssThemeCreation) {
|
|
themes = ['halo']
|
|
// compress = true
|
|
// sprites = true
|
|
// cleanup = true
|
|
}
|
|
|
|
task deployHalo(type: Copy, dependsOn: buildHalo) {
|
|
from file("$webModule.buildDir/web/VAADIN/themes/halo")
|
|
into "${cuba.tomcat.dir}/webapps/cuba/VAADIN/themes/halo"
|
|
exclude '**/web.xml'
|
|
}
|
|
|
|
task buildHavana(type: CubaWebScssThemeCreation) {
|
|
themes = ['havana']
|
|
// compress = true
|
|
// sprites = true
|
|
// cleanup = true
|
|
}
|
|
|
|
task deployHavana(type: Copy, dependsOn: buildHavana) {
|
|
from file("$webModule.buildDir/web/VAADIN/themes/havana")
|
|
into "${cuba.tomcat.dir}/webapps/cuba/VAADIN/themes/havana"
|
|
exclude '**/web.xml'
|
|
}
|
|
|
|
def webOutDir = file("$buildDir/web")
|
|
task webArchive(dependsOn: buildScssThemes, type: Zip) {
|
|
from file('web')
|
|
from webOutDir
|
|
exclude '**/web.xml', '**/app.properties'
|
|
classifier = 'web'
|
|
}
|
|
|
|
artifacts {
|
|
archives webArchive
|
|
}
|
|
|
|
task deploy(dependsOn: assemble, type: CubaDeployment) {
|
|
appName = 'cuba'
|
|
appJars('cuba-global', 'cuba-client', 'cuba-gui', 'cuba-web', 'cuba-rest-api', 'cuba-idp')
|
|
}
|
|
}
|
|
|
|
configure(webModuleThemesModule) {
|
|
apply(plugin: 'java')
|
|
apply(plugin: 'maven')
|
|
apply(plugin: 'cuba')
|
|
|
|
appModuleType = 'web-themes'
|
|
|
|
buildDir = file('../build/scss-themes')
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir '.'
|
|
}
|
|
resources {
|
|
srcDir '.'
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile(bom['com.vaadin:vaadin-themes'])
|
|
}
|
|
}
|
|
|
|
configure(webToolkitModule) {
|
|
dependencies {
|
|
compile(webModule)
|
|
compile(bom['com.vaadin:vaadin-client']) {
|
|
exclude(group: 'com.vaadin.external.gwt', module: 'gwt-elemental')
|
|
}
|
|
compile(bom['com.vaadin:vaadin-client-compiler']) {
|
|
exclude(group: 'com.vaadin.external.gwt', module: 'gwt-elemental')
|
|
exclude(group: 'com.vaadin.external.gwt', module: 'gwt-dev')
|
|
}
|
|
compile(bom['com.google.gwt:gwt-elemental'])
|
|
compile(bom['com.google.gwt:gwt-dev'])
|
|
|
|
runtime(bom['javax.servlet:javax.servlet-api'])
|
|
}
|
|
|
|
task buildWidgetSet(type: CubaWidgetSetBuilding) {
|
|
widgetSetClass = 'com.haulmont.cuba.web.toolkit.ui.WidgetSet'
|
|
// Strict
|
|
strict = true
|
|
// Debug flags:
|
|
printCompilerClassPath = false
|
|
logLevel = 'INFO'
|
|
// Parallel thread count
|
|
workers = 2
|
|
|
|
// Performance and widgetset size:
|
|
style = 'OBF' // 'OBF' or 'PRETTY' or 'DETAILED'
|
|
disableCastChecking = false
|
|
optimize = 9
|
|
draft = false
|
|
|
|
// Compiler JVM
|
|
xmx = '-Xmx512m'
|
|
xss = '-Xss8m'
|
|
xxMPS = '-XX:MaxPermSize=256m'
|
|
}
|
|
|
|
task buildDebugWidgetSet(type: CubaWidgetSetBuilding) {
|
|
widgetSetsDir = "$project.buildDir/web-debug/VAADIN/widgetsets"
|
|
widgetSetClass = 'com.haulmont.cuba.web.toolkit.ui.WidgetSet'
|
|
// Performance and widgetset size:
|
|
style = 'PRETTY'
|
|
}
|
|
|
|
task debugWidgetSet(type: CubaWidgetSetDebug) {
|
|
widgetSetClass = 'com.haulmont.cuba.web.toolkit.ui.WidgetSet'
|
|
}
|
|
|
|
jar {
|
|
from sourceSets.main.allJava
|
|
}
|
|
|
|
task webArchive(dependsOn: buildWidgetSet, type: Zip) {
|
|
from file("$buildDir/web")
|
|
classifier = 'web'
|
|
}
|
|
|
|
task webDebugArchive(dependsOn: buildDebugWidgetSet, type: Zip) {
|
|
from file("$buildDir/web-debug")
|
|
classifier = 'debug'
|
|
}
|
|
|
|
artifacts {
|
|
archives webArchive
|
|
if (!cuba.artifact.isSnapshot) {
|
|
archives webDebugArchive
|
|
}
|
|
}
|
|
|
|
task deploy(dependsOn: buildWidgetSet) {
|
|
doLast {
|
|
delete {
|
|
"$cuba.tomcat.dir/webapps/cuba/VAADIN/widgetsets"
|
|
}
|
|
copy {
|
|
from "$buildDir/web"
|
|
into "$cuba.tomcat.dir/webapps/cuba"
|
|
}
|
|
}
|
|
}
|
|
|
|
task cleanWidgetSet(dependsOn: clean) {
|
|
}
|
|
}
|
|
|
|
configure(desktopModule) {
|
|
apply(plugin: 'application')
|
|
|
|
mainClassName = 'com.haulmont.cuba.desktop.App'
|
|
|
|
dependencies {
|
|
compile(guiModule)
|
|
compile(bom['com.miglayout:miglayout-swing'])
|
|
compile(bom['com.fifesoft:rsyntaxtextarea'])
|
|
compile(bom['com.haulmont.thirdparty:glazedlists'])
|
|
compile(bom['com.haulmont.thirdparty:swingx-core'])
|
|
|
|
compile(bom['com.haulmont.cuba-resources:cuba-png-icons'])
|
|
|
|
testCompile(clientModule.sourceSets.test.output)
|
|
testCompile(guiModule.sourceSets.test.output)
|
|
testRuntime(bom['javax.servlet:javax.servlet-api'])
|
|
}
|
|
|
|
// disable building of *.tar and *.zip artifacts by default assemble task
|
|
configurations.archives.artifacts.removeAll {
|
|
it.file =~ 'tar' || it.file =~ 'zip'
|
|
}
|
|
}
|
|
|
|
configure(restApiModule) {
|
|
dependencies {
|
|
compile(globalModule)
|
|
compile(clientModule)
|
|
compile(sharedLibModule)
|
|
|
|
compile(bom['commons-fileupload:commons-fileupload']) // required for Spring multipart resolver
|
|
|
|
compile(bom['org.springframework:spring-webmvc'])
|
|
compile(bom['org.springframework:spring-context-support'])
|
|
|
|
compile(bom['org.springframework.ldap:spring-ldap-core']) {
|
|
exclude(group: 'org.slf4j', module: 'jcl-over-slf4j') // removed because it defines its own Log4j LogFactory via JDK services mechanism
|
|
}
|
|
|
|
compile(bom['org.json:json'])
|
|
|
|
compile(bom['com.fasterxml.jackson.core:jackson-databind'])
|
|
compile(bom['com.fasterxml.jackson.core:jackson-annotations'])
|
|
compile(bom['com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'])
|
|
|
|
compile(bom['org.springframework.security:spring-security-core'])
|
|
compile(bom['org.springframework.security:spring-security-web'])
|
|
compile(bom['org.springframework.security:spring-security-config'])
|
|
compile(bom['org.springframework.security.oauth:spring-security-oauth2']) {
|
|
exclude(group: 'org.springframework.security')
|
|
}
|
|
|
|
compile(bom['io.swagger:swagger-models'])
|
|
|
|
provided(bom['javax.servlet:javax.servlet-api'])
|
|
|
|
testCompile(clientModule.sourceSets.test.output)
|
|
}
|
|
}
|
|
|
|
configure(portalModule) {
|
|
dependencies {
|
|
compile(globalModule)
|
|
compile(clientModule)
|
|
compile(sharedLibModule)
|
|
compile(restApiModule)
|
|
|
|
compile(bom['org.springframework:spring-webmvc'])
|
|
compile(bom['org.springframework:spring-context-support'])
|
|
compile(bom['org.springframework:spring-jdbc'])
|
|
|
|
compile(bom['org.springframework.security:spring-security-core'])
|
|
compile(bom['org.springframework.security:spring-security-web'])
|
|
compile(bom['org.springframework.security:spring-security-config'])
|
|
compile(bom['org.springframework.security:spring-security-taglibs'])
|
|
|
|
compile(bom['org.json:json'])
|
|
|
|
compile(bom['org.thymeleaf:thymeleaf'])
|
|
compile(bom['org.thymeleaf:thymeleaf-spring4'])
|
|
compile(bom['org.thymeleaf.extras:thymeleaf-extras-springsecurity4'])
|
|
|
|
provided(bom['javax.servlet:javax.servlet-api'])
|
|
|
|
testCompile(clientModule.sourceSets.test.output)
|
|
}
|
|
|
|
test {
|
|
scanForTestClasses = false
|
|
includes = ['**/*Test.class']
|
|
}
|
|
|
|
task deploy(dependsOn: assemble, type: CubaDeployment) {
|
|
appName = 'cuba-portal'
|
|
appJars('cuba-global', 'cuba-client', 'cuba-portal', 'cuba-rest-api')
|
|
}
|
|
}
|
|
|
|
configure(idpModule) {
|
|
dependencies {
|
|
compile(globalModule)
|
|
compile(clientModule)
|
|
compile(sharedLibModule)
|
|
|
|
compile(bom['org.springframework:spring-webmvc'])
|
|
compile(bom['org.springframework:spring-context-support'])
|
|
|
|
compile(bom['org.springframework.security:spring-security-core'])
|
|
compile(bom['org.springframework.security:spring-security-config'])
|
|
compile(bom['org.springframework.security:spring-security-web'])
|
|
|
|
testCompile(clientModule.sourceSets.test.output)
|
|
|
|
provided(bom['javax.servlet:javax.servlet-api'])
|
|
}
|
|
|
|
task webArchive(type: Zip) {
|
|
from file('web')
|
|
classifier = 'web'
|
|
}
|
|
|
|
artifacts {
|
|
archives webArchive
|
|
}
|
|
|
|
task deploy(dependsOn: assemble) {
|
|
doLast {
|
|
delete {
|
|
"$cuba.tomcat.dir/webapps/cuba/idp"
|
|
}
|
|
copy {
|
|
from "$projectDir/web"
|
|
into "$cuba.tomcat.dir/webapps/cuba"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
configure(uberJarModule) {
|
|
dependencies {
|
|
compile(bom['org.eclipse.jetty:jetty-server']) {
|
|
exclude module: 'jetty-util'
|
|
}
|
|
compile(bom['org.eclipse.jetty:jetty-webapp']) {
|
|
exclude module: 'jetty-util'
|
|
}
|
|
compile(bom['org.eclipse.jetty:jetty-plus']) {
|
|
exclude module: 'jetty-util'
|
|
}
|
|
compile(bom['org.eclipse.jetty:jetty-jndi']) {
|
|
exclude module: 'jetty-util'
|
|
}
|
|
compile(bom['org.eclipse.jetty.websocket:websocket-server']) {
|
|
exclude module: 'jetty-util'
|
|
}
|
|
compile(bom['org.eclipse.jetty:jetty-util'])
|
|
compile(bom['commons-cli:commons-cli'])
|
|
compile(bom['commons-io:commons-io'])
|
|
compile(bom['org.apache.commons:commons-dbcp2'])
|
|
compile(bom['ch.qos.logback:logback-classic'])
|
|
compile(bom['org.slf4j:log4j-over-slf4j'])
|
|
compile(bom['org.perf4j:perf4j'])
|
|
}
|
|
}
|
|
|
|
configure(frontModule) {
|
|
dependencies {
|
|
compile(bom['org.springframework:spring-webmvc'])
|
|
compile(bom['org.springframework:spring-context-support'])
|
|
provided(bom['javax.servlet:javax.servlet-api'])
|
|
}
|
|
}
|
|
|
|
task restart(dependsOn: ['stop', ':cuba-core:deploy', ':cuba-web:deploy', ':cuba-web-toolkit:deploy'],
|
|
description: 'Redeploys applications and restarts local Tomcat') {
|
|
doLast {
|
|
ant.waitfor(maxwait: 6, maxwaitunit: 'second', checkevery: 2, checkeveryunit: 'second') {
|
|
not {
|
|
socket(server: 'localhost', port: '8787')
|
|
}
|
|
}
|
|
start.execute()
|
|
}
|
|
}
|
|
|
|
apply plugin: 'jacoco'
|
|
|
|
jacoco {
|
|
toolVersion = "0.8.0"
|
|
}
|
|
|
|
task jacocoProjectReport(type: JacocoReport, group: 'Reporting') {
|
|
description = 'Generates an aggregate report from all subprojects'
|
|
|
|
def jacocoProjects = subprojects.findAll { prj ->
|
|
return prj.project.extensions.findByName('jacoco') != null
|
|
}
|
|
|
|
dependsOn(jacocoProjects.jacocoTestReport)
|
|
|
|
additionalSourceDirs = generateSourceFiles(jacocoProjects)
|
|
sourceDirectories = generateSourceFiles(jacocoProjects)
|
|
classDirectories = generateClassDirs(jacocoProjects)
|
|
executionData = rootProject.files(jacocoProjects.jacocoTestReport.executionData)
|
|
|
|
reports {
|
|
html {
|
|
enabled true
|
|
destination new File(rootProject.buildDir, 'reports/jacoco/project')
|
|
}
|
|
xml {
|
|
enabled true
|
|
destination new File(rootProject.buildDir, 'reports/jacoco/project/jacoco-project.xml')
|
|
}
|
|
}
|
|
|
|
doFirst {
|
|
executionData = files(executionData.findAll { it.exists() })
|
|
}
|
|
}
|
|
|
|
def generateSourceFiles(Collection projects) {
|
|
def dirs = projects.collect { prj -> new File(prj.projectDir, 'src') }
|
|
|
|
return rootProject.files(dirs)
|
|
}
|
|
|
|
def generateClassDirs(Collection projects) {
|
|
def trees = projects.collect { prj ->
|
|
return prj.fileTree(dir: new File(prj.buildDir, 'classes/java/main'))
|
|
}
|
|
|
|
return trees.inject(files().asFileTree) { sum, current ->
|
|
sum += current
|
|
}
|
|
}
|
|
|
|
|
|
task aggregateJavadoc(type: Javadoc,
|
|
description: 'Generate javadocs from all child projects as if it was a single project',
|
|
group: 'Documentation') {
|
|
|
|
destinationDir = file("$buildDir/docs/javadoc")
|
|
title = "${project.name.toUpperCase()} ${cubaVersion.replace('-SNAPSHOT','')} API"
|
|
|
|
options.encoding = 'UTF-8'
|
|
options.addStringOption("sourcepath", "")
|
|
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PUBLIC
|
|
|
|
exclude 'com/haulmont/cuba/core/app/cache/**'
|
|
exclude 'com/haulmont/cuba/core/sys/jpql/antlr2/**'
|
|
exclude 'com/haulmont/cuba/core/sys/utils/**'
|
|
exclude 'com/haulmont/cuba/desktop/sys/vcl/**'
|
|
exclude 'com/haulmont/cuba/restapi/**'
|
|
exclude 'com/haulmont/cuba/web/toolkit/**'
|
|
exclude 'org/eclipse/**'
|
|
|
|
subprojects.each { proj ->
|
|
def javadocTask = proj.tasks.getByPath('javadoc')
|
|
|
|
source += javadocTask.source
|
|
classpath += javadocTask.classpath
|
|
}
|
|
}
|