Skip to content
Snippets Groups Projects
Select Git revision
  • accountability
  • development default protected
  • 749-improve-adding-participants-to-edition
  • 754-you-can-t-delete-presentation-slides
  • main protected
  • 739-add-pdf-support-for-presentation-slides
  • 389-queue-2-0-modules-page-pagination
  • 454-selection-for-student-groups-with-multiple-students
  • ask-why-student-requeued
  • 571-allowed-assignments-for-multiple-roles
  • 552-trying-to-create-a-lab-without-specifying-any-request-type-leads-to-oops-screen
  • 628-add-a-button-for-tas-to-redirect-a-request-to-a-head-ta-and-or-lecturer
  • 729-re-think-lab-create-page
  • busy-lab-notification
  • 732-allow-lab-creation-based-on-mytimetable-schedule
  • 691-notification-for-staff-about-busy-lab
  • profile
  • 695-refactor-methods-in-requesttableservice
  • 99-allow-adding-students-staff-using-email-student-number-name
  • flag-feedback
  • 2425.0.2-release protected
  • 2425.0.1-release protected
  • 2425.0.0-release protected
  • 2.3.2-release protected
  • 2.3.0-release protected
  • 2.2.2-release protected
  • 2.2.1-release protected
  • 2.2.0-release protected
  • 2.1.4-release protected
  • 2.1.3-release protected
  • 2.1.2-release protected
  • 2.1.1-release protected
  • 2.1.0-release protected
  • 1.0.1-release protected
  • 1.0.0-release protected
35 results

CONTRIBUTING.md

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    After you've reviewed these contribution guidelines, you'll be all set to contribute to this project.
    build.gradle.kts 11.32 KiB
    import com.diffplug.gradle.spotless.SpotlessExtension
    import org.springframework.boot.gradle.tasks.bundling.BootJar
    import nl.javadude.gradle.plugins.license.DownloadLicensesExtension
    import nl.javadude.gradle.plugins.license.LicenseExtension
    
    group = "nl.tudelft.tam"
    version = "2.2.1"
    
    val javaVersion = JavaVersion.VERSION_17
    
    val labradoorVersion = "1.4.1"
    val libradorVersion = "1.3.0"
    val chihuahUIVersion = "1.0.0"
    val guavaVersion = "32.1.1-jre"
    val modelMapperVersion = "3.1.0"
    val jQueryVersion = "3.6.2"
    val sockJsVersion = "1.5.1"
    val stompVersion = "2.3.4"
    val fontAwesomeVersion = "6.2.0"
    val chartJsVersion = "26962ce-1"
    val jaegerVersion = "3.3.1"
    val httpClientVersion = "5.1.3"
    val sentryVersion = "5.0.1"
    val csvVersion = "5.7.0"
    val springDocVersion = "1.6.11"
    
    val genSourceDir = file("$buildDir/tam/src/main/java")
    
    // The repositories used to lookup dependencies.
    repositories {
        mavenLocal()
        mavenCentral()
    
        maven {
            url = uri("https://build.shibboleth.net/nexus/content/repositories/releases")
        }
        maven {
            url = uri("https://gitlab.ewi.tudelft.nl/api/v4/projects/3611/packages/maven")
        }
        maven {
            url = uri("https://gitlab.ewi.tudelft.nl/api/v4/projects/3634/packages/maven")
        }
        maven {
            url = uri("https://gitlab.ewi.tudelft.nl/api/v4/projects/8633/packages/maven")
        }
    }
    
    // The plugins used by Gradle to generate files, start Spring boot, perform static analysis etc.
    plugins {
        // Plugin for the Kotlin-DSL to be on classpath, disabled
        // because it does not need to be applied during build.
        `kotlin-dsl` apply false
    
        // Standard plugins for Gradle to work properly
        java
        idea
        jacoco
        `maven-publish`
    
        // Spring plugins for managing dependencies and creating
        // a nice Spring Boot application.
        id("org.springframework.boot").version("2.7.18")
        id("io.spring.dependency-management").version("1.1.4")
    
        // Spotless plugin for checking style of Java code.
        id("com.diffplug.spotless").version("6.23.3")
    
        // Plugin for checking license headers within our code and files.
        id("com.github.hierynomus.license").version("0.16.1")
        id("com.github.hierynomus.license-report").version("0.16.1")
    
        // Plugin to provide task to check the current versions of
        // dependencies and of Gradle to see if updates are available.
        id("com.github.ben-manes.versions").version("0.50.0")
    
    	id("com.unclezs.gradle.sass").version("1.0.10")
    }
    
    sourceSets {
        main {
            java {
                srcDir(file("src/main/java"))
                srcDir(genSourceDir)
            }
        }
    
        test {
            java {
                srcDir(file("src/test/java"))
            }
        }
    }
    
    ///// PLUGIN CONFIGURATIONS ///////
    
    java {
        sourceCompatibility = javaVersion
        targetCompatibility = javaVersion
    }
    
    // Configure license plugins.
    configure<DownloadLicensesExtension> {
        includeProjectDependencies = true
    }
    
    configure<LicenseExtension> {
        header = file("$rootDir/LICENSE.header")
        skipExistingHeaders = false
    
        mapping(mapOf(
                "java" to "SLASHSTAR_STYLE"
        ))
    
        excludes(listOf(
                "**/*.json",
    			"**/static/css/*.css",
                "**/labracore/api/**/*.java"
        ))
    }
    
    // Configure Spotless plugin for style checking Java code.
    configure<SpotlessExtension> {
        format("frontend") {
            target("src/main/resources/**/*.html", "src/main/resources/**/*.js", "src/main/resources/scss/**/*.scss")
    
            prettier("3.0.3").config(mapOf(
                    "tabWidth" to 4, "semi" to true,
                    "printWidth" to 100,
                    "bracketSameLine" to true,
                    "arrowParens" to "avoid",
                    "htmlWhitespaceSensitivity" to "ignore"))
        }
    
        java {
            // Use the eclipse formatter format and import order.
            eclipse().configFile(file("eclipse-formatter.xml"))
            importOrderFile(file("$rootDir/importorder.txt"))
    
            // Check for a license header in the form of LICENSE.header.java.
            licenseHeaderFile(file("$rootDir/LICENSE.header.java"))
    
            targetExclude("build/")
    
            // Default added rules.
            removeUnusedImports()
            trimTrailingWhitespace()
            endWithNewline()
        }
    }
    
    /////// TASKS ///////
    val jacocoTestReport by tasks.getting(JacocoReport::class) {
        group = "Reporting"
    
        classDirectories.setFrom(files(classDirectories.files.flatMap {
            val f = files(fileTree(it).exclude("nl/tudelft/tam/dto/id", "nl/tudelft/tam/config", "nl/tudelft/tam/external"))
            f.filter { file -> !file.name.startsWith("DevDatabaseLoader")  }
        }))
    
        reports {
            xml.required.set(true)
            csv.required.set(true)
    
            html.outputLocation.set(file("$buildDir/reports/coverage"))
        }
    }
    
    // Task for generating the client code for connecting with the Labracore API
    
    val processResources by tasks.getting(ProcessResources::class)
    
    // Configure Spring Boot plugin task for running the application.
    val bootJar by tasks.getting(BootJar::class) {
        enabled = true
    }
    
    //    doLast {
    //        maven.pom {
    //            withXml {
    //                val repos = asNode().appendNode("repositories")
    //                fun repository(id: String, url: String) {
    //                    val repo = repos.appendNode("repository")
    //                    repo.appendNode("id", id)
    //                    repo.appendNode("url", url)
    //                }
    //
    //                repository("maven-central", "https://repo.maven.apache.org/maven2")
    //                repository("shibboleth", "https://build.shibboleth.net/nexus/content/repositories/releases")
    //                repository("librador", "https://gitlab.ewi.tudelft.nl/api/v4/projects/3634/packages/maven")
    //                repository("labradoor", "https://gitlab.ewi.tudelft.nl/api/v4/projects/3611/packages/maven")
    //            }
    //        }.writeTo("build/pom.xml")
    //    }
    //}
    
    tasks.withType<Test>().configureEach {
        useJUnitPlatform()
        minHeapSize = "256m"
        maxHeapSize = "1024m"
        testLogging {
            events("passed", "skipped", "failed")
        }
    }
    
    // we don't use the "plain"/light jar
    tasks.getByName<Jar>("jar") {
        enabled = false
    }
    
    sass {
        cssPath = "static/css"
        sassPath = "scss"
    }
    
    tasks.named("processResources") {
        dependsOn("compileSass")
    }
    
    dependencies {
        // Labrador libs
        implementation("nl.tudelft.labrador:labradoor:$labradoorVersion") {
            exclude("org.springframework.boot:spring-boot-devtools")
        }
        implementation("nl.tudelft.labrador:librador:$libradorVersion") {
            exclude("org.springframework.boot:spring-boot-devtools")
        }
        implementation("nl.tudelft.labrador:chihuahui:$chihuahUIVersion")
    
        // Hibernate for database-entity mapping and EntityManagers
        implementation("org.hibernate:hibernate-core")
    
        // Database migration + database driver dependencies
        implementation("org.liquibase:liquibase-core")
        implementation("com.h2database:h2")
    	implementation("com.mysql:mysql-connector-j")
    	implementation("org.mariadb.jdbc:mariadb-java-client")
    	implementation("org.postgresql:postgresql")
    
        // Generic Spring Boot starter dependencies
        implementation("org.springframework.boot:spring-boot-starter")
        implementation("org.springframework.boot:spring-boot-starter-data-jpa")
        implementation("org.springframework.boot:spring-boot-starter-data-rest")
        implementation("org.springframework.boot:spring-boot-starter-web")
        implementation("org.springframework.boot:spring-boot-starter-webflux")
        implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
        implementation("org.springframework.boot:spring-boot-starter-mail")
        implementation("org.springframework.boot:spring-boot-starter-websocket")
        implementation("org.springframework.boot:spring-boot-starter-validation")
        implementation("org.springframework.boot:spring-boot-starter-tomcat")
        implementation("org.springframework.boot:spring-boot-starter-security")
    
        // Other Spring dependencies
        implementation("org.springframework:spring-web")
        implementation("org.springframework.security:spring-security-messaging")
    
        // Thymeleaf layout dialect
        implementation("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect")
    
        // Guava - helps with data structure manipulation
        implementation("com.google.guava:guava:$guavaVersion")
    
        // Dependency for mapping one data class to another
        implementation("org.modelmapper:modelmapper:$modelMapperVersion")
    
        // Jackson core specific version for dependency vulnerabilities check
        implementation("com.fasterxml.jackson.core:jackson-core")
        implementation("com.fasterxml.jackson.core:jackson-databind")
    
        // Webjars
        implementation("org.webjars:webjars-locator-core")
        implementation("org.webjars:jquery:$jQueryVersion")
        implementation("org.webjars:sockjs-client:$sockJsVersion")
        implementation("org.webjars:stomp-websocket:$stompVersion")
        implementation("org.webjars:font-awesome:$fontAwesomeVersion")
        implementation("org.webjars:chartjs:$chartJsVersion")
        implementation("org.webjars:momentjs:2.29.4")
    
        // Flexmark for parsing Markdown into HTML
        implementation("com.vladsch.flexmark:flexmark-all:0.64.0")
    
        // Jaeger
        implementation("io.opentracing.contrib:opentracing-spring-jaeger-starter:$jaegerVersion")
        implementation("io.opentracing.contrib:opentracing-spring-jaeger-web-starter:$jaegerVersion")
    
        // Test dependencies
        testImplementation("org.springframework.boot:spring-boot-starter-test") {
            exclude("junit", "junit")
    		exclude("org.junit.vintage", "junit-vintage-engine")
        }
        testImplementation("org.springframework.security:spring-security-test") {
            exclude("junit", "junit")
    		exclude("org.junit.vintage", "junit-vintage-engine")
        }
    
        testImplementation("org.apache.httpcomponents.client5:httpclient5:$httpClientVersion")
    
        // Lombok for generation of builder pattern, getters, setters, constructors, etc.
        compileOnly("org.projectlombok:lombok")
        testCompileOnly("org.projectlombok:lombok")
        annotationProcessor("org.projectlombok:lombok")
        testAnnotationProcessor("org.projectlombok:lombok")
    
        // Sentry for writing error logs to a server for developer access
        implementation("io.sentry:sentry-spring-boot-starter:$sentryVersion")
        implementation("io.sentry:sentry-logback:$sentryVersion")
    
        // open CSV
        implementation("com.opencsv:opencsv:$csvVersion")
    
    }
    
    /*publishing {
    	publications {
    		create<MavenPublication>("mavenJava") {
    			versionMapping {
                    usage("java-api") {
                        fromResolutionOf("runtimeClasspath")
                    }
                    usage("java-runtime") {
                        fromResolutionResult()
                    }
                }
    			doLast {
    				pom {
    					name.set("TAM")
    
    					this.withXml {
    						val repos = asNode().appendNode("repositories")
    						fun repository(id: String, url: String) {
    							val repo = repos.appendNode("repository")
    							repo.appendNode("id", id)
    							repo.appendNode("url", url)
    						}
    
    						repository("maven-central", "https://repo.maven.apache.org/maven2")
    						repository("shibboleth", "https://build.shibboleth.net/nexus/content/repositories/releases")
    						repository("librador", "https://gitlab.ewi.tudelft.nl/api/v4/projects/3634/packages/maven")
    						repository("labradoor", "https://gitlab.ewi.tudelft.nl/api/v4/projects/3611/packages/maven")
    					}
    				}
    			}
    		}
    	}
    }
    
    val generatePom by tasks.register("generateMavenPom", GenerateMavenPom::class) {
    	destination = File("build/pom.xml")
    }*/