Repo to repo with deps, test
Signed-off-by: Luca Fulchir <luca.fulchir@runesauth.com>
This commit is contained in:
parent
a615ee13ba
commit
081d0ecbc1
@ -276,7 +276,7 @@ pub(crate) fn deps_build(
|
|||||||
*
|
*
|
||||||
}
|
}
|
||||||
#[::macro_magic::export_tokens(#pkg_trait)]
|
#[::macro_magic::export_tokens(#pkg_trait)]
|
||||||
pub trait #pkg_trait {
|
pub trait #pkg_trait: ::bok::Repository {
|
||||||
#(fn #deps(&self) -> ::std::boxed::Box<dyn ::bok::Pkg>;)
|
#(fn #deps(&self) -> ::std::boxed::Box<dyn ::bok::Pkg>;)
|
||||||
*
|
*
|
||||||
}
|
}
|
||||||
|
@ -227,6 +227,9 @@ pub(crate) fn derive_repository(input: TokenStream) -> TokenStream {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn as_any(&self) -> &dyn ::std::any::Any {
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.into()
|
}.into()
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ impl ::bok::Pkg for One {
|
|||||||
}
|
}
|
||||||
fn dependencies_set(
|
fn dependencies_set(
|
||||||
&self,
|
&self,
|
||||||
_repo: ::std::sync::Arc<dyn ::bok::Repository>,
|
repo: ::std::sync::Arc<dyn ::bok::Repository>,
|
||||||
_build: &::bok::deps::Build,
|
_build: &::bok::deps::Build,
|
||||||
_runtime: &::bok::deps::Runtime,
|
_runtime: &::bok::deps::Runtime,
|
||||||
) -> Result<(), ()> {
|
) -> Result<(), ()> {
|
||||||
|
@ -45,10 +45,16 @@ impl ::std::default::Default for Two {
|
|||||||
impl ::bok::Pkg for Two {
|
impl ::bok::Pkg for Two {
|
||||||
fn dependencies_set(
|
fn dependencies_set(
|
||||||
&self,
|
&self,
|
||||||
_repo: ::std::sync::Arc<dyn ::bok::Repository>,
|
repo: ::std::sync::Arc<dyn ::bok::Repository>,
|
||||||
_build: &::bok::deps::Build,
|
_build: &::bok::deps::Build,
|
||||||
_runtime: &::bok::deps::Runtime,
|
_runtime: &::bok::deps::Runtime,
|
||||||
) -> Result<(), ()> {
|
) -> Result<(), ()> {
|
||||||
|
let repo_any = repo.as_any();
|
||||||
|
let Some(actual_repo) = repo_any.downcast_ref::<R>() else {
|
||||||
|
return Err(());
|
||||||
|
};
|
||||||
|
let _ = actual_repo.one();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ pub trait Repository: ::core::fmt::Debug {
|
|||||||
fn path(&self) -> Path<RepoName>;
|
fn path(&self) -> Path<RepoName>;
|
||||||
fn pkg_list(&self) -> &[&'static str];
|
fn pkg_list(&self) -> &[&'static str];
|
||||||
fn get(&self, pkg_name: &str) -> Option<::std::boxed::Box<dyn Pkg>>;
|
fn get(&self, pkg_name: &str) -> Option<::std::boxed::Box<dyn Pkg>>;
|
||||||
|
fn as_any(&self) -> &dyn ::std::any::Any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is an empty Package List.
|
/// This is an empty Package List.
|
||||||
@ -75,6 +76,9 @@ impl Repository for RepositoryEmpty {
|
|||||||
fn get(&self, _pkg_name: &str) -> Option<::std::boxed::Box<dyn Pkg>> {
|
fn get(&self, _pkg_name: &str) -> Option<::std::boxed::Box<dyn Pkg>> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
fn as_any(&self) -> &dyn ::std::any::Any {
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Print the code of the package
|
/// Print the code of the package
|
||||||
|
Loading…
Reference in New Issue
Block a user