Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #323 from curiousleo/prepare-1.0
Browse files Browse the repository at this point in the history
Prepare 1.0 release
  • Loading branch information
grahamc authored Feb 4, 2020
2 parents 7ab1e29 + aa7a343 commit 88c680c
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 97 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

146 changes: 73 additions & 73 deletions Cargo.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[package]
name = "lorri"
version = "0.1.0"
# lorri uses a MAJOR.MINOR versioning scheme, see MAINTAINERS.md for details.
# Cargo requires MAJOR.MINOR.PATCH. So we translate lorri's versioning scheme
# to MAJOR.MINOR.0, i.e. the PATCH part is always zero.
version = "1.0.0" # Format: MAJOR.MINOR.0
authors = [
"Graham Christensen <[email protected]>",
]
Expand Down
36 changes: 18 additions & 18 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
//! build.rs is used to generate code at build time, which is then
//! imported elsewhere. This file is understood and executed by cargo.
use std::env;
use std::fs::File;
use std::io::Write;
use std::fs;
use std::path::Path;

/// write out to a build_rev.rs file, which contains generated
/// code containing information about the built version.
/// build_rev.rs is included in src/lib.rs.
/// Write version information to $OUT_DIR/build_rev.rs, which is included in src/lib.rs.
fn main() {
println!("cargo:rerun-if-env-changed=BUILD_REV_COUNT");
println!("cargo:rerun-if-env-changed=RUN_TIME_CLOSURE");
println!("cargo:rerun-if-changed=build.rs");
// OUT_DIR is set by cargo:
// https://doc.rust-lang.org/cargo/reference/environment-variables.html
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("build_rev.rs");
let mut f = File::create(&dest_path).unwrap();

let rev_count = env::var("BUILD_REV_COUNT")
.expect("BUILD_REV_COUNT not set, please reload nix-shell")
.parse::<usize>()
.expect("BUILD_REV_COUNT should be parsable as usize");
.expect("BUILD_REV_COUNT should be parseable as usize");

let run_time_closure =
env::var("RUN_TIME_CLOSURE").expect("RUN_TIME_CLOSURE not set, please reload nix-shell");

f.write_all(
fs::write(
// cargo sets OUT_DIR: https://doc.rust-lang.org/cargo/reference/environment-variables.html
Path::new(&env::var("OUT_DIR").unwrap()).join("build_rev.rs"),
format!(
r#"
/// lorri version in MAJOR.MINOR format.
pub const LORRI_VERSION: &str = "{major}.{minor}";
/// Number of revisions in the Git tree.
pub const VERSION_BUILD_REV: usize = {};
pub const VERSION_BUILD_REV: usize = {rev_count};
/// Run-time closure parameters. This argument points to a file
/// generated by ./nix/runtime.nix in Lorri's source.
pub const RUN_TIME_CLOSURE: &str = "{}";
pub const RUN_TIME_CLOSURE: &str = "{runtime_closure}";
"#,
rev_count, run_time_closure
// cargo sets CARGO_PKG_VERSION_MAJOR and CARGO_PKG_VERSION_MINOR:
// https://doc.rust-lang.org/cargo/reference/environment-variables.html
major = env::var("CARGO_PKG_VERSION_MAJOR").unwrap(),
minor = env::var("CARGO_PKG_VERSION_MINOR").unwrap(),
rev_count = rev_count,
runtime_closure = env::var("RUN_TIME_CLOSURE")
.expect("RUN_TIME_CLOSURE not set, please reload nix-shell"),
)
.as_bytes(),
)
Expand Down
6 changes: 3 additions & 3 deletions nix/nixpkgs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"url": "https://github.com/nixos/nixpkgs-channels.git",
"rev": "6d9a4a615ee2706047c2cec3acc61d2cfbffdb0b",
"date": "2020-01-28T14:21:49+01:00",
"sha256": "1zgwp31nqh7glh7l2i0n5vic5jv1683l6lvc7r7wdmkbsbkmig1p",
"rev": "ea553d8c67c6a718448da50826ff5b6916dc9c59",
"date": "2020-02-02T15:39:15+01:00",
"sha256": "0g9smv36sk42rfyzi8wyq2wl11c5l0qaldij1zjdj60s57cl3wgj",
"fetchSubmodules": false
}
2 changes: 1 addition & 1 deletion src/ops/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::project::{roots::Roots, Project};
/// See the documentation for lorri::cli::Command::Info for more
/// details.
pub fn main(project: Project) -> OpResult {
println!("lorri version: {}", crate::VERSION_BUILD_REV);
println!("lorri version: {}", crate::LORRI_VERSION);
let root_paths = Roots::from_project(&project).paths();
let OutputPaths { shell_gc_root } = &root_paths;
if root_paths.all_exist() {
Expand Down

0 comments on commit 88c680c

Please sign in to comment.