1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 15:04:36 +03:00

fixup build to not consider termwiz tags as wezterm tags

CI got broken by the termwiz release.  This commit teaches the
various `git describe --tags` calls to filter to the wezterm
tags which all start with the year.  We're match `20*` which should
be good for the next 79 years.

I've removed the vergen dependency as there was no way to teach it
to do the equivalent matching, and it wasn't a terrible burden
to just inline the git describe call anyway.
This commit is contained in:
Wez Furlong 2021-03-17 21:02:03 -07:00
parent ba7add140e
commit 57f1aa2785
7 changed files with 27 additions and 46 deletions

25
Cargo.lock generated
View File

@ -713,7 +713,6 @@ dependencies = [
"termwiz",
"toml",
"umask",
"vergen",
"wezterm-input-types",
"wezterm-term",
"winapi 0.3.9",
@ -2565,7 +2564,7 @@ checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
dependencies = [
"lock_api 0.3.4",
"parking_lot_core 0.6.2",
"rustc_version 0.2.3",
"rustc_version",
]
[[package]]
@ -2588,7 +2587,7 @@ dependencies = [
"cloudabi",
"libc",
"redox_syscall 0.1.57",
"rustc_version 0.2.3",
"rustc_version",
"smallvec 0.6.14",
"winapi 0.3.9",
]
@ -3231,15 +3230,6 @@ dependencies = [
"semver 0.9.0",
]
[[package]]
name = "rustc_version"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
dependencies = [
"semver 0.11.0",
]
[[package]]
name = "rustls"
version = "0.19.0"
@ -4066,17 +4056,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "vergen"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7141e445af09c8919f1d5f8a20dae0b20c3b57a45dee0d5823c6ed5d237f15a"
dependencies = [
"bitflags",
"chrono",
"rustc_version 0.3.3",
]
[[package]]
name = "version_check"
version = "0.9.2"

View File

@ -13,7 +13,7 @@ install -Dm644 assets/wezterm.appdata.xml AppDir/usr/share/metainfo/org.wezfurlo
[ -x /tmp/linuxdeploy ] || ( curl -L 'https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage' -o /tmp/linuxdeploy && chmod +x /tmp/linuxdeploy )
TAG_NAME=${TAG_NAME:-$(git describe --tags)}
TAG_NAME=${TAG_NAME:-$(git describe --tags --match '20*')}
TAG_NAME=${TAG_NAME:-$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)}
distro=$(lsb_release -is)
distver=$(lsb_release -rs)

View File

@ -4,7 +4,7 @@ set -e
TARGET_DIR=${1:-target}
TAG_NAME=${TAG_NAME:-$(git describe --tags)}
TAG_NAME=${TAG_NAME:-$(git describe --tags --match '20*')}
TAG_NAME=${TAG_NAME:-$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)}
HERE=$(pwd)

View File

@ -3,7 +3,7 @@
set -x
TAG_NAME=${TAG_NAME:-$(git describe --tags)}
TAG_NAME=${TAG_NAME:-$(git describe --tags --match '20*')}
TAG_NAME=${TAG_NAME:-$(date +'%Y%m%d-%H%M%S')-$(git log --format=%h -1)}
if [[ "$BUILD_REASON" == "Schedule" ]] ; then

View File

@ -7,9 +7,6 @@ build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
vergen = "3"
[dev-dependencies]
pretty_env_logger = "0.4"

View File

@ -1,5 +1,4 @@
use std::path::Path;
use vergen::{generate_cargo_keys, ConstantsFlags};
fn bake_color_schemes() {
let dir = std::fs::read_dir("../assets/colors").unwrap();
@ -45,12 +44,6 @@ fn bake_color_schemes() {
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let mut flags = ConstantsFlags::all();
flags.remove(ConstantsFlags::SEMVER_FROM_CARGO_PKG);
// Generate the 'cargo:' key output
generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!");
bake_color_schemes();
// If a file named `.tag` is present, we'll take its contents for the
@ -61,7 +54,25 @@ fn main() {
ci_tag = s.trim().to_string();
println!("cargo:rerun-if-changed=../.tag");
}
} else {
// Otherwise we'll derive it from the git information
let head = Path::new("../.git/HEAD");
if head.exists() {
let head = head.canonicalize().unwrap();
println!("cargo:rerun-if-changed={}", head.display());
if let Ok(output) = std::process::Command::new("git")
.args(&["describe", "--tags", "--match", "20*"])
.output()
{
let info = String::from_utf8_lossy(&output.stdout);
ci_tag = info.trim().to_string();
}
}
}
let target = std::env::var("TARGET").unwrap_or("unknown".to_string());
println!("cargo:rustc-env=WEZTERM_TARGET_TRIPLE={}", target);
println!("cargo:rustc-env=WEZTERM_CI_TAG={}", ci_tag);
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.9");
}

View File

@ -1,17 +1,11 @@
pub fn wezterm_version() -> &'static str {
// Prefer our version override, if present (see build.rs)
let tag = env!("WEZTERM_CI_TAG");
if tag.is_empty() {
// Otherwise, fallback to the vergen-generated information,
// which is basically `git describe --tags` computed in build.rs
env!("VERGEN_SEMVER_LIGHTWEIGHT")
} else {
tag
}
// See build.rs
env!("WEZTERM_CI_TAG")
}
pub fn wezterm_target_triple() -> &'static str {
env!("VERGEN_TARGET_TRIPLE")
// See build.rs
env!("WEZTERM_TARGET_TRIPLE")
}
pub fn running_under_wsl() -> bool {