Improved the use of source sets, separated the jar resources from the amp resources

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@57761 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gethin James
2013-11-08 13:31:17 +00:00
parent 00d66de409
commit 65d53a66e9
4 changed files with 49 additions and 61 deletions

View File

@@ -34,13 +34,13 @@ ext {
task packageBuild (dependsOn: [':rm-server:amp', ':rm-share:amp']) << { task packageBuild (dependsOn: [':rm-server:amp', ':rm-share:amp']) << {
distDirFile = file('dist') def distDirFile = file('dist')
if (distDirFile.exists() == false) { if (distDirFile.exists() == false) {
distDirFile.mkdirs(); distDirFile.mkdirs();
} }
alfrescoAmp = "${project(':rm-server').name}/${project(':rm-server').buildDistDir}/${project(':rm-server').ampFile}" def alfrescoAmp = "${project(':rm-server').name}/${project(':rm-server').buildDistDir}/${project(':rm-server').ampFile}"
shareAmp = "${project(':rm-share').name}/${project(':rm-share').buildDistDir}/${project(':rm-share').ampFile}" def shareAmp = "${project(':rm-share').name}/${project(':rm-share').buildDistDir}/${project(':rm-share').ampFile}"
ant.zip(destfile: "${distDir}/${packageZipFile}", update: 'true') { ant.zip(destfile: "${distDir}/${packageZipFile}", update: 'true') {
@@ -132,12 +132,7 @@ subprojects {
explodedDepsDir = 'explodedDeps' explodedDepsDir = 'explodedDeps'
explodedLibsDir = "${explodedDepsDir}/lib" explodedLibsDir = "${explodedDepsDir}/lib"
explodedConfigDir = "${explodedDepsDir}/config" explodedConfigDir = "${explodedDepsDir}/config"
sourceJavaDir = 'source/java'
sourceWebDir = 'source/web'
iconDir = 'build/icon' iconDir = 'build/icon'
testJavaDir = 'test/java'
testResourceDir = 'test/resources'
configDir = 'config'
configModuleDir = "config/alfresco/module/${moduleid}" configModuleDir = "config/alfresco/module/${moduleid}"
baseName = "${groupid}-${appName}-${version}-${build}" baseName = "${groupid}-${appName}-${version}-${build}"
jarFile = "${baseName}.jar" jarFile = "${baseName}.jar"
@@ -149,17 +144,31 @@ subprojects {
sourceSets { sourceSets {
main { main {
java { java {
srcDir sourceJavaDir srcDir 'source/java'
} }
resources {
srcDir 'source/resources'
}
} }
amp {
resources {
srcDir 'config'
}
}
test { test {
java { java {
srcDir testJavaDir srcDir 'test/java'
} }
resources { resources {
srcDir testResourceDir srcDir 'test/resources'
} }
runtimeClasspath += amp.output
} }
web {
resources {
srcDir 'source/web'
}
}
} }
repositories { repositories {
@@ -219,7 +228,11 @@ subprojects {
compileJava.options.encoding = 'UTF-8' compileJava.options.encoding = 'UTF-8'
compileTestJava.options.encoding = 'UTF-8' compileTestJava.options.encoding = 'UTF-8'
jar.archiveName = jarFile jar {
archiveName = jarFile
exclude "**/dev-context.xml"
exclude "**/readme.txt"
}
/** --- Dependancy tasks --- */ /** --- Dependancy tasks --- */
@@ -301,7 +314,7 @@ subprojects {
file(i18nDir).mkdirs() file(i18nDir).mkdirs()
copy { copy {
from configDir from sourceSets.amp.resources
include '**/*.properties' include '**/*.properties'
exclude '**/*_*.properties' exclude '**/*_*.properties'
exclude '**/rm-method-security.properties' exclude '**/rm-method-security.properties'
@@ -309,7 +322,7 @@ subprojects {
exclude '**/log4j.properties' exclude '**/log4j.properties'
exclude '**/module.properties' exclude '**/module.properties'
exclude '**/file-mapping.properties' exclude '**/file-mapping.properties'
into "${i18nDir}/${project.name}/${configDir}" into "${i18nDir}/${project.name}/config"
includeEmptyDirs = false includeEmptyDirs = false
} }
@@ -355,15 +368,16 @@ subprojects {
} }
copy { copy {
from configDir from sourceSets.amp.resources
exclude "**/${moduleProperties}" exclude "**/${moduleProperties}"
exclude "**/${fileMapping}" exclude "**/${fileMapping}"
exclude "**/readme.txt"
exclude "**/dev-context.xml" exclude "**/dev-context.xml"
into "${assembleDir}/config" into "${assembleDir}/config"
} }
copy { copy {
from sourceWebDir from sourceSets.web.resources
include '**/*' include '**/*'
into "${assembleDir}/web" into "${assembleDir}/web"
} }
@@ -393,10 +407,8 @@ subprojects {
task deployExploded(dependsOn: 'jar') << { task deployExploded(dependsOn: 'jar') << {
def jarFileObj = file(jarFilePath) def jarFileObj = file(jarFilePath)
def configDirObj = file(configDir)
def sourceWebObj = file(sourceWebDir)
explodedWebAppDir = new File("${tomcatRoot}/webapps/${webAppName}") def explodedWebAppDir = new File("${tomcatRoot}/webapps/${webAppName}")
if (explodedWebAppDir.exists() == true) { if (explodedWebAppDir.exists() == true) {
// copy module properties // copy module properties
@@ -411,23 +423,16 @@ subprojects {
} }
// copy config // copy config
if (configDirObj.exists() == true) { from(sourceSets.amp.resources) {
copy { exclude "**/${moduleProperties}"
from(configDir) { exclude "**/${fileMapping}"
exclude "**/${moduleProperties}" }
exclude "**/${fileMapping}" into "${explodedWebAppDir}/WEB-INF/classes"
}
into "${explodedWebAppDir}/WEB-INF/classes"
}
}
// copy web // copy web
if (sourceWebObj.exists() == true) { copy {
copy { from sourceSets.web.resources
from sourceWebObj into "${explodedWebAppDir}"
into "${explodedWebAppDir}"
}
} }
} }
else { else {

View File

@@ -1,5 +1,5 @@
sourceSets.main.java.srcDirs = [sourceJavaDir, 'source/compatibility'] sourceSets.main.java.srcDir('source/compatibility')
dependencies { dependencies {
@@ -10,10 +10,7 @@ dependencies {
testCompile "${alfrescoGroupId}:alfresco-repository:${alfrescoTestDepsVersion}:tests@jar" testCompile "${alfrescoGroupId}:alfresco-repository:${alfrescoTestDepsVersion}:tests@jar"
testCompile "${alfrescoGroupId}:alfresco-remote-api:${alfrescoTestDepsVersion}:tests@jar" testCompile "${alfrescoGroupId}:alfresco-remote-api:${alfrescoTestDepsVersion}:tests@jar"
testRuntime files(explodedConfigDir) testRuntime files(explodedConfigDir)
testRuntime files(configDir)
testRuntime files(testResourceDir)
alfrescoDeps "${alfrescoGroupId}:alfresco:${alfrescoBaseVersion}@war" alfrescoDeps "${alfrescoGroupId}:alfresco:${alfrescoBaseVersion}@war"
alfrescoDeps "${alfrescoGroupId}:alfresco-solr:${alfrescoBaseSolrVersion}@zip" alfrescoDeps "${alfrescoGroupId}:alfresco-solr:${alfrescoBaseSolrVersion}@zip"
@@ -30,22 +27,6 @@ task fetchSOLR(type:Copy) {
task useSOLR << { 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 << { task resetDatabase << {
// Set default values if nothing was found (remember Ant props are 'first set wins') // 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.name", value: "alfresco")

View File

@@ -0,0 +1 @@
Files in this directory will be added to the amp.

View File

@@ -0,0 +1 @@
Files in this directory will be added to the jar.