Struct auto_owners::OwnersDb

source ·
pub(crate) struct OwnersDb {
    pub(crate) projects: Vec<ProjectMetadata>,
    pub(crate) owners_path_cache: BTreeMap<String, Utf8PathBuf>,
    pub(crate) rust_metadata: Option<PathBuf>,
    pub(crate) overrides: BTreeMap<String, Vec<Utf8PathBuf>>,
    pub(crate) dry_run: bool,
    pub(crate) update_strategy: UpdateStrategy,
    pub(crate) gn_bin: PathBuf,
    pub(crate) out_dir: PathBuf,
}

Fields§

§projects: Vec<ProjectMetadata>

metadata about projects

§owners_path_cache: BTreeMap<String, Utf8PathBuf>

cache of OWNERS file paths, indexed by target name. Holds the targets for which the corresponding OWNERS file path is known; cached to avoid probing the filesystem

§rust_metadata: Option<PathBuf>

path to the JSON metadata produced by cargo-gnaw

§overrides: BTreeMap<String, Vec<Utf8PathBuf>>

explicit lists of OWNERS files to include instead of inferring, indexed by project name

§dry_run: bool

if set, print update results instead of updating OWNERS file

§update_strategy: UpdateStrategy§gn_bin: PathBuf§out_dir: PathBuf

Implementations§

source§

impl OwnersDb

source

pub(crate) fn new( rust_metadata: Option<PathBuf>, integration_manifest: Option<PathBuf>, overrides: Utf8PathBuf, gn_bin: PathBuf, out_dir: PathBuf, update_strategy: UpdateStrategy, projects_path: Option<String>, dry_run: bool ) -> Result<Self>

source

pub(crate) fn update_all_files(&self) -> Result<()>

Update all OWNERS files for all projects.

source

pub(crate) fn update_owners_file<W: Write>( &self, metadata: &ProjectMetadata, output_buffer: &mut W ) -> Result<()>

Update the OWNERS file for a single 3p project.

source

pub(crate) fn compute_owners_file( &self, metadata: &ProjectMetadata ) -> Result<OwnersFile>

source

pub(crate) fn owners_files_from_reverse_deps( &self, metadata: &ProjectMetadata ) -> Result<OwnersFile>

Run gn refs for the project’s GN target(s) and find the OWNERS files that correspond to its reverse deps.

For Rust projects, cargo-gnaw metadata encodes version-unambiguous GN targets like //third_party/rust_crates:foo-v1_0_0 but we discourage the use of those targets throughout the tree. To find dependencies from in-house code we need to also get reverse deps for the equivalent target without the version, e.g. //third_party/rust_crates:foo.

source

pub(crate) fn reverse_deps(&self, target: &str) -> Result<BTreeSet<String>>

Run gn refs $OUT_DIR $GN_TARGET and return a list of GN targets which depend on the target.

source

pub(crate) fn owners_file_for_gn_target( &self, target: &str ) -> Result<Utf8PathBuf>

Given a GN target, find the most likely path for its corresponding OWNERS file.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more