UNPKG

@specs-feup/lara

Version:

A js port of the popular framework for building source-to-source compilers

68 lines 2.03 kB
import Io from "../../lara/Io.js"; import DataStore from "../../lara/util/DataStore.js"; import JavaTypes from "../../lara/util/JavaTypes.js"; /** * DataStore used in LaraI weavers. */ export default class WeaverDataStore extends DataStore { constructor(data = "LaraI Options", definition = JavaTypes.LaraiKeys.STORE_DEFINITION) { super(data, definition); } /** * Wraps a Java DataStore around a Lara DataStore. */ dataStoreWrapper(javaDataStore) { return new WeaverDataStore(javaDataStore, this.definition); } /** * @returns a java.io.File representing the current output folder of the weaver */ getOutputFolder() { return this.get("output"); } /** * @param outputFolder - a java.io.File or a String, representing the current output folder of the weaver * */ setOutputFolder(outputFolder) { const normalizedOutputFolder = Io.getPath(outputFolder); this.put("output", normalizedOutputFolder); } /** * */ getSourceFolders() { const sourcesFileList = this.get("workspace"); return sourcesFileList.getFiles().toArray(); } /** * */ setSourceFolders(sourceFolders) { const fileList = JavaTypes.FileList.newInstance(sourceFolders); // Change to JavaTypes this.put("workspace", fileList); } /** * */ getIncludeFolders() { const includesFileList = this.get("include"); return includesFileList.getFiles().toArray(); } /** * */ setIncludeFolders(includeFolders) { const fileList = JavaTypes.FileList.newInstance(includeFolders); this.put("include", fileList); } setLogFile(logPath) { const logFile = JavaTypes.OptionalFile.newInstance(logPath); this.put("log", logFile); } getLogFile() { const optionalFile = this.get("log"); return optionalFile ?? optionalFile.getFile(); } } //# sourceMappingURL=WeaverDataStore.js.map