-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
c: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityplatform-androidAndroid applications specificallyAndroid applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
When doing a build, the --build-name and --build-number command line settings should always override
the 'version' tag in pubspec.yaml.
This is happening correctly for IOS, but not Android.
Suspect this is related to:
"Add version to pubspec.yaml"
#16857
and
"package_info broken on ios"
#20761
STEPS TO RECREATE:
# create a new project with "flutter create foo"
# then verify that the "version" field is present in pubspec.yaml
Richards-MacBook-Pro:foo richard$ grep "version:" pubspec.yaml
version: 1.0.0+1
# run an IOS build, specifying --build-name and --build-number
Richards-MacBook-Pro:foo richard$ flutter build ios --build-name=0.99 --build-number=97
Richards-MacBook-Pro:foo richard$ cat ./ios/Flutter/Generated.xcconfig
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/richard/dev/flutter
FLUTTER_APPLICATION_PATH=/Users/richard/dev/foo
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_MODE=release
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
FLUTTER_FRAMEWORK_DIR=/Users/richard/dev/flutter/bin/cache/artifacts/engine/ios-release
FLUTTER_BUILD_NAME=0.99 <----- correct, as expected
FLUTTER_BUILD_NUMBER=97 <----- correct, as expected
Richards-MacBook-Pro:foo richard$
# the results are as expected on IOS
# the command-line parameters (--build-name and --build-number) correctly override the pubspec.yaml "version"
####
# the results on android, however, are incorrect.
# the command line parameters are ignored and the value from pubspec.yaml is used.
Richards-MacBook-Pro:foo richard$ rm android/local.properties
Richards-MacBook-Pro:foo richard$ grep "version:" pubspec.yaml
version: 1.0.0+1
Richards-MacBook-Pro:foo richard$ flutter build apk --build-name=0.99 --build-number=97
Richards-MacBook-Pro:foo richard$ cat android/local.properties
sdk.dir=/Users/richard/Library/Android/sdk
flutter.sdk=/Users/richard/dev/flutter
flutter.versionName=1.0.0 <--- incorrect
flutter.versionCode=1 <--- incorrect
flutter.buildMode=releaseRichards-MacBook-Pro:foo richard$
Richards-MacBook-Pro:foo richard$
# if we comment out the "version" tag in pubspec.yaml, then the build correctly
# pulls from the --build-name and --build-number settings
Richards-MacBook-Pro:foo richard$ vi pubspec.yaml
Richards-MacBook-Pro:foo richard$ grep "version:" pubspec.yaml
#version: 1.0.0+1
Richards-MacBook-Pro:foo richard$ flutter build apk --build-name=0.99 --build-number=97
Richards-MacBook-Pro:foo richard$ cat android/local.properties
sdk.dir=/Users/richard/Library/Android/sdk
flutter.sdk=/Users/richard/dev/flutter
flutter.versionName=0.99 <--- now correct
flutter.versionCode=97 <--- now correct
flutter.buildMode=releaseRichards-MacBook-Pro:foo richard$
rtolar, veryhumble, skybur, mmcc007, miguelpruivo and 2 more
Metadata
Metadata
Assignees
Labels
c: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityplatform-androidAndroid applications specificallyAndroid applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.