make compileTabLogic a plugin

pull/1119/head
yann300 4 years ago committed by Aniket
parent d62c6c4c08
commit 39dc990573
  1. 1
      apps/remix-ide/src/app.js
  2. 9
      apps/remix-ide/src/app/tabs/compile-tab.js
  3. 19
      apps/remix-ide/src/app/tabs/compileTab/compileTab.js
  4. 2
      apps/remix-ide/src/remixAppManager.js

@ -431,6 +431,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
engine.register([
compileTab,
compileTab.compileTabLogic,
run,
debug,
analysis,

@ -65,15 +65,10 @@ class CompileTab extends ViewPlugin {
eventHandlers: {},
loading: false
}
this.compileTabLogic = new CompileTabLogic(this.queryParams, this.fileManager, this.editor, this.config, this.fileProvider, this.contentImport)
}
onActivationInternal () {
const miscApi = {
clearAnnotations: () => {
this.call('editor', 'clearAnnotations')
}
}
this.compileTabLogic = new CompileTabLogic(this.queryParams, this.fileManager, this.editor, this.config, this.fileProvider, this.contentImport, miscApi)
this.compiler = this.compileTabLogic.compiler
this.compileTabLogic.init()
@ -486,6 +481,7 @@ class CompileTab extends ViewPlugin {
}
onActivation () {
this.call('manager', 'activatePlugin', 'solidity-logic')
this.listenToEvents()
}
@ -499,6 +495,7 @@ class CompileTab extends ViewPlugin {
this.fileManager.events.removeListener('noFileSelected', this.data.eventHandlers.onNoFileSelected)
this.compiler.event.unregister('compilationFinished', this.data.eventHandlers.onCompilationFinished)
globalRegistry.get('themeModule').api.events.removeListener('themeChanged', this.data.eventHandlers.onThemeChanged)
this.call('manager', 'deactivatePlugin', 'solidity-logic')
}
}

@ -1,10 +1,19 @@
const EventEmitter = require('events')
var Compiler = require('@remix-project/remix-solidity').Compiler
import * as packageJson from '../../../../../../package.json'
import { Plugin } from '@remixproject/engine'
class CompileTab {
constructor (queryParams, fileManager, editor, config, fileProvider, contentImport, miscApi) {
const profile = {
name: 'solidity-logic',
displayName: 'Solidity compiler logic',
description: 'Compile solidity contracts - Logic',
version: packageJson.version
}
class CompileTab extends Plugin {
constructor (queryParams, fileManager, editor, config, fileProvider, contentImport) {
super(profile)
this.event = new EventEmitter()
this.miscApi = miscApi
this.queryParams = queryParams
this.compilerImport = contentImport
this.compiler = new Compiler((url, cb) => this.compilerImport.resolveAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
@ -100,10 +109,10 @@ class CompileTab {
`
const configFilePath = 'remix-compiler.config.js'
this.fileManager.setFileContent(configFilePath, fileContent)
this.fileManager.call('hardhat', 'compile', configFilePath)
this.call('hardhat', 'compile', configFilePath)
}
this.fileManager.saveCurrentFile()
this.miscApi.clearAnnotations()
this.call('editor', 'clearAnnotations')
var currentFile = this.config.get('currentFile')
return this.compileFile(currentFile)
} catch (err) {

@ -14,7 +14,7 @@ const requiredModules = [ // services + layout views + system views
const dependentModules = ['git', 'hardhat'] // module which shouldn't be manually activated (e.g git is activated by remixd)
export function isNative (name) {
const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons']
const nativePlugins = ['vyper', 'workshops', 'debugger', 'remixd', 'menuicons', 'solidity']
return nativePlugins.includes(name) || requiredModules.includes(name)
}

Loading…
Cancel
Save