// Students should not edit this file. plugins { // id 'pmd' // id "com.github.spotbugs" version "1.7.1" // id "com.diffplug.gradle.spotless" version "3.21.1" } apply plugin: 'java' sourceCompatibility = 1.11 targetCompatibility = 1.11 repositories { mavenCentral() jcenter() } dependencies { testImplementation group: 'junit', name: 'junit', version: '4.12' testRuntime group: 'junit', name: 'junit', version: '4.12' testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '1.3' testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' implementation 'com.opencsv:opencsv:4.3.2' implementation "com.google.code.gson:gson:2.8.5" implementation "com.sparkjava:spark-core:2.8.0" implementation "org.slf4j:slf4j-simple:1.7.21" } javadoc { options.tags = ["spec.modifies", "spec.effects", "spec.requires", "spec.specfield", "spec.derivedfield"] options.addBooleanOption "-no-module-directories", true } /// /// Testing /// test { exclude 'setup/**' exclude 'poly/**' // exclude 'graph/**' // exclude 'marvel/**' // exclude 'pathfinder/**' } tasks.withType(Test) { enableAssertions = true } task copyGraphTestScripts(type: Copy) { from "src/test/java/graph/specTest" include "*.test", "*.expected" into "${buildDir}/classes/java/test/graph/specTest" } task copyMarvelTestScripts(type: Copy) { from "src/test/java/marvel/specTest" include "*.test", "*.expected" into "${buildDir}/classes/java/test/marvel/specTest" } task copyPathfinderTestScripts(type: Copy) { from "src/test/java/pathfinder/specTest" include "*.test", "*.expected" into "${buildDir}/classes/java/test/pathfinder/specTest" } test.dependsOn copyGraphTestScripts test.dependsOn copyMarvelTestScripts test.dependsOn copyPathfinderTestScripts /// /// Extra code quality checks /// compileJava { options.encoding = 'UTF-8' options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror" } compileTestJava { options.encoding = 'UTF-8' options.compilerArgs << "-Xlint:unchecked" << "-Werror" } /// /// Validation: Checking additional assignment requirements /// task validate { description = 'Validate the working copy. Ensures that the project builds, that required files exist and a Javadoc is generated.' } validate.dependsOn clean validate.dependsOn build validate.dependsOn javadoc /// /// Run: running Java classes /// task runHolaWorld(type: JavaExec) { main = "setup/HolaWorld" standardInput = System.in classpath = sourceSets.main.runtimeClasspath } task runRandomHello(type: JavaExec) { main = "setup/RandomHello" standardInput = System.in classpath = sourceSets.main.runtimeClasspath } task runCalculator(type: JavaExec) { main = "poly/CalculatorFrame" standardInput = System.in classpath = sourceSets.main.runtimeClasspath } task runMarvel(type: JavaExec) { main = "marvel/MarvelPaths" standardInput = System.in classpath = sourceSets.main.runtimeClasspath } task runPathfinder(type: JavaExec) { main = "pathfinder/textInterface/Pathfinder" standardInput = System.in classpath = sourceSets.main.runtimeClasspath } task runSpark(type: JavaExec) { main = "campuspaths/SparkServer" classpath = sourceSets.main.runtimeClasspath } /// /// Other targets /// task cleanByRenaming { description = 'Use this when the "clean" target fails due to "unable to delete file" "device or resource busy".' doLast { File destinationDir = new File("${buildDir}", 'deleteme-' + new Random().nextInt(1000000)) mkdir destinationDir println "destinationDir = " + destinationDir buildDir.eachFile { f -> println "Processing " + f f.renameTo(new File(destinationDir, f.getName())) } } } task specTests(type: Test) { description = 'Runs the specification tests.' group = 'verification' filter { setExcludePatterns "*.implTest.*" setIncludePatterns "*.specTest.*" } } task implTests(type: Test) { description = 'Runs the implementation tests.' group = 'verification' filter { setExcludePatterns "*.specTest.*" setIncludePatterns "*.implTest.*" } } specTests.dependsOn compileTestJava specTests.dependsOn copyGraphTestScripts specTests.dependsOn copyMarvelTestScripts specTests.dependsOn copyPathfinderTestScripts implTests.dependsOn compileTestJava /// /// HW7 Configurations /// task compileGraphOnly(type: JavaCompile) { source = compileJava.source destinationDir = compileJava.destinationDir classpath = compileJava.classpath } compileGraphOnly { exclude 'setup/**' exclude 'poly/**' exclude 'marvel/**' exclude 'pathfinder/**' options.encoding = 'UTF-8' options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror" }