Skip to content

Commit 0e3018d

Browse files
committed
chore: port demos builds to Gradle
1 parent 4d94c52 commit 0e3018d

File tree

34 files changed

+651
-5302
lines changed

34 files changed

+651
-5302
lines changed

demos/build.gradle

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
plugins {
2+
id 'java'
3+
}
4+
5+
apply plugin: 'org.springframework.boot'
6+
apply plugin: 'io.spring.dependency-management'
7+
8+
java {
9+
toolchain {
10+
languageVersion = JavaLanguageVersion.of(21)
11+
}
12+
}
13+
14+
// Don't publish this module
15+
bootJar { enabled = false }
16+
jar { enabled = false }
17+
tasks.matching { it.name.startsWith('publish') }.configureEach {
18+
enabled = false
19+
}
20+
21+
repositories {
22+
mavenLocal()
23+
mavenCentral()
24+
maven {
25+
name = 'Spring Milestones'
26+
url = 'https://repo.spring.io/milestone'
27+
}
28+
maven {
29+
name = 'Spring Snapshots'
30+
url = 'https://repo.spring.io/snapshot'
31+
}
32+
}
33+
34+
// Tell gradle to add the generated sources directory
35+
sourceSets {
36+
main {
37+
java {
38+
srcDir file("${buildDir}/generated/sources/annotationProcessor/java/main")
39+
}
40+
}
41+
test {
42+
java {
43+
srcDir file("${buildDir}/generated/sources/annotationProcessor/java/test")
44+
}
45+
}
46+
}
47+
48+
dependencies {
49+
implementation project(':redis-om-spring')
50+
51+
// Important for RedisOM annotation processing!
52+
annotationProcessor project(':redis-om-spring')
53+
testAnnotationProcessor project(':redis-om-spring')
54+
55+
// Lombok
56+
compileOnly 'org.projectlombok:lombok'
57+
annotationProcessor 'org.projectlombok:lombok'
58+
testCompileOnly 'org.projectlombok:lombok'
59+
testAnnotationProcessor 'org.projectlombok:lombok'
60+
61+
// Spring Boot starters
62+
implementation 'org.springframework.boot:spring-boot-starter-web'
63+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
64+
implementation 'org.springframework.boot:spring-boot-devtools'
65+
66+
// Test dependencies
67+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
68+
testImplementation 'org.junit.jupiter:junit-jupiter'
69+
testImplementation 'org.assertj:assertj-core'
70+
testImplementation 'org.mockito:mockito-core'
71+
testImplementation "com.redis:testcontainers-redis:${testcontainersRedisVersion}"
72+
testImplementation "org.testcontainers:junit-jupiter"
73+
74+
// Optional dependencies used by some demos
75+
implementation 'com.github.javafaker:javafaker:1.0.2'
76+
implementation 'org.springframework:spring-context-support'
77+
}
78+
79+
// Use -parameters flag for Spring
80+
tasks.withType(JavaCompile).configureEach {
81+
options.compilerArgs << '-parameters'
82+
options.fork = true
83+
options.forkOptions.jvmArgs << '-Xshare:off'
84+
}
85+
86+
// Configure annotation processing
87+
compileJava {
88+
options.annotationProcessorPath = configurations.annotationProcessor
89+
options.generatedSourceOutputDirectory = file("${buildDir}/generated/sources/annotationProcessor/java/main")
90+
}
91+
92+
compileTestJava {
93+
options.annotationProcessorPath = configurations.testAnnotationProcessor
94+
options.generatedSourceOutputDirectory = file("${buildDir}/generated/sources/annotationProcessor/java/test")
95+
}
96+
97+
// Fix task dependencies for sourcesJar
98+
sourcesJar {
99+
dependsOn compileJava
100+
}
101+
102+
test {
103+
useJUnitPlatform()
104+
maxHeapSize = "1g"
105+
106+
testLogging {
107+
events "passed", "skipped", "failed"
108+
exceptionFormat = 'full'
109+
}
110+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
plugins {
2+
id 'java'
3+
id 'org.springframework.boot'
4+
id 'io.spring.dependency-management'
5+
}
6+
7+
java {
8+
toolchain {
9+
languageVersion = JavaLanguageVersion.of(21)
10+
}
11+
}
12+
13+
// Don't publish this module
14+
tasks.matching { it.name.startsWith('publish') }.configureEach {
15+
enabled = false
16+
}
17+
18+
repositories {
19+
mavenLocal()
20+
mavenCentral()
21+
maven {
22+
name = 'Spring Milestones'
23+
url = 'https://repo.spring.io/milestone'
24+
}
25+
maven {
26+
name = 'Spring Snapshots'
27+
url = 'https://repo.spring.io/snapshot'
28+
}
29+
}
30+
31+
dependencies {
32+
implementation project(':redis-om-spring')
33+
34+
// Important for RedisOM annotation processing!
35+
annotationProcessor project(':redis-om-spring')
36+
testAnnotationProcessor project(':redis-om-spring')
37+
38+
// Lombok
39+
compileOnly 'org.projectlombok:lombok'
40+
annotationProcessor 'org.projectlombok:lombok'
41+
testCompileOnly 'org.projectlombok:lombok'
42+
testAnnotationProcessor 'org.projectlombok:lombok'
43+
44+
// Spring Boot starters
45+
implementation 'org.springframework.boot:spring-boot-starter'
46+
implementation 'org.springframework.boot:spring-boot-starter-web'
47+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
48+
49+
// Test dependencies
50+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
51+
}
52+
53+
// Use -parameters flag for Spring
54+
tasks.withType(JavaCompile).configureEach {
55+
options.compilerArgs << '-parameters'
56+
}
57+
58+
test {
59+
useJUnitPlatform()
60+
}

0 commit comments

Comments
 (0)