Skip to content

Commit

Permalink
Change project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Thijsiez committed Oct 7, 2024
1 parent 5b13391 commit 4647b7d
Show file tree
Hide file tree
Showing 41 changed files with 675 additions and 138 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
- name: Move into examples directory
run: cd examples
- name: Make gradlew executable
run: chmod +x gradlew
- name: Run tests with Gradle wrapper
Expand Down
70 changes: 30 additions & 40 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,44 @@
plugins {
kotlin("jvm")
id("org.jetbrains.kotlinx.kover")
id("org.sonarqube")
}

dependencies {
kover(project(":examples"))
kover(project(":library"))
}

allprojects {
apply(plugin = "kotlin")
apply(plugin = "org.jetbrains.kotlinx.kover")

group = "ch.icken"
version = "0.1.0-SNAPSHOT"
group = "ch.icken"
version = "0.1.0-SNAPSHOT"

repositories {
mavenCentral()
}
repositories {
mavenCentral()
}

configure(subprojects) {
dependencies {
val quarkusVersion: String by project
val mockkVersion: String by project

implementation(platform("io.quarkus.platform:quarkus-bom:$quarkusVersion"))
implementation("io.quarkus:quarkus-hibernate-orm-panache-kotlin")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.mockk:mockk:$mockkVersion")
}

tasks.test {
useJUnitPlatform()
}

kotlin {
jvmToolchain(17)
}
dependencies {
val quarkusVersion: String by project
val kspVersion: String by project
val kotlinPoetVersion: String by project
val mockkVersion: String by project
val compileTestingVersion: String by project

implementation(platform("io.quarkus.platform:quarkus-bom:$quarkusVersion"))
implementation("io.quarkus:quarkus-hibernate-orm-panache-kotlin")
implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion")
implementation("com.squareup:kotlinpoet:$kotlinPoetVersion")
implementation("com.squareup:kotlinpoet-ksp:$kotlinPoetVersion")

testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.mockk:mockk:$mockkVersion")
testImplementation("com.github.tschuchortdev:kotlin-compile-testing:$compileTestingVersion")
testImplementation("com.github.tschuchortdev:kotlin-compile-testing-ksp:$compileTestingVersion")
}

tasks.test {
useJUnitPlatform()
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}

sonar {
properties {
property("sonar.projectKey", "Thijsiez_panache-kotlin-dsl_760170ef-68c7-43b0-880d-cf1034afe3c6")
property("sonar.projectName", "panache-kotlin-dsl")
property("sonar.coverage.jacoco.xmlReportPaths", "**/build/reports/kover/report.xml")
tasks {
test {
useJUnitPlatform()
}
}
145 changes: 145 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,kotlin
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,gradle,kotlin

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
.idea/artifacts
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
.idea/modules
*.iml
*.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

.idea/*

!.idea/codeStyles
!.idea/runConfigurations

### Kotlin ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

### Gradle ###
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### Gradle Patch ###
# Java heap dump
*.hprof

# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,kotlin
65 changes: 61 additions & 4 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,77 @@

plugins {
id("io.quarkus")
kotlin("jvm")
kotlin("plugin.allopen")
kotlin("plugin.jpa")
id("com.google.devtools.ksp")
id("org.jetbrains.kotlinx.kover")
id("org.sonarqube")
}

group = "ch.icken"
version = "0.1.0-SNAPSHOT"

repositories {
mavenCentral()
}

dependencies {
implementation(project(":library"))
ksp(project(":library"))
val quarkusVersion: String by project

implementation(platform("io.quarkus.platform:quarkus-bom:$quarkusVersion"))
implementation("io.quarkus:quarkus-jdbc-h2")
kover(project(":library"))
implementation("io.quarkus:quarkus-hibernate-orm-panache-kotlin")
implementation(project(":panache-kotlin-dsl"))
ksp(project(":panache-kotlin-dsl"))

testImplementation("io.quarkus:quarkus-junit5")
kover(project(":panache-kotlin-dsl"))
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
allOpen {
annotation("jakarta.persistence.Entity")
}

ksp {
arg("addGeneratedAnnotation", "true")
}
kover {
reports {
filters {
//Exclude non-library coverage
excludes {
classes("ch.icken.ExamplesKt")
packages("ch.icken.model")
}
}
}
}
sonar {
properties {
property("sonar.projectKey", "Thijsiez_panache-kotlin-dsl_760170ef-68c7-43b0-880d-cf1034afe3c6")
property("sonar.projectName", "panache-kotlin-dsl")
property("sonar.coverage.jacoco.xmlReportPaths", "**/build/reports/kover/report.xml")
}
}

//Basic Quarkus Gradle setup
tasks {
test {
systemProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager")
useJUnitPlatform()
}
withType<JavaCompile> {
options.compilerArgs.add("-parameters")
options.encoding = "UTF-8"
}
}

//Fixes issue with task execution order
tasks.compileKotlin {
Expand All @@ -58,3 +110,8 @@ project.afterEvaluate {
.filterNot { it.get().name == "processResources" })
}
}

//Disable Quarkus native builds triggered by Kover
tasks.quarkusAppPartsBuild {
isEnabled = false
}
28 changes: 28 additions & 0 deletions examples/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# Copyright 2023-2024 Thijs Koppen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#https://github.com/quarkusio/quarkus
quarkusVersion=3.12.3
#https://github.com/JetBrains/kotlin
kotlinVersion=2.0.0
#https://github.com/google/ksp
kspVersion=2.0.0-1.0.23
#https://github.com/Kotlin/kotlinx-kover
koverVersion=0.8.3
#https://github.com/SonarSource/sonar-scanner-gradle
sonarqubeVersion=5.1.0.4882

kotlin.code.style=official
Binary file added examples/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions examples/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon Oct 07 00:02:53 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4647b7d

Please sign in to comment.