mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-11-28 12:27:16 +03:00
feat(ci): add unused dependencies check (#1168)
This commit is contained in:
parent
3e8abe3764
commit
ba8fb00880
4
.github/workflows/core-lint-fmt.yml
vendored
4
.github/workflows/core-lint-fmt.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
|||||||
- uses: actions-rs/clippy-check@v1
|
- uses: actions-rs/clippy-check@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
args: --all-targets -- -D warnings
|
args: --all-targets --all-features -- -D warnings
|
||||||
name: workspace
|
name: workspace
|
||||||
env:
|
env:
|
||||||
TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
|
TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
|
||||||
@ -48,7 +48,7 @@ jobs:
|
|||||||
- uses: actions-rs/clippy-check@v1
|
- uses: actions-rs/clippy-check@v1
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
args: --manifest-path ./cli/core/Cargo.toml --all-targets -- -D warnings
|
args: --manifest-path ./cli/core/Cargo.toml --all-targets --all-features -- -D warnings
|
||||||
name: cli
|
name: cli
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
78
.github/workflows/udeps.yml
vendored
Normal file
78
.github/workflows/udeps.yml
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
name: Udeps
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/udeps.yml'
|
||||||
|
- 'cli/tauri-bundler/**'
|
||||||
|
- 'cli/core/**'
|
||||||
|
- 'tauri/**'
|
||||||
|
- 'tauri-api/**'
|
||||||
|
- 'tauri-utils/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
udeps:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
|
||||||
|
- name: Cache cargo index
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/git
|
||||||
|
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
|
||||||
|
- name: Cache core cargo target
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ubuntu-latest-nightly-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
|
||||||
|
- name: Cache bundler cargo target
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: cli/tauri-bundler/target
|
||||||
|
key: ubuntu-latest-nightly-cargo-build-bundler-target-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
|
||||||
|
- name: Cache CLI cargo target
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: cli/core/target
|
||||||
|
key: ubuntu-latest-nightly-cargo-build-cli-target-${{ hashFiles('**/Cargo.toml') }}
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: install
|
||||||
|
args: cargo-udeps --locked
|
||||||
|
|
||||||
|
- name: Install required packages
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y webkit2gtk-4.0
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: udeps
|
||||||
|
args: --all-targets --all-features
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: udeps
|
||||||
|
args: --manifest-path ./cli/tauri-bundler/Cargo.toml --all-targets --all-features
|
||||||
|
|
||||||
|
- uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: udeps
|
||||||
|
args: --manifest-path ./cli/core/Cargo.toml --all-targets --all-features
|
87
cli/tauri-bundler/Cargo.lock
generated
87
cli/tauri-bundler/Cargo.lock
generated
@ -190,16 +190,6 @@ version = "1.0.61"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
|
checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfb"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca453e8624711b2f0f4eb47076a318feda166252a827ee25d067b43de83dcba0"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
@ -394,70 +384,6 @@ version = "1.6.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding"
|
|
||||||
version = "0.2.33"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
|
|
||||||
dependencies = [
|
|
||||||
"encoding-index-japanese",
|
|
||||||
"encoding-index-korean",
|
|
||||||
"encoding-index-simpchinese",
|
|
||||||
"encoding-index-singlebyte",
|
|
||||||
"encoding-index-tradchinese",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-japanese"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-korean"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-simpchinese"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-singlebyte"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding-index-tradchinese"
|
|
||||||
version = "1.20141219.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
|
|
||||||
dependencies = [
|
|
||||||
"encoding_index_tests",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "encoding_index_tests"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "failure"
|
name = "failure"
|
||||||
version = "0.1.8"
|
version = "0.1.8"
|
||||||
@ -775,18 +701,6 @@ dependencies = [
|
|||||||
"autocfg 1.0.1",
|
"autocfg 1.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "msi"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a560d1c6b878d43f61c4c4cd252a75bff207347ecc959d89a71d3ec1c517dfe2"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
"cfb",
|
|
||||||
"encoding",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "native-tls"
|
name = "native-tls"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
@ -1507,7 +1421,6 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libflate",
|
"libflate",
|
||||||
"md5",
|
"md5",
|
||||||
"msi",
|
|
||||||
"regex",
|
"regex",
|
||||||
"runas",
|
"runas",
|
||||||
"serde 1.0.117",
|
"serde 1.0.117",
|
||||||
|
@ -26,7 +26,6 @@ icns = "0.3"
|
|||||||
image = "0.23.12"
|
image = "0.23.12"
|
||||||
libflate = "1.0"
|
libflate = "1.0"
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
msi = "0.3"
|
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
@ -36,7 +35,6 @@ tar = "0.4"
|
|||||||
target_build_utils = "0.3"
|
target_build_utils = "0.3"
|
||||||
termcolor = "1.1.2"
|
termcolor = "1.1.2"
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
uuid = { version = "0.8", features = [ "v5" ] }
|
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
lazy_static = { version = "1.4" }
|
lazy_static = { version = "1.4" }
|
||||||
handlebars = { version = "3.5" }
|
handlebars = { version = "3.5" }
|
||||||
@ -45,6 +43,7 @@ handlebars = { version = "3.5" }
|
|||||||
attohttpc = { version = "0.16.1" }
|
attohttpc = { version = "0.16.1" }
|
||||||
regex = { version = "1" }
|
regex = { version = "1" }
|
||||||
runas = "0.2"
|
runas = "0.2"
|
||||||
|
uuid = { version = "0.8", features = [ "v5" ] }
|
||||||
|
|
||||||
[target."cfg(not(target_os = \"linux\"))".dependencies]
|
[target."cfg(not(target_os = \"linux\"))".dependencies]
|
||||||
zip = { version = "0.5" }
|
zip = { version = "0.5" }
|
||||||
|
@ -85,7 +85,7 @@ mod test {
|
|||||||
#[quickcheck]
|
#[quickcheck]
|
||||||
fn qc_formating(f: String, a: String) -> bool {
|
fn qc_formating(f: String, a: String) -> bool {
|
||||||
// can not accept empty strings
|
// can not accept empty strings
|
||||||
if f != "" && a != "" {
|
if !f.is_empty() && !a.is_empty() {
|
||||||
// call format callback
|
// call format callback
|
||||||
let fc = format_callback(f.clone(), a.clone());
|
let fc = format_callback(f.clone(), a.clone());
|
||||||
fc.contains(&format!(
|
fc.contains(&format!(
|
||||||
|
@ -31,7 +31,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.split('|')
|
.split('|')
|
||||||
.map(|s| s.to_string())
|
.map(|s| s.to_string())
|
||||||
.filter(|s| s != "")
|
.filter(|s| !s.is_empty())
|
||||||
.collect(),
|
.collect(),
|
||||||
None => Vec::new(),
|
None => Vec::new(),
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
#[allow(unused_imports)]
|
use std::path::Path;
|
||||||
use std::{
|
|
||||||
env,
|
|
||||||
fs::{self, read_to_string},
|
|
||||||
path::Path,
|
|
||||||
process::Stdio,
|
|
||||||
thread::spawn,
|
|
||||||
};
|
|
||||||
|
|
||||||
use webview_official::{SizeHint, Webview, WebviewBuilder};
|
use webview_official::{SizeHint, Webview, WebviewBuilder};
|
||||||
|
|
||||||
@ -55,11 +48,11 @@ pub(crate) fn run(application: &mut App) -> crate::Result<()> {
|
|||||||
|
|
||||||
// spawn the embedded server on our server url
|
// spawn the embedded server on our server url
|
||||||
#[cfg(embedded_server)]
|
#[cfg(embedded_server)]
|
||||||
spawn_server(server_url)?;
|
spawn_server(server_url);
|
||||||
|
|
||||||
// spin up the updater process
|
// spin up the updater process
|
||||||
#[cfg(feature = "updater")]
|
#[cfg(feature = "updater")]
|
||||||
spawn_updater()?;
|
spawn_updater();
|
||||||
|
|
||||||
// run the webview
|
// run the webview
|
||||||
webview.run();
|
webview.run();
|
||||||
@ -67,6 +60,11 @@ pub(crate) fn run(application: &mut App) -> crate::Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(all(embedded_server, no_server))]
|
||||||
|
fn setup_content() -> crate::Result<Content<String>> {
|
||||||
|
panic!("only one of `embedded-server` and `no-server` is allowed")
|
||||||
|
}
|
||||||
|
|
||||||
// setup content for dev-server
|
// setup content for dev-server
|
||||||
#[cfg(dev)]
|
#[cfg(dev)]
|
||||||
fn setup_content() -> crate::Result<Content<String>> {
|
fn setup_content() -> crate::Result<Content<String>> {
|
||||||
@ -107,13 +105,13 @@ fn setup_content() -> crate::Result<Content<String>> {
|
|||||||
}
|
}
|
||||||
Ok(Content::Html(format!(
|
Ok(Content::Html(format!(
|
||||||
"data:text/html,{}",
|
"data:text/html,{}",
|
||||||
urlencoding::encode(&read_to_string(dev_path)?)
|
urlencoding::encode(&std::fs::read_to_string(dev_path)?)
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup content for embedded server
|
// setup content for embedded server
|
||||||
#[cfg(embedded_server)]
|
#[cfg(all(embedded_server, not(no_server)))]
|
||||||
fn setup_content() -> crate::Result<Content<String>> {
|
fn setup_content() -> crate::Result<Content<String>> {
|
||||||
let (port, valid) = setup_port()?;
|
let (port, valid) = setup_port()?;
|
||||||
let url = (if valid {
|
let url = (if valid {
|
||||||
@ -127,7 +125,7 @@ fn setup_content() -> crate::Result<Content<String>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setup content for no-server
|
// setup content for no-server
|
||||||
#[cfg(no_server)]
|
#[cfg(all(no_server, not(embedded_server)))]
|
||||||
fn setup_content() -> crate::Result<Content<String>> {
|
fn setup_content() -> crate::Result<Content<String>> {
|
||||||
let html = include_str!(concat!(env!("OUT_DIR"), "/index.tauri.html"));
|
let html = include_str!(concat!(env!("OUT_DIR"), "/index.tauri.html"));
|
||||||
Ok(Content::Html(format!(
|
Ok(Content::Html(format!(
|
||||||
@ -138,6 +136,7 @@ fn setup_content() -> crate::Result<Content<String>> {
|
|||||||
|
|
||||||
// get the port for the embedded server
|
// get the port for the embedded server
|
||||||
#[cfg(embedded_server)]
|
#[cfg(embedded_server)]
|
||||||
|
#[allow(dead_code)]
|
||||||
fn setup_port() -> crate::Result<(String, bool)> {
|
fn setup_port() -> crate::Result<(String, bool)> {
|
||||||
let config = get()?;
|
let config = get()?;
|
||||||
match config.tauri.embedded_server.port {
|
match config.tauri.embedded_server.port {
|
||||||
@ -154,6 +153,7 @@ fn setup_port() -> crate::Result<(String, bool)> {
|
|||||||
|
|
||||||
// setup the server url for embedded server
|
// setup the server url for embedded server
|
||||||
#[cfg(embedded_server)]
|
#[cfg(embedded_server)]
|
||||||
|
#[allow(dead_code)]
|
||||||
fn setup_server_url(port: String) -> crate::Result<String> {
|
fn setup_server_url(port: String) -> crate::Result<String> {
|
||||||
let config = get()?;
|
let config = get()?;
|
||||||
let mut url = format!("{}:{}", config.tauri.embedded_server.host, port);
|
let mut url = format!("{}:{}", config.tauri.embedded_server.host, port);
|
||||||
@ -165,8 +165,8 @@ fn setup_server_url(port: String) -> crate::Result<String> {
|
|||||||
|
|
||||||
// spawn the embedded server
|
// spawn the embedded server
|
||||||
#[cfg(embedded_server)]
|
#[cfg(embedded_server)]
|
||||||
fn spawn_server(server_url: String) -> crate::Result<()> {
|
fn spawn_server(server_url: String) {
|
||||||
spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let server = tiny_http::Server::http(server_url.replace("http://", "").replace("https://", ""))
|
let server = tiny_http::Server::http(server_url.replace("http://", "").replace("https://", ""))
|
||||||
.expect("Unable to spawn server");
|
.expect("Unable to spawn server");
|
||||||
for request in server.incoming_requests() {
|
for request in server.incoming_requests() {
|
||||||
@ -180,18 +180,19 @@ fn spawn_server(server_url: String) -> crate::Result<()> {
|
|||||||
.expect("unable to setup response");
|
.expect("unable to setup response");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// spawn an updater process.
|
// spawn an updater process.
|
||||||
#[cfg(feature = "updater")]
|
#[cfg(feature = "updater")]
|
||||||
fn spawn_updater() -> crate::Result<()> {
|
fn spawn_updater() {
|
||||||
spawn(|| {
|
std::thread::spawn(|| {
|
||||||
tauri_api::command::spawn_relative_command("updater".to_string(), Vec::new(), Stdio::inherit())
|
tauri_api::command::spawn_relative_command(
|
||||||
.expect("Unable to spawn relative command");
|
"updater".to_string(),
|
||||||
|
Vec::new(),
|
||||||
|
std::process::Stdio::inherit(),
|
||||||
|
)
|
||||||
|
.expect("Unable to spawn relative command");
|
||||||
});
|
});
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() -> String {
|
pub fn init() -> String {
|
||||||
@ -295,7 +296,7 @@ fn build_webview(
|
|||||||
if has_splashscreen {
|
if has_splashscreen {
|
||||||
let env_var = envmnt::get_or("TAURI_DIR", "../dist");
|
let env_var = envmnt::get_or("TAURI_DIR", "../dist");
|
||||||
let path = Path::new(&env_var);
|
let path = Path::new(&env_var);
|
||||||
let contents = fs::read_to_string(path.join("/tauri.js"))?;
|
let contents = std::fs::read_to_string(path.join("/tauri.js"))?;
|
||||||
// inject the tauri.js entry point
|
// inject the tauri.js entry point
|
||||||
webview.dispatch(move |_webview| _webview.eval(&contents));
|
webview.dispatch(move |_webview| _webview.eval(&contents));
|
||||||
}
|
}
|
||||||
@ -357,7 +358,7 @@ fn build_webview(
|
|||||||
})
|
})
|
||||||
.map_err(|e| e.replace("'", "\\'"));
|
.map_err(|e| e.replace("'", "\\'"));
|
||||||
if let Err(handler_error_message) = endpoint_handle {
|
if let Err(handler_error_message) = endpoint_handle {
|
||||||
if handler_error_message != "" {
|
if !handler_error_message.is_empty() {
|
||||||
w.eval(&get_api_error_message(&arg, handler_error_message));
|
w.eval(&get_api_error_message(&arg, handler_error_message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,9 +392,6 @@ mod test {
|
|||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
#[cfg(not(feature = "embedded-server"))]
|
|
||||||
use std::{fs::read_to_string, path::Path};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn check_setup_content() {
|
fn check_setup_content() {
|
||||||
let tauri_dir = match option_env!("TAURI_DIR") {
|
let tauri_dir = match option_env!("TAURI_DIR") {
|
||||||
@ -409,7 +407,7 @@ mod test {
|
|||||||
|
|
||||||
#[cfg(embedded_server)]
|
#[cfg(embedded_server)]
|
||||||
match res {
|
match res {
|
||||||
Ok(Content::Url(u)) => assert!(u.contains("http://")),
|
Ok(Content::Url(ref u)) => assert!(u.contains("http://")),
|
||||||
_ => panic!("setup content failed"),
|
_ => panic!("setup content failed"),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +427,8 @@ mod test {
|
|||||||
format!(
|
format!(
|
||||||
"data:text/html,{}",
|
"data:text/html,{}",
|
||||||
urlencoding::encode(
|
urlencoding::encode(
|
||||||
&read_to_string(Path::new(&dist_dir).join("index.tauri.html")).unwrap()
|
&std::fs::read_to_string(std::path::Path::new(&dist_dir).join("index.tauri.html"))
|
||||||
|
.unwrap()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -444,12 +443,14 @@ mod test {
|
|||||||
Ok(Content::Url(dp)) => assert_eq!(dp, config.build.dev_path),
|
Ok(Content::Url(dp)) => assert_eq!(dp, config.build.dev_path),
|
||||||
Ok(Content::Html(s)) => {
|
Ok(Content::Html(s)) => {
|
||||||
let dev_dir = &config.build.dev_path;
|
let dev_dir = &config.build.dev_path;
|
||||||
let dev_path = Path::new(dev_dir).join("index.tauri.html");
|
let dev_path = std::path::Path::new(dev_dir).join("index.tauri.html");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
s,
|
s,
|
||||||
format!(
|
format!(
|
||||||
"data:text/html,{}",
|
"data:text/html,{}",
|
||||||
urlencoding::encode(&read_to_string(dev_path).expect("failed to read dev path"))
|
urlencoding::encode(
|
||||||
|
&std::fs::read_to_string(dev_path).expect("failed to read dev path")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user