mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Update build.rs & publish.sh with minor fixes
This commit is contained in:
parent
e1c33422a1
commit
4de9c92a29
2 changed files with 24 additions and 2 deletions
|
@ -1,8 +1,10 @@
|
||||||
extern crate protobuf_codegen; // Does the business
|
extern crate protobuf_codegen; // Does the business
|
||||||
extern crate protobuf_codegen_pure; // Helper function
|
extern crate protobuf_codegen_pure; // Helper function
|
||||||
|
|
||||||
|
use std::env;
|
||||||
use std::fs::{read_to_string, write};
|
use std::fs::{read_to_string, write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use protobuf_codegen_pure::parse_and_typecheck;
|
use protobuf_codegen_pure::parse_and_typecheck;
|
||||||
use protobuf_codegen_pure::Customize;
|
use protobuf_codegen_pure::Customize;
|
||||||
|
@ -28,9 +30,12 @@ fn main() {
|
||||||
name = &line[4..len - 1]; // Remove keywords and semi-colon
|
name = &line[4..len - 1]; // Remove keywords and semi-colon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//let out_dir = env::var("OUT_DIR").is_err();
|
||||||
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
|
||||||
// Build the paths to relevant files.
|
// Build the paths to relevant files.
|
||||||
let src_fname = &format!("proto/{}.proto", name);
|
let src_fname = &format!("proto/{}.proto", name);
|
||||||
let dest_fname = &format!("src/{}.rs", name);
|
let dest_fname = &out_dir.join(format!("{}.rs", name));
|
||||||
let src = Path::new(src_fname);
|
let src = Path::new(src_fname);
|
||||||
let dest = Path::new(dest_fname);
|
let dest = Path::new(dest_fname);
|
||||||
// Get the contents of the existing generated file.
|
// Get the contents of the existing generated file.
|
||||||
|
|
19
publish.sh
19
publish.sh
|
@ -24,6 +24,10 @@ function updateVersion {
|
||||||
crate_path=${crate_path//\/\///}
|
crate_path=${crate_path//\/\///}
|
||||||
sed -i '' "s/^version.*/version = \"$1\"/g" "$crate_path"
|
sed -i '' "s/^version.*/version = \"$1\"/g" "$crate_path"
|
||||||
echo "Path is $crate_path"
|
echo "Path is $crate_path"
|
||||||
|
if [ "$CRATE" = "librespot" ]
|
||||||
|
then
|
||||||
|
cargo update
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +40,19 @@ function get_crate_name {
|
||||||
awk -v FS="name = " 'NF>1{print $2; exit}' Cargo.toml
|
awk -v FS="name = " 'NF>1{print $2; exit}' Cargo.toml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remoteWait() {
|
||||||
|
IFS=:
|
||||||
|
secs=${1}
|
||||||
|
while [ $secs -gt 0 ]
|
||||||
|
do
|
||||||
|
sleep 1 &
|
||||||
|
printf "\rSleeping to allow packages to propagate on crates.io servers. Continuing in %2d second(s)." ${secs}
|
||||||
|
secs=$(( $secs - 1 ))
|
||||||
|
wait
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
function publishCrates {
|
function publishCrates {
|
||||||
for CRATE in "${crates[@]}"
|
for CRATE in "${crates[@]}"
|
||||||
do
|
do
|
||||||
|
@ -58,7 +75,7 @@ function publishCrates {
|
||||||
cargo publish
|
cargo publish
|
||||||
fi
|
fi
|
||||||
echo "Successfully published $crate_name to crates.io"
|
echo "Successfully published $crate_name to crates.io"
|
||||||
# Should sleep here for 30 seconds to allow Crates.io time to push updated package to edge servers.
|
remoteWait 30
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue