Merge pull request #504 from librespot-org/build-fixes

General fixes to protobuf bindings, depreciation warnings and publish.sh
This commit is contained in:
Sasha Hilton 2020-07-27 00:17:38 +01:00 committed by GitHub
commit 4886d4eed2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 93 additions and 43119 deletions

1
Cargo.lock generated
View file

@ -1083,6 +1083,7 @@ dependencies = [
name = "librespot-protocol" name = "librespot-protocol"
version = "0.1.2" version = "0.1.2"
dependencies = [ dependencies = [
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf-codegen 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf-codegen 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",
"protobuf-codegen-pure 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf-codegen-pure 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -41,7 +41,7 @@ version = "0.1.2"
[dependencies] [dependencies]
base64 = "0.10" base64 = "0.10"
env_logger = {version = "0.6", default-features = false, features = ["termcolor","humantime","atty"]} env_logger = {version = "0.6", default-features = false, features = ["termcolor","humantime","atty"]}
futures = "0.1" futures = "0.1"
getopts = "0.2" getopts = "0.2"
hyper = "0.11" hyper = "0.11"

View file

@ -71,10 +71,6 @@ impl fmt::Display for VorbisError {
} }
impl error::Error for VorbisError { impl error::Error for VorbisError {
fn description(&self) -> &str {
error::Error::description(&self.0)
}
fn source(&self) -> Option<&(dyn error::Error + 'static)> { fn source(&self) -> Option<&(dyn error::Error + 'static)> {
error::Error::source(&self.0) error::Error::source(&self.0)
} }

View file

@ -1,4 +1,3 @@
use std::error::Error;
use std::io; use std::io;
use std::str::FromStr; use std::str::FromStr;
@ -58,7 +57,7 @@ impl<T: AsyncRead + AsyncWrite> Future for ProxyTunnel<T> {
let status = match response.parse(&buf) { let status = match response.parse(&buf) {
Ok(status) => status, Ok(status) => status,
Err(err) => { Err(err) => {
return Err(io::Error::new(io::ErrorKind::Other, err.description())); return Err(io::Error::new(io::ErrorKind::Other, err.to_string()));
} }
}; };

View file

@ -13,3 +13,4 @@ protobuf = "~2.14.0"
[build-dependencies] [build-dependencies]
protobuf-codegen-pure = "~2.14.0" protobuf-codegen-pure = "~2.14.0"
protobuf-codegen = "~2.14.0" protobuf-codegen = "~2.14.0"
glob = "0.3.0"

View file

@ -1,59 +1,69 @@
extern crate protobuf_codegen; // Does the business extern crate glob;
extern crate protobuf_codegen_pure; // Helper function
use std::fs::{read_to_string, write}; use std::{
use std::path::Path; env, fs,
ops::Deref,
path::{Path, PathBuf},
};
use protobuf_codegen_pure::parse_and_typecheck; fn out_dir() -> PathBuf {
use protobuf_codegen_pure::Customize; Path::new(&env::var("OUT_DIR").expect("env")).to_path_buf()
}
fn cleanup() {
let _ = fs::remove_dir_all(&out_dir());
}
fn compile() {
let proto_dir = Path::new(&env::var("CARGO_MANIFEST_DIR").expect("env")).join("proto");
let files = &[
proto_dir.join("authentication.proto"),
proto_dir.join("keyexchange.proto"),
proto_dir.join("mercury.proto"),
proto_dir.join("metadata.proto"),
proto_dir.join("playlist4changes.proto"),
proto_dir.join("playlist4content.proto"),
proto_dir.join("playlist4issues.proto"),
proto_dir.join("playlist4meta.proto"),
proto_dir.join("playlist4ops.proto"),
proto_dir.join("pubsub.proto"),
proto_dir.join("spirc.proto"),
];
let slices = files.iter().map(Deref::deref).collect::<Vec<_>>();
let out_dir = out_dir();
fs::create_dir(&out_dir).expect("create_dir");
protobuf_codegen_pure::Codegen::new()
.out_dir(&out_dir)
.inputs(&slices)
.include(&proto_dir)
.run()
.expect("Codegen failed.");
}
fn generate_mod_rs() {
let out_dir = out_dir();
let mods = glob::glob(&out_dir.join("*.rs").to_string_lossy())
.expect("glob")
.filter_map(|p| {
p.ok()
.map(|p| format!("pub mod {};", p.file_stem().unwrap().to_string_lossy()))
})
.collect::<Vec<_>>()
.join("\n");
let mod_rs = out_dir.join("mod.rs");
fs::write(&mod_rs, format!("// @generated\n{}\n", mods)).expect("write");
println!("cargo:rustc-env=PROTO_MOD_RS={}", mod_rs.to_string_lossy());
}
fn main() { fn main() {
let customizations = Customize { cleanup();
..Default::default() compile();
}; generate_mod_rs();
let lib_str = read_to_string("src/lib.rs").unwrap();
// Iterate over the desired module names.
for line in lib_str.lines() {
if !line.starts_with("pub mod ") && !line.starts_with("mod ") {
continue;
}
let len = line.len();
let name;
if line.starts_with("pub mod ") {
name = &line[8..len - 1]; // Remove keywords and semi-colon
} else {
name = &line[4..len - 1]; // Remove keywords and semi-colon
}
// Build the paths to relevant files.
let src_fname = &format!("proto/{}.proto", name);
let dest_fname = &format!("src/{}.rs", name);
let src = Path::new(src_fname);
let dest = Path::new(dest_fname);
// Get the contents of the existing generated file.
let mut existing = "".to_string();
if dest.exists() {
// Removing CRLF line endings if present.
existing = read_to_string(dest).unwrap().replace("\r\n", "\n");
}
println!("Regenerating {} from {}", dest.display(), src.display());
// Parse the proto files as the protobuf-codegen-pure crate does.
let p = parse_and_typecheck(&[&Path::new("proto")], &[src]).expect("protoc");
// But generate them with the protobuf-codegen crate directly.
// Then we can keep the result in-memory.
let result = protobuf_codegen::gen(&p.file_descriptors, &p.relative_paths, &customizations);
// Protoc result as a byte array.
let new = &result.first().unwrap().content;
// Convert to utf8 to compare with existing.
let new = std::str::from_utf8(&new).unwrap();
// Save newly generated file if changed.
if new != existing {
write(dest, &new).unwrap();
}
}
} }

4
protocol/proto/mod.rs Normal file
View file

@ -0,0 +1,4 @@
// generated protobuf files will be included here. See build.rs for details
#![allow(renamed_and_removed_lints)]
include!(env!("PROTO_MOD_RS"));

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,5 @@
extern crate protobuf; extern crate protobuf;
// This file is parsed by build.rs // This file is parsed by build.rs
// Each included module will be compiled from the matching .proto definition. // Each included module will be compiled from the matching .proto definition.
pub mod authentication;
pub mod keyexchange; include!(concat!(env!("OUT_DIR"), "/mod.rs"));
pub mod mercury;
pub mod metadata;
pub mod playlist4changes;
mod playlist4content;
mod playlist4issues;
mod playlist4meta;
mod playlist4ops;
pub mod pubsub;
pub mod spirc;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,794 +0,0 @@
// This file is generated by rust-protobuf 2.14.0. Do not edit
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unsafe_code)]
#![allow(unused_imports)]
#![allow(unused_results)]
//! Generated file from `playlist4issues.proto`
use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0;
#[derive(PartialEq, Clone, Default)]
pub struct ClientIssue {
// message fields
level: ::std::option::Option<ClientIssue_Level>,
code: ::std::option::Option<ClientIssue_Code>,
repeatCount: ::std::option::Option<i32>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a ClientIssue {
fn default() -> &'a ClientIssue {
<ClientIssue as ::protobuf::Message>::default_instance()
}
}
impl ClientIssue {
pub fn new() -> ClientIssue {
::std::default::Default::default()
}
// optional .ClientIssue.Level level = 1;
pub fn get_level(&self) -> ClientIssue_Level {
self.level.unwrap_or(ClientIssue_Level::LEVEL_UNKNOWN)
}
pub fn clear_level(&mut self) {
self.level = ::std::option::Option::None;
}
pub fn has_level(&self) -> bool {
self.level.is_some()
}
// Param is passed by value, moved
pub fn set_level(&mut self, v: ClientIssue_Level) {
self.level = ::std::option::Option::Some(v);
}
// optional .ClientIssue.Code code = 2;
pub fn get_code(&self) -> ClientIssue_Code {
self.code.unwrap_or(ClientIssue_Code::CODE_UNKNOWN)
}
pub fn clear_code(&mut self) {
self.code = ::std::option::Option::None;
}
pub fn has_code(&self) -> bool {
self.code.is_some()
}
// Param is passed by value, moved
pub fn set_code(&mut self, v: ClientIssue_Code) {
self.code = ::std::option::Option::Some(v);
}
// optional int32 repeatCount = 3;
pub fn get_repeatCount(&self) -> i32 {
self.repeatCount.unwrap_or(0)
}
pub fn clear_repeatCount(&mut self) {
self.repeatCount = ::std::option::Option::None;
}
pub fn has_repeatCount(&self) -> bool {
self.repeatCount.is_some()
}
// Param is passed by value, moved
pub fn set_repeatCount(&mut self, v: i32) {
self.repeatCount = ::std::option::Option::Some(v);
}
}
impl ::protobuf::Message for ClientIssue {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(
&mut self,
is: &mut ::protobuf::CodedInputStream<'_>,
) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(
wire_type,
is,
&mut self.level,
1,
&mut self.unknown_fields,
)?,
2 => ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(
wire_type,
is,
&mut self.code,
2,
&mut self.unknown_fields,
)?,
3 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(
wire_type,
));
}
let tmp = is.read_int32()?;
self.repeatCount = ::std::option::Option::Some(tmp);
}
_ => {
::protobuf::rt::read_unknown_or_skip_group(
field_number,
wire_type,
is,
self.mut_unknown_fields(),
)?;
}
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if let Some(v) = self.level {
my_size += ::protobuf::rt::enum_size(1, v);
}
if let Some(v) = self.code {
my_size += ::protobuf::rt::enum_size(2, v);
}
if let Some(v) = self.repeatCount {
my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(
&self,
os: &mut ::protobuf::CodedOutputStream<'_>,
) -> ::protobuf::ProtobufResult<()> {
if let Some(v) = self.level {
os.write_enum(1, v.value())?;
}
if let Some(v) = self.code {
os.write_enum(2, v.value())?;
}
if let Some(v) = self.repeatCount {
os.write_int32(3, v)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> ClientIssue {
ClientIssue::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> =
::protobuf::lazy::Lazy::INIT;
unsafe {
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_option_accessor::<
_,
::protobuf::types::ProtobufTypeEnum<ClientIssue_Level>,
>(
"level",
|m: &ClientIssue| &m.level,
|m: &mut ClientIssue| &mut m.level,
));
fields.push(::protobuf::reflect::accessor::make_option_accessor::<
_,
::protobuf::types::ProtobufTypeEnum<ClientIssue_Code>,
>(
"code",
|m: &ClientIssue| &m.code,
|m: &mut ClientIssue| &mut m.code,
));
fields.push(::protobuf::reflect::accessor::make_option_accessor::<
_,
::protobuf::types::ProtobufTypeInt32,
>(
"repeatCount",
|m: &ClientIssue| &m.repeatCount,
|m: &mut ClientIssue| &mut m.repeatCount,
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<ClientIssue>(
"ClientIssue",
fields,
file_descriptor_proto(),
)
})
}
}
fn default_instance() -> &'static ClientIssue {
static mut instance: ::protobuf::lazy::Lazy<ClientIssue> = ::protobuf::lazy::Lazy::INIT;
unsafe { instance.get(ClientIssue::new) }
}
}
impl ::protobuf::Clear for ClientIssue {
fn clear(&mut self) {
self.level = ::std::option::Option::None;
self.code = ::std::option::Option::None;
self.repeatCount = ::std::option::Option::None;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for ClientIssue {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ClientIssue {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum ClientIssue_Level {
LEVEL_UNKNOWN = 0,
LEVEL_DEBUG = 1,
LEVEL_INFO = 2,
LEVEL_NOTICE = 3,
LEVEL_WARNING = 4,
LEVEL_ERROR = 5,
}
impl ::protobuf::ProtobufEnum for ClientIssue_Level {
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<ClientIssue_Level> {
match value {
0 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_UNKNOWN),
1 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_DEBUG),
2 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_INFO),
3 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_NOTICE),
4 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_WARNING),
5 => ::std::option::Option::Some(ClientIssue_Level::LEVEL_ERROR),
_ => ::std::option::Option::None,
}
}
fn values() -> &'static [Self] {
static values: &'static [ClientIssue_Level] = &[
ClientIssue_Level::LEVEL_UNKNOWN,
ClientIssue_Level::LEVEL_DEBUG,
ClientIssue_Level::LEVEL_INFO,
ClientIssue_Level::LEVEL_NOTICE,
ClientIssue_Level::LEVEL_WARNING,
ClientIssue_Level::LEVEL_ERROR,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> =
::protobuf::lazy::Lazy::INIT;
unsafe {
descriptor.get(|| {
::protobuf::reflect::EnumDescriptor::new_pb_name::<ClientIssue_Level>(
"ClientIssue.Level",
file_descriptor_proto(),
)
})
}
}
}
impl ::std::marker::Copy for ClientIssue_Level {}
impl ::std::default::Default for ClientIssue_Level {
fn default() -> Self {
ClientIssue_Level::LEVEL_UNKNOWN
}
}
impl ::protobuf::reflect::ProtobufValue for ClientIssue_Level {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
}
}
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum ClientIssue_Code {
CODE_UNKNOWN = 0,
CODE_INDEX_OUT_OF_BOUNDS = 1,
CODE_VERSION_MISMATCH = 2,
CODE_CACHED_CHANGE = 3,
CODE_OFFLINE_CHANGE = 4,
CODE_CONCURRENT_CHANGE = 5,
}
impl ::protobuf::ProtobufEnum for ClientIssue_Code {
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<ClientIssue_Code> {
match value {
0 => ::std::option::Option::Some(ClientIssue_Code::CODE_UNKNOWN),
1 => ::std::option::Option::Some(ClientIssue_Code::CODE_INDEX_OUT_OF_BOUNDS),
2 => ::std::option::Option::Some(ClientIssue_Code::CODE_VERSION_MISMATCH),
3 => ::std::option::Option::Some(ClientIssue_Code::CODE_CACHED_CHANGE),
4 => ::std::option::Option::Some(ClientIssue_Code::CODE_OFFLINE_CHANGE),
5 => ::std::option::Option::Some(ClientIssue_Code::CODE_CONCURRENT_CHANGE),
_ => ::std::option::Option::None,
}
}
fn values() -> &'static [Self] {
static values: &'static [ClientIssue_Code] = &[
ClientIssue_Code::CODE_UNKNOWN,
ClientIssue_Code::CODE_INDEX_OUT_OF_BOUNDS,
ClientIssue_Code::CODE_VERSION_MISMATCH,
ClientIssue_Code::CODE_CACHED_CHANGE,
ClientIssue_Code::CODE_OFFLINE_CHANGE,
ClientIssue_Code::CODE_CONCURRENT_CHANGE,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> =
::protobuf::lazy::Lazy::INIT;
unsafe {
descriptor.get(|| {
::protobuf::reflect::EnumDescriptor::new_pb_name::<ClientIssue_Code>(
"ClientIssue.Code",
file_descriptor_proto(),
)
})
}
}
}
impl ::std::marker::Copy for ClientIssue_Code {}
impl ::std::default::Default for ClientIssue_Code {
fn default() -> Self {
ClientIssue_Code::CODE_UNKNOWN
}
}
impl ::protobuf::reflect::ProtobufValue for ClientIssue_Code {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
}
}
#[derive(PartialEq, Clone, Default)]
pub struct ClientResolveAction {
// message fields
code: ::std::option::Option<ClientResolveAction_Code>,
initiator: ::std::option::Option<ClientResolveAction_Initiator>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a ClientResolveAction {
fn default() -> &'a ClientResolveAction {
<ClientResolveAction as ::protobuf::Message>::default_instance()
}
}
impl ClientResolveAction {
pub fn new() -> ClientResolveAction {
::std::default::Default::default()
}
// optional .ClientResolveAction.Code code = 1;
pub fn get_code(&self) -> ClientResolveAction_Code {
self.code.unwrap_or(ClientResolveAction_Code::CODE_UNKNOWN)
}
pub fn clear_code(&mut self) {
self.code = ::std::option::Option::None;
}
pub fn has_code(&self) -> bool {
self.code.is_some()
}
// Param is passed by value, moved
pub fn set_code(&mut self, v: ClientResolveAction_Code) {
self.code = ::std::option::Option::Some(v);
}
// optional .ClientResolveAction.Initiator initiator = 2;
pub fn get_initiator(&self) -> ClientResolveAction_Initiator {
self.initiator
.unwrap_or(ClientResolveAction_Initiator::INITIATOR_UNKNOWN)
}
pub fn clear_initiator(&mut self) {
self.initiator = ::std::option::Option::None;
}
pub fn has_initiator(&self) -> bool {
self.initiator.is_some()
}
// Param is passed by value, moved
pub fn set_initiator(&mut self, v: ClientResolveAction_Initiator) {
self.initiator = ::std::option::Option::Some(v);
}
}
impl ::protobuf::Message for ClientResolveAction {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(
&mut self,
is: &mut ::protobuf::CodedInputStream<'_>,
) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(
wire_type,
is,
&mut self.code,
1,
&mut self.unknown_fields,
)?,
2 => ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(
wire_type,
is,
&mut self.initiator,
2,
&mut self.unknown_fields,
)?,
_ => {
::protobuf::rt::read_unknown_or_skip_group(
field_number,
wire_type,
is,
self.mut_unknown_fields(),
)?;
}
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if let Some(v) = self.code {
my_size += ::protobuf::rt::enum_size(1, v);
}
if let Some(v) = self.initiator {
my_size += ::protobuf::rt::enum_size(2, v);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(
&self,
os: &mut ::protobuf::CodedOutputStream<'_>,
) -> ::protobuf::ProtobufResult<()> {
if let Some(v) = self.code {
os.write_enum(1, v.value())?;
}
if let Some(v) = self.initiator {
os.write_enum(2, v.value())?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> ClientResolveAction {
ClientResolveAction::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> =
::protobuf::lazy::Lazy::INIT;
unsafe {
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_option_accessor::<
_,
::protobuf::types::ProtobufTypeEnum<ClientResolveAction_Code>,
>(
"code",
|m: &ClientResolveAction| &m.code,
|m: &mut ClientResolveAction| &mut m.code,
));
fields.push(::protobuf::reflect::accessor::make_option_accessor::<
_,
::protobuf::types::ProtobufTypeEnum<ClientResolveAction_Initiator>,
>(
"initiator",
|m: &ClientResolveAction| &m.initiator,
|m: &mut ClientResolveAction| &mut m.initiator,
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<ClientResolveAction>(
"ClientResolveAction",
fields,
file_descriptor_proto(),
)
})
}
}
fn default_instance() -> &'static ClientResolveAction {
static mut instance: ::protobuf::lazy::Lazy<ClientResolveAction> =
::protobuf::lazy::Lazy::INIT;
unsafe { instance.get(ClientResolveAction::new) }
}
}
impl ::protobuf::Clear for ClientResolveAction {
fn clear(&mut self) {
self.code = ::std::option::Option::None;
self.initiator = ::std::option::Option::None;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for ClientResolveAction {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ClientResolveAction {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum ClientResolveAction_Code {
CODE_UNKNOWN = 0,
CODE_NO_ACTION = 1,
CODE_RETRY = 2,
CODE_RELOAD = 3,
CODE_DISCARD_LOCAL_CHANGES = 4,
CODE_SEND_DUMP = 5,
CODE_DISPLAY_ERROR_MESSAGE = 6,
}
impl ::protobuf::ProtobufEnum for ClientResolveAction_Code {
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<ClientResolveAction_Code> {
match value {
0 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_UNKNOWN),
1 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_NO_ACTION),
2 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_RETRY),
3 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_RELOAD),
4 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_DISCARD_LOCAL_CHANGES),
5 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_SEND_DUMP),
6 => ::std::option::Option::Some(ClientResolveAction_Code::CODE_DISPLAY_ERROR_MESSAGE),
_ => ::std::option::Option::None,
}
}
fn values() -> &'static [Self] {
static values: &'static [ClientResolveAction_Code] = &[
ClientResolveAction_Code::CODE_UNKNOWN,
ClientResolveAction_Code::CODE_NO_ACTION,
ClientResolveAction_Code::CODE_RETRY,
ClientResolveAction_Code::CODE_RELOAD,
ClientResolveAction_Code::CODE_DISCARD_LOCAL_CHANGES,
ClientResolveAction_Code::CODE_SEND_DUMP,
ClientResolveAction_Code::CODE_DISPLAY_ERROR_MESSAGE,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> =
::protobuf::lazy::Lazy::INIT;
unsafe {
descriptor.get(|| {
::protobuf::reflect::EnumDescriptor::new_pb_name::<ClientResolveAction_Code>(
"ClientResolveAction.Code",
file_descriptor_proto(),
)
})
}
}
}
impl ::std::marker::Copy for ClientResolveAction_Code {}
impl ::std::default::Default for ClientResolveAction_Code {
fn default() -> Self {
ClientResolveAction_Code::CODE_UNKNOWN
}
}
impl ::protobuf::reflect::ProtobufValue for ClientResolveAction_Code {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
}
}
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
pub enum ClientResolveAction_Initiator {
INITIATOR_UNKNOWN = 0,
INITIATOR_SERVER = 1,
INITIATOR_CLIENT = 2,
}
impl ::protobuf::ProtobufEnum for ClientResolveAction_Initiator {
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<ClientResolveAction_Initiator> {
match value {
0 => ::std::option::Option::Some(ClientResolveAction_Initiator::INITIATOR_UNKNOWN),
1 => ::std::option::Option::Some(ClientResolveAction_Initiator::INITIATOR_SERVER),
2 => ::std::option::Option::Some(ClientResolveAction_Initiator::INITIATOR_CLIENT),
_ => ::std::option::Option::None,
}
}
fn values() -> &'static [Self] {
static values: &'static [ClientResolveAction_Initiator] = &[
ClientResolveAction_Initiator::INITIATOR_UNKNOWN,
ClientResolveAction_Initiator::INITIATOR_SERVER,
ClientResolveAction_Initiator::INITIATOR_CLIENT,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> =
::protobuf::lazy::Lazy::INIT;
unsafe {
descriptor.get(|| {
::protobuf::reflect::EnumDescriptor::new_pb_name::<ClientResolveAction_Initiator>(
"ClientResolveAction.Initiator",
file_descriptor_proto(),
)
})
}
}
}
impl ::std::marker::Copy for ClientResolveAction_Initiator {}
impl ::std::default::Default for ClientResolveAction_Initiator {
fn default() -> Self {
ClientResolveAction_Initiator::INITIATOR_UNKNOWN
}
}
impl ::protobuf::reflect::ProtobufValue for ClientResolveAction_Initiator {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Enum(self.descriptor())
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x15playlist4issues.proto\x12\0\"\x86\x03\n\x0bClientIssue\x12#\n\x05l\
evel\x18\x01\x20\x01(\x0e2\x12.ClientIssue.LevelB\0\x12!\n\x04code\x18\
\x02\x20\x01(\x0e2\x11.ClientIssue.CodeB\0\x12\x15\n\x0brepeatCount\x18\
\x03\x20\x01(\x05B\0\"s\n\x05Level\x12\x11\n\rLEVEL_UNKNOWN\x10\0\x12\
\x0f\n\x0bLEVEL_DEBUG\x10\x01\x12\x0e\n\nLEVEL_INFO\x10\x02\x12\x10\n\
\x0cLEVEL_NOTICE\x10\x03\x12\x11\n\rLEVEL_WARNING\x10\x04\x12\x0f\n\x0bL\
EVEL_ERROR\x10\x05\x1a\0\"\xa0\x01\n\x04Code\x12\x10\n\x0cCODE_UNKNOWN\
\x10\0\x12\x1c\n\x18CODE_INDEX_OUT_OF_BOUNDS\x10\x01\x12\x19\n\x15CODE_V\
ERSION_MISMATCH\x10\x02\x12\x16\n\x12CODE_CACHED_CHANGE\x10\x03\x12\x17\
\n\x13CODE_OFFLINE_CHANGE\x10\x04\x12\x1a\n\x16CODE_CONCURRENT_CHANGE\
\x10\x05\x1a\0:\0\"\xef\x02\n\x13ClientResolveAction\x12)\n\x04code\x18\
\x01\x20\x01(\x0e2\x19.ClientResolveAction.CodeB\0\x123\n\tinitiator\x18\
\x02\x20\x01(\x0e2\x1e.ClientResolveAction.InitiatorB\0\"\xa3\x01\n\x04C\
ode\x12\x10\n\x0cCODE_UNKNOWN\x10\0\x12\x12\n\x0eCODE_NO_ACTION\x10\x01\
\x12\x0e\n\nCODE_RETRY\x10\x02\x12\x0f\n\x0bCODE_RELOAD\x10\x03\x12\x1e\
\n\x1aCODE_DISCARD_LOCAL_CHANGES\x10\x04\x12\x12\n\x0eCODE_SEND_DUMP\x10\
\x05\x12\x1e\n\x1aCODE_DISPLAY_ERROR_MESSAGE\x10\x06\x1a\0\"P\n\tInitiat\
or\x12\x15\n\x11INITIATOR_UNKNOWN\x10\0\x12\x14\n\x10INITIATOR_SERVER\
\x10\x01\x12\x14\n\x10INITIATOR_CLIENT\x10\x02\x1a\0:\0B\0b\x06proto2\
";
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<
::protobuf::descriptor::FileDescriptorProto,
> = ::protobuf::lazy::Lazy::INIT;
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
}
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
unsafe { file_descriptor_proto_lazy.get(|| parse_descriptor_proto()) }
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,320 +0,0 @@
// This file is generated by rust-protobuf 2.14.0. Do not edit
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unsafe_code)]
#![allow(unused_imports)]
#![allow(unused_results)]
//! Generated file from `pubsub.proto`
use protobuf::Message as Message_imported_for_functions;
use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
/// Generated files are compatible only with the same version
/// of protobuf runtime.
// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0;
#[derive(PartialEq, Clone, Default)]
pub struct Subscription {
// message fields
uri: ::protobuf::SingularField<::std::string::String>,
expiry: ::std::option::Option<i32>,
status_code: ::std::option::Option<i32>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a Subscription {
fn default() -> &'a Subscription {
<Subscription as ::protobuf::Message>::default_instance()
}
}
impl Subscription {
pub fn new() -> Subscription {
::std::default::Default::default()
}
// optional string uri = 1;
pub fn get_uri(&self) -> &str {
match self.uri.as_ref() {
Some(v) => &v,
None => "",
}
}
pub fn clear_uri(&mut self) {
self.uri.clear();
}
pub fn has_uri(&self) -> bool {
self.uri.is_some()
}
// Param is passed by value, moved
pub fn set_uri(&mut self, v: ::std::string::String) {
self.uri = ::protobuf::SingularField::some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_uri(&mut self) -> &mut ::std::string::String {
if self.uri.is_none() {
self.uri.set_default();
}
self.uri.as_mut().unwrap()
}
// Take field
pub fn take_uri(&mut self) -> ::std::string::String {
self.uri
.take()
.unwrap_or_else(|| ::std::string::String::new())
}
// optional int32 expiry = 2;
pub fn get_expiry(&self) -> i32 {
self.expiry.unwrap_or(0)
}
pub fn clear_expiry(&mut self) {
self.expiry = ::std::option::Option::None;
}
pub fn has_expiry(&self) -> bool {
self.expiry.is_some()
}
// Param is passed by value, moved
pub fn set_expiry(&mut self, v: i32) {
self.expiry = ::std::option::Option::Some(v);
}
// optional int32 status_code = 3;
pub fn get_status_code(&self) -> i32 {
self.status_code.unwrap_or(0)
}
pub fn clear_status_code(&mut self) {
self.status_code = ::std::option::Option::None;
}
pub fn has_status_code(&self) -> bool {
self.status_code.is_some()
}
// Param is passed by value, moved
pub fn set_status_code(&mut self, v: i32) {
self.status_code = ::std::option::Option::Some(v);
}
}
impl ::protobuf::Message for Subscription {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(
&mut self,
is: &mut ::protobuf::CodedInputStream<'_>,
) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.uri)?;
}
2 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(
wire_type,
));
}
let tmp = is.read_int32()?;
self.expiry = ::std::option::Option::Some(tmp);
}
3 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(
wire_type,
));
}
let tmp = is.read_int32()?;
self.status_code = ::std::option::Option::Some(tmp);
}
_ => {
::protobuf::rt::read_unknown_or_skip_group(
field_number,
wire_type,
is,
self.mut_unknown_fields(),
)?;
}
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if let Some(ref v) = self.uri.as_ref() {
my_size += ::protobuf::rt::string_size(1, &v);
}
if let Some(v) = self.expiry {
my_size += ::protobuf::rt::value_size(2, v, ::protobuf::wire_format::WireTypeVarint);
}
if let Some(v) = self.status_code {
my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(
&self,
os: &mut ::protobuf::CodedOutputStream<'_>,
) -> ::protobuf::ProtobufResult<()> {
if let Some(ref v) = self.uri.as_ref() {
os.write_string(1, &v)?;
}
if let Some(v) = self.expiry {
os.write_int32(2, v)?;
}
if let Some(v) = self.status_code {
os.write_int32(3, v)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> Subscription {
Subscription::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> =
::protobuf::lazy::Lazy::INIT;
unsafe {
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(
::protobuf::reflect::accessor::make_singular_field_accessor::<
_,
::protobuf::types::ProtobufTypeString,
>(
"uri",
|m: &Subscription| &m.uri,
|m: &mut Subscription| &mut m.uri,
),
);
fields.push(::protobuf::reflect::accessor::make_option_accessor::<
_,
::protobuf::types::ProtobufTypeInt32,
>(
"expiry",
|m: &Subscription| &m.expiry,
|m: &mut Subscription| &mut m.expiry,
));
fields.push(::protobuf::reflect::accessor::make_option_accessor::<
_,
::protobuf::types::ProtobufTypeInt32,
>(
"status_code",
|m: &Subscription| &m.status_code,
|m: &mut Subscription| &mut m.status_code,
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<Subscription>(
"Subscription",
fields,
file_descriptor_proto(),
)
})
}
}
fn default_instance() -> &'static Subscription {
static mut instance: ::protobuf::lazy::Lazy<Subscription> = ::protobuf::lazy::Lazy::INIT;
unsafe { instance.get(Subscription::new) }
}
}
impl ::protobuf::Clear for Subscription {
fn clear(&mut self) {
self.uri.clear();
self.expiry = ::std::option::Option::None;
self.status_code = ::std::option::Option::None;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for Subscription {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for Subscription {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0cpubsub.proto\x12\0\"H\n\x0cSubscription\x12\r\n\x03uri\x18\x01\x20\
\x01(\tB\0\x12\x10\n\x06expiry\x18\x02\x20\x01(\x05B\0\x12\x15\n\x0bstat\
us_code\x18\x03\x20\x01(\x05B\0:\0B\0b\x06proto2\
";
static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<
::protobuf::descriptor::FileDescriptorProto,
> = ::protobuf::lazy::Lazy::INIT;
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
}
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
unsafe { file_descriptor_proto_lazy.get(|| parse_descriptor_proto()) }
}

File diff suppressed because it is too large Load diff

View file

@ -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,20 @@ 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}
crate_name=${2}
while [ $secs -gt 0 ]
do
sleep 1 &
printf "\rSleeping to allow %s to propagate on crates.io servers. Continuing in %2d second(s)." ${crate_name} ${secs}
secs=$(( $secs - 1 ))
wait
done
echo
}
function publishCrates { function publishCrates {
for CRATE in "${crates[@]}" for CRATE in "${crates[@]}"
do do
@ -58,7 +76,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 crate_name
done done
} }