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.7 kB 110 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## Local development 46 47To run the compiler tests. This will require a recent stable version of Rust, 48Erlang, NodeJS, Deno, and Bun to be installed. 49 50If you are using the Nix package manager, there's a [gleam-nix flake](https://github.com/vic/gleam-nix) 51you can use for running any Gleam version or quickly obtaining a development environment for Gleam. 52 53```shell 54cargo test 55 56# Or if you have watchexec installed you can run them automatically 57# when files change 58make test-watch 59``` 60 61To run the language integration tests. This will require a recent stable 62version of Rust, Erlang, and NodeJS to be installed. 63 64```shell 65make language-test 66``` 67 68If you don't have Rust or Cargo installed you can run the above command in a docker sandbox. 69Run the command below from this directory. 70 71```shell 72docker run -v $(pwd):/opt/app -it -w /opt/app rust:latest bash 73``` 74 75## Rust development 76 77Here are some tips and guidelines for writing Rust code in the Gleam compiler: 78 79The `GLEAM_LOG` environment variable can be used to cause the compiler to 80print more information for debugging and introspection. i.e. 81`GLEAM_LOG=trace`. 82 83### Clippy linter 84 85Your PR may fail on CI due to clippy errors. Clippy can be run locally like so: 86 87```shell 88cargo clean -p gleam 89cargo clippy 90``` 91 92If you have lint errors on CI but not locally upgrade your Rust version to the 93latest stable. 94 95```shell 96rustup upgrade stable 97``` 98 99## Cap'n Proto schema 100 101The compiler uses a Cap'n Proto schema to serialize/deserialize module information. 102Occasionally, the schema needs to change. After modifying `compiler-core/schema.capnp` 103you need to to re-generate `compiler-core/generated/schema_capnp.rs`. To do that, 104[install Cap'n Proto](https://capnproto.org/install.html) and un-comment appropriate lines 105in `compiler-core/build.rs`. Then you should be able to re-generate that file with: 106 107```shell 108cd compiler-core 109cargo build 110```