Skip to content

Commit

Permalink
fix(build): allow installMacrogen when env exists
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Sep 15, 2021
1 parent b996ec4 commit 4d5145b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ task installAnaconda() {
project.ext.anacondaDir = "$buildDir/tools/miniconda"
project.ext.conda = "$anacondaDir/bin/conda"
outputs.dir anacondaDir
outputs.file "$anacondaDir/bin/conda"

doLast {
File installer = configurations.python.getSingleFile()
Expand All @@ -108,11 +109,19 @@ task installMacrogen() {
dependsOn 'installAnaconda'
group 'macrogen'
inputs.files("$projectDir/envionment.yaml", "$projectDir/pyproject.toml")
outputs.dir venv
outputs.dir "$venv"
outputs.file "$venv/bin/macrogen"
doLast {
exec {
executable conda
args "env", "create", "-p", venv, "-f", "$projectDir/environment.yml"
if (new File("$venv").exists()) {
exec {
executable conda
args "env", "update", "-p", venv, "-f", "$projectDir/environment.yml"
}
} else {
exec {
executable conda
args "env", "create", "-p", venv, "-f", "$projectDir/environment.yml"
}
}
exec {
executable "$venv/bin/pip"
Expand Down

0 comments on commit 4d5145b

Please sign in to comment.