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

Better way to distribute prebuilt packages for macOS #36

Open
ghost opened this issue Dec 12, 2022 · 1 comment
Open

Better way to distribute prebuilt packages for macOS #36

ghost opened this issue Dec 12, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 12, 2022

You can implement something icons_launcher implemented to change icons.

flutter pub get
# create a function that can be passed in terminal and download binaries directly
flutter pub run icons_launcher:create

Create a installer_cli.dart and implement something like:

flutter pub get
flutter pub run webview_cef:download

Example for installer_cli.dart:

// ignore_for_file: avoid_print
import 'dart:io';

void downloadPrequisitesForMac() async {
  if (Platform.isMacOS) {
    if (await File('../macos/third/cef/libcef_dll_wrapper.a').exists()) {
      return;
    } else {
      const url =
          'https://github.com/hlwhl/webview_cef/releases/download/pods/mac103.0.12-universal.zip';
      final file = File('../mac103.0.12-universal.zip');
      final request = await HttpClient().getUrl(Uri.parse(url));
      final response = await request.close();
      final contentLength = response.contentLength;
      var bytes = <int>[];
      var total = 0;

      await for (var data in response) {
        bytes.addAll(data);
        total += data.length;

        stdout.write('\x1B[2J\x1B[0;0H');

        print('Downloading ${(total / contentLength * 100).toInt()}%');
      }

      await file.writeAsBytes(bytes);
      print('Download complete.');

      print('Extracting files...');
      await Process.run('unzip', [
        '../mac103.0.12-universal.zip',
        '-d',
        '../macos/third/cef/',
      ]);
      print('Files successfully extracted.');

      print('Cleaning up...');
      file.delete();

      print('Done.');
    }
  } else {
    return;
  }
}
@bahricanyesil
Copy link

bahricanyesil commented Dec 30, 2023

@SinyimZhi Better macOS binary distribution can be the next thing to improve for the package. It's a bit hard to manage package code manually with the repo. You may prioritize it, take it as a suggestion. The real problem is the fact that being have to download the whole zip and unzip it to the repo folder and preserve the source code. We should remove this requirement.

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

No branches or pull requests

1 participant