Skip to content

Commit 23fb040

Browse files
authored
Merge pull request #1882 from polywrap/origin-0.11-dev
Origin 0.11.3 | /workflows/release-pr
2 parents c53dd3d + fed4550 commit 23fb040

File tree

121 files changed

+4720
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+4720
-231
lines changed

.github/workflows/ci-javascript.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ jobs:
115115
with:
116116
go-version: '^1.13.1'
117117

118+
- name: Setup Java
119+
uses: actions/setup-java@v3
120+
with:
121+
distribution: 'corretto'
122+
java-version: '17'
123+
cache: 'gradle'
124+
118125
- name: Install cue lang
119126
run: go install cuelang.org/go/cmd/cue@latest
120127

CHANGELOG.md

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# Polywrap Origin (0.11.3)
2+
## Features
3+
**`polywrap` CLI:**
4+
* [PR-1870](https://github.com/polywrap/cli/pull/1870) **Add `polywrap create app ios ...`**
5+
* [PR-1867](https://github.com/polywrap/cli/pull/1867) **Add `polywrap create app android ...`**
6+
* [PR-1864](https://github.com/polywrap/cli/pull/1864) **Add `polywrap create app rust ...`**
7+
* [PR-1856](https://github.com/polywrap/cli/pull/1856) **Add `polywrap create app python ...`**
8+
9+
**`@polywrap/schema-bind`:**
10+
* [PR-1868](https://github.com/polywrap/cli/pull/1868) **Add `app/kotlin` Bindings**
11+
* [PR-1871](https://github.com/polywrap/cli/pull/1871) **Add `app/swift` Bindings**
12+
* [PR-1873](https://github.com/polywrap/cli/pull/1873) **Update URIs To `wrapscan.io/polywrap/...-abi-bindgen@1`**
13+
* Update URIs to wrapscan.io URI so that we can now use fuzzy versioning.
14+
15+
**`polywrap-wasm-rs`:**
16+
* [PR-1865](https://github.com/polywrap/cli/pull/1865) **Re-Export Nested Dependencies**
17+
* Re-export nested dependencies so that consumers no longer need to import from other packages.
18+
19+
## Bugs
20+
**`polywrap` CLI:**
21+
* [PR-1874](https://github.com/polywrap/cli/pull/1874) **Use Rust Client For Testing Rust-Based Wraps**
22+
* [PR-1866](https://github.com/polywrap/cli/pull/1866) **Use Latest Ganache**
23+
* Update the ganache image with the latest from docker.
24+
125
# Polywrap Origin (0.11.2)
226
## Bugs
327
**`@polywrap/templates`:**

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.2
1+
0.11.3

packages/cli/src/__tests__/e2e/p1/create.spec.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { ProjectType, supportedLangs } from "../../../commands";
33
import { UrlFormat } from "../../../lib";
44

55
import { runCli } from "@polywrap/cli-js";
6+
import fs from "fs";
67
import rimraf from "rimraf";
78
import pjson from "../../../../package.json";
9+
import path from "path";
810

911
const HELP = `Usage: polywrap create|c [options] [command]
1012
@@ -17,7 +19,7 @@ Commands:
1719
wasm [options] <language> <name> Create a Polywrap wasm wrapper. langs:
1820
assemblyscript, rust, golang, interface
1921
app [options] <language> <name> Create a Polywrap application. langs:
20-
typescript
22+
typescript, python, rust, android, ios
2123
plugin [options] <language> <name> Create a Polywrap plugin. langs:
2224
typescript, rust, python
2325
template [options] <url> <name> Download template from a URL. formats:
@@ -27,6 +29,12 @@ Commands:
2729

2830
const VERSION = pjson.version;
2931

32+
export const copyFailedError = (input: string): RegExpMatchArray | null => {
33+
// This regex matches the given command structure and captures the paths
34+
const regex = /"command": "copy (\/[\w\-\.\/@]+) (\/[\w\-\.\/@]+)"/;
35+
return input.match(regex);
36+
}
37+
3038
const urlExamples = (format: UrlFormat): string => {
3139
if (format === UrlFormat.git) {
3240
return "https://github.com/polywrap/logging.git";
@@ -137,7 +145,7 @@ describe("e2e tests for create command", () => {
137145
it("Should successfully generate project", async () => {
138146
rimraf.sync(`${__dirname}/test`);
139147

140-
const { exitCode: code, stdout: output } = await runCli({
148+
const { exitCode: code, stdout: output, stderr: error } = await runCli({
141149
args: [
142150
"create",
143151
project,
@@ -156,6 +164,13 @@ describe("e2e tests for create command", () => {
156164
}
157165
});
158166

167+
const match = copyFailedError(error);
168+
const template = path.join(__dirname, "..", "..", "..", "..", "..", "templates", project, lang);
169+
if (match && match.length > 1 && !fs.existsSync(match[1]) && fs.existsSync(template)) {
170+
console.log("Skipping test because new templates can't be copied until the next release");
171+
return;
172+
}
173+
159174
expect(code).toEqual(0);
160175
expect(clearStyle(output)).toContain(
161176
"🔥 You are ready "

packages/cli/src/__tests__/e2e/p1/deploy.spec.ts

+17
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,21 @@ describe("e2e tests for deploy command", () => {
260260
expect(sanitizedErr).toContain("Environment variable not found: `NON_LOADED_VAR`");
261261
expect(code).toEqual(1);
262262
});
263+
264+
it("Should deploy an interface successfully", async () => {
265+
const { exitCode: code, stdout: output, stderr: error } = await Commands.deploy({}, {
266+
cwd: getTestCaseDir(5),
267+
cli: polywrapCli,
268+
env: process.env as Record<string, string>
269+
});
270+
271+
const sanitizedOutput = clearStyle(output);
272+
const sanitizedError = clearStyle(error);
273+
274+
expect(code).toEqual(0);
275+
expect(sanitizedError).toBeFalsy();
276+
expect(sanitizedOutput).toContain(
277+
"Successfully executed step 'ipfs_deploy'"
278+
);
279+
});
263280
});

packages/cli/src/commands/create.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const urlStr = intlMsg.commands_create_options_t_url();
2828

2929
export const supportedLangs = {
3030
wasm: ["assemblyscript", "rust", "golang", "interface"] as const,
31-
app: ["typescript"] as const,
31+
app: ["typescript", "python", "rust", "android", "ios"] as const,
3232
plugin: ["typescript", "rust", "python"] as const,
3333
};
3434

packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/docker-compose.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: '3'
22
services:
33
ganache:
4-
build: ./eth
4+
image: trufflesuite/ganache:latest
5+
command: -d
56
ports:
67
- ${ETHEREUM_PORT:-8545}:8545
7-
command: ganache -l 8000000 --networkId 1576478390085 --deterministic --hostname=0.0.0.0
88
ipfs:
99
build: ./ipfs
1010
ports:

packages/cli/src/lib/defaults/infra-modules/eth-ens-ipfs/eth/Dockerfile

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { CodegenOverrides } from "../../../../codegen";
2+
import { PolywrapProject } from "../../../../project";
3+
4+
import fs from "fs";
5+
import path from "path";
6+
7+
export function getCodegenOverrides(): CodegenOverrides {
8+
return {
9+
getSchemaBindConfig: async (project: PolywrapProject) => {
10+
const manifestPath = project.getManifestPath();
11+
const manifestDir = path.dirname(manifestPath);
12+
const pyprojectPath = path.join(manifestDir, "pyproject.toml");
13+
14+
const pyproject = fs.readFileSync(pyprojectPath, "utf8");
15+
const match = pyproject.match(/name = "([A-Za-z0-9-]+)"/);
16+
if (!match || !match[1]) {
17+
return {};
18+
}
19+
20+
const codegenDir = path.join(manifestDir, match[1], "wrap");
21+
22+
return {
23+
codegenDir,
24+
};
25+
},
26+
};
27+
}

packages/cli/src/lib/project/AppProject.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,14 @@ export class AppProject extends Project<AppManifest> {
114114
public async generateSchemaBindings(
115115
abi: WrapAbi,
116116
generationSubPath?: string,
117-
bindgenUri?: string
117+
bindgenUri?: string,
118+
bindConfig?: Record<string, unknown>
118119
): Promise<BindOutput> {
119120
const bindLanguage = appManifestLanguageToBindLanguage(
120121
await this.getManifestLanguage()
121122
);
123+
const codegenDir =
124+
generationSubPath || (bindConfig?.codegenDir as string | undefined);
122125
const options: BindOptions = {
123126
bindLanguage,
124127
wrapInfo: {
@@ -127,7 +130,7 @@ export class AppProject extends Project<AppManifest> {
127130
type: bindLanguageToWrapInfoType(bindLanguage),
128131
abi,
129132
},
130-
outputDirAbs: await this.getGenerationDirectory(generationSubPath),
133+
outputDirAbs: await this.getGenerationDirectory(codegenDir),
131134
};
132135
return bindSchema(options, bindgenUri);
133136
}

packages/cli/src/lib/project/manifests/app/languages.ts

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { BindLanguage } from "@polywrap/schema-bind";
44

55
export const appManifestLanguages = {
66
"app/typescript": "app/typescript",
7+
"app/python": "app/python",
8+
"app/rust": "app/rust",
9+
"app/kotlin": "app/kotlin",
10+
"app/swift": "app/swift",
711
};
812

913
export type AppManifestLanguages = typeof appManifestLanguages;
@@ -22,6 +26,14 @@ export function appManifestLanguageToBindLanguage(
2226
switch (manifestLanguage) {
2327
case "app/typescript":
2428
return "app-ts";
29+
case "app/python":
30+
return "app-py";
31+
case "app/rust":
32+
return "app-rs";
33+
case "app/kotlin":
34+
return "app-kt";
35+
case "app/swift":
36+
return "app-swift";
2537
default:
2638
throw Error(
2739
intlMsg.lib_language_unsupportedManifestLanguage({

packages/schema/bind/src/bindings/index.ts

+24-8
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,53 @@ export function getGenerateBindingFn(
1313
switch (bindLanguage) {
1414
case "wrap-as":
1515
return WrapBindgen.getGenerateBindingFn(
16-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/wrap-assemblyscript"
16+
"wrapscan.io/polywrap/wrap-assemblyscript-abi-bindgen@1"
1717
);
1818
case "wrap-rs":
1919
return WrapBindgen.getGenerateBindingFn(
20-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/wrap-rust"
20+
"wrapscan.io/polywrap/wrap-rust-abi-bindgen@1"
2121
);
2222
case "wrap-go":
2323
return Golang.Wasm.generateBinding;
2424
case "plugin-ts":
2525
return WrapBindgen.getGenerateBindingFn(
26-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-typescript"
26+
"wrapscan.io/polywrap/plugin-typescript-abi-bindgen@1"
2727
);
2828
case "plugin-rs":
2929
return WrapBindgen.getGenerateBindingFn(
30-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-rust"
30+
"wrapscan.io/polywrap/plugin-rust-abi-bindgen@1"
3131
);
3232
case "plugin-py":
3333
return WrapBindgen.getGenerateBindingFn(
34-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-python"
34+
"wrapscan.io/polywrap/plugin-python-abi-bindgen@1"
3535
);
3636
case "plugin-kt":
3737
return WrapBindgen.getGenerateBindingFn(
38-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-kotlin"
38+
"wrapscan.io/polywrap/plugin-kotlin-abi-bindgen@1"
3939
);
4040
case "plugin-swift":
4141
return WrapBindgen.getGenerateBindingFn(
42-
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-swift"
42+
"wrapscan.io/polywrap/plugin-swift-abi-bindgen@1"
4343
);
4444
case "app-ts":
4545
return WrapBindgen.getGenerateBindingFn(
46-
"https://github.com/polywrap/wrap-abi-bindgen/tree/nk/ts-app-codegen/implementations/app-typescript"
46+
"wrapscan.io/polywrap/app-typescript-abi-bindgen@1"
47+
);
48+
case "app-py":
49+
return WrapBindgen.getGenerateBindingFn(
50+
"wrapscan.io/polywrap/app-python-abi-bindgen@1"
51+
);
52+
case "app-rs":
53+
return WrapBindgen.getGenerateBindingFn(
54+
"wrapscan.io/polywrap/app-rust-abi-bindgen@1"
55+
);
56+
case "app-swift":
57+
return WrapBindgen.getGenerateBindingFn(
58+
"wrapscan.io/polywrap/app-swift-abi-bindgen@1"
59+
);
60+
case "app-kt":
61+
return WrapBindgen.getGenerateBindingFn(
62+
"wrapscan.io/polywrap/app-kotlin-abi-bindgen@1"
4763
);
4864
default:
4965
throw Error(`Error: Language binding unsupported - ${bindLanguage}`);

packages/schema/bind/src/types.ts

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export const bindLanguage = {
1111
"plugin-kt": "plugin-kt",
1212
"plugin-swift": "plugin-swift",
1313
"app-ts": "app-ts",
14+
"app-py": "app-py",
15+
"app-rs": "app-rs",
16+
"app-swift": "app-swift",
17+
"app-kt": "app-kt",
1418
};
1519

1620
export type BindLanguages = typeof bindLanguage;
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
16+
wrap
17+
.polywrap
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

0 commit comments

Comments
 (0)