Add build.rs that provides a version number, release date and other details

This commit is contained in:
ahamedsajeer.15 2019-06-03 16:23:58 +05:30 committed by Sebastian Dröge
parent 0f15b58453
commit dc45b7f8ac
39 changed files with 230 additions and 76 deletions

View file

@ -9,6 +9,7 @@ members = [
"gst-plugin-threadshare",
"gst-plugin-tutorial",
"gst-plugin-closedcaption",
"gst-plugin-version-helper",
"gst-plugin-sodium",
"gst-plugin-cdg",
"gst-plugin-rav1e",

View file

@ -4,6 +4,7 @@ version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Rust AudioFx Plugin"
[dependencies]
glib = { git = "https://github.com/gtk-rs/glib" }
@ -17,3 +18,6 @@ num-traits = "0.2"
name = "gstrsaudiofx"
crate-type = ["cdylib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -25,12 +25,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
rsaudiofx,
"Rust AudioFx Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"rsaudiofx",
"rsaudiofx",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2016-12-08"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -4,6 +4,7 @@ version = "0.5.0"
authors = ["Guillaume Desmottes <guillaume.desmottes@collabora.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugin-rs"
license = "MIT/Apache-2.0"
description = "CDG Plugin"
edition = "2018"
[dependencies]
@ -21,3 +22,6 @@ muldiv = "0.2"
name = "gstcdg"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

5
gst-plugin-cdg/build.rs Normal file
View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -21,12 +21,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
cdg,
"CDG Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"cdg",
"cdg",
"https://gitlab.freedesktop.org/gstreamer/gst-plugin-rs",
"2019-05-01"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -4,6 +4,8 @@ version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>", "Jordan Petridis <jordan@centricular.com>"]
license = "LGPL-2.1+"
edition = "2018"
description = "Rust Closed Caption Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
[dependencies]
glib = { git = "https://github.com/gtk-rs/glib", features = ["subclassing"] }
@ -40,3 +42,6 @@ package="gstreamer-check"
name = "gstrsclosedcaption"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -52,12 +52,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
rsclosedcaption,
"Rust Closed Caption Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"0.1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"LGPL",
"rsclosedcaption",
"rsclosedcaption",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2018-12-17"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -4,6 +4,7 @@ version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Rust File Plugin"
[dependencies]
url = "1.1"
@ -15,3 +16,6 @@ gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
name = "gstrsfile"
crate-type = ["cdylib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

5
gst-plugin-file/build.rs Normal file
View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -27,12 +27,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
rsfile,
"Rust File Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"rsfile",
"rsfile",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2016-12-08"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -5,6 +5,7 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
description = "Rust FLV Plugin"
[dependencies]
url = "1.1"
@ -23,3 +24,6 @@ smallvec = "0.6"
name = "gstrsflv"
crate-type = ["cdylib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

5
gst-plugin-flv/build.rs Normal file
View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -26,12 +26,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
rsflv,
"Rust FLV Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"rsflv",
"rsflv",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2016-12-08"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -4,6 +4,7 @@ version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
description = "Rust HTTP Plugin"
[dependencies]
url = "1.1"
@ -17,3 +18,6 @@ gstreamer-base = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs"
name = "gstrshttp"
crate-type = ["cdylib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

5
gst-plugin-http/build.rs Normal file
View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -25,12 +25,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
rshttp,
"Rust HTTP Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"rshttp",
"rshttp",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2016-12-08"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -4,6 +4,7 @@ version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugin-rs"
license = "MIT/Apache-2.0"
description = "rav1e AV1 Encoder Plugin"
edition = "2018"
[dependencies]
@ -17,3 +18,6 @@ rav1e = { git = "https://github.com/xiph/rav1e.git", default-features=false }
name = "gstrav1e"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -21,12 +21,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
rav1e,
"rav1e AV1 Encoder Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"rav1e",
"rav1e",
"https://gitlab.freedesktop.org/gstreamer/gst-plugin-rs",
"2019-05-25"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -4,6 +4,7 @@ version = "0.5.0"
authors = ["Arun Raghavan <arun@arunraghavan.net>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugin-rs"
license = "MIT/Apache-2.0"
description = "Amazon S3 Plugin"
edition = "2018"
[dependencies]
@ -21,3 +22,6 @@ tokio = "0.1"
name = "gsts3"
crate-type = ["cdylib", "rlib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

5
gst-plugin-s3/build.rs Normal file
View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -23,12 +23,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
s3,
"Amazon S3 Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"s3",
"s3",
"https://github.com/ford-prefect/gst-plugin-s3",
"2017-04-17"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -2,6 +2,8 @@
name = "gst-plugin-sodium"
version = "0.1.0"
authors = ["Jordan Petridis <jordan@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugin-rs"
description = "libsodium-based file encryption and decryption"
edition = "2018"
[dependencies]
@ -49,3 +51,6 @@ required-features = ["serde", "serde_json", "clap"]
name = "decrypt-example"
path = "examples/decrypt_example.rs"
required-features = ["serde", "serde_json", "clap"]
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -1,5 +1,3 @@
// lib.rs
//
// Copyright 2019 Jordan Petridis <jordan@centricular.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -75,12 +73,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
sodium,
"libsodium-based file encryption and decryption",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"sodium",
"sodium",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2019-03-18"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -1,8 +1,10 @@
[package]
name = "gst-plugin-threadshare"
version = "0.1.0"
version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
license = "LGPL-2.1+"
description = "Threadshare Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
[dependencies]
libc = "0.2"
@ -47,3 +49,6 @@ path = "examples/udpsrc_benchmark_sender.rs"
[[example]]
name = "tcpclientsrc-benchmark-sender"
path = "examples/tcpclientsrc_benchmark_sender.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -73,14 +73,14 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
threadshare,
"Threadshare Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"0.1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"LGPL",
"threadshare",
"threadshare",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2018-03-01"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);
pub fn set_element_flags<T: glib::IsA<gst::Object> + glib::IsA<gst::Element>>(

View file

@ -3,6 +3,8 @@ name = "gst-plugin-togglerecord"
version = "0.5.0"
authors = ["Sebastian Dröge <sebastian@centricular.com>"]
license = "LGPL-2.1+"
description = "Toggle Record Plugin"
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
[dependencies]
glib = { git = "https://github.com/gtk-rs/glib", features = ["subclassing"] }
@ -24,3 +26,6 @@ path = "src/lib.rs"
name = "gtk-recording"
path = "examples/gtk_recording.rs"
required-features = ["gtk", "gio"]
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -33,12 +33,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst_plugin_define!(
togglerecord,
"Toggle Record Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"0.1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"LGPL",
"togglerecord",
"togglerecord",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2017-12-04"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -5,6 +5,7 @@ authors = ["Sebastian Dröge <sebastian@centricular.com>"]
repository = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs"
license = "MIT/Apache-2.0"
edition = "2018"
description = "Rust Tutorial Plugin"
[dependencies]
glib = { git = "https://github.com/gtk-rs/glib", features = ["subclassing"] }
@ -19,3 +20,6 @@ num-traits = "0.2"
name = "gstrstutorial"
crate-type = ["cdylib"]
path = "src/lib.rs"
[build-dependencies]
gst-plugin-version-helper = { path="../gst-plugin-version-helper" }

View file

@ -0,0 +1,5 @@
extern crate gst_plugin_version_helper;
fn main() {
gst_plugin_version_helper::get_info()
}

View file

@ -39,12 +39,12 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
// and the date/time of release.
gst_plugin_define!(
rstutorial,
"Rust Tutorial Plugin",
env!("CARGO_PKG_DESCRIPTION"),
plugin_init,
"1.0",
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
"MIT/X11",
"rstutorial",
"rstutorial",
"https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs",
"2017-12-30"
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
env!("BUILD_REL_DATE")
);

View file

@ -0,0 +1,9 @@
[package]
name = "gst-plugin-version-helper"
version = "0.1.0"
authors = ["Sajeer Ahamed <ahamedsajeer.15.15@cse.mrt.ac.lk>"]
edition = "2018"
[dependencies]
git2 = "0.8.0"
chrono = "0.4.6"

View file

@ -0,0 +1,34 @@
use chrono::TimeZone;
use git2::{Commit, ObjectType, Repository};
use std::path;
pub fn get_info() -> () {
let mut commit_id = "UNKNOWN".to_string();
let mut commit_date = chrono::Utc::now().format("%Y-%m-%d").to_string();
let mut repo_dir = path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
repo_dir.pop();
let repo = Repository::open(&repo_dir);
if let Ok(repo) = repo {
let commit = find_last_commit(&repo).expect("Couldn't find last commit");
commit_id = oid_to_short_sha(commit.id());
let timestamp = commit.time().seconds();
let dt = chrono::Utc.timestamp(timestamp, 0);
commit_date = dt.format("%Y-%m-%d").to_string()
}
println!("cargo:rustc-env=COMMIT_ID={}", commit_id);
println!("cargo:rustc-env=BUILD_REL_DATE={}", commit_date);
}
fn find_last_commit(repo: &Repository) -> Result<Commit, git2::Error> {
let obj = repo.head()?.resolve()?.peel(ObjectType::Commit)?;
obj.into_commit()
.map_err(|_| git2::Error::from_str("Couldn't find commit"))
}
fn oid_to_short_sha(oid: git2::Oid) -> String {
oid.to_string()[..8].to_string()
}