2020-10-08 23:14:43 -04:00
|
|
|
group = "dev.fyloz.trial.colorrecipesexplorer"
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("java")
|
2020-11-17 14:53:02 -05:00
|
|
|
id("org.jetbrains.kotlin.jvm") version "1.4.10"
|
|
|
|
id("org.jetbrains.dokka") version "1.4.10"
|
2020-10-08 23:14:43 -04:00
|
|
|
id("com.leobia.gradle.sassjavacompiler") version "0.2.1"
|
|
|
|
id("io.freefair.lombok") version "5.2.1"
|
|
|
|
id("org.springframework.boot") version "2.3.4.RELEASE"
|
2020-10-15 23:38:13 -04:00
|
|
|
id("org.jetbrains.kotlin.plugin.spring") version "1.4.10"
|
|
|
|
id("org.jetbrains.kotlin.plugin.jpa") version "1.4.10"
|
2020-10-08 23:14:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2020-11-17 14:53:02 -05:00
|
|
|
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.4.10"))
|
|
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10")
|
|
|
|
implementation("org.jetbrains.kotlin:kotlin-reflect:1.4.10")
|
2020-10-08 23:14:43 -04:00
|
|
|
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.11.3")
|
2020-11-17 14:53:02 -05:00
|
|
|
implementation("javax.xml.bind:jaxb-api:2.3.0")
|
|
|
|
implementation("io.jsonwebtoken:jjwt:0.9.1")
|
|
|
|
implementation("org.apache.poi:poi-ooxml:4.1.0")
|
|
|
|
implementation("org.apache.pdfbox:pdfbox:2.0.4")
|
|
|
|
implementation("com.atlassian.commonmark:commonmark:0.13.1")
|
|
|
|
implementation("commons-io:commons-io:2.6")
|
2020-10-08 23:14:43 -04:00
|
|
|
|
2020-10-15 23:38:13 -04:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-data-jpa:2.3.4.RELEASE")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-jdbc:2.3.4.RELEASE")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-thymeleaf:2.3.4.RELEASE")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-web:2.3.4.RELEASE")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-validation:2.3.4.RELEASE")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-security:2.3.4.RELEASE")
|
|
|
|
implementation("org.springframework.boot:spring-boot-configuration-processor:2.3.4.RELEASE")
|
2020-11-17 14:53:02 -05:00
|
|
|
implementation("org.springframework.boot:spring-boot-devtools:2.3.4.RELEASE")
|
2020-10-15 23:38:13 -04:00
|
|
|
|
2020-11-17 14:53:02 -05:00
|
|
|
testImplementation("org.springframework:spring-test:5.1.6.RELEASE")
|
|
|
|
testImplementation("org.mockito:mockito-core:3.6.0")
|
|
|
|
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
|
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.2")
|
2020-10-15 23:38:13 -04:00
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test:2.3.4.RELEASE")
|
|
|
|
testImplementation("org.springframework.boot:spring-boot-test-autoconfigure:2.3.4.RELEASE")
|
2020-11-17 14:53:02 -05:00
|
|
|
testImplementation("org.jetbrains.kotlin:kotlin-test:1.4.10")
|
|
|
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.4.10")
|
2020-10-08 23:14:43 -04:00
|
|
|
|
|
|
|
runtimeOnly("com.h2database:h2:1.4.199")
|
2020-12-23 14:45:21 -05:00
|
|
|
runtimeOnly("mysql:mysql-connector-java:8.0.22")
|
2020-10-08 23:14:43 -04:00
|
|
|
compileOnly("org.projectlombok:lombok:1.18.10")
|
|
|
|
}
|
|
|
|
|
|
|
|
java {
|
2020-11-17 14:53:02 -05:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_14
|
|
|
|
targetCompatibility = JavaVersion.VERSION_14
|
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java
|
|
|
|
kotlin
|
|
|
|
}
|
|
|
|
test {
|
|
|
|
kotlin
|
|
|
|
}
|
2020-10-08 23:14:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
testLogging {
|
|
|
|
events("passed", "skipped", "failed")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<JavaCompile> {
|
2020-11-17 14:53:02 -05:00
|
|
|
options.compilerArgs.addAll(arrayOf("--release", "14"))
|
2020-10-08 23:14:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
2020-11-17 14:53:02 -05:00
|
|
|
kotlinOptions.jvmTarget = "14"
|
2020-10-08 23:14:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.dokkaHtml {
|
2020-11-17 14:53:02 -05:00
|
|
|
outputDirectory.set(rootDir.resolve("dokka"))
|
2020-10-08 23:14:43 -04:00
|
|
|
}
|
2021-02-10 20:41:17 -05:00
|
|
|
|
|
|
|
// Custom tasks
|
|
|
|
|
|
|
|
tasks.register("buildBackend") {
|
|
|
|
val outputDirectory = "dist/backend"
|
|
|
|
println("Building Spring backend to ${projectDir.absolutePath}/$outputDirectory")
|
|
|
|
|
|
|
|
dependsOn(tasks.bootJar)
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
// Creates the output directory if it does not exists.
|
|
|
|
val outputDirectoryFile = File("${projectDir.absolutePath}/$outputDirectory")
|
|
|
|
if (!outputDirectoryFile.exists() || !outputDirectoryFile.isDirectory) {
|
|
|
|
outputDirectoryFile.mkdirs()
|
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
|
|
|
if (isUnixOs())
|
|
|
|
commandLineUnix("cp build/libs/${project.name}.jar ${outputDirectoryFile.absolutePath}/${project.name}.jar")
|
|
|
|
else
|
|
|
|
commandLineWindows("xcopy build\\libs\\${project.name}.jar ${outputDirectoryFile.absolutePath}/${project.name}.jar")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("buildFrontend") {
|
|
|
|
val outputDirectory = "dist/frontend"
|
|
|
|
println("Building Angular frontend to ${projectDir.absolutePath}/$outputDirectory")
|
|
|
|
|
|
|
|
// Creates the output directory if it does not exists.
|
|
|
|
val outputDirectoryFile = File("${projectDir.absolutePath}/$outputDirectory")
|
|
|
|
if (!outputDirectoryFile.exists() || !outputDirectoryFile.isDirectory) {
|
|
|
|
outputDirectoryFile.mkdirs()
|
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
|
|
|
commandLineUniversal("cd src/main/frontend && npm install")
|
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
|
|
|
commandLineUniversal("cd src/main/frontend && npm run-script build")
|
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
|
|
|
if (isUnixOs())
|
|
|
|
commandLineUnix("cp -r src/main/frontend/dist/color-recipes-explorer-frontend/* ${outputDirectoryFile.absolutePath}")
|
|
|
|
else
|
|
|
|
commandLineWindows("xcopy src\\main\\frontend\\dist\\color-recipes-explorer-frontend\\* ${outputDirectoryFile.absolutePath}")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fun isUnixOs(): Boolean = "windows" !in System.getProperty("os.name").toLowerCase()
|
|
|
|
fun ExecSpec.commandLineUnix(command: String) = commandLine("sh", "-c", command)
|
|
|
|
fun ExecSpec.commandLineWindows(command: String) = commandLine("cmd", "/c", command)
|
|
|
|
fun ExecSpec.commandLineUniversal(command: String) =
|
|
|
|
if (isUnixOs()) commandLineUnix(command) else commandLineWindows(command)
|