Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only include build number if it exists. #232

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/flutter_app_packager/lib/src/api/make_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import 'package:pub_semver/pub_semver.dart';
import 'package:pubspec_parse/pubspec_parse.dart';

const _kArtifactName =
'{{name}}{{#flavor}}-{{flavor}}{{/flavor}}-{{build_name}}+{{build_number}}{{#is_profile}}-{{build_mode}}{{/is_profile}}-{{platform}}{{#is_installer}}-setup{{/is_installer}}{{#ext}}.{{ext}}{{/ext}}';
'{{name}}{{#flavor}}-{{flavor}}{{/flavor}}-{{build_name}}{{#has_build_number}}+{{build_number}}{{/has_build_number}}{{#is_profile}}-{{build_mode}}{{/is_profile}}-{{platform}}{{#is_installer}}-setup{{/is_installer}}{{#ext}}.{{ext}}{{/ext}}';
const _kArtifactNameWithChannel =
'{{name}}-{{channel}}-{{build_name}}+{{build_number}}{{#is_profile}}-{{build_mode}}{{/is_profile}}-{{platform}}{{#is_installer}}-setup{{/is_installer}}{{#ext}}.{{ext}}{{/ext}}';
'{{name}}-{{channel}}-{{build_name}}{{#has_build_number}}+{{build_number}}{{/has_build_number}}{{#is_profile}}-{{build_mode}}{{/is_profile}}-{{platform}}{{#is_installer}}-setup{{/is_installer}}{{#ext}}.{{ext}}{{/ext}}';

class MakeConfig {
late bool isInstaller = false;
Expand All @@ -28,7 +28,10 @@ class MakeConfig {
String get appBinaryName => pubspec.name;
Version get appVersion => pubspec.version!;
String get appBuildName => appVersion.toString().split('+').first;
String get appBuildNumber => appVersion.toString().split('+').last;
String? get appBuildNumber {
final parts = appVersion.toString().split('+');
return parts.length > 1 ? parts.last : null;
}

Pubspec? _pubspec;
Directory? _packagingDirectory;
Expand Down Expand Up @@ -61,6 +64,7 @@ class MakeConfig {
Map<String, dynamic> variables = {
'is_installer': isInstaller,
'is_profile': buildMode == 'profile',
'has_build_number': appBuildNumber != null,
'name': appName,
'version': appVersion.toString(),
'build_name': appBuildName,
Expand Down
Loading