Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

gleam / CONTRIBUTING.md
3.9 kB 116 lines
1# Contributing to Gleam 2 3Thanks for contributing to Gleam! 4 5Before continuing please read our [code of conduct][code-of-conduct] which all 6contributors are expected to adhere to. 7 8[code-of-conduct]: https://github.com/gleam-lang/gleam/blob/main/CODE_OF_CONDUCT.md 9 10 11## Contributing bug reports 12 13If you have found a bug in Gleam please check to see if there is an open 14ticket for this problem on [our GitHub issue tracker][issues]. If you cannot 15find an existing ticket for the bug please open a new one. 16 17[issues]: https://github.com/gleam-lang/gleam/issues 18 19A bug may be a technical problem such as a compiler crash or an incorrect 20return value from a library function, or a user experience issue such as 21unclear or absent documentation. If you are unsure if your problem is a bug 22please open a ticket and we will work it out together. 23 24 25## Contributing code changes 26 27Before working on code it is suggested that you read the 28[docs/compiler/README.md](docs/compiler/README.md) file. 29It outlines fundamental components and design of this project. 30 31Code changes to Gleam are welcomed via the process below. 32 331. Find or open a GitHub issue relevant to the change you wish to make and 34 comment saying that you wish to work on this issue. If the change 35 introduces new functionality or behaviour this would be a good time to 36 discuss the details of the change to ensure we are in agreement as to how 37 the new functionality should work. 382. Open a GitHub pull request with your changes and ensure the tests and build 39 pass on CI. 403. A Gleam team member will review the changes and may provide feedback to 41 work on. Depending on the change there may be multiple rounds of feedback. 424. Once the changes have been approved the code will be rebased into the 43 `main` branch. 44 45## Hacking on Gleam in Gitpod 46 47If you have a web browser, you can get a fully pre-configured Gleam development environment in one click: 48 49[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/gleam-lang/gleam) 50 51## Local development 52 53To run the compiler tests. This will require a recent stable version of Rust 54to be installed. 55 56If you are using the Nix package manager, there's a [gleam-nix flake](https://github.com/vic/gleam-nix) 57you can use for running any Gleam version or quickly obtaining a development environment for Gleam. 58 59```shell 60cargo test 61 62# Or if you have watchexec installed you can run them automatically 63# when files change 64make test-watch 65``` 66 67To run the language integration tests. This will require a recent stable 68version of Rust, Erlang, and NodeJS to be installed. 69 70```shell 71make language-test 72``` 73 74If you don't have Rust or Cargo installed you can run the above command in a docker sandbox. 75Run the command below from this directory. 76 77```shell 78docker run -v $(pwd):/opt/app -it -w /opt/app rust:latest bash 79``` 80 81## Rust development 82 83Here are some tips and guidelines for writing Rust code in the Gleam compiler: 84 85The `GLEAM_LOG` environment variable can be used to cause the compiler to 86print more information for debugging and introspection. i.e. 87`GLEAM_LOG=trace`. 88 89### Clippy linter 90 91Your PR may fail on CI due to clippy errors. Clippy can be run locally like so: 92 93```shell 94cargo clean -p gleam 95cargo clippy 96``` 97 98If you have lint errors on CI but not locally upgrade your Rust version to the 99latest stable. 100 101```shell 102rustup upgrade stable 103``` 104 105## Cap'n Proto schema 106 107The compiler uses a Cap'n Proto schema to serialize/deserialize module information. 108Occasionally, the schema needs to change. After modifying `compiler-core/schema.capnp` 109you need to to re-generate `compiler-core/generated/schema_capnp.rs`. To do that, 110[install Cap'n Proto](https://capnproto.org/install.html) and un-comment appropriate lines 111in `compiler-core/build.rs`. Then you should be able to re-generate that file with: 112 113```shell 114cd compiler-core 115cargo build 116```