diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d1906b8..8219c0f 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -32,20 +32,26 @@ jobs: target: wasm32-wasi - name: Compile Rust tasks run: | - cd examples/rust_template - cargo build --release --target wasm32-wasi - cd ../rust_concat2files - cargo build --release --target wasm32-wasi - cd ../rust_mergedirectories - cargo build --release --target wasm32-wasi + cargo build --release --target wasm32-wasi --manifest-path templates/content/RustWasmTaskTemplate/rust_template/Cargo.toml + cargo build --release --target wasm32-wasi --manifest-path examples/rust_mergedirectories/Cargo.toml + cargo build --release --target wasm32-wasi --manifest-path examples/rust_concat2files/Cargo.toml - name: install standalone wasmtime run: | curl https://wasmtime.dev/install.sh -sSf | bash echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH export PATH=$HOME/.wasmtime/bin:$PATH wasmtime --version - - name: Publish - run: dotnet publish src + - name: Get global-packages path + id: get-packages-path + run: | + PACKAGES_PATH=$(dotnet nuget locals global-packages -l | cut -d ' ' -f 2) + echo "packages_path=$PACKAGES_PATH" >> $GITHUB_OUTPUT + - name: Build + run: dotnet build src/ -c Release + - name: Package + run: dotnet pack src/ -o ${{ steps.get-packages-path.outputs.packages_path }} + - name: Add local NuGet source + run: dotnet nuget add source ${{ steps.get-packages-path.outputs.packages_path }} --name local - name: Examples run: dotnet build examples - name: build MSBuild for unit test .dll diff --git a/.gitignore b/.gitignore index 3411aec..36bd81a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ obj/ Playground/ /MSBuildWasmLocal.sln /examples/go +templates/src \ No newline at end of file diff --git a/MSBuildWasm.sln b/MSBuildWasm.sln index e171ad4..1fd2ba7 100644 --- a/MSBuildWasm.sln +++ b/MSBuildWasm.sln @@ -7,7 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuildWasm", "src\MSBuildW EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExampleProject", "examples\ExampleProject\ExampleProject.csproj", "{B72FEC86-8BB7-49A4-B0D8-52D77EA31B0B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WasmTasksTests", "test\WasmTasksTests\WasmTasksTests.csproj", "{94FE5153-34D6-4F93-9792-7408AD89945D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WasmTasksTests", "test\WasmTasksTests\WasmTasksTests.csproj", "{94FE5153-34D6-4F93-9792-7408AD89945D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RustWasmTaskTemplate", "templates\content\RustWasmTaskTemplate\RustWasmTaskTemplate.csproj", "{68ECCF1E-A1B7-44AE-9B61-D12399B1F739}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuildWasm.Templates", "templates\MSBuildWasm.Templates.csproj", "{7A84956E-ECE0-4401-850E-2CA1DE3356C9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +31,14 @@ Global {94FE5153-34D6-4F93-9792-7408AD89945D}.Debug|Any CPU.Build.0 = Debug|Any CPU {94FE5153-34D6-4F93-9792-7408AD89945D}.Release|Any CPU.ActiveCfg = Release|Any CPU {94FE5153-34D6-4F93-9792-7408AD89945D}.Release|Any CPU.Build.0 = Release|Any CPU + {68ECCF1E-A1B7-44AE-9B61-D12399B1F739}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68ECCF1E-A1B7-44AE-9B61-D12399B1F739}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68ECCF1E-A1B7-44AE-9B61-D12399B1F739}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68ECCF1E-A1B7-44AE-9B61-D12399B1F739}.Release|Any CPU.Build.0 = Release|Any CPU + {7A84956E-ECE0-4401-850E-2CA1DE3356C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A84956E-ECE0-4401-850E-2CA1DE3356C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A84956E-ECE0-4401-850E-2CA1DE3356C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A84956E-ECE0-4401-850E-2CA1DE3356C9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index 3e27cad..bc5a4eb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ - Wasm/WASI for MSBuild +# Wasm/WASI tasks for MSBuild +**EXPERIMENTAL** + - MSBuild task is an unit of execution inside a build, [that can be created by users of MSBuild](https://learn.microsoft.com/en-us/visualstudio/msbuild/tutorial-custom-task-code-generation) - experimental project exporing using Wasm/WASI to create MSBuild tasks - Wasm/WASI supports multiple languages extending the notion of a MSBuild Task from a C# class to a Wasm module @@ -30,4 +32,15 @@ Create a MSBuild task using Wasm/WASI toolchain. Inputs and outputs from a tasks can be bools, strings and "ITaskItem" which is basically a file path. -[Writing tasks for MSBuild](https://learn.microsoft.com/en-us/visualstudio/msbuild/task-writing) \ No newline at end of file +[Writing tasks for MSBuild](https://learn.microsoft.com/en-us/visualstudio/msbuild/task-writing) + + +## License +This project is licensed under the MIT License - see the LICENSE file for details. + +### Third-party Licenses +This project includes software developed under the Apache License, Version 2.0: +Wasmtime - https://github.com/bytecodealliance/wasmtime +Wasmtime.Dotnet - https://github.com/bytecodealliance/wasmtime-dotnet + +For full terms and conditions, please see the Apache 2.0 license. \ No newline at end of file diff --git a/THIRDPARTYNOTICES.txt b/THIRDPARTYNOTICES.txt new file mode 100644 index 0000000..afd890b --- /dev/null +++ b/THIRDPARTYNOTICES.txt @@ -0,0 +1,222 @@ +MSBuildWasm uses third party libraries that are distributed with the software. + +Notice for Wasmtime and Wasmtime.Dotnet: +--------------------------------------------------------------------------- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +--- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. \ No newline at end of file diff --git a/examples/ExampleProject/ExampleProject.csproj b/examples/ExampleProject/ExampleProject.csproj index 7705a91..d422af2 100644 --- a/examples/ExampleProject/ExampleProject.csproj +++ b/examples/ExampleProject/ExampleProject.csproj @@ -8,7 +8,7 @@ - + @@ -17,14 +17,14 @@ - - ..\rust_template\target\wasm32-wasi\release\rust_template.wasm + + ..\..\templates\content\RustWasmTaskTemplate\rust_template\target\wasm32-wasi\release\rust_template.wasm - + ..\rust_concat2files\target\wasm32-wasi\release\rust_concat2files.wasm - + ..\rust_mergedirectories\target\wasm32-wasi\release\rust_mergedirectories.wasm @@ -40,6 +40,7 @@ + diff --git a/examples/rust_concat2files/Cargo.lock b/examples/rust_concat2files/Cargo.lock deleted file mode 100644 index 433f536..0000000 --- a/examples/rust_concat2files/Cargo.lock +++ /dev/null @@ -1,196 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rust_concat2files" -version = "0.1.0" -dependencies = [ - "serde", - "serde-wasm-bindgen", - "serde_json", - "wasm-bindgen", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "serde" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-wasm-bindgen" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515286919c7a28f96c362f42cd42aec7ef6d417334118be69d1ad96160aa5f5" -dependencies = [ - "fnv", - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "serde_derive" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "syn" -version = "2.0.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" diff --git a/examples/rust_mergedirectories/Cargo.lock b/examples/rust_mergedirectories/Cargo.lock deleted file mode 100644 index 5a81de1..0000000 --- a/examples/rust_mergedirectories/Cargo.lock +++ /dev/null @@ -1,437 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", - "serde", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "prettyplease" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" -dependencies = [ - "proc-macro2", - "syn", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rust_mergedirectories" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "wasm-bindgen", - "wit-bindgen", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "serde" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "spdx" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47317bbaf63785b53861e1ae2d11b80d6b624211d42cb20efcd210ee6f8a14bc" -dependencies = [ - "smallvec", -] - -[[package]] -name = "syn" -version = "2.0.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "wasm-encoder" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" -dependencies = [ - "leb128", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a1849fac257fd76c43268555e73d74848c8dff23975c238c2cbad61cffe5045" -dependencies = [ - "anyhow", - "indexmap", - "serde", - "serde_derive", - "serde_json", - "spdx", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" -dependencies = [ - "ahash", - "bitflags", - "hashbrown", - "indexmap", - "semver", -] - -[[package]] -name = "wit-bindgen" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabce76bbb8938536c437da0c3e1d4dda9065453f72a68f797c0cb3d67356a28" -dependencies = [ - "wit-bindgen-rt", - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b43fbdd3497c471bbfb6973b1fb9ffe6949f158248cb43171d6f1cf3de7eaa3" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rt" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75956ff0a04a87ca0526b07199ce3b9baee899f2e4723b5b63aa296ab172ec52" -dependencies = [ - "bitflags", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf509c4ef97b18ec0218741c8318706ac30ff16bc1731f990319a42bbbcfe8e3" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6f2e025e38395d71fc1bf064e581b2ad275ce322d6f8d87ddc5e76a7b8c42" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ed5b0f9fc3d6424787d2a49e1142bf954ae4f26ee891992c144f0cfd68c4b7f" -dependencies = [ - "anyhow", - "bitflags", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "zerocopy" -version = "0.7.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/examples/rust_mergedirectories/src/lib.rs b/examples/rust_mergedirectories/src/lib.rs index 5abfd11..6185d50 100644 --- a/examples/rust_mergedirectories/src/lib.rs +++ b/examples/rust_mergedirectories/src/lib.rs @@ -15,7 +15,7 @@ pub enum MessageImportance { #[repr(C)] #[allow(dead_code)] pub enum TaskResult { - Success, + Success, Failure, } @@ -89,7 +89,7 @@ pub fn Execute() -> TaskResult { .collect(); merge_directories(&wasm_paths, "output_dir").unwrap(); - for path in wasm_paths { + for path in wasm_paths { log_warning(&format!("WasmPath: {}", path)); } diff --git a/examples/rust_template/.gitignore b/examples/rust_template/.gitignore deleted file mode 100644 index ea8c4bf..0000000 --- a/examples/rust_template/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/examples/rust_template/Cargo.lock b/examples/rust_template/Cargo.lock deleted file mode 100644 index c242d11..0000000 --- a/examples/rust_template/Cargo.lock +++ /dev/null @@ -1,436 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", - "serde", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "prettyplease" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" -dependencies = [ - "proc-macro2", - "syn", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rust_template" -version = "0.1.0" -dependencies = [ - "serde_json", - "wasm-bindgen", - "wit-bindgen", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "serde" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.203" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.120" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "spdx" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47317bbaf63785b53861e1ae2d11b80d6b624211d42cb20efcd210ee6f8a14bc" -dependencies = [ - "smallvec", -] - -[[package]] -name = "syn" -version = "2.0.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "wasm-encoder" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" -dependencies = [ - "leb128", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a1849fac257fd76c43268555e73d74848c8dff23975c238c2cbad61cffe5045" -dependencies = [ - "anyhow", - "indexmap", - "serde", - "serde_derive", - "serde_json", - "spdx", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" -dependencies = [ - "ahash", - "bitflags", - "hashbrown", - "indexmap", - "semver", -] - -[[package]] -name = "wit-bindgen" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabce76bbb8938536c437da0c3e1d4dda9065453f72a68f797c0cb3d67356a28" -dependencies = [ - "wit-bindgen-rt", - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b43fbdd3497c471bbfb6973b1fb9ffe6949f158248cb43171d6f1cf3de7eaa3" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rt" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75956ff0a04a87ca0526b07199ce3b9baee899f2e4723b5b63aa296ab172ec52" -dependencies = [ - "bitflags", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf509c4ef97b18ec0218741c8318706ac30ff16bc1731f990319a42bbbcfe8e3" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6f2e025e38395d71fc1bf064e581b2ad275ce322d6f8d87ddc5e76a7b8c42" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ed5b0f9fc3d6424787d2a49e1142bf954ae4f26ee891992c144f0cfd68c4b7f" -dependencies = [ - "anyhow", - "bitflags", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.212.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "zerocopy" -version = "0.7.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/msbuild b/msbuild index a9c95c7..10fbfbf 160000 --- a/msbuild +++ b/msbuild @@ -1 +1 @@ -Subproject commit a9c95c7251503f85493d3f3bb43780ffa8104589 +Subproject commit 10fbfbf2eeb0597fdc1f600d87d38c7f57317bdc diff --git a/msbuildwasmlogo.png b/msbuildwasmlogo.png new file mode 100644 index 0000000..79acc97 Binary files /dev/null and b/msbuildwasmlogo.png differ diff --git a/src/MSBuildWasm.csproj b/src/MSBuildWasm.csproj index 12c92d3..fb9f4f4 100644 --- a/src/MSBuildWasm.csproj +++ b/src/MSBuildWasm.csproj @@ -4,14 +4,132 @@ net8.0 MSBuildWasm enable + true - + + + + + + + + + + true + MSBuildWasm + 0.1.0-alpha + Jan Provaznik + Microsoft + + + $(TargetsForTfmSpecificBuildOutput);_CopyManagedDependenciesToPackage + + + true + + tasks + + NU5100 + + true + true + + .so;.dylib + MSBuild Tasks in Wasm + Introduces the WasmTaskFactory which creates MSBuild Tasks from .wasm modules. + + msbuildwasmlogo.png + README.md + https://github.com/JanProvaznik/MSBuildWasm + MSBuild;Wasm;WebAssembly + LICENSE + + + + + + + + + + + + + + <_ManagedReferences Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.AssetType)' == 'runtime'" /> + <_WasmRuntimeFiles Include="$(PkgWasmtime)\runtimes\**\*.*" /> + <_WasmRuntimeFiles DestinationSubPath="runtimes\%(_WasmRuntimeFiles.RecursiveDir)%(_WasmRuntimeFiles.Filename)%(_WasmRuntimeFiles.Extension)" /> + + + + + + - - - - - + + + + + + - \ No newline at end of file + + + True + \ + + + True + \ + + + True + \ + + + + + True + \ + + + diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..5ba2671 --- /dev/null +++ b/src/README.md @@ -0,0 +1,20 @@ +# MSBuildWasm +**EXPERIMENTAL** + +This package introduces the `WasmTaskFactory` which can be used to create MSBuild tasks from .wasm modules. + +## Usage +0. To create a compatible Wasm module use the template in https://github.com/JanProvaznik/MSBuildWasm/tree/main/templates +1. In a the .proj file add +```xml + +path/to/module.wasm + +``` +2. Use the task +```xml + + + +``` +3. `dotnet build` \ No newline at end of file diff --git a/src/Serializer.cs b/src/Serializer.cs index a964666..e506cbb 100644 --- a/src/Serializer.cs +++ b/src/Serializer.cs @@ -13,6 +13,7 @@ namespace MSBuildWasm { + // TODO documentation internal class Serializer { @@ -46,6 +47,7 @@ internal static string SerializeProperties(object o, HashSet excluded) .ToDictionary(p => p.Name, p => { object value = p.GetValue(o); + // TODO can other types be here? if (value is ITaskItem taskItem) { return SerializeITaskItem(taskItem); diff --git a/src/WasmExec.cs b/src/WasmExec.cs index b23c165..51151f3 100644 --- a/src/WasmExec.cs +++ b/src/WasmExec.cs @@ -1,17 +1,13 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; using System.Text; -using System.Threading.Tasks; using Microsoft.Build.Framework; -namespace MSBuildWasm +namespace MSBuildWasm { + // TODO: use ToolTask public class WasmExec : Microsoft.Build.Utilities.Task, IWasmTask { public string WasmFilePath { get; set; } diff --git a/src/WasmTask.cs b/src/WasmTask.cs index 0f18db4..ce349bd 100644 --- a/src/WasmTask.cs +++ b/src/WasmTask.cs @@ -11,6 +11,7 @@ namespace MSBuildWasm { + // Add documentation public abstract class WasmTask : Microsoft.Build.Utilities.Task, IWasmTask { const string ExecuteFunctionName = "Execute"; @@ -227,6 +228,7 @@ private void CopyAllTaskItemPropertiesToTmp() } } + // TODO does sandboxing belong here? private void CopyPropertyToTmp(PropertyInfo property) { object value = property.GetValue(this); @@ -244,6 +246,7 @@ private void CopyPropertyToTmp(PropertyInfo property) } } + // TODO does it belong here? + the rest of json-related logic private string CreateTaskInputJSON() { var sb = new StringBuilder(); diff --git a/src/WasmTaskFactory.cs b/src/WasmTaskFactory.cs index 19d7a30..7c134f7 100644 --- a/src/WasmTaskFactory.cs +++ b/src/WasmTaskFactory.cs @@ -15,7 +15,8 @@ namespace MSBuildWasm /// public class WasmTaskFactory : ITaskFactory2 { - public string FactoryName => "WasmTaskFactory"; + // TODO avoid hardcoded when possible + public string FactoryName => nameof(WasmTaskFactory); private TaskPropertyInfo[] _taskProperties; private TaskLoggingHelper _log; private string _taskName; @@ -168,7 +169,6 @@ private static void DefineAttributes(TaskPropertyInfo prop, PropertyBuilder prop { propertyBuilder.SetCustomAttribute(new CustomAttributeBuilder(typeof(RequiredAttribute).GetConstructor(Type.EmptyTypes), [])); } - } private static void DefineProperty(TypeBuilder typeBuilder, TaskPropertyInfo prop) { diff --git a/src/WasmTaskLinker.cs b/src/WasmTaskLinker.cs index a9383bb..f8d25a7 100644 --- a/src/WasmTaskLinker.cs +++ b/src/WasmTaskLinker.cs @@ -52,6 +52,7 @@ public void LinkTaskInfo(Store store, TaskInfoEventHandler? eventHandler) private string ExtractStringFromCallerMemory(Caller caller, int address, int length) { Memory memory = caller.GetMemory("memory") ?? throw new WasmtimeException("WebAssembly module did not export a memory."); + // TODO any ways to provide more safety here? return memory.ReadString(address, length); } diff --git a/src/build/MSBuildWasm.props b/src/build/MSBuildWasm.props new file mode 100644 index 0000000..bdcdc4b --- /dev/null +++ b/src/build/MSBuildWasm.props @@ -0,0 +1,11 @@ + + + + + + <_MSBuildWasmFolder>$(MSBuildThisFileDirectory)..\tasks\net8.0 + + $(_MSBuildWasmFolder)\$(MSBuildThisFileName).dll + + + \ No newline at end of file diff --git a/src/build/MSBuildWasm.targets b/src/build/MSBuildWasm.targets new file mode 100644 index 0000000..6ce2b6f --- /dev/null +++ b/src/build/MSBuildWasm.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/msbuildwasmlogo.png b/src/msbuildwasmlogo.png new file mode 100644 index 0000000..79acc97 Binary files /dev/null and b/src/msbuildwasmlogo.png differ diff --git a/templates/MSBuildWasm.Templates.csproj b/templates/MSBuildWasm.Templates.csproj new file mode 100644 index 0000000..85dd8d1 --- /dev/null +++ b/templates/MSBuildWasm.Templates.csproj @@ -0,0 +1,58 @@ + + + + MSBuildWasm.Templates + Jan Provaznik + Microsoft + MSBuild WebAssembly Task Templates + Templates for creating MSBuild tasks from WebAssembly modules, which are compiled from different languages (Rust). + https://github.com/JanProvaznik/MSBuildWasm + Template + net8.0 + false + $(NoWarn);NU5128 + true + true + 0.1.0-alpha + MSBuild;Wasm;WebAssembly + MIT + msbuildwasmlogo.png + README.md + https://github.com/JanProvaznik/MSBuildWasm + + true + false + content + $(NoWarn);NU5128 + true + + + + false + + + + + + + + + + + + + + + True + \ + + + + + + True + \ + + + + \ No newline at end of file diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000..d2b078e --- /dev/null +++ b/templates/README.md @@ -0,0 +1,8 @@ +# MSBuildWasm Template Package +**EXPERIMENTAL** + +The package contains Rust template for creating MSBuild Tasks using Rust with MSBuildWasm + +If/when other languages support function imports and exports in WASIp1 modules, templates for them may be added. + +use `dotnet new rust.msbuild.task` diff --git a/templates/content/RustWasmTaskTemplate/.template.config/template.json b/templates/content/RustWasmTaskTemplate/.template.config/template.json new file mode 100644 index 0000000..65667ed --- /dev/null +++ b/templates/content/RustWasmTaskTemplate/.template.config/template.json @@ -0,0 +1,27 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Jan Provaznik", + "classifications": [ "Wasm", "Rust", "MSBuild"], + "description": "Rust template for a WebAssembly MSBuild task.", + "identity": "MSBuildWasm.RustTask", + "name": "Rust WebAssembly MSBuild Task", + "preferNameDirectory": true, + "shortName": "rust.msbuild.task", + "defaultName": "RustWasmMSBuildTask", + "tags": { + "language": "Rust", + "type": "project" + }, + "postActions": [ + { + "id": "restore", + "condition": "(!skipRestore)", + "description": "Restore NuGet packages required by this project.", + "manualInstructions": [ + { "text": "Run 'dotnet restore'" } + ], + "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", + "continueOnError": true + } + ] +} \ No newline at end of file diff --git a/templates/content/RustWasmTaskTemplate/Program.cs b/templates/content/RustWasmTaskTemplate/Program.cs new file mode 100644 index 0000000..581bddb --- /dev/null +++ b/templates/content/RustWasmTaskTemplate/Program.cs @@ -0,0 +1,7 @@ +internal class Program +{ + private static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + } +} \ No newline at end of file diff --git a/templates/content/RustWasmTaskTemplate/README.md b/templates/content/RustWasmTaskTemplate/README.md new file mode 100644 index 0000000..d9c3a10 --- /dev/null +++ b/templates/content/RustWasmTaskTemplate/README.md @@ -0,0 +1,24 @@ +# MSBuild Wasm - Rust Task Template + +Template for creating a Rust WebAssembly task for MSBuild. + + +1. Use the Rust template add logic for the task. +2. Compile to WebAssembly with Cargo `cargo b --target wasm32-wasi --release --manifest-path=rust_template/Cargo.toml` +3. Register the task in the project file +```xml + + rust_template\target\wasm32-wasi\release\rust_template.wasm + +``` +4. Use the task in the project file in a target + +```xml + + + +``` +5. dotnet build + diff --git a/templates/content/RustWasmTaskTemplate/RustWasmTaskTemplate.csproj b/templates/content/RustWasmTaskTemplate/RustWasmTaskTemplate.csproj new file mode 100644 index 0000000..c3b46f7 --- /dev/null +++ b/templates/content/RustWasmTaskTemplate/RustWasmTaskTemplate.csproj @@ -0,0 +1,29 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + + + rust_template\target\wasm32-wasi\release\rust_template.wasm + + + + + + + diff --git a/templates/content/RustWasmTaskTemplate/rust_template/.gitignore b/templates/content/RustWasmTaskTemplate/rust_template/.gitignore new file mode 100644 index 0000000..869df07 --- /dev/null +++ b/templates/content/RustWasmTaskTemplate/rust_template/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock \ No newline at end of file diff --git a/examples/rust_template/Cargo.toml b/templates/content/RustWasmTaskTemplate/rust_template/Cargo.toml similarity index 87% rename from examples/rust_template/Cargo.toml rename to templates/content/RustWasmTaskTemplate/rust_template/Cargo.toml index e8d2517..a9c37d5 100644 --- a/examples/rust_template/Cargo.toml +++ b/templates/content/RustWasmTaskTemplate/rust_template/Cargo.toml @@ -9,4 +9,4 @@ crate-type = ["cdylib"] [dependencies] serde_json = "1.0.120" wasm-bindgen = "0.2" -wit-bindgen = "0.27.0" +wit-bindgen = "0.28.0" diff --git a/examples/rust_template/src/lib.rs b/templates/content/RustWasmTaskTemplate/rust_template/src/lib.rs similarity index 100% rename from examples/rust_template/src/lib.rs rename to templates/content/RustWasmTaskTemplate/rust_template/src/lib.rs diff --git a/test/WasmTasksTests/WasmTask_Tests.cs b/test/WasmTasksTests/WasmTask_Tests.cs index cb6f627..8884b36 100644 --- a/test/WasmTasksTests/WasmTask_Tests.cs +++ b/test/WasmTasksTests/WasmTask_Tests.cs @@ -19,7 +19,7 @@ public class TemplateWasmTask : WasmTask public TemplateWasmTask() : base() { // set some default values - WasmFilePath = "../../../../../examples/rust_template/target/wasm32-wasi/release/rust_template.wasm"; + WasmFilePath = "../../../../../templates/content/RustWasmTaskTemplate/rust_template/target/wasm32-wasi/release/rust_template.wasm"; BuildEngine = new MockEngine(); } } @@ -126,7 +126,7 @@ public void ExecuteDirectoryMergeDifferentPaths(string inputPath1, string inputP Directory.GetFiles(outputDir).Length.ShouldBe(5); - + // TODO formatting // cleanup Directory.Delete(inputPath1,true); diff --git a/test/WasmTasksTests/WasmTasksTests.csproj b/test/WasmTasksTests/WasmTasksTests.csproj index 7ed0a49..efdcc85 100644 --- a/test/WasmTasksTests/WasmTasksTests.csproj +++ b/test/WasmTasksTests/WasmTasksTests.csproj @@ -14,6 +14,8 @@ + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -25,9 +27,14 @@ $(MSBuildThisFileDirectory)\..\..\msbuild\artifacts\bin\Microsoft.Build.UnitTests.Shared\Debug\net8.0\Microsoft.Build.UnitTests.Shared.dll + + $(MSBuildThisFileDirectory)\..\..\msbuild\artifacts\bin\Microsoft.Build.Utilities\Debug\net8.0\Microsoft.Build.Utilities.Core.dll + $(MSBuildThisFileDirectory)\..\..\msbuild\artifacts\bin\Microsoft.Build.Framework\Debug\net8.0\Microsoft.Build.Framework.dll - + + + $(MSBuildThisFileDirectory)\..\..\msbuild\artifacts\bin\Microsoft.Build.Tasks\Debug\net8.0\Microsoft.Build.Tasks.Core.dll