use of org.metaborg.spoofax.meta.core.pluto.util.StrategoExecutor.ExecutionResult in project spoofax by metaborg.
the class Rtg2Sig method build.
@Override
public OutputPersisted<File> build(Input input) throws IOException {
requireBuild(input.origin);
require(input.inputFile);
// @formatter:off
final Arguments arguments = new Arguments().addFile("-i", input.inputFile).add("--module", input.module).addFile("-o", input.outputFile);
final ExecutionResult result = new StrategoExecutor().withToolsContext().withStrategy(main_rtg2sig_0_0.instance).withTracker(newResourceTracker()).withName("rtg2sig").executeCLI(arguments);
// @formatter:on
provide(input.outputFile);
setState(State.finished(result.success));
return OutputPersisted.of(input.outputFile);
}
use of org.metaborg.spoofax.meta.core.pluto.util.StrategoExecutor.ExecutionResult in project spoofax by metaborg.
the class Sdf2ParenthesizeLegacy method build.
@Override
public None build(Input input) throws IOException {
requireBuild(input.origin);
if (SpoofaxContext.BETTER_STAMPERS) {
require(input.inputFile, new Sdf2ParenthesizeStamper(input.context));
} else {
require(input.inputFile);
}
// @formatter:off
final Arguments arguments = new Arguments().addFile("-i", input.inputFile).add("-m", input.inputModule).add("--lang", input.inputModule).add("--omod", input.outputModule).addFile("-o", input.outputFile).add("--main-strategy", "io-" + input.inputModule + "-parenthesize").add("--rule-prefix", input.inputModule).add("--sig-module", "signatures/-");
final ExecutionResult result = new StrategoExecutor().withToolsContext().withStrategy(main_sdf2parenthesize_0_0.instance).withTracker(newResourceTracker(Pattern.quote("[ sdf2parenthesize | info ]") + ".*", Pattern.quote("Invoking native tool") + ".*")).withName("sdf2parenthesize").executeCLI(arguments);
if (!result.success) {
FileCommands.writeToFile(input.outputFile, "module " + input.inputModule + "\nrules\n\n parenthesize-" + input.inputModule + " = id");
}
// @formatter:on
provide(input.outputFile);
return None.val;
}
use of org.metaborg.spoofax.meta.core.pluto.util.StrategoExecutor.ExecutionResult in project spoofax by metaborg.
the class StrategoBuildStep method execute.
@Override
protected void execute(StrategoBuildStepConfig config, LanguageSpecBuildPhase phase, LanguageSpecBuildInput input) throws MetaborgException {
// @formatter:off
final StrategoExecutor executor = new StrategoExecutor().withToolsContext().withTracker(new ResourceAgentTracker(resourceService, input.languageSpec().location())).withStrategyName(config.strategy).withName(config.strategy);
// @formatter:on
final ExecutionResult result = executor.executeCLI(config.arguments());
if (!result.success) {
throw new MetaborgException("Stratego execution of " + config.strategy + " failed");
}
}
Aggregations