69 lines
2.3 KiB
Groovy
69 lines
2.3 KiB
Groovy
/*
|
|
* The build script for compiling a java algo.
|
|
*/
|
|
|
|
plugins {
|
|
// Apply the java plugin to add support for Java
|
|
id 'java'
|
|
|
|
// Apply the application plugin to add support for building an application
|
|
id 'application'
|
|
|
|
// Apply the shadow plugin to add support for fat, self-sufficient jars
|
|
id 'com.github.johnrengelman.shadow' version '5.2.0'
|
|
}
|
|
|
|
// This is necessary for successful compilation on our servers
|
|
sourceCompatibility = JavaVersion.VERSION_1_10
|
|
targetCompatibility = JavaVersion.VERSION_1_10
|
|
|
|
// Define the main class for the application
|
|
mainClassName = 'com.c1games.terminal.starteralgo.StarterAlgo'
|
|
|
|
dependencies {
|
|
// Use JUnit test framework
|
|
testCompile 'junit:junit:4.12'
|
|
|
|
// GSON, used for java-json serialization.
|
|
compile 'com.google.code.gson:gson:2.8.5'
|
|
}
|
|
|
|
// A task to create the fat jar in build/libs/algo.jar
|
|
shadowJar {
|
|
baseName = 'algo'
|
|
classifier = null
|
|
version = null
|
|
}
|
|
// Copy the fat jar into the project root so that the terminal servers can find it
|
|
task relocateJar(type: Copy, group: "Custom", description: "Copies algo.jar from build/libs to the project root") {
|
|
from "build/libs/algo.jar"
|
|
into "algo-target"
|
|
}
|
|
build.finalizedBy(relocateJar)
|
|
|
|
// A task to build the fat jar to be used within the automated algo path tests
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
task pathTest(type: ShadowJar) {
|
|
group = "Custom"
|
|
baseName = 'pathtest'
|
|
description = "Build a jar to be used within the automated algo path tests"
|
|
manifest.attributes 'Main-Class': 'com.c1games.terminal.pathtest.PathTest'
|
|
classifier = 'algo'
|
|
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
|
|
configurations = [project.configurations.runtime]
|
|
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
|
|
}
|
|
// Copy the path test fat jar
|
|
task relocatePathJar(type: Copy, group: "Custom", description: "Copies algo.jar from build/libs to the project root") {
|
|
from "build/libs/pathtest-algo.jar"
|
|
into "."
|
|
}
|
|
pathTest.finalizedBy(relocatePathJar)
|
|
|
|
// In this section you declare where to find the dependencies of your project
|
|
repositories {
|
|
// Use jcenter for resolving your dependencies.
|
|
// You can declare any Maven/Ivy/file repository here.
|
|
jcenter()
|
|
}
|