diff --git a/plugins/com.yakindu.solidity.compiler.win.fragment/compiler/solc.exe b/plugins/com.yakindu.solidity.compiler.win.fragment/compiler/solc.exe new file mode 100644 index 00000000..dd9156ea Binary files /dev/null and b/plugins/com.yakindu.solidity.compiler.win.fragment/compiler/solc.exe differ diff --git a/plugins/com.yakindu.solidity.compiler/src/com/yakindu/solidity/compiler/parameter/ParameterBuilder.java b/plugins/com.yakindu.solidity.compiler/src/com/yakindu/solidity/compiler/parameter/ParameterBuilder.java new file mode 100644 index 00000000..221ff138 --- /dev/null +++ b/plugins/com.yakindu.solidity.compiler/src/com/yakindu/solidity/compiler/parameter/ParameterBuilder.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2017 committers of YAKINDU and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andreas Muelder - Itemis AG - initial API and implementation + * Karsten Thoms - Itemis AG - initial API and implementation + * Florian Antony - Itemis AG - initial API and implementation + * committers of YAKINDU + * + */ +package com.yakindu.solidity.compiler.parameter; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.gson.GsonBuilder; + +/** + * @author Florian Antony - Initial contribution and API + */ +public class ParameterBuilder { + + private Parameter parameter; + private GsonBuilder gsonBuilder; + + public ParameterBuilder() { + this("Solidity"); + } + + public ParameterBuilder(String language) { + gsonBuilder = new GsonBuilder(); + gsonBuilder.setPrettyPrinting(); + this.parameter = new Parameter(); + this.parameter.setLanguage(language); + this.parameter.setSettings(defaultSettings()); + } + + private Settings defaultSettings() { + Settings settings = new Settings(); + settings.setOptimizer(defaultOptimizer()); + settings.setParserErrorRecovery(true); + Map>> output = Maps.newHashMap(); + HashMap> internalOutputs = Maps.newHashMap(); + internalOutputs.put("*", Lists.newArrayList()); + output.put("*", internalOutputs); + settings.setOutputSelection(output); + return settings; + } + + private Optimizer defaultOptimizer() { + Optimizer optimizer = new Optimizer(); + optimizer.setEnabled(false); + optimizer.setRuns(0); + return optimizer; + } + + public String buildJson() { + return gsonBuilder.create().toJson(parameter); + } + + public ParameterBuilder addOutput(String key) { + List outputKeys = this.parameter.getSettings().getOutputSelection().get("*").get("*"); + if (!outputKeys.contains(key)) { + outputKeys.add(key); + } + return this; + } + + public ParameterBuilder addSource(String name, Source source) { + this.parameter.getSources().put(name, source); + return this; + } +} diff --git a/plugins/com.yakindu.solidity.compiler/src/com/yakindu/solidity/compiler/parameter/Settings.java b/plugins/com.yakindu.solidity.compiler/src/com/yakindu/solidity/compiler/parameter/Settings.java new file mode 100644 index 00000000..0507c4b7 --- /dev/null +++ b/plugins/com.yakindu.solidity.compiler/src/com/yakindu/solidity/compiler/parameter/Settings.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2017 committers of YAKINDU and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andreas Muelder - Itemis AG - initial API and implementation + * Karsten Thoms - Itemis AG - initial API and implementation + * Florian Antony - Itemis AG - initial API and implementation + * committers of YAKINDU + * + */ +package com.yakindu.solidity.compiler.parameter; + +import java.util.List; +import java.util.Map; + +/** + * + * @author Florian Antony - Initial contribution and API + * + */ +public class Settings { + + private Optimizer optimizer; + + private Boolean parserErrorRecovery; + + private Map libraries; + + private Map>> outputSelection; + + public Optimizer getOptimizer() { + return optimizer; + } + + public void setOptimizer(Optimizer optimizer) { + this.optimizer = optimizer; + } + + public Map getLibraries() { + return libraries; + } + + public void setLibraries(Map libraries) { + this.libraries = libraries; + } + + public Map>> getOutputSelection() { + return outputSelection; + } + + public void setOutputSelection(Map>> outputSelection) { + this.outputSelection = outputSelection; + } + + public Boolean getParserErrorRecovery() { + return parserErrorRecovery; + } + + public void setParserErrorRecovery(Boolean parserErrorRecovery) { + this.parserErrorRecovery = parserErrorRecovery; + } + + +} diff --git a/plugins/com.yakindu.solidity.solc.linux.fragment/compiler/solc b/plugins/com.yakindu.solidity.solc.linux.fragment/compiler/solc index 2ad0dd66..cc429717 100755 Binary files a/plugins/com.yakindu.solidity.solc.linux.fragment/compiler/solc and b/plugins/com.yakindu.solidity.solc.linux.fragment/compiler/solc differ diff --git a/plugins/com.yakindu.solidity.solc.win.fragment/compiler/solc.exe b/plugins/com.yakindu.solidity.solc.win.fragment/compiler/solc.exe index 797c090a..ee0a8de3 100644 Binary files a/plugins/com.yakindu.solidity.solc.win.fragment/compiler/solc.exe and b/plugins/com.yakindu.solidity.solc.win.fragment/compiler/solc.exe differ diff --git a/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/ParameterBuilder.java b/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/ParameterBuilder.java index 9f46e450..48da74d0 100644 --- a/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/ParameterBuilder.java +++ b/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/ParameterBuilder.java @@ -45,6 +45,7 @@ public ParameterBuilder(String language) { private Settings defaultSettings() { Settings settings = new Settings(); settings.setOptimizer(defaultOptimizer()); + settings.setParserErrorRecovery(true); Map>> output = Maps.newHashMap(); HashMap> internalOutputs = Maps.newHashMap(); internalOutputs.put("*", Lists.newArrayList()); diff --git a/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/Settings.java b/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/Settings.java index 6c8c1acc..807feefb 100644 --- a/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/Settings.java +++ b/plugins/com.yakindu.solidity.solc/src/com/yakindu/solidity/solc/parameter/Settings.java @@ -25,6 +25,8 @@ public class Settings { private Optimizer optimizer; + + private Boolean parserErrorRecovery; private Map libraries; @@ -53,4 +55,12 @@ public Map>> getOutputSelection() { public void setOutputSelection(Map>> outputSelection) { this.outputSelection = outputSelection; } + + public Boolean getParserErrorRecovery() { + return parserErrorRecovery; + } + + public void setParserErrorRecovery(Boolean parserErrorRecovery) { + this.parserErrorRecovery = parserErrorRecovery; + } } diff --git a/plugins/com.yakindu.solidity/model/generated/Solidity.genmodel b/plugins/com.yakindu.solidity/model/generated/Solidity.genmodel index 07093f36..a8e5ae81 100644 --- a/plugins/com.yakindu.solidity/model/generated/Solidity.genmodel +++ b/plugins/com.yakindu.solidity/model/generated/Solidity.genmodel @@ -3,7 +3,7 @@ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="generated by Xtext 2.18.0" modelDirectory="/com.yakindu.solidity/src-gen" modelPluginID="com.yakindu.solidity" forceOverwrite="true" modelName="Solidity" updateClasspath="false" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" - complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.12" usedGenPackages="platform:/resource/org.yakindu.base.expressions/model/Expressions.genmodel#//expressions platform:/resource/org.yakindu.base.types/model/base.genmodel#//base platform:/resource/org.yakindu.base.types/model/types.genmodel#//types"> + complianceLevel="6.0" copyrightFields="false" runtimeVersion="2.18" usedGenPackages="platform:/resource/org.yakindu.base.expressions/model/Expressions.genmodel#//expressions platform:/resource/org.yakindu.base.types/model/base.genmodel#//base platform:/resource/org.yakindu.base.types/model/types.genmodel#//types"> diff --git a/plugins/com.yakindu.solidity/src/com/yakindu/solidity/SolidityVersion.java b/plugins/com.yakindu.solidity/src/com/yakindu/solidity/SolidityVersion.java index 17e9ebde..a1e67236 100644 --- a/plugins/com.yakindu.solidity/src/com/yakindu/solidity/SolidityVersion.java +++ b/plugins/com.yakindu.solidity/src/com/yakindu/solidity/SolidityVersion.java @@ -2,6 +2,6 @@ public interface SolidityVersion { public static final String SOLIDITY_VERSION = "solidity_version"; - public static final String DEFAULT_SOLIDITY_VERSION = "^0.5.4"; + public static final String DEFAULT_SOLIDITY_VERSION = "^0.5.11"; public static final String MIN_SUPPORTED_VERSION = "^0.5"; }