Commit Graph
480 Commits
Author SHA1 Message Date
Moritz Hedtke cd920d2b6b Pass android linker to cargo (#4332) 2025-06-30 17:41:19 -07:00
Evan AlmloffandJonathan Kelley 2071be2b67 Fix hotpatched assets (#4326)
* wip: fixes to get docsite working again

* Fix asset location with PIC in hot patched builds

* Add an hidden cli flag to exit early in hot patch tests on failure

* add a test for hot patching with assets

* fix clippy

* fix looks_like_manganis_symbol

* longer timeout for hot patching in CI

* log page content

* log assets

* Log asset after write

* record a playwright trace

* Explicitly enable cargo incremental for hot patching

* fix retry for patch test

* reset asset

* disable hot patching test for new exports

* add nightly playwright

* use different toolchain names

* use beta instead of nightly for less thrashing

* add failing test

* workaround hot reloading bug

* restore swapping asset tests

* add toolchain

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-06-30 16:23:04 -07:00
6cc379718b Don't use inline scripts and function constructor (#4310)
* Don't use inline scripts and function constructor.

This allows a stricter Content-Security-Policy which is required for web extensions.

* Load module scripts asynchronously

* Extract common code into method

* Fix injecting loading script

* Append to the file instead of reading and appending to the file string

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2025-06-26 12:08:02 -05:00
Jonathan Kelley dcf46ce81a fix "multiple" attribute (#4323)
* fix "multiple" attribute

* change timeout in spin future
2025-06-25 13:13:08 -07:00
Jonathan Kelley dd53ce72a7 add --offline, --locked, remove dioxus branding if dioxus is not being used explicitly (#4155)
* wip: add some spin logging

* wipe dioxus branding if not being used by dioxus

* add --locked, --offline, --frozen

* properly git init with `dx new` and `dx init`

* dont panic in verbosity

* Move build-assets to "tools"

* change ui for dx new offline

* pin tauri-bundle

* pin tauri

* run tailwind once
2025-06-24 18:21:25 -07:00
FontlosandJonathan Kelley bfb0642a1d fix(cli, breaking): Align Android applicationId with user's bundle.identifier (#4103)
* fix(cli, breaking): Align Android applicationId with user's `bundle.identifier`

This commit fixes the Android `applicationId` generation to accurately reflect the user-configured `bundle.identifier` when provided. It also refactors the logic by removing the `full_mobile_app_name` function, with `bundle_identifier` now being the direct source for the Android `applicationId`.

The `bundle_identifier` function now operates as follows:
1. If `bundle.identifier` is explicitly set by the user:
    - It validates that the identifier has at least three segments (e.g., `com.example.app`).
    - The user's `identifier` is then returned and used directly as the Android `applicationId`.
2. If `config.bundle.identifier` is not set by the user:
    - It defaults to `com.example.{PascalCaseExecutableName}`. The `executable_name` (e.g., "my-app" derived from a project name like "MyApp") is converted to `PascalCase` (e.g., "MyApp") for this default.

**BREAKING CHANGE**:

This change primarily affects Android builds and may alter the final `applicationId` for users who had a custom `bundle.identifier` set, particularly if its casing or final segment differed from the PascalCased `executable_name`.

- **Previous Behavior**:

    The Android `applicationId` was derived from `full_mobile_app_name`. This function effectively used the first two segments of the `bundle_identifier` (user-configured or default) but then **always** appended a PascalCased version of the `executable_name` as the final segment.

    Example Scenario:
    - User project name: "MyApp" (CLI set `executable_name` to "my-app")
    - User configured `bundle.identifier` in Dioxus config: `"com.custom.myapp"`
    - `bundled_app_name()` (from "my-app"): "MyApp"
    - Old `applicationId` (via `full_mobile_app_name`): `"com.custom.MyApp"`

- **New Behavior**:

    With the same user configuration (`"com.custom.myapp"`), the `applicationId` will now be: `"com.custom.myapp"`

This change ensures the `applicationId` respects the user's explicit `bundle.identifier` string. However, if users were unknowingly relying on the previous behavior where the last segment was always a PascalCased version of the `executable_name` (potentially mismatching their intended lowercase final segment in `bundle.identifier`), their `applicationId` will change upon updating the CLI.

According to Google's Android documentation, the `applicationId` must not be changed after an app is published, as this causes Google Play to treat it as a new application. Users who have published Android apps and utilized custom `bundle.identifier` configurations should meticulously verify their `applicationId` after this update to ensure it remains consistent with their published versions or to take appropriate action if a change is detected.

* fix: relax validation for bundle.identifier

1. Contains at least one dot ('.').
2. Does not start with a dot.
3. Does not end with a dot.
4. Does not contain consecutive dots ('..').

e.g., `com.example` or `com.example.app`

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-06-24 12:52:10 -07:00
Jonathan Kelley fd1b04eba1 use dx run for playwright tests, properly abort if error occurs, don't ddos github releases, split apt-cache by os/target in matrix (#4315)
* properly emit errors

* fix error propagate

* install glib

* fix playwright for dx run ssg

* add execute install scripts (for arm linux)

* use verbose playwright

* wip: unwrap playwright download error

* use alternative wasm-opt install

* log wasm-opt download

* use hardcoded endpoint for wasm-opt download

* disambiguate cache

* clean up impl
2025-06-23 21:30:41 -07:00
HéctorandJonathan Kelley e477e0b485 Avoid fingerprint busting during builds (#4244)
* Avoid fingerprint busting during builds

* delete `.fingerprint/package-hash` instead of modifying source code

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-06-23 20:05:56 -07:00
Moritz HedtkeandJonathan Kelley f40f7a5aeb Add better error handling for wasm-opt and prevent file truncation on error (#4313)
* Add better error handling for wasm-opt and prevent file truncation on error

* clippy

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-06-23 17:20:25 -07:00
Evan Almloff fdd77d79c1 Restore SSG serve logic (#4111)
* Build ssg routes when both the client and server builds are finished

* Fix default server fn encoding

* fix tokio console

* fix ssg

* add prerendering message

* render under the same environment variables as normal

* fix check

* use should_bundle_to_asset

* enable ssg playwright test

* fix clippy
2025-06-23 13:35:46 -07:00
Jonathan Kelley 09d8e3aef2 tell user about basepath (#4298) 2025-06-19 21:32:15 -07:00
Evan Almloff 10a63d07e2 Fix base path (#4276)
* fix base path

* remove log

* fix clippy
2025-06-19 21:24:26 -07:00
Jonathan Kelley ec80e6bd37 switch to ignore::walk for fmt/check 2025-06-19 21:07:07 -07:00
Jonathan Kelley 8d5a3a09da properly respect rustflags, fix x86-sim issue (#4295)
* properly respect rustflags

* typo

* drop `-sim`
2025-06-19 14:42:33 -07:00
Evan AlmloffandJonathan Kelley 7d2a3aa751 Use different release profiles for desktop and server builds, adhoc profiles (#3693)
* Use different release profiles for desktop and server builds

* fix clippy

* change the global cargo config instead of the local one

* fix merge

* fix release profile logic

* use adhoc profile generation

* fix compilation of dioxus-lib in fullstack

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-06-18 17:58:39 -07:00
Juan VásquezandJonathan Kelley 1d3168dc4a Allows desktop apps to open mailto links (#4282)
* Allows desktop apps to open mailto links

* Drop webbrowser, use `open` only

* switch to that_detached

* use workspace `open`

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-06-18 16:14:54 -07:00
Evan Almloff 3bf8f09c65 Fix --args and handle merging in @server and @client (#4212)
* Pass args after -- to the executable during run and serve

* fix clippy

* switch to accepting a string argument for subcommand compatibility

* Handle merging with `@server` and `@client`

* fix clippy

* fix formatting

* always build into the client package

* fix clippy

* more clippy fixes
2025-06-17 18:17:06 -07:00
Evan Almloff 693f5c61b9 Always download wasm opt from the binary (#4247)
* always download wasm opt from the binary

* clean up and pass clippy

* fix playwright commands

* don't cache dx target folder
2025-06-04 08:43:58 -05:00
Jonathan Kelley 39ed3b7122 pass thru ld-path 2025-06-03 16:51:36 +02:00
Jonathan Kelley dc8e98e8c4 remove unneeded dx_link env var 2025-06-03 16:44:20 +02:00
Jonathan Kelley 2ee54e507b white-list .rcgu.o files in the linking phase, otherwise dump them into the normal linking pile (#4246)
* white-list .rcgu.o files in the linking phase, otherwise dump them into the normal linking pile

* simplify a bit

* remove noisy trace

* remove wrong comment
2025-06-03 16:40:28 +02:00
Evan Almloff ae64d9534c Allow changing the base path from a cli arg (#4242)
* add a base-path argument to the CLI

* use the merged base path everywhere
2025-06-02 16:07:33 -05:00
Evan AlmloffandJonathan Kelley 58669f892d Move asset hashing into the CLI (#3988)
* Fix deduping assets

* hash assets in the linker

* fix extracting assets

* Fix the hashed asset name

* deserialize the asset back from the link section

* prevent the read from being inlined

* remove some extra logs

* Fix liveview routing

* Only look for direct dependencies on dioxus features

* fix wasm split test

* On wasm, create a new object file with the asset information

* Fix multiple assets

* add a regression test for 3467

* fix image link

* fix linker out file

* fix linux linker args

* add windows linker command

* fix linux link args

* fix windows target triple

* Expose an option to build assets in the linker intercept

* Fix the standalone optimizer and document it in the dx help command

* include the cli opt version in the hash

* fix clippy

* fix ssg port

* add a safety note to the read_volatile call

* move found assets log

* fix some merge conflicts

* fix build

* make most env var for the linker optional

* guess the target triple when dx acts as the linker intercept

* automatically find the linker for normal builds

* use the right linker in wasm mode

* fix mac linker

* look inside archive files (rlibs)

* remove out.txt

* fix clippy

* fix typo

* fix clippy

* fix build

* fix dx link name in docs

* ignore libcompiler_builtins warnings

* fix playwright

* pass typocheck

* fix printing sysroot

* Modify final binary

* fix wasm assets

* remove old link section logic

* fix tests

* forward manganis export args

* fail to evaluate relocatable address

* retain all exports in the same pattern as other platforms

* Fix adding assets during a wasm hot patch

* less nesting and remove logs

* fix clippy

* log pdb files

* read from pdb

* print data section contents

* print with object

* normal windows builds working

* fix hot patch windows

* clean up logs

* fix clippy

* clean up assets

* use the most recent pdb

* fix doc test

* fix typo

* tiny nits

* make bundled a reference instead of a pointer

* add helpful comment to impl

* match on file format

* Fix asset hashing comment

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-05-31 21:45:12 +02:00
Jonathan Kelley e1bd06bda5 unset CARGO_MANIFEST_DIR, don't set it to empty string (#4225)
* tie rust backtrace to verbosity to tracing

* dont panic
2025-05-30 22:22:43 +02:00
Evan Almloff 18d8e6a534 Fix dx bundle and release web builds (#4211)
* remove fullstack flag

* fix release web builds
2025-05-30 19:43:26 +02:00
laund 937e9b9789 subsecond/cli: fix linker and passing through -fuse-ld properly (#4222)
* subsecond/cli: fix passing through -fuse-ld for LinkerFlavour::Gnu

* if linker isn't a relative, local path, keep it unresolved since its a command on PATH
2025-05-30 13:06:57 +02:00
Evan Almloff ee3b45af49 Restore docs CI checks and fix all doc lints (#4204) 2025-05-26 19:50:51 +01:00
Jonathan Kelley 9027ffc278 attempt to fix playwright (#4198)
* disable precompress by default

* go back to nuking wasm dir in some cases

* enable more wasm-opt flags, use stable

* add better logging for wasm-opt failure
2025-05-25 18:51:40 +01:00
Jonathan Kelley 22e0682f10 fix hot-reload watcher for client/server (#4200)
* use `@` syntax

* watch the server

* fmt
2025-05-25 17:42:12 +01:00
Jonathan Kelley bb0621fa1b use vcs when dx new (#4199) 2025-05-25 17:25:32 +01:00
Falk Woldmann 3c3256ec02 refactor: remove once_cell dependency and use std::sync equivalents (#4185) 2025-05-25 16:09:56 +01:00
Jonathan Kelley 1d954c2f6f fix: only patch pid and require rebuilds (#4197) 2025-05-25 14:45:53 +01:00
Jonathan Kelley b2bd1f48d4 debugger support for dx (#3814)
* add vscode debugger for apps

* todo: need to disconnect when rebuilding

* update debugger

* add uri handler to remote launch the debugger

* attach

* dont panic

* fixed it - hung processes are not errors

* wip: android debugger

* clean it up a bit

* revert ios stdout/stderr

* wire up pid from ios

* use target family instead of target_arch

* fix android

* bring back softkill

* typo
2025-05-24 23:31:42 +01:00
Jonathan Kelley 0982c1ff8b feat: copy frameworks to Frameworks folder, detect linkers, custom target dirs (#4174)
* feat: copy frameworks to Frameworks folder

* add dylib linking to patching

* remove logging

* rename __aslr_offset

* fix android/linux

* support linker flavor

* support custom target dirs

* custom cargo target dir support

* whoops ios

* dlsym doesn't exist on windows

* look for the right main symbol per platform

* distinction between mains

* export main on windows

* enbable rlib caching

* add dx hash

* adjust linking warnings

* update tui with hotreload state

* implement symbol flags

* add flags

* only run ranlib on darwin

* enable lld

* paths

* add harness test for tls

* wip: revert launch mobile

* wip

* fix fullstack mobile

* fix a few bugs
- long paths?
- reverting back to original

* pass-thru fuse-ld args

* fix nan in render, fix empty archives

* consider existing dep files if archive exists

* fmt

* drop msrv
2025-05-24 22:41:30 +01:00
Jonathan Kelley 751f1920c3 fix rust 1.87 with wasm-opt bulk-memory, allow configuring wasm-opt flags (#4187)
* add handling for bulk features for rust 1.87

* bump nightly

* rollback changes to toolchain
2025-05-24 15:58:27 +01:00
Fontlos ad8c869ba2 fix(cli): filter out .lib files when targeting Android (#4130)
When building for Android, the linker may incorrectly pick up Windows-specific
.lib files (e.g., from embed-resource) even with proper #[cfg] guards in build.rs.
This explicitly filters out .lib files from linker arguments when the target
environment is Android to prevent linkage failures.
2025-05-23 12:39:19 +01:00
Jonathan Kelley d435f0084e fix: use the rustc env for linking too, hopefully fixing windows (#4172) 2025-05-22 12:33:17 +01:00
Daniel GallupsandJonathan Kelley 8216e4f177 fix: symbol mismatch in object file (#4171)
* fix: symbol kind in obj

* actually patch TLS

* update docs and cleanup size impl for tls

* remove debug logs

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-05-22 12:33:08 +01:00
Jonathan Kelley e719f9c7c4 fix: use system ranlib (#4163) 2025-05-22 11:10:31 +01:00
Jonathan Kelley 021c877361 fix windows subsecond, add DX_LINKER and DX_HOST_LINKER env var overrides (#4164)
* fix: subsecond on windows

an off-by-one error and improper escaping for response files was causing windows to fail

this fixes that

* add linker selection
2025-05-21 15:43:39 +01:00
Fontlos 78e65f240c fix(cli): prevent linker argument overflow on Windows (#4126) 2025-05-20 11:40:05 +02:00
Jonathan Kelley bd3b2da7a4 fixes the ADRP violation bugs by treating TLS as Text (#4152)
This is because Rust generates accessors but marks them as TLS. This might not be a 100% portable fix across all code, but the dissasembly seems to hold.
2025-05-20 10:59:24 +02:00
Jonathan Kelley b610ab372c fix: use diagnostic instead of compilermessage giving rendered ansi logs during hotpatch (#4123)
* fix: use diagnostic instead of compilermessage giving rendered ansi logs during hotpatch

* no need for builder
2025-05-19 17:10:11 +02:00
VipWW 0a18c12c32 fix: fixed wasm and js paths in release mode (#4140) 2025-05-19 15:54:48 +02:00
Leon WimbesandJonathan Kelley 18477a0373 Fix is_release_profile Logic (#4091)
* fix `is_release_profile` logic

* fix: don't merge wasm-split modules with asset system, don't compress randomly

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-05-15 19:18:36 +02:00
Jonathan Kelley 06aaf15d83 fix: use response files (@args) on windows (#4121)
* fix: use use response files on windows

* response files are based on host arch, not target
2025-05-15 18:58:21 +02:00
Jonathan Kelley 6b8919b37b fix stdin handling for the tw watcher (#4119) 2025-05-15 14:16:59 +02:00
Jonathan Kelley 48e925f9af fix: don't use offline in cargo-metadata 2025-05-15 13:11:22 +02:00
Jonathan Kelley 1b9a33ef97 fix: null stdin breaks tailwind 2025-05-14 10:49:51 +02:00
Jonathan Kelley 4d3d55a7a3 CLI self-updater, warn on version mismatch, direct install.sh option, androidmanifest and info.plist customization, bump to 0.7-alpha.0 (#4095)
* wip.... bun installer

* - warn on incompatible versions
- clean up some logs
- add coloring to log levels

* add toasts to desktop/mobile

* Auto open simulators

* auto boot android

* preserve url

* pull out some of the warnings

* add self-updater

* wip: mcp

* add install.sh and adjust binstall path

* add some cuter styling to logs!

* update "input.css"

* update other input.css

* style a bit more

* change getting started

* add windows installer

* move dioxus-mobile into dioxus-desktop
add sentry wip to cli

* shorten timeout of toast

* fix cli display

* wire up customization of android manifest

* udid is a real word

* add 429 to lychee cache

* accept all 200-204 and 429
2025-05-14 08:43:11 +02:00