Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4109e282
Commit
4109e282
authored
May 10, 2017
by
Ian Hickson
Committed by
GitHub
May 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an enum instead of a bool for tracking the release level. (#9942)
parent
1af253e3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
update_versions.dart
dev/tools/update_versions.dart
+15
-12
No files found.
dev/tools/update_versions.dart
View file @
4109e282
...
...
@@ -22,6 +22,8 @@ const String kHelp = 'help';
const
String
kYamlVersionPrefix
=
'version: '
;
const
String
kDev
=
'-dev'
;
enum
VersionKind
{
dev
,
release
}
void
main
(
List
<
String
>
args
)
{
// If we're run from the `tools` dir, set the cwd to the repo root.
if
(
path
.
basename
(
Directory
.
current
.
path
)
==
'tools'
)
...
...
@@ -43,7 +45,7 @@ void main(List<String> args) {
final
bool
brokeTest
=
argResults
[
kBrokeTest
];
final
bool
brokeDriver
=
argResults
[
kBrokeDriver
];
final
bool
brokeAnything
=
brokeSdk
||
brokeFramework
||
brokeTest
||
brokeDriver
;
final
bool
release
=
argResults
[
kMarkRelease
]
;
final
VersionKind
level
=
argResults
[
kMarkRelease
]
?
VersionKind
.
release
:
VersionKind
.
dev
;
final
bool
help
=
argResults
[
kHelp
];
if
(
help
)
{
...
...
@@ -52,6 +54,7 @@ void main(List<String> args) {
exit
(
0
);
}
final
bool
release
=
level
==
VersionKind
.
release
;
if
((
brokeAnything
&&
release
)
||
(
brokeAnything
&&
increment
)
||
(
release
&&
increment
))
{
print
(
'You can either increment all the version numbers (--
$kIncrement
), indicate that some packages have had breaking changes (--broke-*), or switch to release mode (--
$kMarkRelease
).'
);
print
(
'You cannot combine these, however.'
);
...
...
@@ -65,19 +68,19 @@ void main(List<String> args) {
if
(
increment
||
brokeAnything
)
sdk
.
increment
(
brokeAnything
);
sdk
.
setMode
(
release
);
sdk
.
setMode
(
level
);
if
(
increment
||
brokeFramework
)
framework
.
increment
(
brokeFramework
);
framework
.
setMode
(
release
);
framework
.
setMode
(
level
);
if
(
increment
||
brokeTest
)
test
.
increment
(
brokeTest
);
test
.
setMode
(
release
);
test
.
setMode
(
level
);
if
(
increment
||
brokeDriver
)
driver
.
increment
(
brokeDriver
);
driver
.
setMode
(
release
);
driver
.
setMode
(
level
);
sdk
.
write
();
framework
.
write
();
...
...
@@ -99,7 +102,7 @@ abstract class Version {
final
List
<
int
>
version
=
<
int
>[];
@protected
bool
dev
;
VersionKind
level
;
@protected
bool
dirty
=
false
;
...
...
@@ -108,8 +111,8 @@ abstract class Version {
void
read
();
void
interpret
(
String
value
)
{
dev
=
value
.
endsWith
(
kDev
)
;
if
(
dev
)
level
=
value
.
endsWith
(
kDev
)
?
VersionKind
.
dev
:
VersionKind
.
release
;
if
(
level
==
VersionKind
.
dev
)
value
=
value
.
substring
(
0
,
value
.
length
-
kDev
.
length
);
version
.
addAll
(
value
.
split
(
'.'
).
map
<
int
>(
int
.
parse
));
}
...
...
@@ -125,9 +128,9 @@ abstract class Version {
dirty
=
true
;
}
void
setMode
(
bool
releas
e
)
{
if
(
release
!=
!
dev
)
{
dev
=
!
releas
e
;
void
setMode
(
VersionKind
valu
e
)
{
if
(
value
!=
level
)
{
level
=
valu
e
;
dirty
=
true
;
}
}
...
...
@@ -135,7 +138,7 @@ abstract class Version {
void
write
();
@override
String
toString
()
=>
version
.
join
(
'.'
)
+
(
dev
?
kDev
:
''
);
String
toString
()
=>
version
.
join
(
'.'
)
+
(
level
==
VersionKind
.
dev
?
kDev
:
''
);
}
class
PubSpecVersion
extends
Version
{
...
...
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