Skip to content

Commit fc6d2f6

Browse files
authored
Improve crate naming and build validation (#1469)
1 parent a08019e commit fc6d2f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+322
-207
lines changed

.github/readme.md

Lines changed: 1 addition & 1 deletion

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ jobs:
3030
run: cargo doc --no-deps -p windows
3131

3232
generation:
33-
name: Check generation of `windows_${{ matrix.generator }}`
33+
name: Check generation of `tool_${{ matrix.generator }}`
3434
runs-on: windows-latest
3535
strategy:
3636
matrix:
37-
generator: [bindings, api, sys, yml]
37+
generator: [bindings, windows, sys, yml]
3838
steps:
3939
- name: Checkout
4040
uses: actions/checkout@v2
41-
- name: Run windows_${{ matrix.generator }}
42-
run: cargo run -p windows_${{ matrix.generator }}
41+
- name: Run tool_${{ matrix.generator }}
42+
run: cargo run -p tool_${{ matrix.generator }}
4343
- name: Compare
4444
shell: bash
45-
run: git diff --exit-code || (echo '::error::Generated `windows_${{ matrix.generator }}` are out-of-date. Please run `cargo run -p windows_${{ matrix.generator }}`'; exit 1)
45+
run: git diff --exit-code || (echo '::error::Generated `tool_${{ matrix.generator }}` are out-of-date. Please run `cargo run -p tool_${{ matrix.generator }}`'; exit 1)
4646

4747
cargo_sys:
4848
name: Check windows-sys

.github/workflows/test.yml

Lines changed: 172 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -5,122 +5,204 @@ on:
55
push:
66
branches:
77
- master
8+
89
env:
910
RUSTFLAGS: -Dwarnings
1011

1112
jobs:
1213
test:
1314
name: Test
14-
runs-on: ${{ matrix.os }}
15+
runs-on: windows-latest
16+
1517
strategy:
1618
matrix:
1719
include:
18-
- os: windows-latest
19-
rust: stable
20-
other: x86_64-pc-windows-msvc
21-
platform: x64
22-
- os: windows-latest
23-
rust: nightly
24-
other: i686-pc-windows-msvc
25-
platform: x86
26-
- os: windows-latest
27-
rust: nightly
28-
other: x86_64-pc-windows-gnu
29-
platform: x64
30-
- os: windows-latest
31-
rust: stable
32-
other: i686-pc-windows-gnu
33-
platform: x86
20+
- version: stable
21+
target: x86_64-pc-windows-msvc
22+
- version: nightly
23+
target: i686-pc-windows-msvc
24+
- version: nightly
25+
target: x86_64-pc-windows-gnu
26+
- version: stable
27+
target: i686-pc-windows-gnu
28+
3429
steps:
3530
- name: Checkout
3631
uses: actions/checkout@v2
37-
3832
- name: Update toolchain
39-
run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
40-
33+
run: rustup update --no-self-update ${{ matrix.version }} && rustup default ${{ matrix.version }}
4134
- name: Add toolchain target
42-
run: rustup target add ${{ matrix.other }}
43-
35+
run: rustup target add ${{ matrix.target }}
36+
- name: Install clippy
37+
run: rustup component add clippy
4438
- name: Configure Cargo for GNU toolchain
4539
shell: pwsh
4640
run: |
4741
Add-Content $env:USERPROFILE\.cargo\config @"
48-
[target.x86_64-pc-windows-gnu]
49-
linker = `"C:\\msys64\\mingw64\\bin\\x86_64-w64-mingw32-gcc.exe`"
50-
ar = `"C:\\msys64\\mingw64\\bin\\ar.exe`"
51-
[target.i686-pc-windows-gnu]
52-
linker = `"C:\\msys64\\mingw32\\bin\\i686-w64-mingw32-gcc.exe`"
53-
ar = `"C:\\msys64\\mingw32\\bin\\ar.exe`"
42+
[target.x86_64-pc-windows-gnu]
43+
linker = `"C:\\msys64\\mingw64\\bin\\x86_64-w64-mingw32-gcc.exe`"
44+
ar = `"C:\\msys64\\mingw64\\bin\\ar.exe`"
45+
[target.i686-pc-windows-gnu]
46+
linker = `"C:\\msys64\\mingw32\\bin\\i686-w64-mingw32-gcc.exe`"
47+
ar = `"C:\\msys64\\mingw32\\bin\\ar.exe`"
5448
"@
55-
if: contains(matrix.other, 'windows-gnu')
56-
49+
if: contains(matrix.target, 'windows-gnu')
5750
- name: Configure environment for GNU toolchain
5851
shell: pwsh
5952
run: |
60-
if("${{ matrix.other }}" -eq "i686-pc-windows-gnu") {
61-
$MingwPath = "C:\msys64\mingw32\bin"
53+
if("${{ matrix.target }}" -eq "i686-pc-windows-gnu") {
54+
$MingwPath = "C:\msys64\mingw32\bin"
6255
} else {
63-
$MingwPath = "C:\msys64\mingw64\bin"
56+
$MingwPath = "C:\msys64\mingw64\bin"
6457
}
6558
$MingwPath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
66-
if: contains(matrix.other, 'windows-gnu')
59+
if: contains(matrix.target, 'windows-gnu')
60+
- name: Test stable
61+
run: |
62+
cargo test --target ${{ matrix.target }} -p windows-bindgen &&
63+
cargo test --target ${{ matrix.target }} -p windows-metadata &&
64+
cargo test --target ${{ matrix.target }} -p windows-sys &&
65+
cargo test --target ${{ matrix.target }} -p windows-tokens &&
66+
cargo test --target ${{ matrix.target }} -p windows &&
67+
cargo test --target ${{ matrix.target }} -p windows_aarch64_msvc &&
68+
cargo test --target ${{ matrix.target }} -p windows_i686_gnu &&
69+
cargo test --target ${{ matrix.target }} -p windows_i686_msvc &&
70+
cargo test --target ${{ matrix.target }} -p windows_x86_64_gnu &&
71+
cargo test --target ${{ matrix.target }} -p windows_x86_64_msvc &&
72+
cargo test --target ${{ matrix.target }} -p test_agile &&
73+
cargo test --target ${{ matrix.target }} -p test_alternate_success_code &&
74+
cargo test --target ${{ matrix.target }} -p test_arch &&
75+
cargo test --target ${{ matrix.target }} -p test_arch_feature &&
76+
cargo test --target ${{ matrix.target }} -p test_bstr &&
77+
cargo test --target ${{ matrix.target }} -p test_core &&
78+
cargo test --target ${{ matrix.target }} -p test_debug &&
79+
cargo test --target ${{ matrix.target }} -p test_deprecated &&
80+
cargo test --target ${{ matrix.target }} -p test_enums &&
81+
cargo test --target ${{ matrix.target }} -p test_handles &&
82+
cargo test --target ${{ matrix.target }} -p test_helpers &&
83+
cargo test --target ${{ matrix.target }} -p test_interop &&
84+
cargo test --target ${{ matrix.target }} -p test_lib &&
85+
cargo test --target ${{ matrix.target }} -p test_matrix3x2 &&
86+
cargo test --target ${{ matrix.target }} -p test_mshtml &&
87+
cargo test --target ${{ matrix.target }} -p test_ntstatus &&
88+
cargo test --target ${{ matrix.target }} -p test_pwstr &&
89+
cargo test --target ${{ matrix.target }} -p test_return_struct &&
90+
cargo test --target ${{ matrix.target }} -p test_structs &&
91+
cargo test --target ${{ matrix.target }} -p test_sys &&
92+
cargo test --target ${{ matrix.target }} -p test_unions &&
93+
cargo test --target ${{ matrix.target }} -p test_weak &&
94+
cargo test --target ${{ matrix.target }} -p test_win32 &&
95+
cargo test --target ${{ matrix.target }} -p test_win32_arrays &&
96+
cargo test --target ${{ matrix.target }} -p tool_bindings &&
97+
cargo test --target ${{ matrix.target }} -p tool_gnu &&
98+
cargo test --target ${{ matrix.target }} -p tool_msvc &&
99+
cargo test --target ${{ matrix.target }} -p tool_sys &&
100+
cargo test --target ${{ matrix.target }} -p tool_windows &&
101+
cargo test --target ${{ matrix.target }} -p tool_yml
102+
if: matrix.version == 'stable'
67103

68-
- name: Test stable (${{ matrix.os }})
104+
- name: Test nightly
69105
run: |
70-
cargo test --target ${{ matrix.other }} -p test_agile &&
71-
cargo test --target ${{ matrix.other }} -p test_alternate_success_code &&
72-
cargo test --target ${{ matrix.other }} -p test_arch &&
73-
cargo test --target ${{ matrix.other }} -p test_arch_feature &&
74-
cargo test --target ${{ matrix.other }} -p test_bstr &&
75-
cargo test --target ${{ matrix.other }} -p test_core &&
76-
cargo test --target ${{ matrix.other }} -p test_debug &&
77-
cargo test --target ${{ matrix.other }} -p test_deprecated &&
78-
cargo test --target ${{ matrix.other }} -p test_enums &&
79-
cargo test --target ${{ matrix.other }} -p test_handles &&
80-
cargo test --target ${{ matrix.other }} -p test_helpers &&
81-
cargo test --target ${{ matrix.other }} -p test_interop &&
82-
cargo test --target ${{ matrix.other }} -p test_lib &&
83-
cargo test --target ${{ matrix.other }} -p test_matrix3x2 &&
84-
cargo test --target ${{ matrix.other }} -p test_mshtml &&
85-
cargo test --target ${{ matrix.other }} -p test_ntstatus &&
86-
cargo test --target ${{ matrix.other }} -p test_pwstr &&
87-
cargo test --target ${{ matrix.other }} -p test_return_struct &&
88-
cargo test --target ${{ matrix.other }} -p test_structs &&
89-
cargo test --target ${{ matrix.other }} -p test_sys &&
90-
cargo test --target ${{ matrix.other }} -p test_unions &&
91-
cargo test --target ${{ matrix.other }} -p test_weak &&
92-
cargo test --target ${{ matrix.other }} -p test_win32 &&
93-
cargo test --target ${{ matrix.other }} -p test_win32_arrays
94-
if: contains(matrix.rust, 'stable')
106+
cargo test --target ${{ matrix.target }} -p windows-implement &&
107+
cargo test --target ${{ matrix.target }} -p sample_com_uri &&
108+
cargo test --target ${{ matrix.target }} -p sample_core_app &&
109+
cargo test --target ${{ matrix.target }} -p sample_create_window &&
110+
cargo test --target ${{ matrix.target }} -p sample_create_window_sys &&
111+
cargo test --target ${{ matrix.target }} -p sample_direct2d &&
112+
cargo test --target ${{ matrix.target }} -p sample_direct3d12 &&
113+
cargo test --target ${{ matrix.target }} -p sample_enum_windows &&
114+
cargo test --target ${{ matrix.target }} -p sample_enum_windows_sys &&
115+
cargo test --target ${{ matrix.target }} -p sample_kernel_event &&
116+
cargo test --target ${{ matrix.target }} -p sample_memory_buffer &&
117+
cargo test --target ${{ matrix.target }} -p sample_message_box &&
118+
cargo test --target ${{ matrix.target }} -p sample_ocr &&
119+
cargo test --target ${{ matrix.target }} -p sample_overlapped &&
120+
cargo test --target ${{ matrix.target }} -p sample_rss &&
121+
cargo test --target ${{ matrix.target }} -p sample_simple &&
122+
cargo test --target ${{ matrix.target }} -p sample_spellchecker &&
123+
cargo test --target ${{ matrix.target }} -p sample_uiautomation &&
124+
cargo test --target ${{ matrix.target }} -p sample_xaml_app &&
125+
cargo test --target ${{ matrix.target }} -p sample_xml &&
126+
cargo test --target ${{ matrix.target }} -p test_implement &&
127+
cargo test --target ${{ matrix.target }} -p test_implement_class_factory &&
128+
cargo test --target ${{ matrix.target }} -p test_implement_data_object &&
129+
cargo test --target ${{ matrix.target }} -p test_implement_identity &&
130+
cargo test --target ${{ matrix.target }} -p test_implement_map &&
131+
cargo test --target ${{ matrix.target }} -p test_implement_no_use &&
132+
cargo test --target ${{ matrix.target }} -p test_implement_null_result &&
133+
cargo test --target ${{ matrix.target }} -p test_implement_properties &&
134+
cargo test --target ${{ matrix.target }} -p test_implement_winrt
135+
if: matrix.version == 'nightly'
95136

96-
- name: Test nightly (${{ matrix.os }})
137+
- name: Test clippy
97138
run: |
98-
cargo test --target ${{ matrix.other }} -p test_implement &&
99-
cargo test --target ${{ matrix.other }} -p test_implement_class_factory &&
100-
cargo test --target ${{ matrix.other }} -p test_implement_data_object &&
101-
cargo test --target ${{ matrix.other }} -p test_implement_identity &&
102-
cargo test --target ${{ matrix.other }} -p test_implement_map &&
103-
cargo test --target ${{ matrix.other }} -p test_implement_no_use &&
104-
cargo test --target ${{ matrix.other }} -p test_implement_null_result &&
105-
cargo test --target ${{ matrix.other }} -p test_implement_properties &&
106-
cargo test --target ${{ matrix.other }} -p test_implement_winrt &&
107-
cargo test --target ${{ matrix.other }} -p com_uri &&
108-
cargo test --target ${{ matrix.other }} -p core_app &&
109-
cargo test --target ${{ matrix.other }} -p create_window &&
110-
cargo test --target ${{ matrix.other }} -p create_window_sys &&
111-
cargo test --target ${{ matrix.other }} -p direct2d &&
112-
cargo test --target ${{ matrix.other }} -p direct3d12 &&
113-
cargo test --target ${{ matrix.other }} -p enum_windows &&
114-
cargo test --target ${{ matrix.other }} -p enum_windows_sys &&
115-
cargo test --target ${{ matrix.other }} -p kernel_event &&
116-
cargo test --target ${{ matrix.other }} -p memory_buffer &&
117-
cargo test --target ${{ matrix.other }} -p message_box &&
118-
cargo test --target ${{ matrix.other }} -p ocr &&
119-
cargo test --target ${{ matrix.other }} -p overlapped &&
120-
cargo test --target ${{ matrix.other }} -p rss &&
121-
cargo test --target ${{ matrix.other }} -p simple &&
122-
cargo test --target ${{ matrix.other }} -p spellchecker &&
123-
cargo test --target ${{ matrix.other }} -p uiautomation &&
124-
cargo test --target ${{ matrix.other }} -p xaml_app &&
125-
cargo test --target ${{ matrix.other }} -p xml
126-
if: contains(matrix.rust, 'nightly')
139+
cargo clippy -p windows-bindgen &&
140+
cargo clippy -p windows-implement &&
141+
cargo clippy -p windows-metadata &&
142+
cargo clippy -p windows-sys &&
143+
cargo clippy -p windows-tokens &&
144+
cargo clippy -p windows &&
145+
cargo clippy -p sample_com_uri &&
146+
cargo clippy -p sample_core_app &&
147+
cargo clippy -p sample_create_window &&
148+
cargo clippy -p sample_create_window_sys &&
149+
cargo clippy -p sample_direct2d &&
150+
cargo clippy -p sample_direct3d12 &&
151+
cargo clippy -p sample_enum_windows &&
152+
cargo clippy -p sample_enum_windows_sys &&
153+
cargo clippy -p sample_kernel_event &&
154+
cargo clippy -p sample_memory_buffer &&
155+
cargo clippy -p sample_message_box &&
156+
cargo clippy -p sample_ocr &&
157+
cargo clippy -p sample_overlapped &&
158+
cargo clippy -p sample_rss &&
159+
cargo clippy -p sample_simple &&
160+
cargo clippy -p sample_spellchecker &&
161+
cargo clippy -p sample_uiautomation &&
162+
cargo clippy -p sample_xaml_app &&
163+
cargo clippy -p sample_xml &&
164+
cargo clippy -p windows_aarch64_msvc &&
165+
cargo clippy -p windows_i686_gnu &&
166+
cargo clippy -p windows_i686_msvc &&
167+
cargo clippy -p windows_x86_64_gnu &&
168+
cargo clippy -p windows_x86_64_msvc &&
169+
cargo clippy -p test_agile &&
170+
cargo clippy -p test_alternate_success_code &&
171+
cargo clippy -p test_arch &&
172+
cargo clippy -p test_arch_feature &&
173+
cargo clippy -p test_bstr &&
174+
cargo clippy -p test_core &&
175+
cargo clippy -p test_debug &&
176+
cargo clippy -p test_deprecated &&
177+
cargo clippy -p test_enums &&
178+
cargo clippy -p test_handles &&
179+
cargo clippy -p test_helpers &&
180+
cargo clippy -p test_implement &&
181+
cargo clippy -p test_implement_class_factory &&
182+
cargo clippy -p test_implement_data_object &&
183+
cargo clippy -p test_implement_identity &&
184+
cargo clippy -p test_implement_map &&
185+
cargo clippy -p test_implement_no_use &&
186+
cargo clippy -p test_implement_null_result &&
187+
cargo clippy -p test_implement_properties &&
188+
cargo clippy -p test_implement_winrt &&
189+
cargo clippy -p test_interop &&
190+
cargo clippy -p test_lib &&
191+
cargo clippy -p test_matrix3x2 &&
192+
cargo clippy -p test_mshtml &&
193+
cargo clippy -p test_ntstatus &&
194+
cargo clippy -p test_pwstr &&
195+
cargo clippy -p test_return_struct &&
196+
cargo clippy -p test_structs &&
197+
cargo clippy -p test_sys &&
198+
cargo clippy -p test_unions &&
199+
cargo clippy -p test_weak &&
200+
cargo clippy -p test_win32 &&
201+
cargo clippy -p test_win32_arrays &&
202+
cargo clippy -p tool_bindings &&
203+
cargo clippy -p tool_gnu &&
204+
cargo clippy -p tool_msvc &&
205+
cargo clippy -p tool_sys &&
206+
cargo clippy -p tool_windows &&
207+
cargo clippy -p tool_yml
208+
if: matrix.version == 'nightly' && matrix.target == 'x86_64-pc-windows-gnu'

crates/libs/bindgen/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ description = "Code gen support for the windows crate"
88
repository = "https://github.com/microsoft/windows-rs"
99

1010
[dependencies]
11-
quote = { package = "windows_quote", path = "../quote", version = "0.30.0" }
12-
reader = { package = "windows_reader", path = "../reader", version = "0.30.0" }
11+
tokens = { package = "windows-tokens", path = "../tokens", version = "0.30.0" }
12+
metadata = { package = "windows-metadata", path = "../metadata", version = "0.30.0" }

crates/libs/bindgen/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ use functions::*;
2525
pub use gen::*;
2626
use helpers::*;
2727
use iterator::*;
28+
use metadata::*;
2829
use method_names::*;
2930
use methods::*;
3031
use names::*;
31-
use quote::*;
3232
use r#async::*;
33-
use reader::*;
3433
use signatures::*;
34+
use tokens::*;
3535

3636
pub fn gen_type(name: &str, gen: &Gen) -> String {
3737
let reader = TypeReader::get();

crates/libs/macros/Cargo.toml renamed to crates/libs/implement/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "windows_macros"
2+
name = "windows-implement"
33
version = "0.30.0"
44
authors = ["Microsoft"]
55
edition = "2018"
@@ -12,4 +12,4 @@ proc-macro = true
1212

1313
[dependencies]
1414
syn = { version = "1.0", default-features = false, features = ["parsing", "proc-macro", "printing", "full", "derive"] }
15-
quote = { package = "windows_quote", path = "../quote", version = "0.30.0" }
15+
tokens = { package = "windows-tokens", path = "../tokens", version = "0.30.0" }

crates/libs/macros/src/implement.rs renamed to crates/libs/implement/src/implement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use quote::*;
21
use std::collections::*;
32
use syn::parse::*;
43
use syn::Ident;
54
use syn::*;
5+
use tokens::*;
66

77
// New traits-based implement macro that doesn't rely on metadata
88
// Also no support for overrides (Xaml) but developers can still implement overrides directly by implementning the necessary override interface
File renamed without changes.

crates/libs/reader/Cargo.toml renamed to crates/libs/metadata/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "windows_reader"
2+
name = "windows-metadata"
33
version = "0.30.0"
44
authors = ["Microsoft"]
55
edition = "2018"

0 commit comments

Comments
 (0)