Skip to content

fix(Fastlane): Fixed bugs with Fastlane generation utils #62

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

Merged
merged 5 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,39 @@ abstract final class FastlaneGenerateMakefile {
FastlaneMakefileUtil.generate(
flavorsIsNotEmpty: flavors.isNotEmpty,
flavor: flavor,
onCreate: (flavorParam, mainDart, lineName, env) {
onCreate: (buildFlavor, mainDart, lineName, env) {
final lineFlavor = flavors.isNotEmpty ? 'flavor:$flavor ' : '';

contents
..add('build_android${lineName}apk:')
..add('\t@echo "Build and distribute android APK"')
..add('\t@flutter build apk --release $flavorParam $mainDart')
..add('\t@echo "Build Android APK"')
..add('\t@flutter build apk --release $buildFlavor $mainDart')
..addNewLine()
..add('build_android${lineName}aab:')
..add('\t@echo "Build and distribute android AAB"')
..add('\t@flutter build appbundle --release $flavorParam $mainDart')
..add('\t@echo "Build Android AAB"')
..add('\t@flutter build appbundle --release $buildFlavor $mainDart')
..addNewLine()
..add(
'build_android${lineName}with_distribution: build_android${lineName}firebase_only build_android${lineName}store_only',
)
..add(
'\t@echo "Build and distribute to the Firebase App Distribution and Store"',
'\t@echo "Distributing"',
)
..addNewLine()
..add(
'build_android${lineName}firebase_only: build_android${lineName}apk')
..add(
'\t@echo "Build and distribute to the Firebase App Distribution"')
'\t@echo "Distributing"')
..add(
'\t@cd android && bundle exec fastlane build flavor:$flavorParam firebase:true artifact_type:apk $env',
'\t@cd android && bundle exec fastlane build ${lineFlavor}firebase:true artifact_type:apk $env',
)
..addNewLine()
..add(
'build_android${lineName}store_only: build_android${lineName}aab',
)
..add('\t@echo "Build and distribute to the Play Store"')
..add('\t@echo "Distributing"')
..add(
'\t@cd android && bundle exec fastlane build flavor:$flavorParam firebase:true artifact_type:apk $env',
'\t@cd android && bundle exec fastlane build ${lineFlavor}firebase:true artifact_type:aab $env',
)
..addNewLine();
},
Expand All @@ -76,25 +78,27 @@ abstract final class FastlaneGenerateMakefile {
FastlaneMakefileUtil.generate(
flavorsIsNotEmpty: flavors.isNotEmpty,
flavor: flavor,
onCreate: (flavorParam, mainDart, lineName, env) {
onCreate: (buildFlavor, mainDart, lineName, env) {
final lineFlavor = flavors.isNotEmpty ? 'flavor:$flavor ' : '';

contents
..add('build${lineName}ios:')
..add('\t@flutter build ios --release $flavorParam $mainDart')
..add('\t@flutter build ios --release $buildFlavor $mainDart')
..addNewLine()
..add('build_ios${lineName}with_distribution: build${lineName}ios')
..add(
'\t@echo "Build and distribute iOS to the TestFlight and Firebase App Distribution"',
)
..add(
'\t@cd ios && bundle exec fastlane build flavor:$flavor firebase:true test_flight:true $env',
'\t@cd ios && bundle exec fastlane build ${lineFlavor}firebase:true test_flight:true $env',
)
..addNewLine()
..add('build_ios${lineName}firebase_only: build${lineName}ios')
..add(
'\t@echo "Build and distribute iOS to the Firebase App Distribution"',
)
..add(
'\t@cd ios && bundle exec fastlane build flavor:$flavor firebase:true $env',
'\t@cd ios && bundle exec fastlane build ${lineFlavor}firebase:true $env',
)
..addNewLine()
..add(
Expand All @@ -104,7 +108,7 @@ abstract final class FastlaneGenerateMakefile {
'\t@echo "Build and distribute iOS to the TestFlight"',
)
..add(
'\t@cd ios && bundle exec fastlane build flavor:$flavor test_flight:true $lineName',
'\t@cd ios && bundle exec fastlane build${lineFlavor}test_flight:true',
)
..addNewLine();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ abstract final class FastlaneMakefileUtil {
required FastlaneMakefileParams onCreate,
}) {
final lineName = flavorsIsNotEmpty ? '_${flavor}_' : '_';
final flavorParam = flavorsIsNotEmpty ? '--flavor $flavor' : '';
final buildFlavor = flavorsIsNotEmpty ? '--flavor $flavor' : '';
final mainDart = flavorsIsNotEmpty
? '-t ${AppConsts.mainDartPath}main_$flavor.dart'
: '';
final envParam = flavorsIsNotEmpty ? '--env $flavor' : '';

onCreate(flavorParam, mainDart, lineName, envParam);
onCreate(buildFlavor, mainDart, lineName, envParam);
}
}