Skip to content

Commit

Permalink
Merge branch 'origin-dev' into nk/add-rs-app-template
Browse files Browse the repository at this point in the history
  • Loading branch information
dOrgJelli authored Sep 1, 2023
2 parents a269b7a + 02b2f34 commit d2a7610
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 96 deletions.
6 changes: 6 additions & 0 deletions packages/cli/src/lib/project/manifests/app/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const appManifestLanguages = {
"app/typescript": "app/typescript",
"app/python": "app/python",
"app/rust": "app/rust",
"app/kotlin": "app/kotlin",
"app/swift": "app/swift",
};

export type AppManifestLanguages = typeof appManifestLanguages;
Expand All @@ -28,6 +30,10 @@ export function appManifestLanguageToBindLanguage(
return "app-py";
case "app/rust":
return "app-rs";
case "app/kotlin":
return "app-kt";
case "app/swift":
return "app-swift";
default:
throw Error(
intlMsg.lib_language_unsupportedManifestLanguage({
Expand Down
11 changes: 8 additions & 3 deletions packages/templates/wasm/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
[package]
name = "template-wasm-rs"
name = "template_wasm_rs"
version = "0.1.0"
description = "A Polywrap Wasm wrapper template written in Rust"
authors = ["Polywrap"]
repository = "https://github.com/polywrap/monorepo"
license = "MIT"
edition = "2021"

include = ["src"]

[dependencies]
polywrap-wasm-rs = { version = "~0.11.0-pre.4" }
polywrap_msgpack_serde = "~0.0.2-beta.5"
polywrap-wasm-rs = { version = "~0.11.2" }
polywrap_msgpack_serde = "0.0.2-beta.7"
serde = { version = "1.0", features = ["derive"] }

[dev-dependencies]
polywrap = { version = "0.1.9-beta.2" }

[lib]
crate-type = ["cdylib"]

Expand Down
15 changes: 0 additions & 15 deletions packages/templates/wasm/rust/jest.config.js

This file was deleted.

10 changes: 3 additions & 7 deletions packages/templates/wasm/rust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@
"build": "npx polywrap build",
"deploy": "npx polywrap deploy",
"test": "yarn test:e2e && yarn test:workflow",
"test:e2e": "yarn test:e2e:codegen && jest --passWithNoTests --runInBand --verbose",
"test:e2e:codegen": "npx polywrap codegen -m ./src/__tests__/types/polywrap.app.yaml -g ./src/__tests__/types/wrap",
"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"
},
"devDependencies": {
"@types/jest": "26.0.8",
"jest": "26.6.3",
"polywrap": "0.11.2",
"ts-jest": "26.5.4",
"typescript": "4.9.5"
"polywrap": "0.11.2"
}
}
2 changes: 1 addition & 1 deletion packages/templates/wasm/rust/polywrap.test.cue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package e2e
sampleMethod: {
$0: {
data: {
value: "polywrap"
value: "polywrap from sample_method"
},
error?: _|_,
}
Expand Down
31 changes: 0 additions & 31 deletions packages/templates/wasm/rust/src/__tests__/e2e/integration.spec.ts

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion packages/templates/wasm/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub use wrap::*;
impl ModuleTrait for Module {
fn sample_method(args: ArgsSampleMethod) -> Result<SampleResult, String> {
return Ok(SampleResult {
result: args.arg
result: format!("{} from sample_method", args.arg),
});
}
}
1 change: 1 addition & 0 deletions packages/templates/wasm/rust/tests/it/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod module;
14 changes: 14 additions & 0 deletions packages/templates/wasm/rust/tests/it/module.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::types::wrap::types::{
TemplateModule,
TemplateModuleArgsSampleMethod
};

#[test]
fn sample_method() {
let args = TemplateModuleArgsSampleMethod {
arg: "input data".to_string(),
};
let template: TemplateModule = TemplateModule::new(None, None, None);
let response = template.sample_method(&args, None, None, None).unwrap();
assert_eq!(response.result, "input data from sample_method");
}
2 changes: 2 additions & 0 deletions packages/templates/wasm/rust/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mod it;
mod types;
1 change: 1 addition & 0 deletions packages/templates/wasm/rust/tests/types/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod wrap;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import * into Template from "fs/build"
6 changes: 6 additions & 0 deletions packages/templates/wasm/rust/tests/types/polywrap.app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
format: 0.3.0
project:
name: template-wasm-rs-app-types
type: app/rust
source:
schema: ./polywrap.app.graphql
28 changes: 0 additions & 28 deletions packages/templates/wasm/rust/tsconfig.json

This file was deleted.

0 comments on commit d2a7610

Please sign in to comment.