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

Commit

Permalink
Get right dependency to avoid blowup.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchallen committed Oct 18, 2021
1 parent a56aca0 commit 2e2e270
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
13 changes: 2 additions & 11 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ plugins {
}

group = "com.github.cs125-illinois"
version = "2021.10.9"
version = "2021.10.10"

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.5.31")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.31")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31") {
exclude(group = "org.jetbrains.kotlin", module = "compiler-embeddable")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-android-extensions")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-compiler-embeddable")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-compiler-runner")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-scripting-compiler-embeddable")
}
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.5.31")
implementation(gradleApi())
implementation("com.google.code.gson:gson:2.8.8")
implementation("org.apache.httpcomponents:httpclient:4.5.13")
Expand Down Expand Up @@ -56,7 +50,4 @@ tasks.withType<KotlinCompile>().configureEach {
apiVersion = "1.4"
languageVersion = "1.4"
}
}
tasks.shadowJar {
isZip64 = true
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import org.eclipse.jgit.lib.Constants
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.plugins.quality.CheckstyleExtension
import org.gradle.api.tasks.Delete
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.testing.Test
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import java.nio.file.Files

/**
Expand All @@ -40,7 +41,7 @@ class GradleGraderPlugin : Plugin<Project> {
}

val javaCompileTasks = mutableSetOf<JavaCompile>()
val kotlinCompileTasks = mutableSetOf<KotlinCompile>()
val kotlinCompileTasks = mutableSetOf<Task>()

val testTasks = mutableMapOf<Project, Test>()
var currentCheckpoint: String? = null
Expand Down Expand Up @@ -85,22 +86,32 @@ class GradleGraderPlugin : Plugin<Project> {
// Check VCS
if (config.vcs.git) {
val gitRepo = try {
val ceiling = project.rootProject.projectDir.parentFile // Go an extra level up to work around a JGit bug
FileRepositoryBuilder().setMustExist(true).addCeilingDirectory(ceiling).findGitDir(project.projectDir).build()
} catch (_: Exception) { exitManager.fail("Grader Git integration is enabled but the project isn't a Git repository.") }
val ceiling =
project.rootProject.projectDir.parentFile // Go an extra level up to work around a JGit bug
FileRepositoryBuilder().setMustExist(true).addCeilingDirectory(ceiling)
.findGitDir(project.projectDir).build()
} catch (_: Exception) {
exitManager.fail("Grader Git integration is enabled but the project isn't a Git repository.")
}
gradeTask.gitConfig = gitRepo.config
val lastCommit = gitRepo.resolve(Constants.HEAD).name
gradeTask.lastCommitId = lastCommit
if (config.vcs.requireCommit) {
var scoreInfo = VcsScoreInfo(listOf())
try {
val loadedInfo = Gson().fromJson(project.rootProject.file(".score.json").readText(), VcsScoreInfo::class.java)
val loadedInfo = Gson().fromJson(
project.rootProject.file(".score.json").readText(),
VcsScoreInfo::class.java
)
@Suppress("SENSELESS_COMPARISON") // Possible for checkpoints to be null if loaded by Gson
if (loadedInfo.checkpoints != null) scoreInfo = loadedInfo
} catch (ignored: Exception) { }
val checkpointScoreInfo = scoreInfo.getCheckpointInfo(currentCheckpoint) ?: VcsCheckpointScoreInfo(currentCheckpoint)
} catch (ignored: Exception) {
}
val checkpointScoreInfo =
scoreInfo.getCheckpointInfo(currentCheckpoint) ?: VcsCheckpointScoreInfo(currentCheckpoint)
val status = Git.open(gitRepo.workTree).status().call()
val clean = (status.added.size + status.changed.size + status.removed.size + status.modified.size + status.missing.size) == 0
val clean =
(status.added.size + status.changed.size + status.removed.size + status.modified.size + status.missing.size) == 0
if (checkpointScoreInfo.increased && checkpointScoreInfo.lastSeenCommit == lastCommit && !clean) {
exitManager.fail("The autograder will not run until you commit the changes that increased your score.")
}
Expand All @@ -119,7 +130,8 @@ class GradleGraderPlugin : Plugin<Project> {
checkstyleTask.source(findSubprojects().map { "${it.projectDir}/src/main" })
checkstyleTask.setIncludes(config.checkstyle.include)
checkstyleTask.setExcludes(config.checkstyle.exclude)
checkstyleTask.configFile = config.checkstyle.configFile ?: exitManager.fail("checkstyle.configFile not specified")
checkstyleTask.configFile =
config.checkstyle.configFile ?: exitManager.fail("checkstyle.configFile not specified")
checkstyleTask.classpath = project.files()
gradeTask.listenTo(checkstyleTask)
}
Expand Down Expand Up @@ -200,7 +212,6 @@ class GradleGraderPlugin : Plugin<Project> {
compile.mustRunAfter(reconfTask)
kotlinCompileTasks.add(compile)
}

// Depend on tests
subproject.tasks.withType(Test::class.java) { test ->
if (test.name in setOf("test", "testDebugUnitTest")) {
Expand Down

0 comments on commit 2e2e270

Please sign in to comment.