-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
plugins { | ||
id "base" | ||
id "com.jetbrains.python.envs" version "0.0.30" | ||
} | ||
|
||
if (project != rootProject) { | ||
project.buildDir = rootProject.buildDir | ||
logger.info("Using root project's buildDir: $buildDir") | ||
} | ||
|
||
if (!project.hasProperty('dataDir')) { | ||
def dataDirCandidate = rootProject.file('data/xml') | ||
if (dataDirCandidate.isDirectory()) | ||
project.ext.dataDir = dataDirCandidate | ||
else { | ||
throw new FileNotFoundException("Data directory not found. Either put data into $dataDirCandidate, or set the dataDir property.") | ||
} | ||
logger.info("Using data from $dataDirCandidate") | ||
} | ||
|
||
|
||
envs { | ||
bootstrapDirectory = new File(buildDir, 'tools') | ||
envsDirectory = new File(buildDir, 'envs') | ||
|
||
python "python37", "3.7.4", [] | ||
virtualenv "macrogen", "python37" | ||
project.ext.venv = new File(buildDir, 'envs/macrogen') | ||
} | ||
|
||
def addInputArg(AbstractExecTask task, GString option, Object file) { | ||
task.args(option, file) | ||
task.inputs(file) | ||
} | ||
|
||
def configureMacrogenTasks(AbstractExecTask... tasks) { | ||
for (AbstractExecTask task in tasks) { | ||
task.group 'macrogen' | ||
task.executable("$venv/bin/macrogen") | ||
|
||
if (rootProject != project) { | ||
addInputArg(task, '--sigils', "$buildDir/sigils.json") | ||
addInputArg(task, '--paralipomena', "$buildDir/www/data/paralipomena.js") | ||
task.args('--progressbar', 'false') | ||
} | ||
} | ||
} | ||
|
||
task installMacrogen(type: Exec) { | ||
description 'Installs the macrogenesis tool and its requirements' | ||
group 'macrogen' | ||
dependsOn 'build_envs' | ||
|
||
executable "$venv/bin/pip" | ||
workingDir projectDir | ||
args "install", "-U", "-e", "." | ||
} | ||
|
||
task runMacrogenComplete(type: Exec) { | ||
description 'Runs the complete macrogenesis analysis and configuration' | ||
dependsOn installMacrogen | ||
} | ||
|
||
task runMacrogenAnalysis(type: Exec) { | ||
description 'Runs the macrogenesis analysis phase' | ||
dependsOn installMacrogen | ||
args "--skip-reports" | ||
args "-o", "$buildDir/macrogen-graphs.zip" | ||
args "--order", "$buildDir/order.xml" | ||
outputs.file "$buildDir/macrogen-graphs.zip" | ||
outputs.file "$buildDir/order.xml" | ||
} | ||
|
||
task runMacrogenReporting(type: Exec) { | ||
description 'Runs the macrogenesis reporting phase' | ||
dependsOn runMacrogenAnalysis | ||
args "-i", "$buildDir/macrogen-graphs.zip" | ||
inputs.file("$buildDir/macrogen-graphs.zip") | ||
} | ||
|
||
configureMacrogenTasks(runMacrogenAnalysis, runMacrogenReporting, runMacrogenComplete) |