Skip to content

Commit

Permalink
Some more Gradle cleanup
Browse files Browse the repository at this point in the history
-Add more comments for documentation purposes
-Remove unnecessary comments and code
-Move WebContent to \src\main\webapp to remove more build code
  • Loading branch information
robertsmieja committed Aug 21, 2014
1 parent faddea9 commit cced92a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 41 deletions.
27 changes: 10 additions & 17 deletions Core/WPISuite/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
//Import the Tomcat plugin
buildscript {
repositories {
jcenter()
// maven {
// url "https://source.db4o.com/maven"
// }
}
dependencies {
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.3'
classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.4'
}
}

//Apply plugins
apply plugin: 'war'
apply plugin: 'tomcat'

webAppDirName = 'WebContent'
//Which version of Tomcat should be used
def tomcatVersion = '7.0.54'

dependencies {
def tomcatVersion = '7.0.54'

providedCompile "javax.servlet:javax.servlet-api:3.0.1"

tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"

//Depend on tomcat
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}"
tomcat "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}

// tomcat {
// httpPort = 8090
// httpsPort = 8091
// enableSSL = true
// }

//Core project dependency
compile project(':WPISuite-Interfaces')

//Modules
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
47 changes: 23 additions & 24 deletions Janeway/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ apply plugin: 'application'
mainClassName = "edu.wpi.cs.wpisuitetng.janeway.Janeway"
//applicationDefaultJvmArgs = ["-Dgreeting.language=en"]

//Janeway depends on it's modules, look at the modules first
modulesList.each {
evaluationDependsOn(":${it}")
}
Expand All @@ -27,31 +28,42 @@ dependencies{
compile project(':WPISuite-Interfaces')
compile project(':Network')

//Modules
//We depend on each modules
modulesList.each {
runtime project(":${it}")
}
runtime project(":${it}")
}
}

//Workaround so that Eclipse knows how to run the Gradle tasks 'modules' in order to prepare modules. 'modules' is dependency for running Janeway
//TODO Pretty sure there is a better way of doing this
eclipse{
project{
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
buildCommand 'org.eclipse.ui.externaltools.ExternalToolBuilder', LaunchConfigHandle: '<project>/.externalToolBuilders/Gradle - Prepare Modules - Windows.launch'
} else {
buildCommand 'org.eclipse.ui.externaltools.ExternalToolBuilder', LaunchConfigHandle: '<project>/.externalToolBuilders/Gradle - Prepare Modules - Unix.launch'
}
}
project{
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
buildCommand 'org.eclipse.ui.externaltools.ExternalToolBuilder', LaunchConfigHandle: '<project>/.externalToolBuilders/Gradle - Prepare Modules - Windows.launch'
} else {
buildCommand 'org.eclipse.ui.externaltools.ExternalToolBuilder', LaunchConfigHandle: '<project>/.externalToolBuilders/Gradle - Prepare Modules - Unix.launch'
}
}
}

//Add the dependencies to the .jar manifest
jar {
manifest{
attributes('Class-Path': configurations.runtime.files.collect {
if(!modulesList.contains(it.name.minus(".jar")) || 'Janeway'.equals(it.name.minus("jar")))
//Don't include the modules in the manifest, we're including them in the modules folder
if(!modulesList.contains(it.name.minus(".jar")))
{"${libsDir}/${it.name}"}}.join(' ') )
attributes('Main-Class': "${mainClassName}")
}
}

//Remove the default distribution tasks, since Janeway requires more complicated configuration
tasks.removeAll([distZip, distTar, installApp, startScripts])

/**
* Custom Gradle tasks to prepare the Janeway modules, and create a distribution. Equivalent to Ant targets
*/

task modules(type: Copy) {
description = "Copy over each module .jar file for Janeway into the modules folder"
group = "Application"
Expand All @@ -66,16 +78,6 @@ task modules(type: Copy) {
}
}

//TODO Start using when Distribution plugin is further developed
//Until then a custom task is more ideal

//distZip.enabled = false
//distTar.enabled = false
//installApp.enabled = false
//startScripts.enabled = false

tasks.removeAll([distZip, distTar, installApp, startScripts])

task distribution(type: Zip){
description = "Create a .zip distribution for Janeway"
group = "Application"
Expand All @@ -87,9 +89,6 @@ task distribution(type: Zip){
into "${project.name}"
}

//Scripts to launch
//from(startScripts)

//Libraries
from(configurations.runtime){
into "${project.name}/${libsDir}"
Expand Down

0 comments on commit cced92a

Please sign in to comment.