Lotsss of comments
parent
68a13e58ed
commit
21f958d0fe
@ -1,27 +0,0 @@
|
||||
image: "rust:latest"
|
||||
|
||||
default:
|
||||
before_script:
|
||||
- rustc --version
|
||||
- cargo --version
|
||||
|
||||
stages:
|
||||
- test
|
||||
|
||||
lint-code:
|
||||
stage: test
|
||||
script:
|
||||
- rustup component add clippy
|
||||
- cargo clippy -- -D warnings
|
||||
|
||||
format-code:
|
||||
stage: test
|
||||
script:
|
||||
- rustup component add rustfmt
|
||||
- cargo fmt -- --check
|
||||
|
||||
audit-code:
|
||||
stage: test
|
||||
script:
|
||||
- cargo install cargo-audit
|
||||
- cargo audit
|
@ -1,28 +0,0 @@
|
||||
# Crystal Linux Contributing Guidelines
|
||||
|
||||
#### !! Always make sure to `git pull` before doing any work to avoid commit hell !!
|
||||
|
||||
### Pre-Commit Checks
|
||||
|
||||
- Make sure to `cargo fmt` your code before every commit push
|
||||
- Unless in specific edge cases, don't push code that doesn't pass `cargo check`
|
||||
- Try to correct any code with `cargo clippy` before you push
|
||||
|
||||
### Formatting
|
||||
|
||||
- UNIX line endings (LF instead of CRLF)
|
||||
- 4 spaces per TAB
|
||||
|
||||
### Good Practices
|
||||
|
||||
- Try to use .unwrap() as little as possible
|
||||
- Try to never use panic!() in production code, always try to have a possible way to resolve errors, even if it's just
|
||||
unwrap_or/_else()
|
||||
- Never use println!() or eprintln!() in finalised code. Using string functions (e.g. info() in Amethyst v3.0.0) is
|
||||
preferred
|
||||
- Compartmentalise as much as you can, avoid writing the exact same line of code 50 times if you can turn it into a
|
||||
function
|
||||
|
||||
### Examples of these guidelines in practice
|
||||
|
||||
- https://git.getcryst.al/crystal/ame/src/branch/rewrite
|
@ -1,46 +1,89 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
naersk = {
|
||||
url = "github:nix-community/naersk";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils, naersk }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
naersk-lib = naersk.lib."${system}";
|
||||
in rec
|
||||
{
|
||||
packages.amethyst = naersk-lib.buildPackage {
|
||||
pname = "ame";
|
||||
root = ./.;
|
||||
nativeBuildInputs = with pkgs; [
|
||||
openssl
|
||||
sqlite
|
||||
pkg-config
|
||||
];
|
||||
};
|
||||
|
||||
packages.default = packages.amethyst;
|
||||
|
||||
apps.amethyst = utils.lib.mkApp {
|
||||
drv = packages.amethyst;
|
||||
};
|
||||
|
||||
apps.default = apps.amethyst;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
rustfmt
|
||||
cargo-audit
|
||||
clippy
|
||||
openssl
|
||||
sqlite
|
||||
pkg-config
|
||||
];
|
||||
};
|
||||
});
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
naersk,
|
||||
fenix,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
toolchain = with fenix.packages."${system}";
|
||||
combine [
|
||||
minimal.rustc
|
||||
minimal.cargo
|
||||
targets.x86_64-pc-windows-gnu.latest.rust-std
|
||||
targets.x86_64-unknown-linux-gnu.latest.rust-std
|
||||
];
|
||||
naersk-lib = naersk.lib."${system}".override {
|
||||
cargo = toolchain;
|
||||
rustc = toolchain;
|
||||
};
|
||||
in rec
|
||||
{
|
||||
packages.amethyst = naersk-lib.buildPackage {
|
||||
pname = "Amethyst";
|
||||
root = ./.;
|
||||
};
|
||||
|
||||
packages.amethyst-win = naersk-lib.buildPackage {
|
||||
pname = "Amethyst";
|
||||
root = ./.;
|
||||
strictDeps = true;
|
||||
depsBuildBuild = with pkgs; [
|
||||
pkgsCross.mingwW64.stdenv.cc
|
||||
pkgsCross.mingwW64.windows.pthreads
|
||||
];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
(
|
||||
if system == "x86_64-linux"
|
||||
then wineWowPackages.stable
|
||||
else hello
|
||||
)
|
||||
];
|
||||
CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu";
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER = pkgs.writeScript "wine-wrapper" ''
|
||||
export WINEPREFIX="$(mktemp -d)"
|
||||
exec wine64 $@
|
||||
'';
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
packages.default = packages.amethyst;
|
||||
|
||||
apps.apod = utils.lib.mkApp {
|
||||
drv = packages.amethyst;
|
||||
};
|
||||
|
||||
apps.default = apps.amethyst;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
cargo-audit
|
||||
rustfmt
|
||||
clippy
|
||||
|
||||
openssl
|
||||
sqlite
|
||||
pkg-config
|
||||
];
|
||||
};
|
||||
|
||||
formatter = pkgs.alejandra;
|
||||
});
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let arg = &env::args().collect::<Vec<String>>()[0];
|
||||
|
||||
println!(
|
||||
"Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!",
|
||||
arg.split('/')
|
||||
.collect::<Vec<&str>>()
|
||||
.last()
|
||||
.unwrap()
|
||||
);
|
||||
std::process::exit(0);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let arg = &env::args().collect::<Vec<String>>()[0];
|
||||
|
||||
println!(
|
||||
"Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!",
|
||||
arg.split('/')
|
||||
.collect::<Vec<&str>>()
|
||||
.last()
|
||||
.unwrap()
|
||||
);
|
||||
std::process::exit(0);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let arg = &env::args().collect::<Vec<String>>()[0];
|
||||
|
||||
println!(
|
||||
"Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!",
|
||||
arg.split('/')
|
||||
.collect::<Vec<&str>>()
|
||||
.last()
|
||||
.unwrap()
|
||||
);
|
||||
std::process::exit(0);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let arg = &env::args().collect::<Vec<String>>()[0];
|
||||
|
||||
println!(
|
||||
"Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!",
|
||||
arg.split('/')
|
||||
.collect::<Vec<&str>>()
|
||||
.last()
|
||||
.unwrap()
|
||||
);
|
||||
std::process::exit(0);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let arg = &env::args().collect::<Vec<String>>()[0];
|
||||
|
||||
println!(
|
||||
"Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!",
|
||||
arg.split('/')
|
||||
.collect::<Vec<&str>>()
|
||||
.last()
|
||||
.unwrap()
|
||||
);
|
||||
std::process::exit(0);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
use std::env;
|
||||
|
||||
fn main() {
|
||||
let arg = &env::args().collect::<Vec<String>>()[0];
|
||||
|
||||
println!(
|
||||
"Sorry for the bother, we don't use \x1b[2;22;35m{}\x1b[0m on Crystal, we use \x1b[2;22;35mame\x1b[0m! Please use that instead!",
|
||||
arg.split('/')
|
||||
.collect::<Vec<&str>>()
|
||||
.last()
|
||||
.unwrap()
|
||||
);
|
||||
std::process::exit(0);
|
||||
}
|
Loading…
Reference in New Issue