Skip to content

Split PolywrapProject into WasmProject and InterfaceProject #1363

@pileks

Description

@pileks

From @dOrgJelli’s comments on PR #1356:

  • There are 2 major architectural changes I think are needed to better support interfaces:
    1. We should split PolywrapProject into WasmProject & InterfaceProject.
    2. We should decouple the concept of generating the wrap.info from the Compiler, and use it for the build and codegen commands (see the comment in codegen.ts that says // HACK: ....

The logic for build should be something like this:

const project = createProject(manifest);
const supportedProject =
  project.isWasm() ||
  project.isPlugin() ||
  project.isInterface();

if (!supportedProject) {
  throw Error("Unsupported project type...");
}

// 1. Parse schema & build wrap.info
const schemaComposer = new SchemaComposer(...);
const infoCompiler = new WrapInfoCompiler(...);
infoCompiler.compile();

// 2, Compile wrap.wasm
if (project.isWasm()) {
  const wasmCompiler = new WrapWasmCompiler(...);
  wasmCompiler.compile();
}

And we can refine the semantics around the polywrap build and polywrap codegen commands. Basically, we shouldn't run codegen automatically when you run polywrap build, and we shouldn't generated the wrap.info file when you run polywrap codegen.

  • Plugin devs will need to run polywrap codegen for types & polywrap build for wrap.info the file.
  • Wasm devs will need to run polywrap codegen for types & polywrap build for wrap.info & wrap.wasm files.
  • Interface devs will need to run polywrap build for wrap.info file.
  • App devs will need to run polywrap codegen for types.

^^^ I guess this is the 3rd major architectural change :P

Originally posted by @dOrgJelli in #1356 (comment)

Related sub-tasks:

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions