Files
alfresco-community-repo/rm-server/build.gradle
2013-08-28 10:46:42 +00:00

125 lines
4.0 KiB
Groovy

sourceSets.main.java.srcDirs = [sourceJavaDir, 'source/compatibility']
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'javax.servlet:servlet-api:2.5'
testCompile 'org.springframework:spring-test:2.5'
testCompile group: alfrescoGroupId, name: 'alfresco-repository', version: alfrescoTestDepsVersion, type: 'jar', classifier: 'tests'
testCompile group: alfrescoGroupId, name: 'alfresco-remote-api', version: alfrescoTestDepsVersion, type: 'jar', classifier: 'tests'
testRuntime files(explodedConfigDir)
testRuntime files(configDir)
testRuntime files(testResourceDir)
alfrescoDeps group: alfrescoGroupId, name: 'alfresco', version: alfrescoBaseVersion, type: 'war'
alfrescoDeps group: alfrescoGroupId, name: 'alfresco-solr', version: alfrescoBaseSolrVersion, type: 'zip'
}
task fetchSOLR(type:Copy) {
from configurations.alfrescoDeps
into '.'
include '*.zip'
rename { String filename -> solrFile }
}
task useSOLR << {
}
eclipse {
classpath {
file {
withXml {
Map<String, String> map = new HashMap<String, String>()
map.put('kind', 'src')
map.put('path', configDir)
def node = it.asNode()
node.appendNode('classpathentry', map)
}
}
}
}
task resetDatabase << {
// Set default values if nothing was found (remember Ant props are 'first set wins')
ant.property(name: "db.name", value: "alfresco")
ant.property(name: "db.url", value: "jdbc:postgresql:alfresco")
ant.property(name: "db.master.url", value: "jdbc:postgresql:template1")
ant.property(name: "db.username", value: "alfresco")
ant.property(name: "db.password", value: "alfresco")
ant.property(name: "db.driver", value: "org.postgresql.Driver")
// Loading the properties in all possible locations
ant.property(file: System.properties.getProperty('DB_PROPERTIES') )
ant.property(file: System.properties.getProperty('user.home')+'/alfresco/extension/repository.properties' )
ant.property(resource: 'alfresco/domain/transaction.properties', classpath: configurations.compile.asPath )
ant.property(resource: 'alfresco/version.properties', classpath: configurations.compile.asPath )
ant.property(resource: 'alfresco/repository.properties', classpath: configurations.compile.asPath )
println "Recreating database " + ant.getProperty("db.name") + " as user " + ant.getProperty("db.username")
ant.sql(driver: 'org.postgresql.Driver',
url: ant.getProperty("db.master.url"),
userid: ant.getProperty("db.username"),
password: ant.getProperty("db.password"),
print: 'true',
autocommit: 'true',
classpath: configurations.compile.asPath,
'drop database if exists ' + ant.getProperty("db.name") + '; create database ' + ant.getProperty("db.name") + ';')
if (ant.getProperties().containsKey("dir.root")) {
println "Deleting content store in " + ant.getProperty("dir.root")
ant.delete(includeEmptyDirs: 'true', dir: ant.getProperty("dir.root"))
}
}
test {
if (localBuild == 'false') {
dependsOn resetDatabase
}
scanForTestClasses = false
include '**/AllTestSuite.class'
testLogging.showStandardStreams = true
jvmArgs '-Xms256M', '-Xmx1024M', '-XX:MaxPermSize=256M'
if (localBuild == 'false') {
// Put systemProperty definition in a doFirst closure, otherwise it's executed before resetDatabase task
doFirst {
ant.property(name: "dir.root", value: System.getProperty("user.dir") + "/build/test_alf_data")
systemProperties = ant.getProperties()
}
}
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
task deploydemo << {
def demoDir = "demo/${demo}"
def demoDirObj = file(demoDir)
explodedWebAppDir = new File("${tomcatRoot}/webapps/${webAppName}")
if (explodedWebAppDir.exists() == true) {
if (demoDirObj.exists() == true) {
copy {
from(demoDir)
into "${explodedWebAppDir}/WEB-INF/classes/alfresco/module/org_alfresco_module_rm/${demoDir}"
}
}
}
else {
println "Exploded webapp directory ${explodedWebAppDir} does not exist."
}
}