Commit graph

5 commits

Author SHA1 Message Date
Miheichev Aleksandr Sergeevich
62b17203a5 Tighten platform annotations and finalize SQLite native sync
This commit refines the platform-aware bits of the .NET 10 dependency
modernization stack added earlier in this PR. It introduces no new
NuGet packages and does not change any pinned versions: dotnet list
package --outdated against v2rayN.sln returns only the eight Avalonia
12.x packages, all of which are explicitly out of scope for this PR.

ServiceLib/Common/Utils.cs:
- Annotate IsLinux() with [SupportedOSPlatformGuard("linux")] and
  IsMacOS() with [SupportedOSPlatformGuard("macos")] so the analyzer
  can narrow the platform context inside Linux/macOS guards in the same
  way it already does for Utils.IsWindows().
- Rewrite GetSystemHosts() as a cross-platform helper. Previously it
  unconditionally tried to read C:\Windows\System32\drivers\etc\{hosts,
  hosts.ics}, which silently returned an empty dictionary on
  Linux/macOS. The new implementation reads /etc/hosts on those
  platforms, fixing UseSystemHosts=true being a silent no-op outside
  Windows. Behavior on Windows is unchanged (still merges hosts and
  hosts.ics).

ServiceLib/Handler/AutoStartupHandler.cs:
- Mark the Linux helpers (ClearTaskLinux, SetTaskLinux,
  GetHomePathLinux) with [SupportedOSPlatform("linux")] and the macOS
  helpers (ClearTaskOSX, SetTaskOSX, GetLaunchAgentPathMacOS,
  GenerateLaunchAgentPlist) with [SupportedOSPlatform("macos")] for
  symmetry with the Windows helpers in the same file. The dispatch in
  UpdateTask is already gated by Utils.IsWindows / IsLinux / IsMacOS,
  whose new SupportedOSPlatformGuard attributes make these annotations
  enforceable by the analyzer.

ServiceLib/Handler/SysProxy/ProxySettingLinux.cs and
ServiceLib/Handler/SysProxy/ProxySettingOSX.cs:
- Mark the classes with [SupportedOSPlatform("linux")] and
  [SupportedOSPlatform("macos")] respectively. Both are reachable only
  through SysProxyHandler.UpdateSysProxy under the corresponding
  platform guard.

ServiceLib/Manager/AppManager.cs:
- Call SQLitePCL.Batteries_V2.Init() at the top of InitApp() in
  addition to the existing call in SQLiteHelper's static constructor.
  The call is idempotent, so it cooperates with that static
  constructor; the duplication is intentional defense-in-depth so that
  any future code path which reaches the database without going through
  SQLiteHelper (background services, tests, future utilities) will
  still find an initialized native provider rather than throwing
  "Library not initialized" at runtime.

ServiceLib/Manager/CoreManager.cs:
- Add a clarifying comment above the existing
  [SupportedOSPlatform("windows")] field-level attribute on
  _processJob, explaining that the attribute narrows the analyzer's
  platform context for every read/assign of the field and that runtime
  safety is preserved by the IsWindows() guard inside AddProcessJob. No
  code change.

package-rhel-riscv.sh:
- Promote the previously hard-coded SQLite amalgamation version
  (sqlite_year / sqlite_ver) inside build_sqlite_native_riscv64 to two
  env-overridable variables (SQLITE_AMALGAMATION_YEAR and
  SQLITE_AMALGAMATION_VER) declared at the top of the script next to
  SKIA_VER and HARFBUZZ_VER.
- Set the defaults to 2025 / 3500400, which corresponds to SQLite
  3.50.4 and matches SourceGear.sqlite3 3.50.4.5 used on the other
  RIDs (x64/arm64/macOS). Previously the script downloaded SQLite
  3.53.0 amalgamation on RISC-V, which left RISC-V users on a
  different SQLite minor version than every other platform shipped
  from this repository. The accompanying comment block documents the
  mapping rule between SourceGear.sqlite3 X.Y.Z.W and the
  SQLITE_AMALGAMATION_* values, so the next bump can be done in two
  coordinated places (this script and Directory.Packages.props)
  without drift. The version can still be overridden per-build via
  environment variables for ad-hoc testing on RISC-V.

Verification
------------
- dotnet restore + dotnet build v2rayN.sln -c Release: 0 errors,
  1 warning (CS8625 in GlobalHotKeys submodule, pre-existing,
  out-of-scope of this PR).
- dotnet test ServiceLib.Tests: 41/41 passed.
- dotnet publish v2rayN.Desktop.csproj for linux-x64 and osx-x64,
  and v2rayN.csproj for win-x64: all succeed with no new warnings.
- dotnet list package --outdated against v2rayN.sln: only the eight
  Avalonia 12.x packages appear; none are eligible while this PR
  stays on the Avalonia 11.x branch.
2026-05-03 01:28:51 +03:00
Miheichev Aleksandr Sergeevich
3b39da124c Modernize .NET 10 dependency stack
Replace ReactiveUI.Fody with ReactiveUI.SourceGenerators, migrate reactive properties, and remove Fody weaver configuration.

Move SQLite from SQLitePCLRaw.bundle_green to SQLitePCLRaw 3.x using config.e_sqlite3 and SourceGear.sqlite3 with explicit initialization.

Update related package versions, set invariant xUnit culture, and refresh RHEL RISC-V packaging versions.
2026-05-03 01:25:37 +03:00
DHR60
aba0e9c222 Update dotnet to 10 2026-05-03 01:25:37 +03:00
JieXu
452478434c
Fix & Update (#9126)
Some checks are pending
release Linux / build (push) Waiting to run
release Linux / release-zip (push) Blocked by required conditions
release Linux / build and release deb x64 & arm64 (push) Waiting to run
release Linux / build and release rpm x64 & arm64 (push) Waiting to run
release Linux / build and release rpm riscv64 (push) Waiting to run
release macOS / build (push) Waiting to run
release macOS / release-zip (push) Blocked by required conditions
release macOS / package and release macOS dmg (push) Blocked by required conditions
release Windows desktop (Avalonia UI) / build (push) Waiting to run
release Windows desktop (Avalonia UI) / release-zip (push) Blocked by required conditions
release Windows / build (push) Waiting to run
release Windows / release-zip (push) Blocked by required conditions
* Update build-linux.yml

* Update build-all.yml

* Update build-linux.yml

* Update build-linux.yml

* Update build-linux.yml

* Update OptionSettingWindow.axaml.cs

* Update ResUI.fr.resx

* Update package-rhel-riscv.sh

* Update build-linux.yml

* Update build-linux.yml

* Update build-all.yml

---------

Co-authored-by: xujie86 <167618598+xujie86@users.noreply.github.com>
2026-04-17 15:29:51 +08:00
JieXu
3bda022574
Add RiscV64 RPM build && Update (#9114)
Some checks are pending
release Linux / build (push) Waiting to run
release Linux / release-zip (push) Blocked by required conditions
release Linux / build and release deb x64 & arm64 (push) Waiting to run
release Linux / build and release rpm x64 & arm64 (push) Waiting to run
release Linux / build and release rpm riscv64 (push) Waiting to run
release macOS / build (push) Waiting to run
release macOS / release-zip (push) Blocked by required conditions
release macOS / package and release macOS dmg (push) Blocked by required conditions
release Windows desktop (Avalonia UI) / build (push) Waiting to run
release Windows desktop (Avalonia UI) / release-zip (push) Blocked by required conditions
release Windows / build (push) Waiting to run
release Windows / release-zip (push) Blocked by required conditions
* Create package-rhel-riscv.sh

* Update build-linux.yml

* Update UpdateService.cs

* Update CoreInfo.cs

* Add RiscV64 download URLs for various platforms

* Update build-linux.yml

* Update ResUI.fr.resx

* Update ResUI.fr.resx

* Update ResUI.fr.resx

* Update proxy_set_linux_sh

---------

Co-authored-by: xujie86 <167618598+xujie86@users.noreply.github.com>
2026-04-15 20:50:27 +08:00