Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Release workflow #322

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: eclipse-zenoh/ci/create-release-branch@main
with:
repo: ${{ github.repository }}
live-run: ${{ inputs.live-run }}
live-run: ${{ inputs.live-run || false }}
version: ${{ inputs.version }}
github-token: ${{ secrets.BOT_TOKEN_WORKFLOW }}

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ declare_cache_var(ZENOHC_LIB_STATIC FALSE BOOL "Alias zenohc::lib target to zeno
# Setup project version
#
set(project_version "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
if(NOT PROJECT_VERSION_TWEAK)
if(NOT DEFINED PROJECT_VERSION_TWEAK)
set(project_version "${project_version}")
elseif(PROJECT_VERSION_TWEAK EQUAL 0)
set(project_version "${project_version}-dev")
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/ze
cbindgen = "0.24.3"
fs2 = "0.4.3"
serde_yaml = "0.9.19"
fs_extra = "1.3.0"

[lib]
path="src/lib.rs"
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/ze
cbindgen = "0.24.3"
fs2 = "0.4.3"
serde_yaml = "0.9.19"
fs_extra = "1.3.0"

[lib]
path="@CARGO_PROJECT_DIR@src/lib.rs"
Expand Down
39 changes: 37 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
use fs2::FileExt;
use std::env;
use std::io::{Read, Write};
use std::{borrow::Cow, collections::HashMap, io::BufWriter, path::Path};
use std::{
borrow::Cow,
collections::HashMap,
io::BufWriter,
path::{Path, PathBuf},
};

const GENERATION_PATH: &str = "include/zenoh-gen.h";
const SPLITGUIDE_PATH: &str = "splitguide.yaml";
Expand Down Expand Up @@ -33,10 +39,39 @@ fn main() {
split_bindings(&split_guide).unwrap();
text_replace(split_guide.rules.iter().map(|(name, _)| name.as_str()));

fs_extra::copy_items(
&["include"],
cargo_target_dir(),
&fs_extra::dir::CopyOptions::default().overwrite(true),
)
.expect("include should be copied to CARGO_TARGET_DIR");

println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src");
println!("cargo:rerun-if-changed=splitguide.yaml");
println!("cargo:rerun-if-changed=cbindgen.toml")
println!("cargo:rerun-if-changed=cbindgen.toml");
println!("cargo:rerun-if-changed=include");
}

// See: https://github.com/rust-lang/cargo/issues/9661
// See: https://github.com/rust-lang/cargo/issues/545
fn cargo_target_dir() -> PathBuf {
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR should be set"));
let profile = env::var("PROFILE").expect("PROFILE should be set");

let mut target_dir = None;
let mut out_dir_path = out_dir.as_path();
while let Some(parent) = out_dir_path.parent() {
if parent.ends_with(&profile) {
target_dir = Some(parent);
break;
}
out_dir_path = parent;
}

target_dir
.expect("OUT_DIR should be a child of a PROFILE directory")
.to_path_buf()
}

fn configure() {
Expand Down
Loading