Skip to content

Commit

Permalink
Add build script for monitorenv
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Oct 18, 2023
1 parent 59b764a commit b94b6a1
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dev-lint-frontend:
cd frontend && npm run test:lint:partial

test-back:
cd backend && ./mvnw clean && ./mvnw test
cd backend && ./gradlew clean test

test-front:
cd frontend && npm run test:unit
Expand All @@ -39,7 +39,7 @@ dev-check-config:
dev-run-back-with-infra: dev-erase-db dev-run-infra dev-clean-target-env dev-run-back

dev-run-back:
cd backend && ./mvnw spring-boot:run -Dspring-boot.run.arguments="--spring.config.additional-location="$(BACKEND_CONFIGURATION_FOLDER)"" -Dspring-boot.run.profiles="dev"
cd backend && ./gradlew bootRun --args='--spring.profiles.active=dev --spring.config.additional-location=$(BACKEND_CONFIGURATION_FOLDER)'

dev-run-infra:
@echo "Preparing database"
Expand Down
114 changes: 113 additions & 1 deletion backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,85 @@
plugins {
id("java")
`java-library`
`maven-publish`
id("org.springframework.boot") version "3.1.4"
id("org.jetbrains.kotlin.plugin.spring") version "1.9.10"
kotlin("jvm") version "1.9.10"
id("org.jetbrains.kotlin.plugin.allopen") version "1.9.10"
kotlin("plugin.noarg") version "1.9.10"
kotlin("plugin.jpa") version "1.9.10"
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
kotlin("plugin.serialization") version "1.9.10"
}

repositories {
mavenCentral()
}

kotlin {
jvmToolchain(17)
}

noArg {
invokeInitializers = true
}

configurations.all {
exclude(group = "org.springframework.boot", module = "spring-boot-starter-logging")
}

tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask::class.java) {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
// jvmTarget.set(JvmTarget.JVM_17)
// javaParameters.set(true)
}
}
dependencies {
api("org.springframework.boot:spring-boot-starter-web:3.1.4")
api("org.hibernate.validator:hibernate-validator:8.0.1.Final")
api("jakarta.validation:jakarta.validation-api:3.0.2")
api("org.springframework.boot:spring-boot-starter-actuator:3.1.4")
api("org.springframework.boot:spring-boot-starter-json:3.1.4")
api("org.springframework.boot:spring-boot-starter-security:3.1.4")
api("org.springframework.boot:spring-boot-starter-data-jpa:3.1.4")
api("org.hibernate.orm:hibernate-spatial:6.2.9.Final")
api("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.0")
api("org.n52.jackson:jackson-datatype-jts:1.2.10")
api("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
api("org.springdoc:springdoc-openapi-ui:1.6.15")
api("org.flywaydb:flyway-core:9.22.0")
api("org.jetbrains.kotlin:kotlin-reflect:1.9.10")
api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.10")
api("org.springframework.boot:spring-boot-configuration-processor:3.1.4")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
api("com.neovisionaries:nv-i18n:1.29")
api("org.http4k:http4k-client-apache:4.45.0.0")
api("com.google.code.gson:gson:2.10.1")
api("org.springframework.boot:spring-boot-starter-cache:3.1.4")
api("com.github.ben-manes.caffeine:caffeine:3.1.5")
api("org.springframework.security:spring-security-test:6.0.2")
api("org.testcontainers:testcontainers:1.19.0")
api("io.hypersistence:hypersistence-utils-hibernate-62:3.5.2")
api("org.assertj:assertj-core:3.24.2")
api("org.testcontainers:postgresql:1.19.0")
api("org.springframework.boot:spring-boot-starter-log4j2:3.1.4")
api("io.sentry:sentry:6.21.0")
runtimeOnly("org.springframework.boot:spring-boot-devtools:3.1.4")
runtimeOnly("org.postgresql:postgresql:42.6.0")
testImplementation("jakarta.servlet:jakarta.servlet-api:6.0.0")
testImplementation("com.squareup.okhttp3:mockwebserver:4.10.0")
testImplementation("org.springframework.boot:spring-boot-starter-test:3.1.4")
testImplementation("org.springframework.restdocs:spring-restdocs-mockmvc:3.0.0")
testImplementation("org.testcontainers:junit-jupiter:1.19.0")
testImplementation("net.java.dev.jna:jna:5.13.0")
}

group = "fr.gouv.cacem"
version = "VERSION_TO_CHANGE"
description = "MonitorEnv"
java.sourceCompatibility = JavaVersion.VERSION_17

// This publication is only runned from the CI in Github Actions
publishing {
repositories {
maven {
Expand All @@ -24,3 +101,38 @@ publishing {
}
}
}

springBoot {
mainClass.set("fr.gouv.cacem.monitorenv.MonitorEnvApplicationKt")

buildInfo {
properties {
additional = mapOf(
"commit.hash" to "COMMIT_TO_CHANGE"
)
}
}
}

tasks.withType<JavaCompile>() {
options.encoding = "UTF-8"
}

tasks.withType<Javadoc>() {
options.encoding = "UTF-8"
}

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
verbose.set(true)
android.set(false)
outputToConsole.set(true)
ignoreFailures.set(true)
}

tasks.named<Test>("test") {
useJUnitPlatform()

testLogging {
events("passed")
}
}
9 changes: 0 additions & 9 deletions backend/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
/*
* This file was generated by the Gradle 'init' task.
*
* The settings file is used to specify which projects to include in your build.
* For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.4/userguide/building_swift_projects.html in the Gradle documentation.
*/

plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

rootProject.name = "monitorenv"
include("lib")

0 comments on commit b94b6a1

Please sign in to comment.