Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Enabling security manager for secure testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchallen committed Oct 1, 2017
1 parent 23e2925 commit 68f88df
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class GradeTask extends DefaultTask {

project.tasks.clean.execute()
project.tasks.checkstyleMain.execute()
def mainResourcesDir = project.tasks.processResources.getDestinationDir()
project.tasks.processResources.execute()
project.tasks.processTestResources.execute()

/*
Expand Down Expand Up @@ -120,6 +122,12 @@ class GradeTask extends DefaultTask {
reports.html.enabled = false
include "**" + name + "Test**"
}
if (gradeConfiguration.secure) {
test.jvmArgs("-Djava.security.manager=net.sourceforge.prograde.sm.ProGradeJSM")
test.jvmArgs("-Djava.security.policy=" + gradeConfiguration.secure)
test.systemProperties(["main.sources": project.sourceSets.main.java.outputDir])
test.systemProperties(["main.resources": mainResourcesDir])
}
testOutputDirectories.add(test.reports.getJunitXml().getDestination())
test.execute()
} catch (Exception e) { }
Expand Down Expand Up @@ -226,7 +234,6 @@ class GradeTask extends DefaultTask {
}
if (gradeConfiguration.reporting.directory) {
def filename = Paths.get(gradeConfiguration.reporting.directory, gradeConfiguration.students.join("_") + ".json")
println filename
def file = new File(filename.toString())
def writer = file.newWriter()
writer << JsonOutput.toJson(gradeConfiguration);
Expand Down

0 comments on commit 68f88df

Please sign in to comment.