diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bf8465be5..df50a8243b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# Polywrap Origin (0.12.2) +## Features +**`polywrap` CLI:** +* [PR-1928](https://github.com/polywrap/cli/pull/1928) **Add `--no-wasm` Option To `polywrap build`** + * `build` command now supports the `--no-wasm` option, which disables the wasm compilation step when compiling projects. + +## Bugs +**`@polywrap/templates`:** +* [PR-1929](https://github.com/polywrap/cli/pull/1929) **Fix Rust Codegen Compiler Errors** + # Polywrap Origin (0.12.1) ## Features **`polywrap` CLI:** diff --git a/VERSION b/VERSION index 34a83616bb..26acbf080b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.12.1 +0.12.2 diff --git a/packages/cli/README.md b/packages/cli/README.md index b1fbb16d80..c59bd5dfd8 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -104,6 +104,10 @@ Currently, `build` can be run for Wasm, Plugin and Interface projects. Skip codegen before building. By default, `build` performs a `codegen` step before building your Project. This option skips this step. +- `--no-wasm` + Skip wasm compilation. + By default, `build` performs wasm compilation. This option skips this step. + - `-s, --strategy ` Specify which build strategy to use. By default, the `vm` build strategy is used. Available strategies: diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index ad9f18c82a..e9324f7da7 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -21,6 +21,7 @@ "commands_build_options_options": "options", "commands_build_options_t": "Use the development server's ENS instance", "commands_build_options_codegen": "Skip code generation before build", + "commands_build_options_no_wasm": "Skip wasm compilation", "commands_build_options_codegen_dir": "Codegen output directory (default: {default})", "commands_build_options_s": "Strategy to use for building the wrapper (default: {default})", "commands_build_options_s_strategy": "strategy", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index ad9f18c82a..e9324f7da7 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -21,6 +21,7 @@ "commands_build_options_options": "options", "commands_build_options_t": "Use the development server's ENS instance", "commands_build_options_codegen": "Skip code generation before build", + "commands_build_options_no_wasm": "Skip wasm compilation", "commands_build_options_codegen_dir": "Codegen output directory (default: {default})", "commands_build_options_s": "Strategy to use for building the wrapper (default: {default})", "commands_build_options_s_strategy": "strategy", diff --git a/packages/cli/src/__tests__/e2e/p2/build.wasm.spec.ts b/packages/cli/src/__tests__/e2e/p2/build.wasm.spec.ts index 43d64f6526..8bd08c8281 100644 --- a/packages/cli/src/__tests__/e2e/p2/build.wasm.spec.ts +++ b/packages/cli/src/__tests__/e2e/p2/build.wasm.spec.ts @@ -24,6 +24,7 @@ Options: -c, --client-config Add custom configuration to the PolywrapClient -n, --no-codegen Skip code generation before build + --no-wasm Skip wasm compilation --codegen-dir Codegen output directory (default: ./src/wrap) --wrapper-envs Path to a JSON file containing wrapper @@ -265,7 +266,7 @@ describe("e2e tests for build command", () => { expect(output).toContain(`WRAP manifest written in ${buildDir}/wrap.info`); }); }) - + describe("test-cases", () => { for (let i = 0; i < testCases.length; i++) { const testCaseName = testCases[i]; diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts index d303991a02..907b7010ee 100644 --- a/packages/cli/src/commands/build.ts +++ b/packages/cli/src/commands/build.ts @@ -51,6 +51,7 @@ export interface BuildCommandOptions extends BaseCommandOptions { clientConfig: string | false; wrapperEnvs: string | false; noCodegen: boolean; + noWasm: boolean; codegenDir: string | false; watch: boolean; strategy: `${SupportedStrategies}`; @@ -80,6 +81,7 @@ export const build: Command = { `${intlMsg.commands_common_options_config()}` ) .option(`-n, --no-codegen`, `${intlMsg.commands_build_options_codegen()}`) + .option(`--no-wasm`, `${intlMsg.commands_build_options_no_wasm()}`) .option( `--codegen-dir`, `${intlMsg.commands_build_options_codegen_dir({ @@ -117,6 +119,7 @@ export const build: Command = { outputDir: parseDirOption(options.outputDir, defaultOutputDir), bindgen: options.bindgen || false, noCodegen: !options.codegen || false, + noWasm: !options.wasm || false, codegenDir: parseDirOptionNoDefault(options.codegenDir), strategy: options.strategy || defaultStrategy, watch: options.watch || false, @@ -174,6 +177,7 @@ async function run(options: Required) { bindgen, strategy, noCodegen, + noWasm, codegenDir, verbose, quiet, @@ -220,7 +224,7 @@ async function run(options: Required) { const isInterface = language === "interface"; - if (isInterface) { + if (isInterface || noWasm) { buildStrategy = new NoopBuildStrategy({ project: project as PolywrapProject, outputDir, diff --git a/packages/cli/src/lib/test-env/client-config.ts b/packages/cli/src/lib/test-env/client-config.ts index 7128b2f9ae..37de5466ce 100644 --- a/packages/cli/src/lib/test-env/client-config.ts +++ b/packages/cli/src/lib/test-env/client-config.ts @@ -1,4 +1,3 @@ -import { getTestEnvProviders } from "./providers"; import { ETH_ENS_IPFS_MODULE_CONSTANTS } from "../../lib"; import { @@ -18,14 +17,8 @@ import { IWrapPackage, Uri } from "@polywrap/core-js"; export function getTestEnvClientConfig(): Partial { // TODO: move this into its own package, since it's being used everywhere? // maybe have it exported from test-env. - const providers = getTestEnvProviders(); - const ipfsProvider = providers.ipfsProvider; - const ethProvider = providers.ethProvider; - - if (!ipfsProvider || !ethProvider) { - throw Error("Test environment not found."); - } - + const ipfsProvider = ETH_ENS_IPFS_MODULE_CONSTANTS.ipfsProvider; + const ethProvider = ETH_ENS_IPFS_MODULE_CONSTANTS.ethereumProvider; const ensAddress = ETH_ENS_IPFS_MODULE_CONSTANTS.ensAddresses.ensAddress; const testnetEnsResolverUri = "proxy/testnet-ens-contenthash-uri-resolver"; diff --git a/packages/cli/src/lib/test-env/index.ts b/packages/cli/src/lib/test-env/index.ts index bf8a304fed..4a77101fc8 100644 --- a/packages/cli/src/lib/test-env/index.ts +++ b/packages/cli/src/lib/test-env/index.ts @@ -1,2 +1 @@ export * from "./client-config"; -export * from "./providers"; diff --git a/packages/cli/src/lib/test-env/providers.ts b/packages/cli/src/lib/test-env/providers.ts deleted file mode 100644 index a25e7c5073..0000000000 --- a/packages/cli/src/lib/test-env/providers.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ETH_ENS_IPFS_MODULE_CONSTANTS } from "../../lib"; - -export function getTestEnvProviders( - ipfsProvider?: string, - ethProvider?: string -): { ipfsProvider?: string; ethProvider?: string } { - return { - ipfsProvider: ipfsProvider ?? ETH_ENS_IPFS_MODULE_CONSTANTS.ipfsProvider, - ethProvider: ethProvider ?? ETH_ENS_IPFS_MODULE_CONSTANTS.ethereumProvider, - }; -} diff --git a/packages/templates/app/android/package.json b/packages/templates/app/android/package.json index 05e6d79b93..9aac4aa747 100644 --- a/packages/templates/app/android/package.json +++ b/packages/templates/app/android/package.json @@ -5,6 +5,6 @@ "codegen": "npx polywrap codegen -g app/src/main/java/wrap" }, "devDependencies": { - "polywrap": "0.11.2" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/app/ios/package.json b/packages/templates/app/ios/package.json index 82a8a9c509..485323bcfd 100644 --- a/packages/templates/app/ios/package.json +++ b/packages/templates/app/ios/package.json @@ -5,6 +5,6 @@ "codegen": "npx polywrap codegen -g Template/wrap" }, "devDependencies": { - "polywrap": "0.11.2" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/app/python/package.json b/packages/templates/app/python/package.json index 01d4b27ff7..fd4bc481ba 100644 --- a/packages/templates/app/python/package.json +++ b/packages/templates/app/python/package.json @@ -6,6 +6,6 @@ "test": "poetry run python -m sample" }, "devDependencies": { - "polywrap": "0.11.2" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/app/rust/Cargo.toml b/packages/templates/app/rust/Cargo.toml index e92914b99f..c21c9182f1 100644 --- a/packages/templates/app/rust/Cargo.toml +++ b/packages/templates/app/rust/Cargo.toml @@ -11,7 +11,7 @@ include = [ ] [dependencies] -polywrap = { version = "~0.1.9-beta.2" } +polywrap = { version = "~0.1.10" } serde = {version = "1.0.145", features = ["derive"]} [dev-dependencies] diff --git a/packages/templates/app/rust/package.json b/packages/templates/app/rust/package.json index b5db6c0aee..9ee61b5d20 100644 --- a/packages/templates/app/rust/package.json +++ b/packages/templates/app/rust/package.json @@ -5,6 +5,6 @@ "codegen": "npx polywrap codegen" }, "devDependencies": { - "polywrap": "0.11.2" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/app/typescript/package.json b/packages/templates/app/typescript/package.json index 03d54c9c36..0bdb2be4e1 100644 --- a/packages/templates/app/typescript/package.json +++ b/packages/templates/app/typescript/package.json @@ -12,7 +12,7 @@ }, "devDependencies": { "@types/node": "18.15.0", - "polywrap": "0.12.1", + "polywrap": "~0.12.1", "ts-node": "10.9.1", "typescript": "4.9.5" } diff --git a/packages/templates/plugin/python/package.json b/packages/templates/plugin/python/package.json index dd948a1b27..6cbfe611ec 100644 --- a/packages/templates/plugin/python/package.json +++ b/packages/templates/plugin/python/package.json @@ -6,6 +6,6 @@ "test": "poetry run pytest" }, "dependencies": { - "polywrap": "0.11.3" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/plugin/rust/Cargo.toml b/packages/templates/plugin/rust/Cargo.toml index 57d2f68633..b3db914e1d 100644 --- a/packages/templates/plugin/rust/Cargo.toml +++ b/packages/templates/plugin/rust/Cargo.toml @@ -11,11 +11,11 @@ include = [ ] [dependencies] -polywrap_core = { version = "~0.1.8" } -polywrap_plugin = { version = "~0.1.8" } +polywrap_core = { version = "~0.1.10" } +polywrap_plugin = { version = "~0.1.10" } polywrap_msgpack_serde = { version = "~0.0.2-beta.7" } -wrap_manifest_schemas = { version = "~0.1.8" } +wrap_manifest_schemas = { version = "~0.1.10" } serde = {version = "1.0.145", features = ["derive"]} [dev-dependencies] -polywrap_client = { version = "~0.1.8" } +polywrap = { version = "~0.1.10" } diff --git a/packages/templates/plugin/rust/package.json b/packages/templates/plugin/rust/package.json index e4d862cdd0..4df756a43b 100644 --- a/packages/templates/plugin/rust/package.json +++ b/packages/templates/plugin/rust/package.json @@ -2,6 +2,6 @@ "name": "templates-plugin-rust", "private": true, "dependencies": { - "polywrap": "0.11.3" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/plugin/rust/tests/e2e.rs b/packages/templates/plugin/rust/tests/e2e.rs index f8a9c346ac..1362611750 100644 --- a/packages/templates/plugin/rust/tests/e2e.rs +++ b/packages/templates/plugin/rust/tests/e2e.rs @@ -1,30 +1,28 @@ use template_plugin_rs::SamplePlugin; use template_plugin_rs::wrap::module::ArgsSampleMethod; -use polywrap_core::{ - client::ClientConfig, - uri::Uri, +use polywrap::{ + Client, + ClientConfig, + ClientConfigBuilder, + Uri, }; use polywrap_plugin::{package::PluginPackage}; -use polywrap_client::{ - client::PolywrapClient, - builder::{PolywrapClientConfig, PolywrapClientConfigBuilder}, -}; use polywrap_msgpack_serde::to_vec; use std::{ - sync::{Arc, Mutex}, + sync::{Arc}, }; -fn get_client() -> PolywrapClient { +fn get_client() -> Client { let sample_plugin = SamplePlugin {}; let plugin_pkg = PluginPackage::::from(sample_plugin); - let mut config = PolywrapClientConfig::new(); + let mut config = ClientConfig::new(); config.add_package( Uri::try_from("plugin/sample").unwrap(), Arc::new(plugin_pkg) ); - PolywrapClient::new(config.into()) + Client::new(config.into()) } #[test] diff --git a/packages/templates/plugin/typescript/package.json b/packages/templates/plugin/typescript/package.json index 7beebcc622..46bf2ac0e2 100644 --- a/packages/templates/plugin/typescript/package.json +++ b/packages/templates/plugin/typescript/package.json @@ -23,7 +23,7 @@ "@types/jest": "26.0.8", "@types/prettier": "2.6.0", "jest": "26.6.3", - "polywrap": "0.12.1", + "polywrap": "~0.12.1", "rimraf": "3.0.2", "ts-jest": "26.5.4", "ts-node": "10.9.1", diff --git a/packages/templates/wasm/assemblyscript/package.json b/packages/templates/wasm/assemblyscript/package.json index 5655b15996..a42c9031dd 100644 --- a/packages/templates/wasm/assemblyscript/package.json +++ b/packages/templates/wasm/assemblyscript/package.json @@ -17,7 +17,7 @@ "devDependencies": { "@types/jest": "26.0.8", "jest": "26.6.3", - "polywrap": "0.12.1", + "polywrap": "~0.12.1", "ts-jest": "26.5.4", "typescript": "4.9.5" }, diff --git a/packages/templates/wasm/golang/package.json b/packages/templates/wasm/golang/package.json index aa9a03750f..1c868f85f2 100644 --- a/packages/templates/wasm/golang/package.json +++ b/packages/templates/wasm/golang/package.json @@ -15,7 +15,7 @@ "devDependencies": { "@types/jest": "26.0.8", "jest": "26.6.3", - "polywrap": "0.12.1", + "polywrap": "~0.12.1", "ts-jest": "26.5.4", "typescript": "4.9.5" } diff --git a/packages/templates/wasm/interface/package.json b/packages/templates/wasm/interface/package.json index 679be83eef..9144c37a7d 100644 --- a/packages/templates/wasm/interface/package.json +++ b/packages/templates/wasm/interface/package.json @@ -2,6 +2,6 @@ "name": "templates-interface", "private": true, "dependencies": { - "polywrap": "~0.11.0" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/wasm/rust/Cargo.toml b/packages/templates/wasm/rust/Cargo.toml index a3a471c4ac..f369a277f2 100644 --- a/packages/templates/wasm/rust/Cargo.toml +++ b/packages/templates/wasm/rust/Cargo.toml @@ -10,12 +10,12 @@ edition = "2021" include = ["src"] [dependencies] -polywrap-wasm-rs = { version = "0.12.0" } -polywrap_msgpack_serde = "0.0.2-beta.7" +polywrap-wasm-rs = { version = "~0.12.1" } +polywrap_msgpack_serde = "0.0.2" serde = { version = "1.0", features = ["derive"] } [dev-dependencies] -polywrap = { version = "0.1.9-beta.2" } +polywrap = { version = "~0.1.10" } [lib] crate-type = ["cdylib"] diff --git a/packages/templates/wasm/rust/package.json b/packages/templates/wasm/rust/package.json index 8aec722df6..3c637a9a4c 100644 --- a/packages/templates/wasm/rust/package.json +++ b/packages/templates/wasm/rust/package.json @@ -7,12 +7,10 @@ "codegen": "npx polywrap codegen", "build": "npx polywrap build", "deploy": "npx polywrap deploy", - "test": "yarn test:e2e && yarn test:workflow", - "test:e2e": "yarn test:e2e:codegen && cargo test --release", - "test:e2e:codegen": "npx polywrap codegen -m ./tests/types/polywrap.app.yaml -g ./tests/types/wrap", - "test:workflow": "npx polywrap test" + "test": "yarn test:codegen && cargo test --release", + "test:codegen": "npx polywrap codegen -m ./tests/types/polywrap.app.yaml -g ./tests/types/wrap" }, "devDependencies": { - "polywrap": "0.12.1" + "polywrap": "~0.12.1" } } diff --git a/packages/templates/wasm/rust/polywrap.test.cue b/packages/templates/wasm/rust/polywrap.test.cue deleted file mode 100644 index 72c37000a6..0000000000 --- a/packages/templates/wasm/rust/polywrap.test.cue +++ /dev/null @@ -1,11 +0,0 @@ -package e2e - -sampleMethod: { - $0: { - data: { - value: "polywrap from sample_method" - }, - error?: _|_, - } -} - diff --git a/packages/templates/wasm/rust/polywrap.test.yaml b/packages/templates/wasm/rust/polywrap.test.yaml deleted file mode 100644 index c622bccd27..0000000000 --- a/packages/templates/wasm/rust/polywrap.test.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: template-wasm-rs -format: 0.1.0 -validation: "./polywrap.test.cue" -jobs: - sampleMethod: - steps: - - uri: fs/build - method: sampleMethod - args: - arg: "polywrap" diff --git a/packages/templates/wasm/rust/tests/it/module.rs b/packages/templates/wasm/rust/tests/it/module.rs index a738738bbc..33e83bc530 100644 --- a/packages/templates/wasm/rust/tests/it/module.rs +++ b/packages/templates/wasm/rust/tests/it/module.rs @@ -1,14 +1,14 @@ use crate::types::wrap::types::{ - TemplateModule, - TemplateModuleArgsSampleMethod + Template, + TemplateArgsSampleMethod }; #[test] fn sample_method() { - let args = TemplateModuleArgsSampleMethod { + let args = TemplateArgsSampleMethod { arg: "input data".to_string(), }; - let template: TemplateModule = TemplateModule::new(None, None, None); - let response = template.sample_method(&args, None, None, None).unwrap(); + let template: Template = Template::new(None); + let response = template.sample_method(&args, None).unwrap(); assert_eq!(response.result, "input data from sample_method"); } diff --git a/packages/templates/wasm/typescript/package.json b/packages/templates/wasm/typescript/package.json index 41a85158d2..1fd0295775 100644 --- a/packages/templates/wasm/typescript/package.json +++ b/packages/templates/wasm/typescript/package.json @@ -21,7 +21,7 @@ "@rollup/plugin-typescript": "^11.1.2", "@types/jest": "26.0.8", "jest": "26.6.3", - "polywrap": "0.12.1", + "polywrap": "~0.12.1", "rollup": "^3.28.0", "typescript": "^5.1.6" } diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/cmd.json b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/cmd.json new file mode 100644 index 0000000000..ea713fc43f --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/cmd.json @@ -0,0 +1,3 @@ +{ + "noWasm": true +} diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/expected/output.json b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/expected/output.json new file mode 100644 index 0000000000..8dc0b28594 --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/expected/output.json @@ -0,0 +1,3 @@ +[ + "wrap.info" +] \ No newline at end of file diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/expected/stdout.json b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/expected/stdout.json new file mode 100644 index 0000000000..22bc83fb95 --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/expected/stdout.json @@ -0,0 +1,6 @@ +{ + "stdout": [ + "WRAP manifest written in ./build" + ], + "exitCode": 0 +} diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/package.json b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/package.json new file mode 100644 index 0000000000..b42812c813 --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/package.json @@ -0,0 +1,15 @@ +{ + "name": "@polywrap/test-project", + "version": "0.1.0", + "license": "MIT", + "private": true, + "scripts": { + "build": "polywrap build" + }, + "dependencies": { + "@polywrap/wasm-as": "../../../../../../../wasm/as" + }, + "devDependencies": { + "assemblyscript": "0.19.23" + } +} diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/polywrap.build.yaml b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/polywrap.build.yaml new file mode 100644 index 0000000000..de1e44ebac --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/polywrap.build.yaml @@ -0,0 +1,9 @@ +format: 0.2.0 +strategies: + image: + node_version: "14.16.0" + include: + - ./package.json +linked_packages: + - name: "@polywrap/wasm-as" + path: ../../../../../../../wasm/as \ No newline at end of file diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/polywrap.yaml b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/polywrap.yaml new file mode 100644 index 0000000000..4461b4fad2 --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/polywrap.yaml @@ -0,0 +1,9 @@ +format: 0.5.0 +project: + name: test-project + type: wasm/assemblyscript +source: + module: ./src/index.ts + schema: ./src/schema.graphql +extensions: + build: ./polywrap.build.yaml \ No newline at end of file diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/src/index.ts b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/src/index.ts new file mode 100644 index 0000000000..96ded11d66 --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/src/index.ts @@ -0,0 +1,7 @@ +import { Args_method, ModuleBase } from "./wrap"; + +export class Module extends ModuleBase { + method(args: Args_method): string { + this fails to compile + } +} diff --git a/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/src/schema.graphql b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/src/schema.graphql new file mode 100644 index 0000000000..325e224971 --- /dev/null +++ b/packages/test-cases/cases/cli/build-cmd/wasm/assemblyscript/017-no-wasm/src/schema.graphql @@ -0,0 +1,5 @@ +type Module { + method( + arg: String! + ): String! +}