Skip to content

Commit 074e32f

Browse files
committed
gradle cleanup
1 parent 1f9110b commit 074e32f

13 files changed

+135
-71
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
- uses: actions/setup-java@v4
1818
with:
1919
distribution: temurin
20-
java-version: 21
20+
java-version: 23
2121
- uses: gradle/actions/setup-gradle@v4
2222
- name: Test with Gradle
2323
run: ./gradlew build
2424
- uses: superfly/flyctl-actions/setup-flyctl@master
25-
if: github.ref == 'refs/heads/main'
25+
if: github.ref_name == github.event.repository.default_branch
2626
- run: flyctl deploy --remote-only
27-
if: github.ref == 'refs/heads/main'
27+
if: github.ref_name == github.event.repository.default_branch
2828
dependabot:
2929
runs-on: ubuntu-latest
3030
if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM bellsoft/liberica-openjdk-alpine:21
2-
COPY ./backend/build/libs/*.jar app.jar
1+
FROM bellsoft/liberica-openjdk-alpine:23
2+
COPY ./build/libs/*.jar app.jar
33
ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-Xmx180M", "-Xss256k", "-jar", "/app.jar"]

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# hackmerlin.io
2+
3+
## Project Structure
4+
5+
- **backend**: Contains the Spring Boot application.
6+
- **frontend**: Contains the React application.
7+
8+
## Getting Started
9+
10+
Currently, this project supports only azure openai deployments as LLM backend.
11+
To point this app to your deployment, you need to set the following `application.yml` properties:
12+
13+
```yaml
14+
merlin:
15+
azure:
16+
key: your-openai-api-key
17+
url: your-openai-api-url
18+
```
19+
20+
## Running the Application
21+
22+
Start the application:
23+
24+
```sh
25+
./gradlew run
26+
```

backend/build.gradle.kts

+14-51
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,23 @@
11
plugins {
22
java
3-
application
4-
id("org.springframework.boot") version "3.4.1"
5-
id("io.spring.dependency-management") version "1.1.7"
6-
id("net.ltgt.errorprone") version "4.1.0"
7-
}
8-
9-
group = "com.github.bgalek"
10-
version = "1.0.0"
11-
12-
java {
13-
toolchain {
14-
languageVersion.set(JavaLanguageVersion.of(21))
15-
}
16-
}
17-
18-
repositories {
19-
mavenCentral()
3+
alias(libs.plugins.error.prone)
204
}
215

226
dependencies {
23-
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
24-
errorprone("com.google.errorprone:error_prone_core:2.36.0")
25-
implementation("org.springframework.boot:spring-boot-starter-web")
26-
implementation("org.springframework.session:spring-session-jdbc")
27-
implementation("org.springframework.boot:spring-boot-starter-jdbc")
28-
implementation("org.springframework.boot:spring-boot-starter-actuator")
29-
implementation("io.sentry:sentry-spring-boot-starter-jakarta:7.20.0")
30-
implementation("com.azure:azure-ai-openai:1.0.0-beta.13")
31-
implementation("com.github.ben-manes.caffeine:caffeine:3.1.8")
32-
runtimeOnly("io.micrometer:micrometer-registry-prometheus:1.14.2")
33-
runtimeOnly("org.postgresql:postgresql")
34-
}
35-
36-
configurations {
37-
compileOnly {
38-
extendsFrom(configurations.annotationProcessor.get())
39-
}
7+
implementation(platform(libs.spring.boot.dependencies))
8+
errorprone(libs.error.prone)
9+
implementation(libs.spring.boot.starter.web)
10+
implementation(libs.spring.session.jdbc)
11+
implementation(libs.spring.boot.starter.jdbc)
12+
implementation(libs.spring.boot.starter.actuator)
13+
implementation(libs.sentry.spring.boot.starter)
14+
implementation(libs.azure.ai.openai)
15+
implementation(libs.caffeine)
16+
runtimeOnly(libs.micrometer.registry.prometheus)
17+
runtimeOnly(libs.postgresql)
18+
runtimeOnly(libs.hsqldb)
4019
}
4120

4221
tasks.withType<Test> {
4322
useJUnitPlatform()
44-
}
45-
46-
tasks.processResources {
47-
dependsOn(":frontend:build")
48-
}
49-
50-
tasks.jar {
51-
enabled = false
52-
}
53-
54-
tasks.distZip {
55-
enabled = false
56-
}
57-
58-
tasks.distTar {
59-
enabled = false
60-
}
23+
}

backend/src/main/resources/application.yml

+2
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ spring:
196196
threads:
197197
virtual:
198198
enabled: true
199+
datasource:
200+
url: jdbc:hsqldb:mem:testdb;sql.syntax_pgs=true
199201
management:
200202
endpoints:
201203
web:

build.gradle.kts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
application
3+
}
4+
5+
application {
6+
mainClass = "com.github.bgalek.MerlinApplication"
7+
}
8+
9+
dependencies {
10+
implementation(project(":backend"))
11+
implementation(project(":frontend"))
12+
}
13+
14+
allprojects {
15+
apply(plugin = "java")
16+
java {
17+
toolchain {
18+
languageVersion.set(JavaLanguageVersion.of(23))
19+
}
20+
}
21+
}

frontend/build.gradle.kts

+33-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1+
import com.github.gradle.node.npm.task.NpmTask
2+
13
plugins {
2-
id("org.siouan.frontend-jdk11") version "6.0.0"
4+
`java-library`
5+
id("com.github.node-gradle.node") version "7.1.0"
36
}
47

5-
frontend {
6-
nodeVersion.set("20.5.1")
7-
assembleScript.set("run build")
8-
cleanScript.set("run clean")
9-
checkScript.set("run check")
10-
nodeDistributionProvided.set(true)
8+
node {
9+
download = true
10+
version = "23.5.0"
1111
}
1212

1313
tasks.build {
14-
dependsOn("copyDistToBackend")
14+
dependsOn(tasks.named("npmBuild"))
15+
}
16+
17+
tasks.test {
18+
dependsOn(tasks.named("npmTest"))
1519
}
1620

17-
tasks.create("copyDistToBackend", Copy::class) {
18-
from("./build/dist")
19-
into("../backend/build/resources/main/static")
21+
tasks.register<NpmTask>("npmBuild") {
22+
dependsOn(tasks.npmInstall)
23+
args.set(listOf("run", "build"))
24+
inputs.dir(project.fileTree("src").exclude("**/*.test.ts"))
25+
inputs.dir(project.fileTree("public"))
26+
inputs.files("*.html", "*.json", "*.ts", "*.js")
27+
outputs.dir(project.layout.buildDirectory.dir("dist"))
28+
dependsOn(tasks.named("npmTest"))
2029
}
30+
31+
tasks.register<NpmTask>("npmTest") {
32+
args.set(listOf("run", "test"))
33+
inputs.dir(project.fileTree("src"))
34+
inputs.dir(project.fileTree("public"))
35+
inputs.files("*.html", "*.json", "*.ts", "*.js")
36+
outputs.upToDateWhen { true }
37+
}
38+
39+
tasks.jar {
40+
dependsOn(tasks.named("npmBuild"))
41+
from(project.layout.buildDirectory.dir("dist"))
42+
}

frontend/vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
77
build: {
8-
outDir: "./build/dist",
8+
outDir: "build/dist/static",
99
},
1010
server: {
1111
proxy: {

gradle/libs.versions.toml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[versions]
2+
azure-ai-openai = "1.0.0-beta.13"
3+
caffeine = "3.1.8"
4+
error-prone-plugin = "4.1.0"
5+
error-prone-core = "2.36.0"
6+
micrometer = "1.14.2"
7+
sentry = "7.20.0"
8+
spring-boot = "3.4.1"
9+
10+
[libraries]
11+
azure-ai-openai = { module = "com.azure:azure-ai-openai", version.ref = "azure-ai-openai" }
12+
caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" }
13+
hsqldb = { module = "org.hsqldb:hsqldb" }
14+
micrometer-registry-prometheus = { module = "io.micrometer:micrometer-registry-prometheus", version.ref = "micrometer" }
15+
postgresql = { module = "org.postgresql:postgresql" }
16+
sentry-spring-boot-starter = { module = "io.sentry:sentry-spring-boot-starter-jakarta", version.ref = "sentry" }
17+
spring-boot-dependencies = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "spring-boot" }
18+
spring-boot-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator" }
19+
spring-boot-starter-jdbc = { module = "org.springframework.boot:spring-boot-starter-jdbc" }
20+
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web" }
21+
spring-session-jdbc = { module = "org.springframework.session:spring-session-jdbc" }
22+
error-prone = { module = "com.google.errorprone:error_prone_core", version.ref = "error-prone-core" }
23+
24+
[plugins]
25+
error-prone = { id = "net.ltgt.errorprone", version.ref = "error-prone-plugin" }

gradle/wrapper/gradle-wrapper.jar

79 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum

settings.gradle.kts

+6
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ plugins {
44

55
rootProject.name = "merlin"
66

7+
dependencyResolutionManagement {
8+
repositories {
9+
mavenCentral()
10+
}
11+
}
12+
713
include("frontend")
814
include("backend")

0 commit comments

Comments
 (0)