Merge pull request #1308 from hannobraun/version

Disable model version check on Windows
This commit is contained in:
Hanno Braun 2022-11-04 10:19:25 +01:00 committed by GitHub
commit 5aa8d218be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 22 deletions

View File

@ -105,32 +105,39 @@ impl Model {
let lib = libloading::Library::new(&self.lib_path) let lib = libloading::Library::new(&self.lib_path)
.map_err(Error::LoadingLibrary)?; .map_err(Error::LoadingLibrary)?;
let version_pkg: libloading::Symbol<fn() -> RawVersion> = if cfg!(target_os = "windows") {
lib.get(b"version_pkg").map_err(Error::LoadingVersion)?; warn!(
"Version check is disabled on Windows (see \
https://github.com/hannobraun/Fornjot/issues/1307)"
);
} else {
let version_pkg: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_pkg").map_err(Error::LoadingVersion)?;
let version_pkg = version_pkg().to_string(); let version_pkg = version_pkg().to_string();
if fj::version::VERSION_PKG != version_pkg { if fj::version::VERSION_PKG != version_pkg {
let host = String::from_utf8_lossy( let host = String::from_utf8_lossy(
fj::version::VERSION_PKG.as_bytes(), fj::version::VERSION_PKG.as_bytes(),
) )
.into_owned(); .into_owned();
let model = version_pkg; let model = version_pkg;
return Err(Error::VersionMismatch { host, model }); return Err(Error::VersionMismatch { host, model });
} }
let version_full: libloading::Symbol<fn() -> RawVersion> = let version_full: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_full").map_err(Error::LoadingVersion)?; lib.get(b"version_full").map_err(Error::LoadingVersion)?;
let version_full = version_full().to_string(); let version_full = version_full().to_string();
if fj::version::VERSION_FULL != version_full { if fj::version::VERSION_FULL != version_full {
let host = String::from_utf8_lossy( let host = String::from_utf8_lossy(
fj::version::VERSION_FULL.as_bytes(), fj::version::VERSION_FULL.as_bytes(),
) )
.into_owned(); .into_owned();
let model = version_full; let model = version_full;
warn!("{}", Error::VersionMismatch { host, model }); warn!("{}", Error::VersionMismatch { host, model });
}
} }
let init: libloading::Symbol<abi::InitFunction> = lib let init: libloading::Symbol<abi::InitFunction> = lib

View File

@ -30,7 +30,7 @@ impl Platform for Unix {
} }
} }
// Represents common apis availiable independent of hosts // Abstracts over differences in host platforms
pub struct HostPlatform; pub struct HostPlatform;
impl HostPlatform { impl HostPlatform {