100 Commits
Author SHA1 Message Date
Oliver Hamlet 1a8fb00e5b Add support for "not (<expression>)" syntax
Following a discussion on Discord where their absence lead to combining
not-function conditions and truth tables. It's just easier to invert a
whole expression.
2021-02-13 12:12:44 +00:00
Oliver Hamlet 0e606e930b Fix outdated test assertion 2020-12-20 15:09:47 +00:00
Oliver Hamlet 2d05577fab Update versions and changelog for v2.1.2 2020-10-23 23:05:32 +01:00
Oliver Hamlet 1ac23d3afd Migrate CI to GitHub Actions
There's nothing wrong with Travis CI, but AppVeyor has started to fail
builds with a toolchain error when they install rustfmt. This is the
second time some kind of toolchain change has broken my builds, so I'm
migrating away from it.

I could have migrated to Travis CI's relatively new Windows support, but
that's still in the early adoption phase according to its own docs, and
I might as well instead move to GitHub's first-party offering. There's
no point then using Travis CI for Linux builds when that can be done on
GitHub Actions too.
2020-07-12 22:39:32 +01:00
Oliver Hamlet 4eb22c1679 Update to Tarpaulin 0.14.2 2020-07-12 08:59:59 +01:00
Oliver Hamlet 5f9a5fb5f0 Switch Travis to Ubuntu 18.04
So that the build can use the prebuilt Tarpaulin binary instead of
building and caching it. 18.04 builds apparently start faster too.
2020-07-12 08:59:44 +01:00
Oliver Hamlet 5c78e770ec Very minor readme update 2020-07-12 08:54:38 +01:00
Oliver Hamlet 7676b66ae8 Remove deps.rs badge
It's been broken for a while.
2020-07-12 08:54:04 +01:00
Oliver Hamlet 9ef3aa23d5 Update versions and changelog for v2.1.1 2020-06-13 23:46:36 +01:00
Oliver Hamlet 76b8f0bd86 Fix a couple of clippy lint warnings 2020-06-13 23:21:37 +01:00
Oliver Hamlet d0bde327c2 Speed up CRC32 calculation
It turns out that passing in one byte at a time is really inefficient
(which really should have been obvious...). For small files the
difference is insignificant, but for Skyrim SE's Update.esm (18 MB)
feeding in the buffered file content slice made the calculation twice
as fast, and this seems to have non-linear effect, as the benchmark
against Dragonborn.esm (63 MB) would have taken ~ 1137 seconds to run
when passing one byte at a time (the benchmark using a buffer took ~ 5
seconds).

On top of that, switching to the crc32fast crate has an insignificant
effect on benchmarking with Blank.esm, but Update.esm's benchmark
was twice as fast again, and when benchmarking with Dragonborn.esm,
using crc32fast was ~ 170x faster than using the crc crate!
2020-06-13 23:17:32 +01:00
Oliver HamletandGitHub 3b1e54a4ed Merge pull request #2 from loot/dependabot/cargo/cbindgen-0.14
Update cbindgen requirement from 0.12 to 0.14
2020-05-30 12:42:16 +01:00
Oliver Hamlet 99d227ec6d Update rustfmt install command in CI
rustfmt hasn't been a preview for a while now. It still needs to
be installed separately because Travis uses the minimal Rustup
profile, which doesn't include it. Also use the minimal profile on
Windows for consistency and to speed up installation.
2020-05-29 16:44:22 +01:00
Oliver Hamlet d9173d37cd Update tarpaulin to support the new Cargo.lock format
Unfortunately the published binary no longer works on Travis
unless the build happens on its bionic image, because the binary is
built in GitHub Actions using the ubuntu:latest image. Running in bionic isn't
guaranteed not to break in the future, so install from source and cache
the artifact to be sure.

Fortunately, cargo install no longer requires --force to update an installed binary
crate, so building from source and caching the result is simpler
than it used to be.
2020-05-29 16:43:17 +01:00
Oliver Hamlet e31456f5b9 Resolve rustc deprecation warnings 2020-04-02 08:55:29 +01:00
Oliver Hamlet f6e988b1af Handle directories gracefully in checksum(), version() and product_version() conditions
If the path is a directory, eval the same as if the path didn't exist.
2020-01-10 18:00:24 +00:00
Oliver Hamlet ff1529d932 Update Tarpaulin to v0.10.0
Also download a prebuilt binary from GitHub to speed up Travis builds.

The later 0.9.x and 0.10.0 release binaries seems to have been built
against a version of libssl that isn't available on Travis.
2019-12-23 23:31:48 +00:00
Oliver Hamlet 458820b638 Update criterion to v0.3.0 2019-12-23 14:04:16 +00:00
Oliver Hamlet 377ebcbb63 Update pelite to v0.8.0 2019-12-23 13:37:55 +00:00
Oliver Hamlet 7ff5e0c5d1 Fix C++ linking on AppVeyor
For some reason Rustup now installs the i686 toolchain by default, so
build the C++ tests as a 32-bit application.
2019-12-23 13:22:01 +00:00
Oliver Hamlet 90ef017807 Update cbindgen to v0.12 2019-12-23 13:20:27 +00:00
Oliver Hamlet 1075596e99 Update versions and changelog for v2.1.0 2019-10-05 13:24:52 +01:00
Oliver Hamlet e5755629e6 Fix deprecation warning about bare trait object syntax 2019-10-05 13:24:52 +01:00
Oliver Hamlet cb211d6ec3 Add support for an is_master(file path) function 2019-10-05 13:24:52 +01:00
Oliver Hamlet 90cbeff71a Update versions and changelog for v2.0.1 2019-07-23 19:15:35 +01:00
Oliver Hamlet b9d5d57dac Fix regex conditions returning true for partial matches
The regex engine implicitly adds .*? to the beginning and end of
expressions, so add ^ and $ to input expressions.
2019-07-23 19:04:22 +01:00
Oliver Hamlet 214cc93423 Update versions and changelog for v2.0.0 2019-06-30 11:25:24 +01:00
Oliver Hamlet 99e1c6d378 Don't error if an executable has no version info
Instead, treat it as having no version (so true if comparator is !=, <
or <=).
2019-06-30 11:25:24 +01:00
Oliver Hamlet 93b16a4c2a Update cbindgen, generate a single C/C++ header 2019-06-30 11:25:24 +01:00
Oliver Hamlet 954757a141 Replace deprecated Error::cause with Error::source
Error::source was added in Rust 1.30.0, and Error::cause was deprecated
in favour of it in Rust 1.33.0.
2019-06-30 11:25:24 +01:00
Oliver Hamlet 860995638c Rename LCI_GAME_* constants to use fewer acronyms
A minor quality of life improvement, to break the FFI compatibility in
step with the Rust library.
2019-06-30 11:25:23 +01:00
Oliver Hamlet 52792626af Update to Rust 2018 syntax 2019-06-30 11:25:23 +01:00
Oliver Hamlet 6cfefc6c31 Rename GameType variants to use fewer acronyms
A minor quality of life improvement since the nom 5 update is a
breaking change.
2019-06-30 11:25:23 +01:00
Oliver Hamlet 4db34be2c9 Upgrade to nom v5
Error handling has changed, affecting the error variants LCI exports,
and macros are replaced by functions, so all the parsing code has been rewritten.
2019-06-30 11:25:23 +01:00
Oliver Hamlet cb19ec084a Add coverage checking for Travis builds 2019-06-16 20:36:14 +01:00
Oliver Hamlet 44d73e0611 Apply clippy suggestions 2019-06-16 20:33:28 +01:00
Oliver Hamlet 611e4490d2 Replace deprecated libc::uint32_t with u32 2019-06-16 20:33:04 +01:00
Oliver Hamlet 2e05117b61 Update versions and changelog for v1.3.0 2019-04-07 12:25:40 +01:00
Oliver Hamlet f039ba397f Add GameType::Tes3 for Morrowind support 2019-04-07 12:20:10 +01:00
Oliver Hamlet ea3a922ee7 Update versions and changelog for v1.2.2 2019-01-26 09:50:40 +00:00
Oliver Hamlet 53a5e22225 Fix functions with a regex parameter not parsing closing ')' 2019-01-26 09:46:41 +00:00
Oliver Hamlet 529e4fc6d1 Error if not all the input is consumed when parsing expressions 2019-01-26 09:44:33 +00:00
Oliver Hamlet 3777c067a4 Update versions and changelog for v1.2.1 2019-01-20 00:47:21 +00:00
Oliver Hamlet 8e116d2980 Fix parsing executables with non-US-English version info resources
pelite is hardcoded to only look for US English version info resources,
but executables may not have any, so just get the first version info
resource instead.
2019-01-20 00:38:32 +00:00
Oliver Hamlet 517b636743 Update versions and changelog for v1.2.0 2018-12-22 23:51:01 +00:00
Oliver Hamlet 9ef82fe886 Run rustfmt (Rust 1.31.1) 2018-12-22 22:50:16 +00:00
Oliver Hamlet 5e1ba5709b Support parsing Script Extender product version fields
They've got a format that matches the format for fixed-size version fields in resource files.
2018-12-22 22:50:16 +00:00
Oliver Hamlet c90814a8ab Read product version from string field
File Explorer displays the ProductVersion version string field, not the fixed-size product version field, so read from it so that LOOT's behaviour matches.
2018-12-22 22:50:16 +00:00
Oliver Hamlet 31d870df9c Add tests parsing conditions that caused problems 2018-12-22 22:50:15 +00:00
Oliver Hamlet 4f1b1c0bf0 Update versions and changelog for 1.1.1 2018-11-14 21:17:59 +00:00
Oliver Hamlet 3007a9e090 Fix parsing error if parentheses are padded with whitespace 2018-11-14 20:51:02 +00:00
Oliver Hamlet 579ba2969a Fix backslashes not allowed in paths that can't be regexes 2018-11-14 20:51:02 +00:00
Oliver Hamlet 26bbda4925 Fix parsing of greater/less-than-or-equal-to parameters 2018-11-14 20:18:28 +00:00
Oliver HamletandGitHub 84c46ebe79 Note the supported metadata syntax version 2018-11-07 18:58:35 +00:00
Oliver HamletandGitHub 1e20451e73 Update README.md 2018-11-06 14:13:37 +00:00
Oliver Hamlet a600083cc9 Apply clippy suggestions 2018-10-25 18:34:00 +01:00
Oliver Hamlet 80676f72b4 Update versions and changelog for 1.1.0 2018-10-23 21:12:41 +01:00
Oliver Hamlet 0c0e8a6639 Add support for product_version() conditions
This checks the product version field of executables instead of their
file version field.
2018-10-23 21:12:40 +01:00
Oliver Hamlet 07737cebe8 Add ability to read executable product version field 2018-10-23 21:12:40 +01:00
Oliver Hamlet 5512581c0f Move test resources into subdirectory 2018-10-23 21:12:40 +01:00
Oliver Hamlet b6a9066eaa Update readme 2018-10-21 14:42:50 +01:00
Oliver Hamlet c0bea60673 Add FFI wrapper crate 2018-10-20 21:13:33 +01:00
Oliver Hamlet 0f805d80ea Allow condition cache to be cleared 2018-10-20 21:12:55 +01:00
Oliver Hamlet efe01a060d Don't try to read executable versions for plugins with no stored version 2018-10-20 21:12:54 +01:00
Oliver Hamlet d6d968c7b5 Update readme 2018-10-07 10:52:09 +01:00
Oliver Hamlet 180b728728 Improve parsing error messages
Nom's custom error type handling isn't great, requiring a lot of
fix_error! macro calls, and even then the complete! macro hardcodes the
error type it expects as u32, so it can't be used and instead the
CompleteStr type needs to be used everywhere.
2018-10-07 10:45:24 +01:00
Oliver Hamlet d28c194c9d Add typedef to abstract away custom parsing error type 2018-10-07 10:45:24 +01:00
Oliver Hamlet 10d078b843 Improve content of I/O and PE parsing errors 2018-10-07 10:45:24 +01:00
Oliver Hamlet 2bb3d8b26f Take advantage of match ergonomics 2018-10-06 16:26:18 +01:00
Oliver Hamlet d3f4169d76 Update readme 2018-10-06 16:04:57 +01:00
Oliver Hamlet 04a92f9968 Implement the Error trait on the Error enum 2018-10-06 16:04:57 +01:00
Oliver Hamlet 594c8d19af Don't expose third-party dependencies in API
Also implement FromStr on Expression instead of the parse() function.
2018-10-06 15:08:26 +01:00
Oliver Hamlet 48ec04a95f Only cache some function results
Some functions evaluate more quickly without caching than with caching,
because they use data that is cached in a separate read-only cache
that's faster to check, and don't do anything complex with that data.
2018-10-06 13:38:55 +01:00
Oliver Hamlet f6f51e2ee6 Add benchmarks to help optimise result caching 2018-10-06 13:28:03 +01:00
Oliver Hamlet 3404924752 Cache Function evaluation results, and use cached results 2018-10-06 11:45:57 +01:00
Oliver Hamlet 11a92511c1 Update readme 2018-10-06 10:42:18 +01:00
Oliver Hamlet 2c8473435a Implement Clone and Default traits on Expression and types it depends on 2018-10-06 10:39:17 +01:00
Oliver Hamlet 77c58c965f Implement Display trait on Expression and all types it depends on 2018-10-06 10:36:39 +01:00
Oliver Hamlet 5d9441623a Derive PartialEq, Eq for Expression, CompoundCondition and Condition 2018-10-06 10:29:50 +01:00
Oliver Hamlet 3bf009e579 Implement PartialEq, Eq for Function 2018-10-06 10:29:50 +01:00
Oliver Hamlet 9f6e941955 Add Travis and AppVeyor config 2018-10-05 20:30:50 +01:00
Oliver Hamlet ce85be1201 Add MIT license 2018-10-05 20:21:14 +01:00
Oliver Hamlet 360058725a Update readme 2018-10-05 19:54:12 +01:00
Oliver Hamlet be313c40cb Support reading file version from Windows executables 2018-10-05 19:52:51 +01:00
Oliver Hamlet 2def44d3aa Rename release_numbers field to release_ids
It's more accurate as they can be non-numeric.
2018-10-05 17:13:31 +01:00
Oliver Hamlet a3f8d1423c Pad release numbers to equal length when comparing 2018-10-05 17:13:31 +01:00
Oliver Hamlet ab2726d5be Fix a few incorrect test assertions 2018-10-05 17:13:31 +01:00
Oliver Hamlet 3b1f3592b3 Support extended version identifier separators
Space, colon and underscore should separate release and pre-release identifiers.
2018-10-05 17:13:31 +01:00
Oliver Hamlet 45ab848c1f Add tests for non-semver version string comparisons
Almost at parity with pseudosem, only identifier padding and extended
separators to go.
2018-10-05 17:13:30 +01:00
Oliver Hamlet 98291fdc23 Implement semver version string comparison 2018-10-05 17:13:30 +01:00
Oliver Hamlet 8cb69dfa86 Add lexicographical evaluation of version conditions
Versions aren't yet read from executables, and evaluation isn't
pseudosem-compatible.
2018-10-05 17:12:38 +01:00
Oliver Hamlet 3acf2ffea1 Refactor game-specific code and add tests for it 2018-10-04 22:16:30 +01:00
Oliver Hamlet 107f61868c Silence name warnings 2018-10-04 22:16:29 +01:00
Oliver Hamlet 3e1c2084e5 Add evaluation of checksum() conditions 2018-10-03 19:21:45 +01:00
Oliver Hamlet 2e57585787 Add evaluation of active() and many_active() conditions 2018-10-03 18:31:26 +01:00
Oliver Hamlet 8526ca5a83 Create case-insensitive regexes in tests 2018-10-03 18:30:11 +01:00
Oliver Hamlet 1d396911a5 Fix formatting 2018-10-03 18:21:07 +01:00
Oliver Hamlet 1881348db3 Create Regex objects to match case insensitively 2018-10-03 18:17:35 +01:00
Oliver Hamlet 0db0930d31 Add evaluation of many() conditions 2018-10-03 17:15:35 +01:00
Oliver Hamlet 72be3f8172 Add evaulation of file regex conditions 2018-10-03 17:15:35 +01:00