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

fix(shorebird_cli): handle multi-dimensional flavors on android #1960

Merged
merged 23 commits into from
Apr 24, 2024

Conversation

erickzanardo
Copy link
Contributor

Description

Our CLI would get confused when using multi dimensional flavors on android. This PR fixes that.

Fixes #1830

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@erickzanardo erickzanardo marked this pull request as draft April 23, 2024 18:38
import 'package:shorebird_cli/src/command.dart';
import 'package:shorebird_cli/src/third_party/flutter_tools/lib/flutter_tools.dart';

/// Throw when multiple artifacts are found in the build directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will that happen when using Android Studio and building different flavors/configs between multiple runs? I wonder if older .aab's from other configs being in the build dir can cause these failures to happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should never happen as far I can tell, this was more of a "just to be sure" checking that Bryan suggested while we were discussing the solution.

Copy link
Contributor

@felangel felangel Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm also concerned about this case. Have we filed an issue upstream for this bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. Was focusing on our PR first, will open now that it seems that I addressed all/most of the comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (09507fa) to head (47d6d05).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1960   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          176       177    +1     
  Lines         5520      5560   +40     
=========================================
+ Hits          5520      5560   +40     
Flag Coverage Δ
shorebird_cli 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Co-authored-by: Felix Angelov <felix@shorebird.dev>
erickzanardo and others added 3 commits April 23, 2024 17:01
Co-authored-by: Bryan Oltman <bryan@shorebird.dev>
Co-authored-by: Felix Angelov <felix@shorebird.dev>
erickzanardo and others added 2 commits April 23, 2024 17:31
Co-authored-by: Bryan Oltman <bryan@shorebird.dev>
Comment on lines 205 to 208
apkFile = shorebirdAndroidArtifacts.findApk(
project: projectRoot,
flavor: flavor,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this the first time, but this reads like it will always fail unless generateApk is true.

Comment on lines 946 to 951
when(
() => shorebirdAndroidArtifacts.findAppBundle(
project: any(named: 'project'),
flavor: any(named: 'flavor'),
),
).thenReturn(File('app-release.aab'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'd maybe leave a small comment so that's clear

Copy link
Contributor

@felangel felangel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just left a bunch of small recommendations

erickzanardo and others added 3 commits April 24, 2024 14:24
Co-authored-by: Felix Angelov <felix@shorebird.dev>
@erickzanardo erickzanardo enabled auto-merge (squash) April 24, 2024 17:29
@erickzanardo erickzanardo merged commit ad3be55 into main Apr 24, 2024
11 checks passed
@erickzanardo erickzanardo deleted the fix/identify-dimension-aabs branch April 24, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: flavors with multiple dimensions cause release command to not find aab
4 participants