Skip to content

Commit

Permalink
unsupported features
Browse files Browse the repository at this point in the history
  • Loading branch information
YehudaKremer committed Apr 7, 2022
1 parent 2e8bf35 commit 7ec0996
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 30 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ msix_config:

</details>

## :heavy_exclamation_mark: Unsupported Features

We added the most common features of Msix in this package, however, if you need to add or edit a feature that is not supported yet, you can do this manually.

First, create the unpackaged msix files with the following command, then edit the files that were created in the build folder
```console
PS c:\src\flutter_project> flutter pub run msix:build
```
After that create a msix installer file from those files with the following command
```console
PS c:\src\flutter_project> flutter pub run msix:pack
```

---

Tags: `msi` `windows` `win10` `win11` `windows10` `windows11` `windows store` `windows installer` `windows packaging` `appx` `AppxManifest` `SignTool` `MakeAppx`
Expand Down
5 changes: 5 additions & 0 deletions bin/build.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:msix/msix.dart';

Future<void> main(List<String> arguments) async {
await Msix(arguments).build();
}
5 changes: 5 additions & 0 deletions bin/pack.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:msix/msix.dart';

Future<void> main(List<String> arguments) async {
await Msix(arguments).pack();
}
103 changes: 75 additions & 28 deletions lib/msix.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:cli_util/cli_logging.dart' show Logger, Ansi;
import 'src/app_installer.dart';
import 'src/windows_build.dart';
Expand All @@ -23,22 +25,52 @@ class Msix {

static void registerWith() {}

/// Execute when use the msix:create command
/// Execute with the `msix:build` command
Future<void> build() async {
await _initConfig();

var loggerProgress = _logger.progress('building msix files');
await _buildMsixFiles();
loggerProgress.finish(showTiming: true);

final msixPath = _config.msixPath.contains('build/windows')
? _config.msixPath.substring(_config.msixPath.indexOf('build/windows'))
: _config.msixPath;
_logger.write('unpackaged msix files created in: ');
_logger.stdout(
File(msixPath).parent.path.blue.emphasized.replaceAll('/', r'\'));
}

/// Execute with the `msix:pack` command
Future<void> pack() async {
await _initConfig();

/// check if the appx manifest is exist
var appxManifestPath = '${_config.buildFilesFolder}/AppxManifest.xml';
if (!(await File(appxManifestPath).exists())) {
var error = 'run "msix:build" first';
_logger.stderr(error.red);
exit(-1);
}

var loggerProgress = _logger.progress('packing msix files');
if (_config.signMsix && !_config.store) {
await SignTool(_config, _logger).getCertificatePublisher();
}
await _packMsixFiles();
loggerProgress.finish(showTiming: true);

_printMsixOutputLocation();
}

/// Execute with the `msix:create` command
Future<void> create() async {
await _initConfig();
await _createMsix();

_logger.write('msix created: '.green.emphasized);
_logger.stdout((_config.msixPath.contains('build/windows')
? _config.msixPath
.substring(_config.msixPath.indexOf('build/windows'))
: _config.msixPath)
.blue
.emphasized
.replaceAll('/', r'\'));
_printMsixOutputLocation();
}

/// Execute when use the msix:publish command
/// Execute with the `msix:publish` command
Future<void> publish() async {
await _initConfig();
await _config.validateAppInstallerConfigValues();
Expand All @@ -47,7 +79,7 @@ class Msix {

await _createMsix();

var loggerProgress = _logger.progress('publish');
var loggerProgress = _logger.progress('publishing');
await appInstaller.copyMsixToVersionsFolder();
await appInstaller.generateAppInstaller();
await appInstaller.generateAppInstallerWebSite();
Expand All @@ -64,35 +96,50 @@ class Msix {
}

Future<void> _createMsix() async {
var loggerProgress = _logger.progress('creating msix installer');
await _buildMsixFiles();
await _packMsixFiles();
loggerProgress.finish(showTiming: true);
}

Future<void> _buildMsixFiles() async {
if (_config.buildWindows) {
// run the "flutter build windows" command
await WindowsBuild(_config, _logger).build();
}

var loggerProgress = _logger.progress('creating msix installer');

// validate the "flutter build windows" output files
await _config.validateBuildFiles();
await _config.validateWindowsBuildFiles();
final assets = Assets(_config, _logger);
await assets.cleanTemporaryFiles(clearMsixFiles: true);
await assets.createIcons();
await assets.copyVCLibsFiles();

final _assets = Assets(_config, _logger);
final _signTool = SignTool(_config, _logger);

await _assets.cleanTemporaryFiles(clearMsixFiles: true);
await _assets.createIcons();
await _assets.copyVCLibsFiles();
if (_config.signMsix && !_config.store) {
await _signTool.getCertificatePublisher();
await SignTool(_config, _logger).getCertificatePublisher();
}
await AppxManifest(_config, _logger).generateAppxManifest();
await MakePri(_config, _logger).generatePRI();
}

Future<void> _packMsixFiles() async {
await MakeAppx(_config, _logger).pack();
await _assets.cleanTemporaryFiles();
await Assets(_config, _logger).cleanTemporaryFiles();

if (_config.signMsix && !_config.store) {
if (_config.installCert) await _signTool.installCertificate();
await _signTool.sign();
final signTool = SignTool(_config, _logger);
if (_config.installCert) await signTool.installCertificate();
await signTool.sign();
}
}

loggerProgress.finish(showTiming: true);
/// print the location of the created msix file
void _printMsixOutputLocation() {
_logger.write('msix created: '.green.emphasized);
_logger.stdout((_config.msixPath.contains('build/windows')
? _config.msixPath
.substring(_config.msixPath.indexOf('build/windows'))
: _config.msixPath)
.blue
.emphasized
.replaceAll('/', r'\'));
}
}
2 changes: 1 addition & 1 deletion lib/src/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class Configuration {
}

/// Validate "flutter build windows" output files
Future<void> validateBuildFiles() async {
Future<void> validateWindowsBuildFiles() async {
_logger.trace('validating build files');

if (!await Directory(buildFilesFolder).exists() ||
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: msix
description: A command-line tool that create Msix installer from your flutter windows-build files.
version: 3.4.1
version: 3.5.0
maintainer: Yehuda Kremer ([email protected])
homepage: https://github.com/YehudaKremer/msix

Expand Down

0 comments on commit 7ec0996

Please sign in to comment.