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

Create a debug build for android #1707

Closed
wants to merge 7 commits into from
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/binary-combine-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Build .xcframework
run: |
xcodebuild -create-xcframework \
-framework ./binary/ios/Release-iphoneos/realm_dart.framework \
-framework ./binary/ios/Release-iphonesimulator/realm_dart.framework \
-framework ./binary/ios/Debug-iphoneos/realm_dart.framework \
-framework ./binary/ios/Debug-iphonesimulator/realm_dart.framework \
-output ./binary/ios/realm_dart.xcframework
rm -rf ./binary/ios/Release-*
rm -rf ./binary/ios/Debug-*

- name: Store .xcframework artifact
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/cache@v4
with:
path: ./packages/realm_dart/binary/**
key: binaries-${{ matrix.build }}-${{ inputs.runner }}-${{hashFiles('./packages/realm_dart/src/**')}}
key: binaries-${{ matrix.build }}-${{ inputs.runner }}-${{hashFiles('./packages/realm_dart/src/**')}}-debug

- name: Setup Ninja
if: steps.check-cache.outputs.cache-hit != 'true' && (startsWith(matrix.build, 'android') || startsWith(matrix.build, 'linux'))
Expand All @@ -61,7 +61,7 @@ jobs:
if: steps.check-cache.outputs.cache-hit != 'true'
run: |
cmake --preset ${{ startsWith(matrix.build, 'ios-') && 'ios' || matrix.build }}
cmake --build --preset ${{ matrix.build }} --config Release ${{ startsWith(matrix.build, 'android-') && '--target strip' || '' }}
cmake --build --preset ${{ matrix.build }} --config Debug

- name: Store artifacts
uses: actions/upload-artifact@v4
Expand Down
18 changes: 11 additions & 7 deletions packages/realm_dart/lib/src/cli/install/install_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ class InstallCommand extends Command<void> {
return false;
}

Future<void> downloadAndExtractBinaries(Directory destinationDir, Version version, String archiveName) async {
Future<void> downloadAndExtractBinaries(Directory destinationDir, Version version, String archiveName, bool force) async {
if (await shouldSkipDownload(destinationDir.absolute.path, version.toString())) {
return;
if (!force) {
return;
}

print('Deleting existing binaries because --force was supplied.');
await destinationDir.delete(recursive: true);
}

if (!await destinationDir.exists()) {
Expand Down Expand Up @@ -134,10 +139,9 @@ class InstallCommand extends Command<void> {

final flavorName = flavor.packageName;
final realmDependency = pubspec.dependencyOverrides[flavorName] ?? pubspec.dependencies[flavorName];
print(pubspec.dependencyOverrides.values.join('\n'));
print(realmDependency);
if (realmDependency is PathDependency) {
print('Path dependency for $flavorName found. Skipping install of native lib (assuming local development)');
if (realmDependency is PathDependency && !options.force) {
print(
'Path dependency for $flavorName found. Skipping install of native lib (assuming local development). If you want to force install, add --force to the command invocation.');
return;
}
if (realmDependency == null) {
Expand All @@ -151,7 +155,7 @@ class InstallCommand extends Command<void> {
final binaryPath = getBinaryPath(realmPackagePath, flavor);
print(binaryPath);
final archiveName = '${targetOsType.name}.tar.gz';
await downloadAndExtractBinaries(binaryPath, realmPubspec.version!, archiveName);
await downloadAndExtractBinaries(binaryPath, realmPubspec.version!, archiveName, options.force);

print('Realm install command finished.');
}
Expand Down
8 changes: 5 additions & 3 deletions packages/realm_dart/lib/src/cli/install/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ class Options {
@CliOption(hide: true, help: 'Download binary from http://localhost:8000/.', defaultsTo: false)
bool debug;

@CliOption(hide: true, help: 'Force install, even if we would normally skip it.', defaultsTo: false)
@CliOption(help: 'Force install, even if we would normally skip it.', defaultsTo: false)
bool force;

Options({this.targetOsType, this.force = false, this.debug = false});
}

String get usage => _$parserForOptions.usage;

ArgParser populateOptionsParser(ArgParser parser, {
ArgParser populateOptionsParser(
ArgParser parser, {
TargetOsType? targetOsTypeDefaultOverride,
Flavor? flavorDefaultOverride,
}) => _$populateOptionsParser(parser, targetOsTypeDefaultOverride: targetOsTypeDefaultOverride, flavorDefaultOverride: flavorDefaultOverride);
}) =>
_$populateOptionsParser(parser, targetOsTypeDefaultOverride: targetOsTypeDefaultOverride, flavorDefaultOverride: flavorDefaultOverride);

Options parseOptionsResult(ArgResults results) => _$parseOptionsResult(results);
1 change: 0 additions & 1 deletion packages/realm_dart/lib/src/cli/install/options.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading