Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: georgi-l95 <[email protected]>
  • Loading branch information
georgi-l95 committed Dec 19, 2024
1 parent e2223a8 commit 6754763
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 40 deletions.
6 changes: 3 additions & 3 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ val copyDockerFolder: TaskProvider<Copy> =
into(dockerBuildRootDirectory)
}

// @todo(#343) - createProductionDotEnv is temporary and used by the suites,
// @todo(#343) - createDotEnv is temporary and used by the suites,
// once the suites no longer rely on the .env file from the build root we
// should remove this task
val createProductionDotEnv: TaskProvider<Exec> =
tasks.register<Exec>("createProductionDotEnv") {
val createDotEnv: TaskProvider<Exec> =
tasks.register<Exec>("createDotEnv") {
description = "Creates the default dotenv file for the Block Node Server"
group = "docker"

Expand Down
39 changes: 37 additions & 2 deletions simulator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ tasks.named("sourcesJar") { dependsOn(tasks.named("untarTestBlockStream")) }

// Vals
val dockerProjectRootDirectory: Directory = layout.projectDirectory.dir("docker")
var resourcesProjectRootDirectory: Directory = layout.projectDirectory.dir("src/main/resources")
var distributionBuildRootDirectory: Directory = layout.buildDirectory.dir("distributions").get()
val dockerBuildRootDirectory: Directory = layout.buildDirectory.dir("docker").get()

// Docker related tasks
Expand All @@ -108,14 +110,47 @@ val copyDockerFolder: TaskProvider<Copy> =
into(dockerBuildRootDirectory)
}

// Docker related tasks
val copyDependenciesFolders: TaskProvider<Copy> =
tasks.register<Copy>("copyDependenciesFolders") {
description = "Copies the docker folder to the build root directory"
group = "docker"

dependsOn(copyDockerFolder, tasks.assemble)
from(resourcesProjectRootDirectory)
from(distributionBuildRootDirectory)
into(dockerBuildRootDirectory)
}

val createDockerImage: TaskProvider<Exec> =
tasks.register<Exec>("createDockerImage") {
description = "Creates the docker image of the Block Stream Simulator"
group = "docker"

dependsOn(copyDependenciesFolders, tasks.assemble)
workingDir(dockerBuildRootDirectory)
commandLine("sh", "-c", "docker buildx build -t hedera-block-simulator:latest .")
}

val createDotEnv: TaskProvider<Exec> =
tasks.register<Exec>("createDotEnv") {
description = "Creates .env file with needed environment variables for the simulator"
group = "docker"

dependsOn(createDockerImage, tasks.assemble)
workingDir(dockerBuildRootDirectory)
commandLine("sh", "-c", "./update-env.sh")
}

val startDockerContainer: TaskProvider<Exec> =
tasks.register<Exec>("startDockerContainer") {
description = "Creates and starts the docker image of the Block Stream Simulator"
group = "docker"

dependsOn(copyDockerFolder, tasks.assemble)
dependsOn(createDotEnv, tasks.assemble)
workingDir(dockerBuildRootDirectory)
commandLine("sh", "-c", "./prepare-docker.sh")

commandLine("sh", "-c", "docker compose -p simulator up -d")
}

tasks.register<Exec>("stopDockerContainer") {
Expand Down
33 changes: 0 additions & 33 deletions simulator/docker/prepare-docker.sh

This file was deleted.

4 changes: 2 additions & 2 deletions suites/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ tasks.register<Test>("runSuites") {
group = "suites"
modularity.inferModulePath = false

// @todo(#343) - :server:createProductionDotEnv should disappear
dependsOn(":server:createDockerImage", ":server:createProductionDotEnv")
// @todo(#343) - :server:createDotEnv should disappear
dependsOn(":server:createDockerImage", ":server:createDotEnv")

useJUnitPlatform()
testLogging { events("passed", "skipped", "failed") }
Expand Down

0 comments on commit 6754763

Please sign in to comment.