Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update windows crate to v0.48 #257

Merged
merged 11 commits into from
Aug 8, 2023
Merged

Conversation

paul-hansen
Copy link
Contributor

Looking to reduce binary size and compile times on Windows by only having one version of the windows crate in my apps.

Should the cargo.lock file be removed from this repo? I was under the impression it normally should be ignored for libraries and it is the bulk of the lines changed in this PR.

@DataTriny
Copy link
Member

Hello @paul-hansen, thank you for this PR.
Please remove your changes to the changelog as it is automatically managed by release-please.

Cargo.lock is checked out on purpose, mainly because of our bindings to other languages.

@paul-hansen
Copy link
Contributor Author

paul-hansen commented Jul 20, 2023

Done, thanks for the heads up. Haven't used release-please before, will know to keep an eye out for it now 👍

I did run cargo update after changing the windows dep, just out of habit. lmk if you need me to fix it to just update the windows dep in the lock file or anything.

@mwcampbell
Copy link
Contributor

@paul-hansen Thanks for this update. Please revert your Cargo.lock changes, then run cargo build under platforms/windows, and commit the Cargo.lock changes that come out of that, so we have the minimal set of updates to Cargo.lock in this commit. I'll do a more comprehensive update to Cargo.lock in a separate commit, but I'd rather keep them separate.

@Vrixyz Vrixyz mentioned this pull request Jul 20, 2023
@paul-hansen
Copy link
Contributor Author

Updated cargo.lock file with minimal changes.

@mwcampbell
Copy link
Contributor

@paul-hansen I just approved the GitHub Actions workflow for you. But I can tell you now that the tests in the accesskit_windows crate don't compile.

@paul-hansen
Copy link
Contributor Author

paul-hansen commented Jul 22, 2023

My bad, didn't realize cargo test in the project root wouldn't test all workspace members automatically, looks like it just does default-members.

@paul-hansen
Copy link
Contributor Author

@mwcampbell just a heads up I think your CI might not be checking the tests in accesskit_windows either as the tests passed. It failed on generate-headers though which I'm not sure if that was me?

@paul-hansen
Copy link
Contributor Author

paul-hansen commented Jul 22, 2023

Looks like the error the generate-headers CI step is returning is:

error[E0635]: unknown feature `proc_macro_span_shrink`
            --> D:\\Packages\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\proc-macro2-1.0.52\\src\\lib.rs:92:30
            |
         92 |     feature(proc_macro_span, proc_macro_span_shrink)
            |
                  ^^^^^^^^^^^^^^^^^^^^^^
        For more information about this error, try `rustc --explain E0635`.
        error: could not compile `proc-macro2` (lib) due to previous error

This happens when cmake --build build is run and I was able to replicate this on the main branch so it shouldn't be due to changes in this PR.
According to rust-lang/rust#113152 it looks like this is because proc-macro2 is pinned in our cargo.lock at a version that no longer works on the latest nightly compiler. I pushed a commit to this branch to update it to the latest version. That did seem to resolve the issue locally for me.

@paul-hansen
Copy link
Contributor Author

Added a CI step that should only run on the windows matrix to run the tests for accesskit_windows. I tried it locally using Act and it seemed to work as expected, lmk if you have better ideas on how to handle it or if you want this as a separate PR or anything.

@waywardmonkeys
Copy link
Contributor

I had separately debugged that issue with proc-macro2 and have a PR that fixes it specifically coming up.

@waywardmonkeys
Copy link
Contributor

My PR is #261, so once that lands, you can rebase ahead of it and things should be good.

@paul-hansen
Copy link
Contributor Author

Since #261 is a change that's exactly the same as a change in this PR, I don't think there would be a conflict, but do lmk if I need to do anything.

@mwcampbell
Copy link
Contributor

@paul-hansen Please rebase your branch on top of the latest commit in main, just to make sure this PR passes the updated CI. I'm sorry I've been slow to handle this PR; I won't delay any further, but I think it's good to do the rebase to be sure before we merge. Thanks.

@@ -64,5 +64,12 @@ jobs:
with:
command: test

- name: cargo test -p accesskit_windows
if: matrix.os == 'windows-2019'
uses: actions-rs/cargo@v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should no longer use any actions-rs stuff… just run the cargo command directly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, could you pass —workspace to the existing test run instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that works because it also runs the windows tests on non-windows platforms and mac tests on the windows platform.

At least when I run it locally I get this error

   --> C:\Users\Paul\.cargo\registry\src\index.crates.io-6f17d22bba15001f\objc2-0.3.0-beta.3.patch-leaks.2\src\foundation\mod.rs:102:36
    |
102 | #[link(name = "Foundation", kind = "framework")]
For more information about this error, try `rustc --explain E0455`.
error: could not compile `objc2` (lib) due to previous error

"Foundation" sounds like an Apple thing I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try it though if you want

@paul-hansen
Copy link
Contributor Author

paul-hansen commented Aug 8, 2023

No worries! Rebased.

On main now I noticed that cargo test -p accesskit_windows will sometimes fail these checks sometimes they pass. So if the CI fails here it's not necessarily due to the changes made here, just that this PR now runs those tests.

> git checkout main
> cargo test -p accesskit_windows

running 6 tests
test node::platform_node_impl_send_sync ... ok
test text::platform_range_impl_send_sync ... ok
test tests::subclassed::has_native_uia ... ok
test tests::simple::focus ... FAILED
test tests::simple::navigation ... FAILED
test tests::simple::has_native_uia ... FAILED

thread 'tests::simple::navigation' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', platforms\windows\src\tests\mod.rs:209:36

---- tests::simple::has_native_uia stdout ----
thread 'tests::simple::has_native_uia' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', platforms\windows\src\tests\mod.rs:209:36


failures:
    tests::simple::focus
    tests::simple::has_native_uia
    tests::simple::navigation

@mwcampbell
Copy link
Contributor

You mean that you saw those tests fail when running them manually, not in CI, right?

If so, then what Windows version were you running them on, and did you do other things while waiting for the tests to build and run? The only time I've seen those tests fail, since getting them to pass in the first place, was if I did something else while waiting, because then the test window wouldn't grab focus.

@paul-hansen
Copy link
Contributor Author

Windows 11 Pro 22H2 22621.2070

I was running them manually yes, though I didn't do anything between runs. I was running it from the clion's built in terminal with cargo test -p accesskit_windows. I wasn't clicking away or anything but now that you mentioned that I tried running it from the windows terminal and it consistently succeeds so you are probably right and it's something with clion switching focus away.

@mwcampbell
Copy link
Contributor

I do all my work from Command Prompt, so I hadn't considered that working in an IDE like CLion (or for that matter, probably VSCode) would be a problem. It doesn't surprise me, though. Windows's rules for whether a new window automatically gets focus are complicated, and it's likely that a new window opened by an application launched from a terminal embedded in some other application wouldn't grab focus as a window launched from the built-in terminal does. As long as the tests consistently pass in CI, I think we'll have to accept this as a known issue.

@paul-hansen
Copy link
Contributor Author

Looks like proc-macro2 updated again since I made this PR. Removed my change to the lock file for that so generate-headers is working again. Looking good on my end again let me know if anyone sees anything else though.

@mwcampbell
Copy link
Contributor

@waywardmonkeys Please let us know when you're satisfied with the CI change. As soon as I get your approval on that, I'm ready to merge.

@waywardmonkeys
Copy link
Contributor

Please try the —workspace suggestion… if that works, then great. Shouldn’t need an extra step. It is 1am here, so I am sleeping.

@paul-hansen
Copy link
Contributor Author

paul-hansen commented Aug 8, 2023

Trying it but I think it will fail (see comment in thread), I'll revert if it fails.

@waywardmonkeys
Copy link
Contributor

Ah, right, so I am okay with however it ends up.

Copy link
Contributor

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after the likely revert of the test change.

@waywardmonkeys
Copy link
Contributor

Approved in advance so I can sleep. :)

@paul-hansen
Copy link
Contributor Author

It did fail, reverted now. Failed run was here: https://github.com/AccessKit/accesskit/actions/runs/5800495126/job/15722882417?pr=257

It is 1am here, so I am sleeping.

1pm here, hi from the other side of the world 👋 Sorry for keeping you up, appreciated your help though!

@DataTriny
Copy link
Member

Your Windows-specific check in the CI is good enough for now, but soon we will be better off adding the adapter package name in the test matrix, so we can easily run tests for every adapter on their respective platforms.

@mwcampbell mwcampbell merged commit cc703ed into AccessKit:main Aug 8, 2023
5 checks passed
@mwcampbell mwcampbell mentioned this pull request Aug 8, 2023
lunixbochs pushed a commit to talonvoice/accesskit that referenced this pull request Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants