-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This corresponds to mustang revision 6acb264dd7e5e8908733d201de270c1e4dfb5e1e.
- Loading branch information
0 parents
commit 3c338a4
Showing
32 changed files
with
3,704 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# install-rust | ||
|
||
A small github action to install `rustup` and a Rust toolchain. This is | ||
generally expressed inline, but it was repeated enough in this repository it | ||
seemed worthwhile to extract. | ||
|
||
Some gotchas: | ||
|
||
* Can't `--self-update` on Windows due to permission errors (a bug in Github | ||
Actions) | ||
* `rustup` isn't installed on macOS (a bug in Github Actions) | ||
|
||
When the above are fixed we should delete this action and just use this inline: | ||
|
||
```yml | ||
- run: rustup update $toolchain && rustup default $toolchain | ||
shell: bash | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: 'Install Rust toolchain' | ||
description: 'Install both `rustup` and a Rust toolchain' | ||
|
||
inputs: | ||
toolchain: | ||
description: 'Default toolchan to install' | ||
required: false | ||
default: 'stable' | ||
|
||
runs: | ||
using: node16 | ||
main: 'main.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const child_process = require('child_process'); | ||
const toolchain = process.env.INPUT_TOOLCHAIN; | ||
const fs = require('fs'); | ||
|
||
function set_env(name, val) { | ||
fs.appendFileSync(process.env['GITHUB_ENV'], `${name}=${val}\n`) | ||
} | ||
|
||
// Needed for now to get 1.24.2 which fixes a bug in 1.24.1 that causes issues | ||
// on Windows. | ||
if (process.platform === 'win32') { | ||
child_process.execFileSync('rustup', ['self', 'update']); | ||
} | ||
|
||
child_process.execFileSync('rustup', ['set', 'profile', 'minimal']); | ||
child_process.execFileSync('rustup', ['update', toolchain, '--no-self-update']); | ||
child_process.execFileSync('rustup', ['default', toolchain]); | ||
|
||
// Deny warnings on CI to keep our code warning-free as it lands in-tree. Don't | ||
// do this on nightly though since there's a fair amount of warning churn there. | ||
// RUSTIX: Disable this so that it doesn't overwrite RUSTFLAGS for setting | ||
// "--cfg rustix_use_libc". We re-add it manually in the workflow. | ||
//if (!toolchain.startsWith('nightly')) { | ||
// set_env("RUSTFLAGS", "-D warnings"); | ||
//} | ||
|
||
// Save disk space by avoiding incremental compilation, and also we don't use | ||
// any caching so incremental wouldn't help anyway. | ||
set_env("CARGO_INCREMENTAL", "0"); | ||
|
||
// Turn down debuginfo from 2 to 1 to help save disk space | ||
set_env("CARGO_PROFILE_DEV_DEBUG", "1"); | ||
set_env("CARGO_PROFILE_TEST_DEBUG", "1"); | ||
|
||
if (process.platform === 'darwin') { | ||
set_env("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO", "unpacked"); | ||
set_env("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO", "unpacked"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
rustfmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- uses: ./.github/actions/install-rust | ||
with: | ||
toolchain: stable | ||
- run: cargo fmt --all -- --check | ||
|
||
# TODO: Add tests for origin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# This file tells tools we use rustfmt. We use the default settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
*Note*: this Code of Conduct pertains to individuals' behavior. Please also see the [Organizational Code of Conduct][OCoC]. | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the Bytecode Alliance CoC team at [report@bytecodealliance.org](mailto:report@bytecodealliance.org). The CoC team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The CoC team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the Bytecode Alliance's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[OCoC]: https://github.com/sunfishcode/origin/blob/main/ORG_CODE_OF_CONDUCT.md | ||
[homepage]: https://www.contributor-covenant.org | ||
[version]: https://www.contributor-covenant.org/version/1/4/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Short version for non-lawyers: | ||
|
||
`origin` is triple-licensed under Apache 2.0 with the LLVM Exception, | ||
Apache 2.0, and MIT terms. | ||
|
||
|
||
Longer version: | ||
|
||
Copyrights in the `origin` project are retained by their contributors. | ||
No copyright assignment is required to contribute to the `origin` | ||
project. | ||
|
||
Some files include code derived from Rust's `libstd`; see the comments in | ||
the code for details. | ||
|
||
Except as otherwise noted (below and/or in individual files), `origin` | ||
is licensed under: | ||
|
||
- the Apache License, Version 2.0, with the LLVM Exception | ||
<LICENSE-Apache-2.0_WITH_LLVM-exception> or | ||
<http://llvm.org/foundation/relicensing/LICENSE.txt> | ||
- the Apache License, Version 2.0 | ||
<LICENSE-APACHE> or | ||
<http://www.apache.org/licenses/LICENSE-2.0>, | ||
- or the MIT license | ||
<LICENSE-MIT> or | ||
<http://opensource.org/licenses/MIT>, | ||
|
||
at your option. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[package] | ||
name = "origin" | ||
version = "0.9.0" | ||
authors = [ | ||
"Dan Gohman <dev@sunfishcode.online>", | ||
] | ||
description = "Program startup and thread support written in Rust" | ||
documentation = "https://docs.rs/origin" | ||
license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" | ||
repository = "https://github.com/sunfishcode/origin" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
linux-raw-sys = { version = "0.4.3", default-features = false, features = ["general", "no_std"] } | ||
rustix = { version = "0.38.1", default-features = false, features = ["mm", "thread", "time", "runtime", "param", "process"] } | ||
bitflags = "1.3.0" | ||
memoffset = { version = "0.8.0", optional = true } | ||
log = { version = "0.4.14", default-features = false, optional = true } | ||
lock_api = { version = "0.4.7", features = ["nightly"] } | ||
|
||
# Optional logging backend. You can use any external logger, but using this | ||
# feature allows origin to initialize the logger before main, so that you can | ||
# see the log messages emitted before main is called. | ||
env_logger = { version = "0.10.0", optional = true } | ||
|
||
[target.'cfg(not(target_vendor = "mustang"))'.dependencies] | ||
libc = { version = "0.2.138", default-features = false } | ||
|
||
# Special dependencies used in rustc-dep-of-std mode. | ||
core = { version = "1.0.0", optional = true, package = "rustc-std-workspace-core" } | ||
alloc = { version = "1.0.0", optional = true, package = "rustc-std-workspace-alloc" } | ||
compiler_builtins = { version = '0.1.49', optional = true } | ||
|
||
[features] | ||
default = ["std", "threads", "log"] | ||
std = ["rustix/std"] | ||
set_thread_id = [] | ||
rustc-dep-of-std = [ | ||
"core", | ||
"alloc", | ||
"compiler_builtins", | ||
"linux-raw-sys/rustc-dep-of-std", | ||
"bitflags/rustc-dep-of-std", | ||
"libc/rustc-dep-of-std", | ||
] | ||
|
||
# Support for threads. | ||
threads = ["memoffset"] | ||
|
||
# Disable logging. | ||
max_level_off = ["log/max_level_off"] |
Oops, something went wrong.