Skip to content

Commit

Permalink
chore: ProjectLayout used
Browse files Browse the repository at this point in the history
  • Loading branch information
augi committed Jul 27, 2021
1 parent d935036 commit 9e3c680
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.avast.gradle.dockercompose

import org.gradle.api.file.ProjectLayout
import org.gradle.api.internal.file.FileOperations
import org.gradle.api.invocation.Gradle
import org.gradle.api.logging.Logger
Expand All @@ -15,17 +16,17 @@ import java.util.concurrent.Executors

class ComposeExecutor {
private final ComposeSettings settings
private final File projectDir
private final ProjectLayout layout
private final ExecOperations exec
private final FileOperations fileOps
private final Gradle gradle

private static final Logger logger = Logging.getLogger(ComposeExecutor.class);

@Inject
ComposeExecutor(ComposeSettings settings, File projectDir, ExecOperations exec, FileOperations fileOps, Gradle gradle) {
ComposeExecutor(ComposeSettings settings, ProjectLayout layout, ExecOperations exec, FileOperations fileOps, Gradle gradle) {
this.settings = settings
this.projectDir = projectDir
this.layout = layout
this.exec = exec
this.fileOps = fileOps
this.gradle = gradle
Expand Down Expand Up @@ -182,9 +183,9 @@ class ComposeExecutor {

Iterable<File> getStandardComposeFiles() {
def res = []
def f = findInParentDirectories('docker-compose.yml', projectDir)
def f = findInParentDirectories('docker-compose.yml', layout.projectDirectory.getAsFile())
if (f != null) res.add(f)
f = findInParentDirectories('docker-compose.override.yml', projectDir)
f = findInParentDirectories('docker-compose.override.yml', layout.projectDirectory.getAsFile())
if (f != null) res.add(f)
res
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class ComposeSettings {
pushTask = project.tasks.register(name ? "${name}ComposePush".toString() : 'composePush', ComposePush, { it.settings = this })

this.dockerExecutor = project.objects.newInstance(DockerExecutor, this)
this.composeExecutor = project.objects.newInstance(ComposeExecutor, this, project.projectDir)
this.composeExecutor = project.objects.newInstance(ComposeExecutor, this)
this.serviceInfoCache = new ServiceInfoCache(this)

this.containerLogToDir = project.buildDir.toPath().resolve('containers-logs').toFile()
Expand Down

0 comments on commit 9e3c680

Please sign in to comment.