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
398e123c
Commit
398e123c
authored
Dec 03, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move runCompiler to compile tab
parent
391dfbba
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
41 deletions
+38
-41
app.js
src/app.js
+0
-37
compile-tab.js
src/app/tabs/compile-tab.js
+38
-4
No files found.
src/app.js
View file @
398e123c
...
...
@@ -227,34 +227,6 @@ class App {
self
.
_adjustLayout
(
'right'
,
self
.
data
.
_layout
.
right
.
offset
)
return
self
.
_view
.
el
}
runCompiler
()
{
const
self
=
this
if
(
self
.
_components
.
righthandpanel
.
debugger
().
isDebuggerActive
())
return
self
.
_components
.
fileManager
.
saveCurrentFile
()
self
.
_components
.
editorpanel
.
getEditor
().
clearAnnotations
()
var
currentFile
=
self
.
_components
.
config
.
get
(
'currentFile'
)
if
(
currentFile
)
{
if
(
/.
(
.sol
)
$/
.
exec
(
currentFile
))
{
// only compile *.sol file.
var
target
=
currentFile
var
sources
=
{}
var
provider
=
self
.
_components
.
fileManager
.
fileProviderOf
(
currentFile
)
if
(
provider
)
{
provider
.
get
(
target
,
(
error
,
content
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
sources
[
target
]
=
{
content
}
self
.
_components
.
compiler
.
compile
(
sources
,
target
)
}
})
}
else
{
console
.
log
(
'cannot compile '
+
currentFile
+
'. Does not belong to any explorer'
)
}
}
}
}
startdebugging
(
txHash
)
{
const
self
=
this
self
.
event
.
trigger
(
'debuggingRequested'
,
[])
...
...
@@ -376,15 +348,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
return
'Are you sure you want to leave?'
}
// Run the compiler instead of trying to save the website
$
(
window
).
keydown
(
function
(
e
)
{
// ctrl+s or command+s
if
((
e
.
metaKey
||
e
.
ctrlKey
)
&&
e
.
keyCode
===
83
)
{
e
.
preventDefault
()
self
.
runCompiler
()
}
})
registry
.
put
({
api
:
msg
=>
self
.
_components
.
editorpanel
.
logHtmlMessage
(
msg
),
name
:
'logCallback'
})
// ----------------- Compiler -----------------
...
...
src/app/tabs/compile-tab.js
View file @
398e123c
...
...
@@ -42,7 +42,6 @@ module.exports = class CompileTab {
self
.
_components
.
queryParams
=
new
QueryParams
()
// dependencies
self
.
_deps
=
{
app
:
self
.
_components
.
registry
.
get
(
'app'
).
api
,
editor
:
self
.
_components
.
registry
.
get
(
'editor'
).
api
,
config
:
self
.
_components
.
registry
.
get
(
'config'
).
api
,
compiler
:
self
.
_components
.
registry
.
get
(
'compiler'
).
api
,
...
...
@@ -71,7 +70,7 @@ module.exports = class CompileTab {
function
scheduleCompilation
()
{
if
(
!
self
.
_deps
.
config
.
get
(
'autoCompile'
))
return
if
(
self
.
data
.
compileTimeout
)
window
.
clearTimeout
(
self
.
data
.
compileTimeout
)
self
.
data
.
compileTimeout
=
window
.
setTimeout
(()
=>
self
.
_deps
.
app
.
runCompiler
(),
self
.
data
.
timeout
)
self
.
data
.
compileTimeout
=
window
.
setTimeout
(()
=>
self
.
runCompiler
(),
self
.
data
.
timeout
)
}
self
.
_deps
.
compiler
.
event
.
register
(
'compilationDuration'
,
function
tabHighlighting
(
speed
)
{
if
(
!
self
.
_view
.
warnCompilationSlow
)
return
...
...
@@ -165,6 +164,15 @@ module.exports = class CompileTab {
})
}
})
// Run the compiler instead of trying to save the website
$
(
window
).
keydown
(
function
(
e
)
{
// ctrl+s or command+s
if
((
e
.
metaKey
||
e
.
ctrlKey
)
&&
e
.
keyCode
===
83
)
{
e
.
preventDefault
()
self
.
runCompiler
()
}
})
}
addWarning
(
msg
,
settings
)
{
const
self
=
this
...
...
@@ -183,7 +191,7 @@ module.exports = class CompileTab {
self
.
data
.
optimize
=
!!
self
.
_view
.
optimize
.
checked
self
.
_components
.
queryParams
.
update
({
optimize
:
self
.
data
.
optimize
})
self
.
_deps
.
compiler
.
setOptimize
(
self
.
data
.
optimize
)
self
.
_deps
.
app
.
runCompiler
()
self
.
runCompiler
()
}
self
.
_deps
.
compiler
.
event
.
register
(
'compilerLoaded'
,
(
version
)
=>
self
.
setVersionText
(
version
))
...
...
@@ -279,7 +287,7 @@ module.exports = class CompileTab {
'web3Deploy'
:
'Copy/paste this code to any JavaScript/Web3 console to deploy this contract'
}
function
updateAutoCompile
(
event
)
{
self
.
_deps
.
config
.
set
(
'autoCompile'
,
self
.
_view
.
autoCompile
.
checked
)
}
function
compile
(
event
)
{
self
.
_deps
.
app
.
runCompiler
()
}
function
compile
(
event
)
{
self
.
runCompiler
()
}
function
hideWarnings
(
event
)
{
self
.
_deps
.
config
.
set
(
'hideWarnings'
,
self
.
_view
.
hideWarningsBox
.
checked
)
compile
()
...
...
@@ -452,6 +460,32 @@ module.exports = class CompileTab {
callback
(
allversions
,
selectedVersion
)
})
}
runCompiler
()
{
const
self
=
this
self
.
_deps
.
fileManager
.
saveCurrentFile
()
self
.
_deps
.
editor
.
clearAnnotations
()
var
currentFile
=
self
.
_deps
.
config
.
get
(
'currentFile'
)
if
(
currentFile
)
{
if
(
/.
(
.sol
)
$/
.
exec
(
currentFile
))
{
// only compile *.sol file.
var
target
=
currentFile
var
sources
=
{}
var
provider
=
self
.
_deps
.
fileManager
.
fileProviderOf
(
currentFile
)
if
(
provider
)
{
provider
.
get
(
target
,
(
error
,
content
)
=>
{
if
(
error
)
{
console
.
log
(
error
)
}
else
{
sources
[
target
]
=
{
content
}
self
.
compiler
.
compile
(
sources
,
target
)
}
})
}
else
{
console
.
log
(
'cannot compile '
+
currentFile
+
'. Does not belong to any explorer'
)
}
}
}
}
}
const
css
=
csjs
`
...
...
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