getCompilerConfig

compilerconfig
filip mertens 4 years ago
parent c5981cedd2
commit 434f563a52
  1. 18
      apps/remix-ide/src/app/tabs/compile-tab.js
  2. 3
      apps/remix-ide/src/app/tabs/compileTab/compileTab.js
  3. 4
      apps/remix-ide/src/app/tabs/test-tab.js

@ -33,7 +33,7 @@ const profile = {
location: 'sidePanel', location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html', documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html',
version: packageJson.version, version: packageJson.version,
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig'] methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'getCompilerConfig']
} }
@ -269,6 +269,22 @@ class CompileTab extends ViewPlugin {
}) })
} }
/**
* Get the compiler configuration
* This function is used by remix-plugin compiler API.
* @return {object} settings {version, evmVersion, optimize, runs, version, language}
*/
getCompilerConfig () {
return {
version: this.compilerContainer.data.selectedVersion,
evmVersion: this.compileTabLogic.evmVersion,
optimize: this.compileTabLogic.optimize,
runs: this.compileTabLogic.runs,
language: this.compileTabLogic.language
}
}
/********* /*********
* SUB-COMPONENTS * SUB-COMPONENTS
*/ */

@ -25,6 +25,8 @@ class CompileTab {
this.queryParams.update({ runs: this.runs }) this.queryParams.update({ runs: this.runs })
this.compiler.set('runs', this.runs) this.compiler.set('runs', this.runs)
this.language = 'Solidity'
this.evmVersion = this.queryParams.get().evmVersion this.evmVersion = this.queryParams.get().evmVersion
if (this.evmVersion === 'undefined' || this.evmVersion === 'null' || !this.evmVersion) { if (this.evmVersion === 'undefined' || this.evmVersion === 'null' || !this.evmVersion) {
this.evmVersion = null this.evmVersion = null
@ -57,6 +59,7 @@ class CompileTab {
*/ */
setLanguage (lang) { setLanguage (lang) {
this.compiler.set('language', lang) this.compiler.set('language', lang)
this.language = lang
} }
/** /**

@ -362,7 +362,7 @@ module.exports = class TestTab extends ViewPlugin {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const runningTest = {} const runningTest = {}
runningTest[path] = { content } runningTest[path] = { content }
const { currentVersion, evmVersion, optimize, runs } = this.compileTab.getCurrentCompilerConfig() const { currentVersion, evmVersion, optimize, runs } = this.compileTab.getCompilerConfig()
const currentCompilerUrl = urlFromVersion(currentVersion) const currentCompilerUrl = urlFromVersion(currentVersion)
const compilerConfig = { const compilerConfig = {
currentCompilerUrl, currentCompilerUrl,
@ -389,7 +389,7 @@ module.exports = class TestTab extends ViewPlugin {
this.fileManager.readFile(testFilePath).then((content) => { this.fileManager.readFile(testFilePath).then((content) => {
const runningTests = {} const runningTests = {}
runningTests[testFilePath] = { content } runningTests[testFilePath] = { content }
const { currentVersion, evmVersion, optimize, runs } = this.compileTab.getCurrentCompilerConfig() const { currentVersion, evmVersion, optimize, runs } = this.compileTab.getCompilerConfig()
const currentCompilerUrl = urlFromVersion(currentVersion) const currentCompilerUrl = urlFromVersion(currentVersion)
const compilerConfig = { const compilerConfig = {
currentCompilerUrl, currentCompilerUrl,

Loading…
Cancel
Save