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
a690ab2e
Commit
a690ab2e
authored
Nov 29, 2019
by
LianaHus
Committed by
Liana Husikyan
Nov 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checking also nightly builds
do not add custom to input if not given
parent
8e4a7a63
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
compilerContainer.js
src/app/tabs/compileTab/compilerContainer.js
+17
-10
No files found.
src/app/tabs/compileTab/compilerContainer.js
View file @
a690ab2e
...
...
@@ -124,8 +124,17 @@ class CompilerContainer {
const
pragmaStr
=
pragmaArr
[
0
].
replace
(
'pragma solidity'
,
''
).
trim
()
const
pragma
=
pragmaStr
.
substring
(
0
,
pragmaStr
.
length
-
1
)
const
releasedVersions
=
this
.
data
.
allversions
.
filter
(
obj
=>
!
obj
.
prerelease
).
map
(
obj
=>
obj
.
version
)
const
currentCompilerName
=
semver
.
clean
(
this
.
_view
.
versionSelector
.
selectedOptions
[
0
].
label
)
if
(
releasedVersions
.
includes
(
currentCompilerName
)
&&
!
semver
.
satisfies
(
this
.
_retrieveVersion
(),
pragma
))
{
const
allVersions
=
this
.
data
.
allversions
.
map
(
obj
=>
this
.
_retrieveVersion
(
obj
.
version
))
const
currentCompilerName
=
this
.
_retrieveVersion
(
this
.
_view
.
versionSelector
.
selectedOptions
[
0
].
label
)
// contains only numbers part, for example '0.4.22'
const
pureVersion
=
this
.
_retrieveVersion
()
// is nightly build newer than the last release
const
isNewestNightly
=
currentCompilerName
.
includes
(
'nightly'
)
&&
semver
.
gt
(
pureVersion
,
releasedVersions
[
0
])
// checking if the selected version is in the pragma range
const
isInRange
=
semver
.
satisfies
(
pureVersion
,
pragma
)
// checking if the selected version is from official compilers list(excluding custom versions) and in range or greater
const
isOfficial
=
allVersions
.
includes
(
currentCompilerName
)
if
(
isOfficial
&&
(
!
isInRange
&&
!
isNewestNightly
))
{
const
compilerToLoad
=
semver
.
maxSatisfying
(
releasedVersions
,
pragma
)
const
compilerPath
=
this
.
data
.
allversions
.
filter
(
obj
=>
!
obj
.
prerelease
&&
obj
.
version
===
compilerToLoad
)[
0
].
path
if
(
this
.
data
.
selectedVersion
!==
compilerPath
)
{
...
...
@@ -137,9 +146,9 @@ class CompilerContainer {
})
}
_retrieveVersion
()
{
let
version
=
this
.
_view
.
versionSelector
.
value
return
version
.
substring
(
9
,
version
.
length
)
_retrieveVersion
(
version
)
{
if
(
!
version
)
version
=
this
.
_view
.
versionSelector
.
value
return
semver
.
coerce
(
version
)
?
semver
.
coerce
(
version
).
version
:
''
}
render
()
{
...
...
@@ -200,7 +209,7 @@ class CompilerContainer {
this
.
_view
.
compilationButton
=
this
.
compilationButton
()
this
.
_view
.
includeNightlies
=
yo
`
<input class="mr-0 ml-1" id="nightlies" type="checkbox" onchange=
${
this
.
_updateVersionSelector
.
bind
(
this
)}
>
<input class="mr-0 ml-1" id="nightlies" type="checkbox" onchange=
${
()
=>
this
.
_updateVersionSelector
(
)}
>
`
this
.
_view
.
compileContainer
=
yo
`
<section>
...
...
@@ -286,9 +295,7 @@ class CompilerContainer {
compile
(
event
)
{
if
(
this
.
config
.
get
(
'currentFile'
))
{
if
(
!
this
.
data
.
selectedVersion
.
includes
(
'nightly'
))
{
this
.
_setCompilerVersionFromPragma
(
this
.
config
.
get
(
'currentFile'
))
}
this
.
_setCompilerVersionFromPragma
(
this
.
config
.
get
(
'currentFile'
))
this
.
compileTabLogic
.
runCompiler
()
}
}
...
...
@@ -353,7 +360,7 @@ class CompilerContainer {
this
.
_view
.
versionSelector
.
removeAttribute
(
'disabled'
)
this
.
queryParams
.
update
({
version
:
this
.
data
.
selectedVersion
})
let
url
if
(
customUrl
)
{
if
(
customUrl
!==
''
)
{
this
.
data
.
selectedVersion
=
customUrl
this
.
_view
.
versionSelector
.
appendChild
(
yo
`<option value="
${
customUrl
}
" selected>custom</option>`
)
url
=
customUrl
...
...
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