Skip to content

Commit

Permalink
Merge pull request #1882 from polywrap/origin-0.11-dev
Browse files Browse the repository at this point in the history
Origin 0.11.3 | /workflows/release-pr
  • Loading branch information
dOrgJelli authored Sep 1, 2023
2 parents c53dd3d + fed4550 commit 23fb040
Show file tree
Hide file tree
Showing 121 changed files with 4,720 additions and 231 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci-javascript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ jobs:
with:
go-version: '^1.13.1'

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
cache: 'gradle'

- name: Install cue lang
run: go install cuelang.org/go/cmd/cue@latest

Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# Polywrap Origin (0.11.3)
## Features
**`polywrap` CLI:**
* [PR-1870](https://github.com/polywrap/cli/pull/1870) **Add `polywrap create app ios ...`**
* [PR-1867](https://github.com/polywrap/cli/pull/1867) **Add `polywrap create app android ...`**
* [PR-1864](https://github.com/polywrap/cli/pull/1864) **Add `polywrap create app rust ...`**
* [PR-1856](https://github.com/polywrap/cli/pull/1856) **Add `polywrap create app python ...`**

**`@polywrap/schema-bind`:**
* [PR-1868](https://github.com/polywrap/cli/pull/1868) **Add `app/kotlin` Bindings**
* [PR-1871](https://github.com/polywrap/cli/pull/1871) **Add `app/swift` Bindings**
* [PR-1873](https://github.com/polywrap/cli/pull/1873) **Update URIs To `wrapscan.io/polywrap/...-abi-bindgen@1`**
* Update URIs to wrapscan.io URI so that we can now use fuzzy versioning.

**`polywrap-wasm-rs`:**
* [PR-1865](https://github.com/polywrap/cli/pull/1865) **Re-Export Nested Dependencies**
* Re-export nested dependencies so that consumers no longer need to import from other packages.

## Bugs
**`polywrap` CLI:**
* [PR-1874](https://github.com/polywrap/cli/pull/1874) **Use Rust Client For Testing Rust-Based Wraps**
* [PR-1866](https://github.com/polywrap/cli/pull/1866) **Use Latest Ganache**
* Update the ganache image with the latest from docker.

# Polywrap Origin (0.11.2)
## Bugs
**`@polywrap/templates`:**
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.2
0.11.3
19 changes: 17 additions & 2 deletions packages/cli/src/__tests__/e2e/p1/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { ProjectType, supportedLangs } from "../../../commands";
import { UrlFormat } from "../../../lib";

import { runCli } from "@polywrap/cli-js";
import fs from "fs";
import rimraf from "rimraf";
import pjson from "../../../../package.json";
import path from "path";

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

const VERSION = pjson.version;

export const copyFailedError = (input: string): RegExpMatchArray | null => {
// This regex matches the given command structure and captures the paths
const regex = /"command": "copy (\/[\w\-\.\/@]+) (\/[\w\-\.\/@]+)"/;
return input.match(regex);
}

const urlExamples = (format: UrlFormat): string => {
if (format === UrlFormat.git) {
return "https://github.com/polywrap/logging.git";
Expand Down Expand Up @@ -137,7 +145,7 @@ describe("e2e tests for create command", () => {
it("Should successfully generate project", async () => {
rimraf.sync(`${__dirname}/test`);

const { exitCode: code, stdout: output } = await runCli({
const { exitCode: code, stdout: output, stderr: error } = await runCli({
args: [
"create",
project,
Expand All @@ -156,6 +164,13 @@ describe("e2e tests for create command", () => {
}
});

const match = copyFailedError(error);
const template = path.join(__dirname, "..", "..", "..", "..", "..", "templates", project, lang);
if (match && match.length > 1 && !fs.existsSync(match[1]) && fs.existsSync(template)) {
console.log("Skipping test because new templates can't be copied until the next release");
return;
}

expect(code).toEqual(0);
expect(clearStyle(output)).toContain(
"🔥 You are ready "
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/__tests__/e2e/p1/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,21 @@ describe("e2e tests for deploy command", () => {
expect(sanitizedErr).toContain("Environment variable not found: `NON_LOADED_VAR`");
expect(code).toEqual(1);
});

it("Should deploy an interface successfully", async () => {
const { exitCode: code, stdout: output, stderr: error } = await Commands.deploy({}, {
cwd: getTestCaseDir(5),
cli: polywrapCli,
env: process.env as Record<string, string>
});

const sanitizedOutput = clearStyle(output);
const sanitizedError = clearStyle(error);

expect(code).toEqual(0);
expect(sanitizedError).toBeFalsy();
expect(sanitizedOutput).toContain(
"Successfully executed step 'ipfs_deploy'"
);
});
});
2 changes: 1 addition & 1 deletion packages/cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const urlStr = intlMsg.commands_create_options_t_url();

export const supportedLangs = {
wasm: ["assemblyscript", "rust", "golang", "interface"] as const,
app: ["typescript"] as const,
app: ["typescript", "python", "rust", "android", "ios"] as const,
plugin: ["typescript", "rust", "python"] as const,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: '3'
services:
ganache:
build: ./eth
image: trufflesuite/ganache:latest
command: -d
ports:
- ${ETHEREUM_PORT:-8545}:8545
command: ganache -l 8000000 --networkId 1576478390085 --deterministic --hostname=0.0.0.0
ipfs:
build: ./ipfs
ports:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { CodegenOverrides } from "../../../../codegen";
import { PolywrapProject } from "../../../../project";

import fs from "fs";
import path from "path";

export function getCodegenOverrides(): CodegenOverrides {
return {
getSchemaBindConfig: async (project: PolywrapProject) => {
const manifestPath = project.getManifestPath();
const manifestDir = path.dirname(manifestPath);
const pyprojectPath = path.join(manifestDir, "pyproject.toml");

const pyproject = fs.readFileSync(pyprojectPath, "utf8");
const match = pyproject.match(/name = "([A-Za-z0-9-]+)"/);
if (!match || !match[1]) {
return {};
}

const codegenDir = path.join(manifestDir, match[1], "wrap");

return {
codegenDir,
};
},
};
}
7 changes: 5 additions & 2 deletions packages/cli/src/lib/project/AppProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ export class AppProject extends Project<AppManifest> {
public async generateSchemaBindings(
abi: WrapAbi,
generationSubPath?: string,
bindgenUri?: string
bindgenUri?: string,
bindConfig?: Record<string, unknown>
): Promise<BindOutput> {
const bindLanguage = appManifestLanguageToBindLanguage(
await this.getManifestLanguage()
);
const codegenDir =
generationSubPath || (bindConfig?.codegenDir as string | undefined);
const options: BindOptions = {
bindLanguage,
wrapInfo: {
Expand All @@ -127,7 +130,7 @@ export class AppProject extends Project<AppManifest> {
type: bindLanguageToWrapInfoType(bindLanguage),
abi,
},
outputDirAbs: await this.getGenerationDirectory(generationSubPath),
outputDirAbs: await this.getGenerationDirectory(codegenDir),
};
return bindSchema(options, bindgenUri);
}
Expand Down
12 changes: 12 additions & 0 deletions packages/cli/src/lib/project/manifests/app/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { BindLanguage } from "@polywrap/schema-bind";

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 @@ -22,6 +26,14 @@ export function appManifestLanguageToBindLanguage(
switch (manifestLanguage) {
case "app/typescript":
return "app-ts";
case "app/python":
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
32 changes: 24 additions & 8 deletions packages/schema/bind/src/bindings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,53 @@ export function getGenerateBindingFn(
switch (bindLanguage) {
case "wrap-as":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/wrap-assemblyscript"
"wrapscan.io/polywrap/wrap-assemblyscript-abi-bindgen@1"
);
case "wrap-rs":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/wrap-rust"
"wrapscan.io/polywrap/wrap-rust-abi-bindgen@1"
);
case "wrap-go":
return Golang.Wasm.generateBinding;
case "plugin-ts":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-typescript"
"wrapscan.io/polywrap/plugin-typescript-abi-bindgen@1"
);
case "plugin-rs":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-rust"
"wrapscan.io/polywrap/plugin-rust-abi-bindgen@1"
);
case "plugin-py":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-python"
"wrapscan.io/polywrap/plugin-python-abi-bindgen@1"
);
case "plugin-kt":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-kotlin"
"wrapscan.io/polywrap/plugin-kotlin-abi-bindgen@1"
);
case "plugin-swift":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/wrap-0.1/implementations/plugin-swift"
"wrapscan.io/polywrap/plugin-swift-abi-bindgen@1"
);
case "app-ts":
return WrapBindgen.getGenerateBindingFn(
"https://github.com/polywrap/wrap-abi-bindgen/tree/nk/ts-app-codegen/implementations/app-typescript"
"wrapscan.io/polywrap/app-typescript-abi-bindgen@1"
);
case "app-py":
return WrapBindgen.getGenerateBindingFn(
"wrapscan.io/polywrap/app-python-abi-bindgen@1"
);
case "app-rs":
return WrapBindgen.getGenerateBindingFn(
"wrapscan.io/polywrap/app-rust-abi-bindgen@1"
);
case "app-swift":
return WrapBindgen.getGenerateBindingFn(
"wrapscan.io/polywrap/app-swift-abi-bindgen@1"
);
case "app-kt":
return WrapBindgen.getGenerateBindingFn(
"wrapscan.io/polywrap/app-kotlin-abi-bindgen@1"
);
default:
throw Error(`Error: Language binding unsupported - ${bindLanguage}`);
Expand Down
4 changes: 4 additions & 0 deletions packages/schema/bind/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export const bindLanguage = {
"plugin-kt": "plugin-kt",
"plugin-swift": "plugin-swift",
"app-ts": "app-ts",
"app-py": "app-py",
"app-rs": "app-rs",
"app-swift": "app-swift",
"app-kt": "app-kt",
};

export type BindLanguages = typeof bindLanguage;
Expand Down
17 changes: 17 additions & 0 deletions packages/templates/app/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
wrap
.polywrap
1 change: 1 addition & 0 deletions packages/templates/app/android/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading

0 comments on commit 23fb040

Please sign in to comment.