Skip to content

Commit 6f6e19a

Browse files
committed
chore: updates root build tasks for docker compose.
1 parent 739278b commit 6f6e19a

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
### Easy way
88

9+
1. Configure your HOSTS file to add entries for `local.studycrm.com` and `api-local.studycrm.com` pointing to `127.0.0.1`.
910
1. Install VS Code and Docker. You can references the [instructions here](https://aka.ms/vscode-remote/containers/getting-started), if needed.
1011
1. Click the `Dev Containers` button above to automatically clone and open the project in a new dev container.
11-
1. From a new VS Code terminal, run `gradle buildAndRunServices`.
12+
1. From a new VS Code terminal, run `gradle start`.
1213
1. Profit!

build-logic/included-build/src/main/kotlin/com.codedifferently.studycrm.included-build.gradle.kts

+6
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,10 @@ tasks.register("cleanAll") {
2626
subprojects.forEach {
2727
dependsOn(it.tasks.named("clean"))
2828
}
29+
}
30+
31+
tasks.register("assembleAll") {
32+
subprojects.forEach {
33+
dependsOn(it.tasks.named("assemble"))
34+
}
2935
}

build.gradle.kts

+13-10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dependencies {
2121
val eventuateCommonImageVersion: String by project
2222
val eventuateCdcImageVersion: String by project
2323
val eventuateMessagingKafkaImageVersion: String by project
24+
val infrastructureServices = listOf("zipkin", "zookeeper", "kafka", "auth-service-mysql", "contact-service-mysql", "organization-service-mysql", "cdc-service")
2425

2526
configure<ComposeExtension> {
2627
includeDependencies.set(true)
@@ -32,26 +33,28 @@ configure<ComposeExtension> {
3233
createNested("infrastructure").apply {
3334
setProjectName(null)
3435
useComposeFiles.set(listOf("docker-compose.yaml"))
35-
startedServices.set(listOf("zipkin", "zookeeper", "kafka", "auth-service-mysql", "contact-service-mysql", "organization-service-mysql", "cdc-service"))
36+
startedServices.set(infrastructureServices)
3637
}
3738

38-
createNested("studycrm").apply {
39+
createNested("services").apply {
3940
setProjectName(null)
4041
environment.putAll(mapOf("TAGS" to "feature-test,local"))
4142
useComposeFiles.set(listOf("docker-compose.yaml"))
42-
startedServices.set(listOf("zipkin", "zookeeper", "kafka", "auth-service", "auth-service-mysql", "contact-service", "contact-service-mysql", "organization-service", "organization-service-mysql", "api-gateway", "cdc-service"))
43+
startedServices.set(listOf(*infrastructureServices.toTypedArray(), "auth-service", "contact-service", "organization-service", "api-gateway"))
4344
}
4445
}
4546

46-
tasks.register("buildAndRunInfrastructure") {
47+
tasks.register("startInfrastructure") {
4748
dependsOn("infrastructureComposeUp")
4849
}
4950

50-
tasks.register("buildAndRunServices") {
51-
dependsOn(gradle.includedBuild("auth-service-main").task(":auth-main-app:build"));
52-
dependsOn(gradle.includedBuild("contact-service-main").task(":contact-main-app:build"));
53-
dependsOn(gradle.includedBuild("organization-service-main").task(":organization-main-app:build"));
54-
dependsOn("studycrmComposeUp")
51+
tasks.register("start") {
52+
dependsOn("assemble");
53+
dependsOn("servicesComposeUp")
54+
}
55+
56+
tasks.register("teardown") {
57+
dependsOn("servicesComposeDown")
5558
}
5659

5760
// Exclude these projects from the repo build tasks.
@@ -61,7 +64,7 @@ var excludeProjects = listOf("build-logic", "platforms")
6164
tasks.register("fix") {}
6265

6366
// Setup repo build tasks
64-
listOf("build", "test", "check", "fix", "clean").forEach { taskName ->
67+
listOf("build", "test", "check", "fix", "clean", "assemble").forEach { taskName ->
6568
tasks.named(taskName) {
6669

6770
dependsOn(

0 commit comments

Comments
 (0)