Skip to content

Commit

Permalink
fix: cached settings stored to a file which name is derived from the …
Browse files Browse the repository at this point in the history
…settings name Fixes #237
  • Loading branch information
augi committed May 22, 2020
1 parent ac150df commit 9b1afba
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.gradle.util.ConfigureUtil

class ComposeExtension extends ComposeSettings {
ComposeExtension(Project project) {
super(project, '')
super(project, '', '')
}

private HashMap<String, ComposeSettings> settings = [:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ComposeSettings {
}
}
String projectNamePrefix
protected String nestedName
String nestedName

boolean stopContainers = true
boolean removeContainers = true
Expand All @@ -103,9 +103,9 @@ class ComposeSettings {
String dockerComposeWorkingDirectory = null
Duration dockerComposeStopTimeout = Duration.ofSeconds(10)

ComposeSettings(Project project, String name = '') {
ComposeSettings(Project project, String name = '', String parentName = '') {
this.project = project
this.nestedName = name
this.nestedName = parentName + name

upTask = project.tasks.register(name ? "${name}ComposeUp" : 'composeUp', ComposeUp, { it.settings = this })
buildTask = project.tasks.register(name ? "${name}ComposeBuild" : 'composeBuild', ComposeBuild, { it.settings = this })
Expand Down Expand Up @@ -135,7 +135,7 @@ class ComposeSettings {
}

ComposeSettings createNested(String name) {
def r = new ComposeSettings(project, name)
def r = new ComposeSettings(project, name, this.nestedName)
r.buildBeforeUp = this.buildBeforeUp
r.buildBeforePull = this.buildBeforePull

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class ServiceInfoCache {

ServiceInfoCache(ComposeSettings settings) {
this.settings = settings
this.servicesInfosFile = new File(settings.project.buildDir, "dockerCompose/servicesInfos.json")
this.stateFile = new File(settings.project.buildDir, "dockerCompose/state.txt")
this.servicesInfosFile = new File(settings.project.buildDir, "dockerCompose/${settings.nestedName}servicesInfos.json")
this.stateFile = new File(settings.project.buildDir, "dockerCompose/${settings.nestedName}state.txt")
}

Map<String, ServiceInfo> get(Supplier<String> stateSupplier) {
Expand Down

0 comments on commit 9b1afba

Please sign in to comment.