Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
e7cba12d
Commit
e7cba12d
authored
Dec 18, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
instanciate PluginManager in app.js and use it for compilation notification
parent
12c41cb9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
63 deletions
+47
-63
app.js
src/app.js
+18
-1
contextualListener.js
src/app/editor/contextualListener.js
+3
-4
compiler-metadata.js
src/app/files/compiler-metadata.js
+5
-5
editor-panel.js
src/app/panels/editor-panel.js
+8
-6
file-panel.js
src/app/panels/file-panel.js
+2
-5
pluginManager.js
src/app/plugin/pluginManager.js
+8
-42
compile-tab.js
src/app/tabs/compile-tab.js
+3
-0
No files found.
src/app.js
View file @
e7cba12d
...
...
@@ -303,7 +303,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
registry
.
put
({
api
:
msg
=>
self
.
_components
.
editorpanel
.
logHtmlMessage
(
msg
),
name
:
'logCallback'
})
// helper for converting offset to line/column
var
offsetToLineColumnConverter
=
new
OffsetToLineColumnConverter
()
registry
.
put
({
api
:
offsetToLineColumnConverter
,
name
:
'offsettolinecolumnconverter'
})
...
...
@@ -362,6 +362,23 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
var
fileManager
=
self
.
_components
.
fileManager
registry
.
put
({
api
:
fileManager
,
name
:
'filemanager'
})
// ---------------- Plugin Manager -------------------------------
let
pluginManager
=
new
PluginManager
(
self
,
self
.
_components
.
compilersArtefacts
,
txlistener
,
self
.
_components
.
fileProviders
,
self
.
_components
.
fileManager
,
udapp
)
registry
.
put
({
api
:
pluginManager
,
name
:
'pluginmanager'
})
pluginManager
.
event
.
register
(
'sendCompilationResult'
,
(
file
,
source
,
languageVersion
,
data
)
=>
{
// TODO check whether the tab is configured
let
compiler
=
new
CompilerAbstract
(
languageVersion
,
data
,
source
)
self
.
_components
.
compilersArtefacts
[
'__last'
]
=
compiler
})
self
.
_components
.
editorpanel
.
init
()
self
.
_components
.
fileManager
.
init
()
...
...
src/app/editor/contextualListener.js
View file @
e7cba12d
...
...
@@ -15,6 +15,7 @@ class ContextualListener {
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
editor
=
opts
.
editor
self
.
pluginManager
=
opts
.
pluginManager
self
.
_deps
=
{
compilersArtefacts
:
self
.
_components
.
registry
.
get
(
'compilersartefacts'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
...
...
@@ -26,15 +27,13 @@ class ContextualListener {
}
this
.
_activeHighlights
=
[]
self
.
_deps
.
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
self
.
pluginManager
.
event
.
register
(
'sendCompilationResult'
,
(
file
,
source
,
languageVersion
,
data
)
=>
{
this
.
_stopHighlighting
()
this
.
_index
=
{
Declarations
:
{},
FlatReferences
:
{}
}
if
(
success
)
{
this
.
_buildIndex
(
data
,
source
)
}
this
.
_buildIndex
(
data
,
source
)
})
self
.
editor
.
event
.
register
(
'contentChanged'
,
()
=>
{
this
.
_stopHighlighting
()
})
...
...
src/app/files/compiler-metadata.js
View file @
e7cba12d
'use strict'
var
executionContext
=
require
(
'../../execution-context'
)
var
CompilerAbstract
=
require
(
'../compiler/compiler-abstract'
)
class
CompilerMetadata
{
constructor
(
events
,
opts
)
{
constructor
(
opts
)
{
var
self
=
this
self
.
_events
=
events
self
.
_opts
=
opts
self
.
networks
=
[
'VM:-'
,
'main:1'
,
'ropsten:3'
,
'rinkeby:4'
,
'kovan:42'
,
'Custom'
]
}
syncContractMetadata
()
{
var
self
=
this
self
.
_events
.
compiler
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
if
(
!
success
)
return
self
.
_opts
.
pluginManager
.
event
.
register
(
'sendCompilationResult'
,
(
file
,
source
,
languageVersion
,
data
)
=>
{
if
(
!
self
.
_opts
.
config
.
get
(
'settings/generate-contract-metadata'
))
return
let
compiler
=
new
CompilerAbstract
(
languageVersion
,
data
,
source
)
var
provider
=
self
.
_opts
.
fileManager
.
currentFileProvider
()
var
path
=
self
.
_opts
.
fileManager
.
currentPath
()
if
(
provider
&&
path
)
{
self
.
_opts
.
compiler
.
visitContracts
((
contract
)
=>
{
compiler
.
visitContracts
((
contract
)
=>
{
if
(
contract
.
file
!==
source
.
target
)
return
var
fileName
=
path
+
'/'
+
contract
.
name
+
'.json'
...
...
src/app/panels/editor-panel.js
View file @
e7cba12d
...
...
@@ -26,7 +26,7 @@ class EditorPanel {
txListener
:
self
.
_components
.
registry
.
get
(
'txlistener'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
udapp
:
self
.
_components
.
registry
.
get
(
'udapp'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compil
er'
).
api
pluginManager
:
self
.
_components
.
registry
.
get
(
'pluginmanag
er'
).
api
}
self
.
data
=
{
_FILE_SCROLL_DELTA
:
200
,
...
...
@@ -40,16 +40,18 @@ class EditorPanel {
self
.
_view
=
{}
var
editor
=
new
Editor
({})
self
.
_components
.
registry
.
put
({
api
:
editor
,
name
:
'editor'
})
var
contextualListener
=
new
ContextualListener
({
editor
:
editor
})
var
contextualListener
=
new
ContextualListener
({
editor
,
pluginManager
:
self
.
_deps
.
pluginManager
})
var
contextView
=
new
ContextView
({
contextualListener
,
editor
})
self
.
_components
=
{
editor
:
editor
,
contextualListener
:
contextualListener
,
contextView
:
new
ContextView
({
contextualListener
:
contextualListener
,
editor
:
editor
}),
contextView
:
contextView
,
// TODO list of compilers is always empty; should find a path to add plugin compiler here
terminal
:
new
Terminal
({
udapp
:
self
.
_deps
.
udapp
,
compilers
:
{
'solidity'
:
self
.
_deps
.
compiler
}
compilers
:
{}
},
{
getPosition
:
(
event
)
=>
{
...
...
src/app/panels/file-panel.js
View file @
e7cba12d
...
...
@@ -49,7 +49,7 @@ function filepanel (localRegistry) {
fileProviders
:
self
.
_components
.
registry
.
get
(
'fileproviders'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
pluginManager
:
self
.
_components
.
registry
.
get
(
'pluginmanager'
).
api
,
}
var
fileExplorer
=
new
FileExplorer
(
self
.
_components
.
registry
,
self
.
_deps
.
fileProviders
[
'browser'
])
var
fileSystemExplorer
=
new
FileExplorer
(
self
.
_components
.
registry
,
self
.
_deps
.
fileProviders
[
'localhost'
])
...
...
@@ -63,11 +63,8 @@ function filepanel (localRegistry) {
// ----------------- editor panel ----------------------
self
.
_compilerMetadata
=
new
CompilerMetadata
(
{
compiler
:
self
.
_deps
.
compiler
.
event
},
{
fileManager
:
self
.
_deps
.
fileManager
,
compiler
:
self
.
_deps
.
compil
er
,
pluginManager
:
self
.
_deps
.
pluginManag
er
,
config
:
self
.
_deps
.
config
}
)
...
...
src/app/plugin/pluginManager.js
View file @
e7cba12d
...
...
@@ -101,15 +101,7 @@ module.exports = class PluginManager {
value
:
[
file
]
}))
})
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
self
.
broadcast
(
JSON
.
stringify
({
action
:
'notification'
,
key
:
'compiler'
,
type
:
'compilationFinished'
,
value
:
[
success
,
data
,
source
]
}))
})
txlistener
.
event
.
register
(
'newTransaction'
,
(
tx
)
=>
{
self
.
broadcast
(
JSON
.
stringify
({
action
:
'notification'
,
...
...
@@ -119,38 +111,6 @@ module.exports = class PluginManager {
}))
})
app
.
event
.
register
(
'tabChanged'
,
(
tabName
)
=>
{
// TODO Fix this cause this event is no longer triggered
if
(
self
.
inFocus
&&
self
.
inFocus
!==
tabName
)
{
// trigger unfocus
self
.
post
(
self
.
inFocus
,
JSON
.
stringify
({
action
:
'notification'
,
key
:
'app'
,
type
:
'unfocus'
,
value
:
[]
}))
}
if
(
self
.
plugins
[
tabName
])
{
// trigger focus
self
.
post
(
tabName
,
JSON
.
stringify
({
action
:
'notification'
,
key
:
'app'
,
type
:
'focus'
,
value
:
[]
}))
self
.
inFocus
=
tabName
pluginAPI
.
compiler
.
getCompilationResult
(
tabName
,
(
error
,
data
)
=>
{
if
(
!
error
)
return
self
.
post
(
tabName
,
JSON
.
stringify
({
action
:
'notification'
,
key
:
'compiler'
,
type
:
'compilationData'
,
value
:
[
data
]
}))
})
}
})
window
.
addEventListener
(
'message'
,
(
event
)
=>
{
if
(
event
.
type
!==
'message'
)
return
var
extension
=
self
.
origins
[
event
.
origin
]
...
...
@@ -202,7 +162,13 @@ module.exports = class PluginManager {
receivedDataFrom
(
methodName
,
mod
,
argumentsArray
)
{
// TODO check whether 'mod' as right to do that
console
.
log
(
argumentsArray
)
this
.
event
.
trigger
(
methodName
,
argumentsArray
)
this
.
event
.
trigger
(
methodName
,
argumentsArray
)
// forward to internal modules
this
.
broadcast
(
JSON
.
stringify
({
// forward to plugins
action
:
'notification'
,
key
:
mod
,
type
:
methodName
,
value
:
argumentsArray
}))
}
post
(
name
,
value
)
{
const
self
=
this
...
...
src/app/tabs/compile-tab.js
View file @
e7cba12d
...
...
@@ -56,6 +56,7 @@ module.exports = class CompileTab {
swarmfileProvider
:
self
.
_components
.
registry
.
get
(
'fileproviders/swarm'
).
api
,
fileManager
:
self
.
_components
.
registry
.
get
(
'filemanager'
).
api
,
fileProviders
:
self
.
_components
.
registry
.
get
(
'fileproviders'
).
api
,
pluginManager
:
self
.
_components
.
registry
.
get
(
'pluginmanager'
).
api
}
self
.
data
=
{
hideWarnings
:
self
.
_deps
.
config
.
get
(
'hideWarnings'
)
||
false
,
...
...
@@ -127,6 +128,8 @@ module.exports = class CompileTab {
// refill the dropdown list
self
.
_view
.
contractNames
.
innerHTML
=
''
if
(
success
)
{
// TODO consider using compile tab as a proper module instead of just forwarding event
self
.
_deps
.
pluginManager
.
receivedDataFrom
(
'sendCompilationResult'
,
'solidity-compiler'
,
[
data
.
target
,
source
,
self
.
data
.
selectedVersion
,
data
]
)
self
.
_view
.
contractNames
.
removeAttribute
(
'disabled'
)
self
.
_components
.
compiler
.
visitContracts
(
contract
=>
{
self
.
data
.
contractsDetails
[
contract
.
name
]
=
parseContracts
(
contract
.
name
,
contract
.
object
,
self
.
_components
.
compiler
.
getSource
(
contract
.
file
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment