Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Jagr - SourceGrade.org
* Copyright (C) 2021-2023 Alexander Städing
* Copyright (C) 2021-2023 Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.sourcegrade.jagr.gradle.extension

import org.gradle.api.Project
Expand All @@ -11,10 +30,10 @@ data class ProjectSourceSetTuple(
val sourceSetName: String,
) : Serializable {
companion object {
fun fromSourceSetNames(projectPath: String, sourceSetNames: Sequence<String>) =
fun fromSourceSetNames(projectPath: String, sourceSetNames: Sequence<String>): Set<ProjectSourceSetTuple> =
sourceSetNames.map { ProjectSourceSetTuple(projectPath, it) }.toSet()

fun fromSourceSetNames(projectPath: String, sourceSetNames: Iterable<String>) =
fun fromSourceSetNames(projectPath: String, sourceSetNames: Iterable<String>): Set<ProjectSourceSetTuple> =
fromSourceSetNames(projectPath, sourceSetNames.asSequence())
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
/*
* Jagr - SourceGrade.org
* Copyright (C) 2021-2023 Alexander Städing
* Copyright (C) 2021-2023 Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.sourcegrade.jagr.gradle.task.submission

import org.gradle.api.Project
import org.gradle.api.provider.Property
import org.gradle.api.tasks.InputFile
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.property
import org.sourcegrade.jagr.gradle.extension.SubmissionConfiguration
import org.sourcegrade.jagr.gradle.extension.getSourceSet
Expand All @@ -22,7 +40,19 @@ abstract class SubmissionBuildTask : Jar(), SubmissionTask {
group = "build"
dependsOn(configurationName.map(SubmissionWriteInfoTask.Factory::determineTaskName))
from(submissionInfoFile)
from(sourceSetNames.map { all -> all.map { it.getSourceSet(project).allSource } })

project.subprojects.forEach { subproject ->
from(
sourceSetNames.map { all ->
all
.filter { it.projectPath == subproject.path }
.map { it.getSourceSet(project).allSource }
},
) { copy ->
copy.into(subproject.path)
}
}

archiveFileName.set(
assignmentId.zip(studentId) { assignmentId, studentId ->
"$assignmentId-$studentId"
Expand Down