Extend native-free provider to NetBSD and add native-free CI#3507
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (7)
📜 Recent review details⏰ Context from checks skipped due to timeout. (12)
🧰 Additional context used🧠 Learnings (2)📚 Learning: 2026-04-12T19:22:09.716ZApplied to files:
📚 Learning: 2026-07-06T19:25:59.225ZApplied to files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughThe native-free ChangesNative-free NetBSD support
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SystemInfoFactory
participant NativeFreeSystemInfo
participant PlatformEnum
SystemInfoFactory->>NativeFreeSystemInfo: create native-free provider
NativeFreeSystemInfo->>PlatformEnum: getCurrentPlatform()
PlatformEnum-->>NativeFreeSystemInfo: LINUX or NETBSD
NativeFreeSystemInfo->>NativeFreeSystemInfo: create platform-specific OS and hardware
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3507 +/- ##
============================================
- Coverage 77.00% 72.16% -4.84%
Complexity 76 76
============================================
Files 660 660
Lines 23347 23358 +11
Branches 3888 3889 +1
============================================
- Hits 17978 16856 -1122
- Misses 3292 4535 +1243
+ Partials 2077 1967 -110
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
NetBSD's oshi-common base classes (NetBsdOperatingSystem, NetBsdHardwareAbstractionLayer) are already fully native-free, querying sysctl/ps via the command line; the oshi-core JNA subclasses only swap in a JNA processor and native pid/tid. So the native-free provider can use the base NetBSD classes directly, letting NetBSD users without the JNA native library depend on oshi-common alone, as Linux already does. - oshi.nativefree.SystemInfo now selects Linux (*NF classes) or NetBSD (base classes) by PlatformEnum; isAvailable() covers LINUX and NETBSD. - Refresh SystemInfoFactory error/javadoc and SystemInfoProvider priority-0 javadoc for the two-platform native-free fallback. - Gate nativefree SystemInfoTest and SystemInfoFactoryTest on a shared isNativeFreePlatform() helper using the same PlatformEnum detection as isAvailable(), so tests can't drift from production logic. - README and index.md: native-free row now "Linux and NetBSD only". - New nativefree.yaml CI builds/tests oshi-common in isolation (no oshi-core/JNA, no oshi-core-ffm): Linux on ubuntu, NetBSD in a VM without java-jna.
e5a6606 to
cea6282
Compare
Summary
Extends the native-free provider (
oshi-commonalone — no JNA, no FFM, no--enable-native-access) to NetBSD, so NetBSD users without the JNA native library can depend onoshi-commondirectly, as Linux already can.NetBSD's
oshi-commonbase classes (NetBsdOperatingSystem,NetBsdHardwareAbstractionLayer,NetBsdCentralProcessor) are already fully native-free — they querysysctl/psvia the command line. Theoshi-coreJNA subclasses only swap in a JNA processor and native pid/tid. So the native-free provider uses the base NetBSD classes directly (unlike Linux, which needs dedicated*NFsubclasses).Changes
oshi.nativefree.SystemInfo: selects Linux (*NFclasses) or NetBSD (base classes) byPlatformEnum;isAvailable()now coversLINUXandNETBSD.SystemInfoFactory/SystemInfoProvider: refreshed the error message and priority-0 javadoc for the two-platform native-free fallback.nativefree.SystemInfoTestandspi.SystemInfoFactoryTestnow gate on a sharedisNativeFreePlatform()helper that uses the samePlatformEnumdetection asisAvailable(), so the tests can't drift from production logic.index.mdnative-free row now reads "Linux and NetBSD only".nativefree.yamlbuilds/testsoshi-commonin isolation (nooshi-core/JNA, nooshi-core-ffm) — Linux on ubuntu, NetBSD in a VM withoutjava-jna.Testing
Both native-free CI jobs pass on my fork. The NetBSD job ran the full native-free
SystemInfoTestend-to-end ("Using Native-Free (NF)", every hardware/OS check) withoshi-commonalone. Localspotless,checkstyle,install,forbiddenapis, andjavadocall pass.Not API-breaking (no interface changes; only a wider
isAvailable()plus docs/CI).Summary by CodeRabbit
New Features
--enable-native-accessoption is required when using the native-free implementation on supported platforms.Documentation
Tests
oshi-common.