File tree Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -1459,11 +1459,11 @@ fn extract_programs<'a>(
1459
1459
it looks like the Rust project used to create this wasm file was linked against
1460
1460
version of wasm-bindgen that uses a different bindgen format than this binary:
1461
1461
1462
- rust wasm file: {}
1463
- this binary: {}
1462
+ rust wasm file schema version : {}
1463
+ this binary schema version : {}
1464
1464
1465
1465
Currently the bindgen format is unstable enough that these two schema versions
1466
- must exactly match. You can accomplish ths by either updating the wasm-bindgen
1466
+ must exactly match. You can accomplish this by either updating the wasm-bindgen
1467
1467
dependency or this binary.
1468
1468
1469
1469
You should be able to update the wasm-bindgen dependency with:
Original file line number Diff line number Diff line change @@ -27,5 +27,5 @@ fn set_schema_version_env_var() {
27
27
let mut hasher = DefaultHasher :: new ( ) ;
28
28
hasher. write ( & schema_file) ;
29
29
30
- println ! ( "cargo:rustc-env=SCHEMA_VERSION ={}" , hasher. finish( ) ) ;
30
+ println ! ( "cargo:rustc-env=SCHEMA_FILE_HASH ={}" , hasher. finish( ) ) ;
31
31
}
Original file line number Diff line number Diff line change 1
1
#![ doc( html_root_url = "https://docs.rs/wasm-bindgen-shared/0.2" ) ]
2
2
3
- // The schema is so unstable right now we just force it to change whenever this
4
- // file changes.
5
- pub const SCHEMA_VERSION : & str = env ! ( "SCHEMA_VERSION" ) ;
3
+ // This gets changed whenever our schema changes.
4
+ // At this time versions of wasm-bindgen and wasm-bindgen-cli are required to have the exact same
5
+ // SCHEMA_VERSION in order to work together.
6
+ pub const SCHEMA_VERSION : & str = "0.2.74" ;
6
7
7
8
#[ macro_export]
8
9
macro_rules! shared_api {
@@ -191,3 +192,25 @@ pub fn version() -> String {
191
192
}
192
193
return v;
193
194
}
195
+
196
+ #[ cfg( test) ]
197
+ mod tests {
198
+ use super :: * ;
199
+
200
+ // Whenever this file changes, the SCHEMA_FILE_HASH environment variable will change and the
201
+ // schema_version test below will fail.
202
+ // Proceed as follows:
203
+ //
204
+ // If the schema in this library has changed then:
205
+ // 1. Change this APPROVED_SCHEMA_FILE_HASH to the new hash.
206
+ //
207
+ // If the schema in this library has changed then:
208
+ // 1. Bump the version in `crates/shared/Cargo.toml`
209
+ // 2. Change the `SCHEMA_VERSION` in this library to this new Cargo.toml version
210
+ const APPROVED_SCHEMA_FILE_HASH : & ' static str = "12345" ;
211
+
212
+ #[ test]
213
+ fn schema_version ( ) {
214
+ assert_eq ! ( env!( "SCHEMA_FILE_HASH" ) , APPROVED_SCHEMA_FILE_HASH )
215
+ }
216
+ }
You can’t perform that action at this time.
0 commit comments