Skip to content

Commit

Permalink
chore: cleanup and simplify examples (#10743)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Aug 26, 2024
1 parent c508000 commit ad83d41
Show file tree
Hide file tree
Showing 119 changed files with 1,907 additions and 18,696 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[env]
# workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error
# workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error in tests
# see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864
__TAURI_WORKSPACE__ = "true"
6 changes: 6 additions & 0 deletions .changes/tauri-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-build": "patch:feat"
---

Add `WindowsAttributes::new_without_app_manifest` to create `WindowsAttributes` without the default manifest.

106 changes: 36 additions & 70 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,89 +1,55 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# smoke-tests repo
/smoke-tests

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output
# dependency directories
node_modules/

# node-waf configuration
.lock-wscript
# Optional npm and yarn cache directory
.npm/
.yarn/

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Output of 'npm pack'
*.tgz

# Dependency directories
node_modules/
jspm_packages/
# dotenv environment variables file
.env

# Typescript v1 declaration files
typings/
# .vscode workspace settings file
.vscode/settings.json

# Optional npm cache directory
.npm
# npm, yarn and bun lock files
package-lock.json
yarn.lock
bun.lockb

# Optional yarn cache directory
.yarn
# rust compiled folders
target/

# Optional eslint cache
.eslintcache
# test video for streaming example
streaming_example_test_video.mp4

# Optional REPL history
.node_repl_history
# examples /gen directory
/examples/**/gen/

# Output of 'npm pack'
*.tgz
# old cli directories
/tooling/cli.js
/tooling/cli.rs

# Yarn Integrity file
.yarn-integrity
# logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# dotenv environment variables file
.env
# runtime data
pids
*.pid
*.seed
*.pid.lock

# miscellaneous
/.vs
.DS_Store
.Thumbs.db
*.sublime*
.idea
debug.log
package-lock.json
.vscode/settings.json
*/.vscode/
proptest-regressions/
TODO.md

# rust compiled folders
target

# lock for libs
#/Cargo.lock Committed to prevent msrv checks from failing
/tooling/bench/tests/Cargo.lock
/yarn.lock

# ignore frida handlers
__handlers__/

# benches
gh-pages
test_video.mp4

# old cli directories
/tooling/cli.js
/tooling/cli.rs
60 changes: 60 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ members = [
# integration tests
"core/tests/restart",
"core/tests/acl",

# examples
"examples/file-associations/src-tauri",
"examples/api/src-tauri",
]

exclude = [
Expand Down
28 changes: 22 additions & 6 deletions core/tauri-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,14 @@ fn cfg_alias(alias: &str, has_feature: bool) {

/// Attributes used on Windows.
#[allow(dead_code)]
#[derive(Debug, Default)]
#[derive(Debug)]
pub struct WindowsAttributes {
window_icon_path: Option<PathBuf>,
/// A string containing an [application manifest] to be included with the application on Windows.
///
/// Defaults to:
/// ```text
#[doc = include_str!("window-app-manifest.xml")]
#[doc = include_str!("windows-app-manifest.xml")]
/// ```
///
/// ## Warning
Expand All @@ -255,10 +255,28 @@ pub struct WindowsAttributes {
app_manifest: Option<String>,
}

impl Default for WindowsAttributes {
fn default() -> Self {
Self::new()
}
}

impl WindowsAttributes {
/// Creates the default attribute set.
pub fn new() -> Self {
Self::default()
Self {
window_icon_path: Default::default(),
app_manifest: Some(include_str!("windows-app-manifest.xml").into()),
}
}

/// Creates the default attriute set wihtou the default app manifest.
#[must_use]
pub fn new_without_app_manifest() -> Self {
Self {
app_manifest: None,
window_icon_path: Default::default(),
}
}

/// Sets the icon to use on the window. Currently only used on Windows.
Expand All @@ -275,7 +293,7 @@ impl WindowsAttributes {
///
/// Defaults to:
/// ```text
#[doc = include_str!("window-app-manifest.xml")]
#[doc = include_str!("windows-app-manifest.xml")]
/// ```
///
/// ## Warning
Expand Down Expand Up @@ -641,8 +659,6 @@ pub fn try_build(attributes: Attributes) -> Result<()> {

if let Some(manifest) = attributes.windows_attributes.app_manifest {
res.set_manifest(&manifest);
} else {
res.set_manifest(include_str!("window-app-manifest.xml"));
}

if let Some(version_str) = &config.version {
Expand Down
Loading

0 comments on commit ad83d41

Please sign in to comment.