Skip to content

Commit

Permalink
fix(bundler): update create-dmg, fixes #1571 (#1729)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed May 6, 2021
1 parent 9c10ccf commit f1aa120
Show file tree
Hide file tree
Showing 17 changed files with 277 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .changes/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"getPublishedVersion": "cargo search ${ pkgFile.pkg.package.name } --limit 1 | sed -nE \"s/^[^\\\"]*\\\"//; s/\\\".*//1p\"",
"prepublish": [
"sudo apt-get update",
"sudo apt-get install -y webkit2gtk-4.0",
"sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0",
"cargo install cargo-audit --features=fix",
{
"command": "cargo generate-lockfile",
Expand Down
5 changes: 5 additions & 0 deletions .changes/dmg-bundle-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---

Pull latest changes from `create-dmg`, fixing unmount issue.
2 changes: 1 addition & 1 deletion .github/workflows/artifacts-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: yarn install for cli
working-directory: tauri/tooling/cli.js
run: yarn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/core-lint-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- uses: actions-rs/toolchain@v1
with:
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- uses: actions-rs/toolchain@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: generate rust docs
working-directory: ./tauri/core/tauri
run: cargo doc --no-deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/smoke-test-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: cache rust bin
id: cache_rust_bin
uses: actions/cache@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: clippy check
uses: actions-rs/clippy-check@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-cta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- run: yarn
working-directory: tooling/create-tauri-app
- run: yarn build
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- run: yarn
working-directory: tooling/create-tauri-app
- run: yarn build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/udeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- uses: actions-rs/cargo@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: install webkit2gtk
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
sudo apt-get install -y libgtk-3-dev libgtksourceview-3.0-dev webkit2gtk-4.0
- name: generate rust docs
working-directory: ./tauri/core/tauri
run: cargo doc --no-deps
Expand Down
17 changes: 4 additions & 13 deletions tooling/bundler/src/bundle/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::Settings;
use std::{
ffi::OsStr,
fs::{self, File},
io::{self, BufRead, BufReader, BufWriter, Write},
io::{self, BufWriter, Write},
path::{Component, Path, PathBuf},
process::{Command, Stdio},
};
Expand Down Expand Up @@ -214,25 +214,16 @@ pub fn print_info(message: &str) -> crate::Result<()> {

pub fn execute_with_verbosity(cmd: &mut Command, settings: &Settings) -> crate::Result<()> {
let stdio_config = if settings.is_verbose() {
Stdio::piped
Stdio::inherit
} else {
Stdio::null
};
let mut child = cmd
let status = cmd
.stdout(stdio_config())
.stderr(stdio_config())
.spawn()
.status()
.expect("failed to spawn command");
if settings.is_verbose() {
let stdout = child.stdout.as_mut().expect("Failed to get stdout handle");
let reader = BufReader::new(stdout);

for line in reader.lines() {
println!("{}", line.expect("Failed to get line"));
}
}

let status = child.wait()?;
if status.success() {
Ok(())
} else {
Expand Down
16 changes: 10 additions & 6 deletions tooling/bundler/src/bundle/macos/dmg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
let dmg_name = format!("{}.dmg", &package_base_name);
let dmg_path = output_path.join(&dmg_name);

let product_name = &format!("{}.app", &package_base_name);
let product_name = &format!("{}.app", settings.main_binary_name());
let bundle_dir = settings.project_out_directory().join("bundle/macos");

let support_directory_path = output_path.join("support");
Expand All @@ -58,7 +58,6 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<

// create paths for script
let bundle_script_path = output_path.join("bundle_dmg.sh");
let license_script_path = support_directory_path.join("dmg-license.py");

common::print_bundling(format!("{:?}", &dmg_path).as_str())?;

Expand All @@ -72,15 +71,14 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
include_str!("templates/dmg/template.applescript"),
)?;
write(
&license_script_path,
include_str!("templates/dmg/dmg-license.py"),
support_directory_path.join("eula-resources-template.xml"),
include_str!("templates/dmg/eula-resources-template.xml"),
)?;

// chmod script for execution
Command::new("chmod")
.arg("777")
.arg(&bundle_script_path)
.arg(&license_script_path)
.current_dir(output_path)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
Expand Down Expand Up @@ -109,9 +107,15 @@ pub fn bundle_project(settings: &Settings, bundles: &[Bundle]) -> crate::Result<
&product_name,
];

#[allow(unused_assignments)]
let mut license_path_ref = "".to_string();
if let Some(license_path) = &settings.macos().license {
args.push("--eula");
args.push(license_path);
license_path_ref = env::current_dir()?
.join(license_path)
.to_string_lossy()
.to_string();
args.push(&license_path_ref);
}

// Issue #592 - Building MacOS dmg files on CI
Expand Down
Loading

0 comments on commit f1aa120

Please sign in to comment.