PolymerLabs / arcs

Arcs
BSD 3-Clause "New" or "Revised" License
57 stars 35 forks source link

Remove references to 'bazel-bin/out' in manifests #3666

Open piotrswigon opened 4 years ago

piotrswigon commented 4 years ago

Bazel outputs binary artefacts it creates to 'bazel-bin' directory at the root the project.

This means that the Arcs manifests need to contain the path to themselves when declaring a wasm particle. E.g.

in a/b/c/d/Examples.arcs

particle Watcher in 'https://$arcs/bazel-bin/a/b/c/d/Watcher.wasm'
  consume root
  in [Product] bar

This is suboptimal. Some obvious problems:

  1. One cannot rename directories or move files around without breaking manifests.
  2. Repetition is error prone - it is likely the developer with get the path wrong.
  3. It is cumbersome to write.

We should investigate at least something like:

particle Watcher in '$build/Watcher.wasm'
  consume root
  in [Product] bar

The `$build' macro should expand to the relative path of the manifest it is used in.

The solution of this problem should also fix the same problem happening in the internal google repo.

piotrswigon commented 4 years ago

The solution we agreed on with @csilvestrini:

For the above example the arcs manifest will reference:

particle Watcher in 'Watcher.wasm'
  consume root
  in [Product] bar

At the time of the development it is the job of a dev-server to map paths to .wasm files into the build directory, and at the time of preparing a deployment package (e.g. an APK file) it is a job of the build tooling to place the WASM modules in the corresponding directory, so that the Arcs manifest path matches.

piotrswigon commented 4 years ago

This is blocking #3819, so it becomes P1 as well.

piotrswigon commented 4 years ago

It will not happen in the dev server - we will do the resolution in the loader instead.