Skip to content

Commit

Permalink
Merge branch '3.0v'
Browse files Browse the repository at this point in the history
  • Loading branch information
YehudaKremer committed Feb 12, 2022
2 parents 2347024 + 7a381db commit 4276d14
Show file tree
Hide file tree
Showing 24 changed files with 1,081 additions and 763 deletions.
19 changes: 11 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@
name: Bug report
about: Create a report to help us fix any issues you are having
title: "[BUG] "
labels: ''
assignees: ''

labels: ""
assignees: ""
---

### :information_source: Info

<!--- Please enter what version of MSIX you were using so we can identify if this is a problem with a certain version of the package --->
Version: `e.g. v0.7.5`

**Version: `e.g. v2.8.15`**

### :speech_balloon: Description
<!--- What is the issue? Does it fail during execution? Does it produce incorrect / wrong icons? Please include all details here --->

Enter a description of your problem here. <br />
Any logs, error and assets you have that can help to find this bug.
<!--- What is the issue? Does it fail during execution? Does it produce incorrect / wrong icons? Please include all details here --->

**Enter a description of your problem here.<br />
Any logs, error and assets you have that can help to find this bug.<br />
To run the tool with extended logs use the `-v` argument, for example: `flutter pub run msix:create -v`**

### :scroll: Pubspec.yaml

<!--- Please include your pubspec.yaml file here --->

We ask that you include your pubspec.yaml file as a common problem we have seen has been the pubspec.yaml file being incorrect
**We ask that you include your pubspec.yaml file as a common problem we have seen has been the pubspec.yaml file being incorrect**
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## 3.0.0

- add `publish` command and configurations, for sideloading publish (outside the microsoft store)
- user asked (cli dialog) if he want to **increment version number** (if needed)
- user asked (cli dialog) if he want to install the test certificate
- add [toast notifications](https://github.com/YehudaKremer/msix/issues/94) configuration
- `msix:create` is includes the `flutter build windows` command, unless use the argument: `--build-windows false`
- add `--with-test-certificate-installer` flag that copy test-certificate installer program (.exe), see configuration table
- logs are now minimal by default, use the `-v` argument to print extended logs (useful for debugging and bug reporting)
- code refactoring

### Breaking Changes

- remove `debug-signing` (not printing useful info)
- change `dont-install-certificate` to `install-certificate` with default of true
- setting msix-version via Command-line argument is allow only with `--version 1.0.0.1` and not with `-v` (use now for extended logs)

## 2.8.18

- fix [#91](https://github.com/YehudaKremer/msix/issues/91)
Expand Down
142 changes: 103 additions & 39 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions bin/create.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:msix/msix.dart';

void main(List<String> arguments) {
Msix().createMsix(arguments);
Future<void> main(List<String> arguments) async {
await Msix(arguments).create();
}
5 changes: 5 additions & 0 deletions bin/publish.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).publish();
}
57 changes: 57 additions & 0 deletions lib/assets/appInstallerSite.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<link rel="icon" type="image/png" href="data:image/png;base64, FAVICON_BASE64" />
<meta name="description" content="PAGE_DESCRIPTION">
<title>PAGE_TITLE</title>
</head>

<body>

<div class="flex m-14">
<div class="mr-5">
<img class="w-48" src="data:image/png;base64, IMAGE_BASE64" alt="logo">
</div>
<div>
<h1 class="text-3xl text-sky-500 mb-5">APP_NAME</h1>
<h3 class="text-xl text-gray-600 mb-8">Version APP_VERSION</h3>
<button class="bg-sky-500 hover:bg-sky-400 transition-colors rounded-md text-white px-8 py-1 mb-3"
onclick="download()">Install</button>
<a href="https://go.microsoft.com/fwlink/?linkid=870616" target="_blank">
<p class="text-sky-500 mb-5">Troubleshoot installation</p>
</a>
<h3 class="text-xl text-gray-600 mb-4">Application Information</h3>

<div class="flex text-gray-500">
<div class="font-bold mr-14">
<div class="mb-4">Version</div>
<div class="mb-4">Required Operating System</div>
<div class="mb-4">Architectures</div>
<div class="mb-4">Publisher</div>
</div>
<div>
<div class="mb-4">APP_VERSION</div>
<div class="mb-4">REQUIRED_OS_VERSION</div>
<div class="mb-4">ARCHITECTURE</div>
<div class="mb-4">PUBLISHER_NAME</div>
</div>
</div>

</div>
</div>

<script>
function download() {
var a = document.createElement("a");
a.href = '/APP_INSTALLER_LINK';
a.setAttribute("download", 'APP_INSTALLER_LINK');
a.click();
}
</script>
</body>

</html>
Binary file not shown.
1 change: 1 addition & 0 deletions lib/assets/testCertificateInstaller/installCertificate.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Import-PfxCertificate -FilePath "test_certificate.pfx" -Password (ConvertTo-SecureString -String "1234" -AsPlainText -Force) -CertStoreLocation Cert:\LocalMachine\Root
Binary file not shown.
109 changes: 74 additions & 35 deletions lib/msix.dart
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import 'package:ansicolor/ansicolor.dart' show ansiColorDisabled;
import 'package:cli_util/cli_logging.dart' show Logger, Ansi;
import 'src/appInstaller.dart';
import 'src/windowsBuild.dart';
import 'src/configuration.dart';
import 'src/assets.dart';
import 'src/makePri.dart';
import 'src/appxManifest.dart';
import 'src/makeAppx.dart';
import 'src/signTool.dart';
import 'src/log.dart';
import 'src/extensions.dart';

/// Execute all the steps to prepare an msix package
/// Handles all the msix package functionality
class Msix {
/// Log instance for all sub classes instances
Log _log = Log();

/// Configuration instance for all sub classes instances
late Logger _logger;
late Configuration _config;

Msix() {
// To enable colored logs
ansiColorDisabled = false;

_config = Configuration(_log);
Msix(List<String> arguments) {
_logger = arguments.contains('-v')
? Logger.verbose()
: Logger.standard(ansi: Ansi(true));
_config = Configuration(arguments, _logger);
}

/// Print if msix is under dependencies instead of dev_dependencies
Expand All @@ -28,40 +27,80 @@ class Msix {
'-----> "MSIX" package needs to be under development dependencies (dev_dependencies) <-----');
}

/// User executes this with optional arguments:
/// flutter pub run msix:create [cliArguments]
Future<void> createMsix(List<String> cliArguments) async {
await _config.getConfigValues(cliArguments);
/// Execute when use 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'\'));
}

/// Execute when use the msix:publish command
Future<void> publish() async {
await _initConfig();
await _config.validateAppInstallerConfigValues();
var appInstaller = AppInstaller(_config, _logger);
await appInstaller.validatePublishVersion();

final _assets = Assets(_config, _log);
final _signTool = SignTool(_config, _log);
await _createMsix();

var loggerProgress = _logger.progress('publish');
await appInstaller.copyMsixToVersionsFolder();
await appInstaller.generateAppInstaller();
await appInstaller.generateAppInstallerWebSite();
loggerProgress.finish(showTiming: true);

_logger.write('appinstaller created: '.green.emphasized);
_logger
.stdout(_config.appInstallerPath.blue.emphasized.replaceAll('/', r'\'));
}

Future<void> _initConfig() async {
await _config.getConfigValues();
await _config.validateConfigValues();
}

Future<void> _createMsix() 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();

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

await _assets.cleanTemporaryFiles(clearMsixFiles: true);
await _assets.createIconsFolder();
await _assets.copyIcons();
await _assets.createIcons();
await _assets.copyVCLibsFiles();
if (!_config.store) {
await _signTool.getCertificatePublisher(false);
await _signTool.getCertificatePublisher();
}
await AppxManifest(_config, _log).generateAppxManifest();
await MakePri(_config, _log).generatePRI();
await MakeAppx(_config, _log).pack();
await AppxManifest(_config, _logger).generateAppxManifest();
await MakePri(_config, _logger).generatePRI();
await MakeAppx(_config, _logger).pack();
await _assets.cleanTemporaryFiles();

// If the package is intended for store publish
// then don't install cert or sign the package
if (!_config.store) {
if (!_config.dontInstallCert) {
await _signTool.installCertificate();
}
if (_config.installCert) await _signTool.installCertificate();
await _signTool.sign();
}

_log.success('Msix Installer Created:');
if (_config.withTestCertificateInstaller) {
await _assets.addTestCertificateInstaller();
}
}

// Print the created msix installer path
_log.link(
'${_config.outputPath ?? _config.buildFilesFolder}\\${_config.outputName ?? _config.appName}.msix'
.replaceAll('/', r'\'));
loggerProgress.finish(showTiming: true);
}
}
Loading

0 comments on commit 4276d14

Please sign in to comment.