1 Star 0 Fork 80

邓华锋 / cuba

forked from Jmix 平台中国团队 / cuba 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.gradle 33.80 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116
/*
* 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 = '7.3-SNAPSHOT'
ext.cubaVersion = rootProject.hasProperty('buildVersion') ? rootProject['buildVersion'] : cubaVersion
println("CUBA Platform Version ${ext.cubaVersion}")
println("")
repositories {
mavenLocal()
if (System.getenv('HAULMONT_REPOSITORY_URL') && !rootProject.hasProperty('dependencyUpdates')) {
maven {
credentials {
username System.getenv('HAULMONT_REPOSITORY_USER')
password System.getenv('HAULMONT_REPOSITORY_PASSWORD')
}
url System.getenv('HAULMONT_REPOSITORY_URL')
}
} else {
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://dl.bintray.com/cuba-platform/main" }
}
}
dependencies {
classpath group: 'com.haulmont.gradle', name: 'cuba-plugin', version: cubaVersion
classpath group: 'gradle.plugin.com.github.spotbugs.snom', name: 'spotbugs-gradle-plugin', version: '4.5.1'
if (rootProject.hasProperty('dependencyUpdates')) {
classpath "com.github.ben-manes:gradle-versions-plugin:0.25.0"
}
}
}
apply(plugin: 'base')
apply(plugin: 'maven')
apply(plugin: 'cuba')
if (rootProject.hasProperty('dependencyUpdates')) {
apply plugin: "com.github.ben-manes.versions"
dependencyUpdates {
resolutionStrategy {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'RC', 'cr', 'm', 'preview', 'b', 'ea'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]$qualifier[.\d-+]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
checkForGradleUpdate = false
}
/*
* Check dependency updates:
*
* 1. Install the corresponding cuba-gradle-plugin to .m2
* 2. Run command:
* > gradlew dependencyUpdates -PdependencyUpdates -Drevision=release
*/
}
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.'''
}
tomcat {
dir = "$project.rootDir/deploy/tomcat"
}
}
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 webWidgetsModule = project(':cuba-web-widgets')
def webToolkitModule = project(':cuba-web-toolkit')
def webModule = project(':cuba-web')
def coreTestsModule = project(':cuba-core-tests')
def clientTestsModule = project(':cuba-client-tests')
def webTestsModule = project(':cuba-web-tests')
configure([sharedLibModule, globalModule, coreModule, clientModule, guiModule,
webModule, desktopModule, portalModule]) {
apply(plugin: 'java')
apply(plugin: 'groovy')
apply(plugin: 'maven')
apply(plugin: 'cuba')
// code quality
apply(plugin: 'com.github.spotbugs')
dependencies {
testCompile(bom['org.jmockit:jmockit'])
testCompile(bom['org.junit.jupiter:junit-jupiter-api'])
testCompile(bom['org.junit.jupiter:junit-jupiter-engine'])
testCompile(bom['org.junit.vintage:junit-vintage-engine'])
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')
from sourceSets.main.output.generatedSourcesDirs
classifier = 'sources'
}
artifacts {
archives sourceJar
}
jar {
manifest {
attributes("Implementation-Version": cubaVersion)
}
}
test {
useJUnitPlatform()
maxHeapSize = '256m'
if (System.getProperty('logback.configurationFile')) {
systemProperty 'logback.configurationFile', System.getProperty('logback.configurationFile')
}
environment('TEST_ENV_PROP_1', 'envValue1')
environment('TEST_ENV_PROP_2', 'envValue2')
environment('TEST_ENV_PROP_3', 'envValue3')
environment('TEST_SOMEPROP4', 'envValue4')
systemProperty('TEST_ENV_PROP_2', 'systemValue2')
}
javadoc {
options.addStringOption("sourcepath", "")
}
spotbugs {
toolVersion = "4.1.4"
ignoreFailures = false
omitVisitors = ['FindDoubleCheck']
excludeFilter = rootProject.file("codestyle/exclude-filter.xml")
effort = "max"
reportLevel = "medium"
}
spotbugsMain {
maxHeapSize = '2048m'
reports {
xml.enabled = false
html {
enabled = true
stylesheet = rootProject.resources.text.fromFile("codestyle/fancy-hist.xsl")
destination file("${project.buildDir}/reports/spotbugs/${project.name}.html")
}
}
}
spotbugsTest {
maxHeapSize = '2048m'
reports {
xml.enabled = false
html {
enabled = true
stylesheet = rootProject.resources.text.fromFile("codestyle/fancy-hist.xsl")
destination file("${project.buildDir}/reports/spotbugs/test-${project.name}.html")
}
}
}
}
if (rootProject.hasProperty('jacoco')) {
// Jacoco
configure([sharedLibModule, globalModule, coreModule, clientModule, guiModule, webModule]) {
apply(plugin: 'jacoco')
jacoco {
toolVersion = "0.8.2"
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
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([webWidgetsModule, webToolkitModule]) {
apply(plugin: 'java')
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'])
compileOnly(bom['javax.servlet:javax.servlet-api'])
jdbc(bom['org.postgresql:postgresql'])
jdbc(bom['org.hsqldb:hsqldb'])
}
}
configure(globalModule) {
dependencies {
compile(bom['org.codehaus.groovy:groovy'])
compile(bom['org.codehaus.groovy:groovy-templates'])
compile(bom['org.codehaus.groovy:groovy-sql'])
compile(bom['org.apache.commons:commons-lang3']) // simplify version management with reports and bpm
compile(bom['org.apache.commons:commons-collections4'])
compile(bom['org.apache.commons:commons-text'])
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['org.dom4j:dom4j']) {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'pull-parser', module: 'pull-parser'
}
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['antlr:antlr'])
compile(bom['org.antlr:antlr-runtime'])
compile(bom['com.google.guava:guava'])
compile(bom['org.eclipse.persistence:org.eclipse.persistence.jpa'])
compile(bom['org.eclipse.persistence:org.eclipse.persistence.oracle'])
compile(bom['org.freemarker:freemarker'])
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.validator:hibernate-validator'])
compile(bom['org.glassfish:javax.el'])
compile(bom['org.mindrot:jbcrypt'])
compile(bom['javax.inject:javax.inject'])
compile(bom['javax.annotation:javax.annotation-api'])
compileOnly(bom['javax.servlet:javax.servlet-api'])
compileOnly(bom['com.querydsl:querydsl-jpa'])
annotationProcessor group: 'com.querydsl', name: 'querydsl-apt', version: '4.1.4', classifier: 'jpa'
annotationProcessor configurations.compile
}
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')
}
entitiesEnhancing {
main {
enabled = true
}
}
task filterDummyEntities {
ext.srcFile1 = file('src/com/haulmont/cuba/base-persistence.xml')
ext.srcFile2 = file('src/com/haulmont/cuba/persistence.xml')
ext.dstDir = file("$buildDir/tmp/filtered")
ext.dstFile1 = new File(ext.dstDir, "com/haulmont/cuba/base-persistence.xml")
ext.dstFile2 = new File(ext.dstDir, "com/haulmont/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/com/haulmont/cuba/base-persistence.xml") }
exclude { it.file == file("$buildDir/resources/main/com/haulmont/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 == 'persistence.xml') && sourceSets.main.java.srcDirs.contains(it.file.parentFile)
}
from "$buildDir/tmp/filtered"
}
sourceJar.dependsOn filterDummyEntities
spotbugsMain {
classes = classes.filter {
!it.path.contains(new File("com/haulmont/cuba/core/global/release.").path)
}
}
test {
jvmArgs "-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}"
}
}
configure(coreModule) {
configurations {
dbscripts
}
dependencies {
compile(globalModule)
compile(sharedLibModule)
compile(bom['com.thoughtworks.xstream:xstream'])
compile(bom['org.jgroups:jgroups'])
compile(bom['org.aspectj:aspectjrt'])
compile(bom['org.aspectj:aspectjweaver'])
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
compileOnly(bom['javax.servlet:javax.servlet-api'])
jdbc(bom['org.postgresql:postgresql'])
jdbc(bom['org.hsqldb:hsqldb'])
testCompile(coreTestsModule)
testCompile(bom['org.hsqldb:hsqldb'])
testCompile(bom['org.codehaus.groovy:groovy-json'])
compile(bom['com.zaxxer:HikariCP'])
}
entitiesEnhancing {
test {
enabled = true
}
}
test {
scanForTestClasses = false
includes = ['**/*Test.class']
if (System.getProperty('logback.configurationFile')) {
systemProperty 'logback.configurationFile', System.getProperty('logback.configurationFile')
}
}
task testEntityCache(type: Test) {
useJUnitPlatform()
scanForTestClasses = false
includes = ['**/**CacheTestClass.class']
if (System.getProperty('logback.configurationFile')) {
systemProperty 'logback.configurationFile', System.getProperty('logback.testEntityCache.configurationFile')
}
}
task testJoinInheritance(type: Test) {
scanForTestClasses = false
includes = ['spec/cuba/core/inheritance/JoinedInheritanceTestClass.class']
}
test.finalizedBy testJoinInheritance
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
showUi = !rootProject.hasProperty('headlessHsqlServer')
}
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')
dependencies {
compile(coreModule)
compile(bom['org.apache.commons:commons-dbcp2'])
compile(bom['org.junit.jupiter:junit-jupiter-api'])
compile(bom['org.junit.jupiter:junit-jupiter-engine'])
compile(bom['org.junit.vintage:junit-vintage-engine'])
compile(bom['javax.servlet:javax.servlet-api'])
}
task sourceJar(type: Jar) {
from file('src')
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')
dependencies {
compile(clientModule)
compile(bom['org.jmockit:jmockit'])
compile(bom['org.junit.jupiter:junit-jupiter-api'])
compile(bom['org.junit.jupiter:junit-jupiter-engine'])
compile(bom['org.junit.vintage:junit-vintage-engine'])
compile(bom['javax.servlet:javax.servlet-api'])
}
task sourceJar(type: Jar) {
from file('src')
classifier = 'sources'
}
artifacts {
archives sourceJar
}
test {
jvmArgs "-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}"
}
}
configure(guiModule) {
dependencies {
compile(clientModule)
compile(bom['org.apache.poi:poi'])
compile(bom['org.apache.poi:poi-ooxml'])
testCompile(clientTestsModule)
}
entitiesEnhancing {
main {
enabled = true
}
}
test {
scanForTestClasses = false
includes = ['**/*Test.class']
exclude 'com/haulmont/cuba/gui/components/*ComponentTest.class'
exclude 'com/haulmont/cuba/gui/components/*FieldTest.class'
jvmArgs "-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}"
}
}
configure(webWidgetsModule) {
dependencies {
compileOnly(bom['org.apache.tomcat:tomcat-servlet-api'])
compile(bom['org.apache.commons:commons-lang3'])
compile(bom['com.google.guava:guava'])
compile(bom['com.google.code.findbugs:jsr305'])
compile(bom['com.google.code.gson:gson'])
compile(bom['org.apache.commons:commons-collections4'])
compile(bom['org.slf4j:slf4j-api'])
/* Vaadin */
compile(bom['com.vaadin:vaadin-server']) {
exclude(group: 'com.vaadin', module: 'vaadin-sass-compiler')
}
compile(bom['com.vaadin:vaadin-compatibility-server']) {
exclude(group: 'com.vaadin', module: 'vaadin-sass-compiler')
}
compile(bom['com.vaadin:vaadin-push'])
/* Vaadin addons */
/* The following add-ons are embedded into Platform
com.vaadin:vaadin-context-menu:2.1.0
org.vaadin.addons:aceeditor:0.8.15
org.vaadin.addons:popupbutton:3.0.0
org.vaadin.addons:dragdroplayouts:1.4.2.cuba.0
*/
/* WebJar dependencies */
compile(bom['org.webjars:jquery'])
compile(bom['org.webjars:jquery-ui'])
compile(bom['org.webjars.bower:jquery-file-upload'])
compile(bom['org.webjars.npm:object-fit-images'])
compile(bom['org.webjars:ace-builds'])
compile(bom['org.webjars:diff-match-patch'])
}
jar {
with copySpec {
from sourceSets.main.allJava
include "com/haulmont/cuba/web/widgets/client/**"
}
}
}
configure(webTestsModule) {
apply(plugin: 'java')
apply(plugin: 'maven')
apply(plugin: 'cuba')
javadoc {
options.addStringOption("sourcepath", "")
}
task sourceJar(type: Jar) {
from file('src')
classifier = 'sources'
}
artifacts {
archives sourceJar
}
dependencies {
compile(clientTestsModule)
compile(webModule)
}
}
configure(webModule) {
configurations {
themes
}
dependencies {
compile(sharedLibModule)
compile(guiModule)
compile(webWidgetsModule)
compile(bom['org.springframework.ldap:spring-ldap-core']) {
// removed because it defines its own Log4j LogFactory via JDK services mechanism
exclude(group: 'org.slf4j', module: 'jcl-over-slf4j')
}
// use the same spring-tx as core
compile(bom['org.springframework:spring-tx'])
compile(bom['org.jsoup:jsoup']) // use the same version as core
compile(bom['org.springframework:spring-webmvc'])
compile(bom['commons-fileupload:commons-fileupload']) // required for Spring multipart resolver
compile(bom['com.haulmont.cuba-resources:cuba-png-icons'])
compile(bom['com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer'])
compileOnly(bom['javax.servlet:javax.servlet-api'])
themes(bom['com.vaadin:vaadin-themes'])
testCompile('cglib:cglib-nodep:3.2.6')
testRuntime(bom['javax.servlet:javax.servlet-api'])
testCompile(clientTestsModule)
// prevent cyclic dependencies
testCompile(webTestsModule.sourceSets.main.output)
testCompile(guiModule.sourceSets.test.output)
}
test {
exclude 'com/haulmont/cuba/web/test/ds/**'
exclude 'com/haulmont/cuba/web/test/ui/**'
}
task testUiComponents(type: Test) {
useJUnitPlatform()
maxHeapSize = '256m'
if (System.getProperty('logback.configurationFile')) {
systemProperty 'logback.configurationFile', System.getProperty('logback.configurationFile')
}
include 'com/haulmont/cuba/web/test/ds/api/consistency/WebCheckBoxDsTest/**'
include 'com/haulmont/cuba/web/test/ui/**'
jvmArgs "-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}"
}
entitiesEnhancing {
main {
enabled = true
}
test {
enabled = true
}
}
task buildScssThemes(type: CubaWebScssThemeCreation) {
themes = ['halo', 'hover', 'havana']
// compress = true
// sprites = true
// cleanup = true
}
task deployThemes(type: CubaDeployThemeTask, dependsOn: buildScssThemes) {
}
task buildHover(type: CubaWebScssThemeCreation) {
themes = ['hover']
// compress = true
// sprites = true
// cleanup = true
}
task deployHover(type: Copy, dependsOn: buildHover) {
from file("$webModule.buildDir/web/VAADIN/themes/hover")
into "${cuba.tomcat.dir}/webapps/cuba/VAADIN/themes/hover"
exclude '**/web.xml'
}
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 vaadinThemesDir = "$buildDir/vaadin-themes"
task unpackVaadinThemes() {
doLast {
project.copy {
from zipTree(configurations.themes.resolvedConfiguration.resolvedArtifacts.find { artifact ->
artifact.name == 'vaadin-themes'
}.getFile())
into vaadinThemesDir
include 'VAADIN/themes/valo/**'
exclude '**/favicon.ico'
exclude '**/styles.css.gz'
}
}
outputs.dir(file(vaadinThemesDir))
}
def webOutDir = file("$buildDir/web")
task webArchive(dependsOn: buildScssThemes, type: Zip) {
from file('web')
from webOutDir
exclude '**/web.xml', '**/app.properties'
classifier = 'web'
}
task themesJar(dependsOn: unpackVaadinThemes, type: Jar) {
from "$vaadinThemesDir/VAADIN/themes"
from file('themes')
classifier = 'themes'
}
artifacts {
archives webArchive, themesJar
}
task deploy(dependsOn: assemble, type: CubaDeployment) {
appName = 'cuba'
appJars('cuba-global', 'cuba-client', 'cuba-gui', 'cuba-web', 'cuba-web-widgets')
}
}
configure(webToolkitModule) {
dependencies {
compile(webWidgetsModule)
compile(bom['com.vaadin:vaadin-client'])
compile(bom['com.vaadin:vaadin-client-compiler'])
compile(bom['com.vaadin:vaadin-compatibility-client'])
// for code server only
compile('org.eclipse.jetty:jetty-server:9.2.27.v20190403')
runtime(bom['javax.servlet:javax.servlet-api'])
}
task buildWidgetSet(type: CubaWidgetSetBuilding) {
widgetSetClass = 'com.haulmont.cuba.web.widgets.WidgetSet'
// Strict
strict = true
// Debug flags:
// printCompilerClassPath = true
// 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 = '-Xmx768m'
xss = '-Xss8m'
xxMPS = '-XX:MaxPermSize=256m'
}
task buildDebugWidgetSet(type: CubaWidgetSetBuilding) {
widgetSetsDir = "$project.buildDir/web-debug/VAADIN/widgetsets"
widgetSetClass = 'com.haulmont.cuba.web.widgets.WidgetSet'
// Performance and widgetset size:
style = 'PRETTY'
}
task debugWidgetSet(type: CubaWidgetSetDebug) {
widgetSetClass = 'com.haulmont.cuba.web.widgets.WidgetSet'
xmx = '-Xmx1600m'
}
jar {
from sourceSets.main.allJava
}
task webArchive(dependsOn: buildWidgetSet, type: Jar) {
from file("$buildDir/web")
classifier = 'client'
}
task webDebugArchive(dependsOn: buildDebugWidgetSet, type: Jar) {
from file("$buildDir/web-debug")
classifier = 'debug-client'
}
artifacts {
archives webArchive
if (!cuba.artifact.isSnapshot) {
archives webDebugArchive
}
}
task deploy(dependsOn: webArchive, type: Copy) {
from webArchive
into "$cuba.tomcat.dir/webapps/cuba/WEB-INF/lib"
}
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(clientTestsModule)
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'
}
// desktop module is disabled
compileJava.enabled = false
test.enabled = false
compileTestGroovy.enabled = false
compileTestJava.enabled = false
javadoc.enabled = false
spotbugsMain.enabled = false
}
configure(portalModule) {
dependencies {
compile(globalModule)
compile(clientModule)
compile(sharedLibModule)
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-spring5'])
compile(bom['org.thymeleaf.extras:thymeleaf-extras-springsecurity5'])
compileOnly(bom['javax.servlet:javax.servlet-api'])
testCompile(clientTestsModule)
}
test {
scanForTestClasses = false
includes = ['**/*Test.class']
}
task deploy(dependsOn: assemble, type: CubaDeployment) {
appName = 'cuba-portal'
appJars('cuba-global', 'cuba-client', 'cuba-portal')
}
}
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')
}
}
}
}
restart.finalizedBy start
zipProject {
excludeFromZip = ['out']
}
if (rootProject.hasProperty('jacoco')) {
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.8.2"
}
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.PROTECTED
include 'com/haulmont/cuba/**'
include 'com/haulmont/bali/**'
include 'com/haulmont/chile/**'
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/gui/components/compatibility/**'
exclude 'com/haulmont/cuba/gui/xml/layout/loaders/**'
exclude 'com/haulmont/cuba/desktop/sys/**'
exclude 'com/haulmont/cuba/desktop/gui/components/**'
exclude 'com/haulmont/cuba/desktop/gui/data/**'
exclude 'com/haulmont/cuba/desktop/gui/executors/**'
exclude 'com/haulmont/cuba/web/widgets/addons/**'
exclude 'com/haulmont/cuba/web/widgets/client/**'
exclude 'com/haulmont/cuba/web/controllers/**'
exclude 'com/haulmont/cuba/web/gui/components/**'
exclude 'com/haulmont/cuba/web/gui/data/**'
exclude 'com/haulmont/cuba/web/gui/executors/**'
subprojects.each { proj ->
def javadocTask = proj.tasks.getByPath('javadoc')
if (javadocTask.enabled) {
source += javadocTask.source
classpath += javadocTask.classpath
}
}
}
Java
1
https://gitee.com/denghuafeng/cuba.git
git@gitee.com:denghuafeng/cuba.git
denghuafeng
cuba
cuba
master

搜索帮助