Week 1: Contribution Baseline

Summary

Date: 2020-03-16 to 2020-03-21

  • Amethyst compiles to a WASM library.
  • Repository forks and branches are created.
  • Contribution guide is written.
  • Basic CI check is set up.
RepositoryCommit Range
pong_wasm9b403f69^..9f6240fe
amethyst8044b2a5^..0af12f84
rendy27e5cdc1^..757c4aa9
glutin (fork)f29d87a3
gfx-rs (fork)3e6db5f0
winit (fork)26e4374a^..04225a39
builder (CI agent)13730efd^..2bb67aae

End Result

$ wasm-pack build -- --features "wasm gl"
# ..
[INFO]: :-) Done in 37.87s
[INFO]: :-) Your wasm pkg is ready to publish at ./pkg.

Implementation

Based off the #2040 branch, which has the changes to use the new winit event loop introduced in winit 0.20.0.

  1. Get amethyst to compile with winit 0.22.0 for better WASM support. (winit#1478)

  2. Attempt to compile amethyst with wasm-pack.

    Instructions from https://rustwasm.github.io/docs/book/ were followed to package the library.

    When building with:

    wasm-pack build --target no-modules -- --features "wasm gl"
    
    • If it fails due to usage of a -sys library, feature gate the dependency and the code that uses it.

    • If it fails and requires a code change:

      1. Fork the repository.
      2. Create a wasm branch.
      3. Amend the code.
      4. Point amethyst at the forked repository.
      5. Make a pull request back to the original repository.

    Repeat until wasm-pack succeeds.

  3. Create end-to-end application, and make sure it compiles: pong_wasm.

  4. Write contribution guidelines. (amethyst#2171)

    Make it easy:

    • Links to all forks and branches.
    • Cut and paste commands.
    • Setup and development instructions.
  5. Create CI job to build amethyst as a WASM library. (amethyst#2175)

    Note: CI agent needs wasm32-unknown-unknown target, and rust-src component.

  6. Publicise the WASM effort on the community forum and chat server.