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
693fb656
Unverified
Commit
693fb656
authored
Dec 18, 2018
by
Stanislav Baranov
Committed by
GitHub
Dec 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flutter tool to actually honor --build-number/--build-name flags. (#25520)
parent
0d4f279f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
7 deletions
+54
-7
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+12
-7
gradle_test.dart
packages/flutter_tools/test/android/gradle_test.dart
+42
-0
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
693fb656
...
...
@@ -231,7 +231,11 @@ void updateLocalProperties({
void
changeIfNecessary
(
String
key
,
String
value
)
{
if
(
settings
.
values
[
key
]
!=
value
)
{
settings
.
values
[
key
]
=
value
;
if
(
value
==
null
)
{
settings
.
values
.
remove
(
key
);
}
else
{
settings
.
values
[
key
]
=
value
;
}
changed
=
true
;
}
}
...
...
@@ -240,15 +244,16 @@ void updateLocalProperties({
if
(
androidSdk
!=
null
)
changeIfNecessary
(
'sdk.dir'
,
escapePath
(
androidSdk
.
directory
));
changeIfNecessary
(
'flutter.sdk'
,
escapePath
(
Cache
.
flutterRoot
));
if
(
buildInfo
!=
null
)
if
(
buildInfo
!=
null
)
{
changeIfNecessary
(
'flutter.buildMode'
,
buildInfo
.
modeName
);
final
String
buildName
=
buildInfo
?.
buildName
??
manifest
.
buildName
;
if
(
buildName
!=
null
)
final
String
buildName
=
buildInfo
.
buildName
??
manifest
.
buildName
;
changeIfNecessary
(
'flutter.versionName'
,
buildName
);
final
int
buildNumber
=
buildInfo
?
.
buildNumber
??
manifest
.
buildNumber
;
if
(
buildNumber
!=
null
)
changeIfNecessary
(
'flutter.versionCode'
,
'
$buildNumber
'
);
final
int
buildNumber
=
buildInfo
.
buildNumber
??
manifest
.
buildNumber
;
changeIfNecessary
(
'flutter.versionCode'
,
buildNumber
?.
toString
());
}
if
(
changed
)
settings
.
writeContents
(
localProperties
);
...
...
packages/flutter_tools/test/android/gradle_test.dart
View file @
693fb656
...
...
@@ -325,6 +325,48 @@ flutter:
expectedBuildNumber:
'3'
,
);
});
testUsingAndroidContext
(
'allow build info to unset build name and number'
,
()
async
{
const
String
manifest
=
'''
name: test
dependencies:
flutter:
sdk: flutter
flutter:
'''
;
await
checkBuildVersion
(
manifest:
manifest
,
buildInfo:
const
BuildInfo
(
BuildMode
.
release
,
null
,
buildName:
null
,
buildNumber:
null
),
expectedBuildName:
null
,
expectedBuildNumber:
null
,
);
await
checkBuildVersion
(
manifest:
manifest
,
buildInfo:
const
BuildInfo
(
BuildMode
.
release
,
null
,
buildName:
'1.0.2'
,
buildNumber:
3
),
expectedBuildName:
'1.0.2'
,
expectedBuildNumber:
'3'
,
);
await
checkBuildVersion
(
manifest:
manifest
,
buildInfo:
const
BuildInfo
(
BuildMode
.
release
,
null
,
buildName:
'1.0.3'
,
buildNumber:
4
),
expectedBuildName:
'1.0.3'
,
expectedBuildNumber:
'4'
,
);
// Values don't get unset.
await
checkBuildVersion
(
manifest:
manifest
,
buildInfo:
null
,
expectedBuildName:
'1.0.3'
,
expectedBuildNumber:
'4'
,
);
// Values get unset.
await
checkBuildVersion
(
manifest:
manifest
,
buildInfo:
const
BuildInfo
(
BuildMode
.
release
,
null
,
buildName:
null
,
buildNumber:
null
),
expectedBuildName:
null
,
expectedBuildNumber:
null
,
);
});
});
}
...
...
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