-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the output of
wasm-tools component wit
(#1657)
* Improve the `--out-dir` flag of `component wit` * Lift files in `deps` outside of their folders to be `deps/*.wit` instead of `deps/*/main.wit` since this structure is now supported. * Handle multi-package input documents by placing each package in the main folder. * Name the main wit file after the package name. * Add some tests for these cases. * Print all WIT packages by default This commit changes the output of `wasm-tools component wit` to by default output all WIT packages using the multi-package syntax implemented in #1577. This means that a complete view of the WIT will be seen when running this command instead of just the top-level world. * Fix build of fuzzer * Sanitize output to be more platform agnostic
- Loading branch information
1 parent
b6b5ad5
commit d4bdb5b
Showing
16 changed files
with
148 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
tests/cli/print-core-wasm-wit-multiple-packages.wit.stdout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
package root:root; | ||
package root:root { | ||
world root { | ||
import bar:bar/my-interface; | ||
} | ||
} | ||
|
||
|
||
package bar:bar { | ||
interface my-interface { | ||
foo: func(); | ||
} | ||
|
||
world root { | ||
import bar:bar/my-interface; | ||
world my-world { | ||
import my-interface; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
package root:root; | ||
package root:root { | ||
world root { | ||
import foo:foo/my-interface; | ||
} | ||
} | ||
|
||
|
||
package foo:foo { | ||
interface my-interface { | ||
foo: func(); | ||
} | ||
|
||
world root { | ||
import foo:foo/my-interface; | ||
world my-world { | ||
import my-interface; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: component embed --dummy % --world a:b/c | component wit --out-dir %tmpdir | ||
|
||
package a:b { | ||
interface foo {} | ||
|
||
world c { | ||
import foo; | ||
import a:c/foo; | ||
} | ||
} | ||
|
||
package a:c { | ||
interface foo {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Writing: %tmpdir/root.wit | ||
Writing: %tmpdir/deps/b.wit | ||
Writing: %tmpdir/deps/c.wit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: component wit % --out-dir %tmpdir | component wit %tmpdir | ||
|
||
package a:b { | ||
interface foo {} | ||
|
||
world c { | ||
import foo; | ||
import a:c/foo; | ||
} | ||
} | ||
|
||
package a:c { | ||
interface foo {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package a:c { | ||
interface foo { | ||
} | ||
|
||
} | ||
|
||
|
||
package a:b { | ||
interface foo { | ||
} | ||
|
||
world c { | ||
import foo; | ||
import a:c/foo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: component wit % --out-dir %tmpdir | ||
|
||
package a:b { | ||
interface foo {} | ||
|
||
world c { | ||
import foo; | ||
import a:c/foo; | ||
} | ||
} | ||
|
||
package a:c { | ||
interface foo {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Writing: %tmpdir/c.wit | ||
Writing: %tmpdir/b.wit |