compile only when enabled

pull/5370/head
aniket-engg 4 years ago committed by Aniket
parent 2a0bdd4b69
commit 57d91cbe28
  1. 1
      apps/remix-ide/src/app/tabs/compile-tab.js
  2. 4
      apps/remix-ide/src/app/tabs/compileTab/compileTab.js
  3. 9
      apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js

@ -93,6 +93,7 @@ class CompileTab extends ViewPlugin {
this.on('filePanel', 'setWorkspace', (workspace) => {
this.compileTabLogic.isHardhatProject().then((result) => {
if (result) this.compilerContainer.hardhatCompilation.style.display = 'flex'
else this.compilerContainer.hardhatCompilation.style.display = 'none'
})
})

@ -84,10 +84,10 @@ class CompileTab {
} else return false
}
runCompiler () {
runCompiler (hhCompilation) {
try {
console.log('mode is - ', this.fileManager.mode)
if (this.fileManager.mode === 'localhost') {
if (this.fileManager.mode === 'localhost' && hhCompilation) {
const { currentVersion, optimize, runs } = this.compiler.state
const fileContent = `module.exports = {
solidity: '${currentVersion.substring(0, currentVersion.indexOf('+commit'))}',

@ -15,6 +15,7 @@ class CompilerContainer {
this.editor = editor
this.config = config
this.queryParams = queryParams
this.hhCompilation = false
this.data = {
hideWarnings: config.get('hideWarnings') || false,
@ -184,7 +185,7 @@ class CompilerContainer {
})
this.hardhatCompilation = yo`<div class="mt-2 ${css.compilerConfig} custom-control custom-checkbox" style="display:none">
<input class="${css.autocompile} custom-control-input" id="enableHardhat" type="checkbox" title="Enable Hardhat Compilation">
<input class="${css.autocompile} custom-control-input" onchange=${(e) => this.updatehhCompilation(e)} id="enableHardhat" type="checkbox" title="Enable Hardhat Compilation">
<label class="form-check-label custom-control-label" for="enableHardhat">Enable Hardhat Compilation</label>
</div>`
this._view.warnCompilationSlow = yo`<i title="Compilation Slow" style="visibility:hidden" class="${css.warnCompilationSlow} fas fa-exclamation-triangle" aria-hidden="true"></i>`
@ -331,12 +332,16 @@ class CompilerContainer {
this.config.set('autoCompile', this._view.autoCompile.checked)
}
updatehhCompilation (event) {
this.hhCompilation = event.target.checked
}
compile (event) {
const currentFile = this.config.get('currentFile')
if (!this.isSolFileSelected()) return
this._setCompilerVersionFromPragma(currentFile)
this.compileTabLogic.runCompiler()
this.compileTabLogic.runCompiler(this.hhCompilation)
}
compileIfAutoCompileOn () {

Loading…
Cancel
Save