Skip to content

Commit

Permalink
Fix what broke on the rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Borja Lorente committed Dec 26, 2018
1 parent bfa16a0 commit 263bdf7
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 33 deletions.
14 changes: 13 additions & 1 deletion src/rust/engine/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/rust/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ members = [
"fs/fs_util",
"graph",
"hashing",
"logging",
"process_execution",
"process_executor",
"resettable",
Expand All @@ -43,7 +44,7 @@ members = [
"testutil",
"testutil/mock",
"testutil/local_cas",
"ui"
"ui",
]

# These are the packages which are built/tested when no special selector flags are passed to cargo.
Expand All @@ -62,6 +63,7 @@ default-members = [
"fs/fs_util",
"graph",
"hashing",
"logging",
"process_execution",
"process_executor",
"resettable",
Expand All @@ -87,6 +89,7 @@ indexmap = "1.0.2"
itertools = "0.7.2"
lazy_static = "1"
log = "0.4"
logging = { path = "logging" }
num_enum = "0.1.1"
parking_lot = "0.6"
process_execution = { path = "process_execution" }
Expand All @@ -100,4 +103,3 @@ tempfile = "3"
ui = { path = "ui" }
url = "1.7.1"
tar_api = { path = "tar_api" }
simplelog = "0.5.3"
13 changes: 13 additions & 0 deletions src/rust/engine/logging/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
version = "0.0.1"
name = "logging"
authors = [ "Pants Build <pantsbuild@gmail.com>" ]
publish = false

[dependencies]
log = "0.4"
lazy_static = "1"
num_enum = "0.1.1"
parking_lot = "0.6"
simplelog = "0.5.3"
ui = { path = "../ui" }
42 changes: 18 additions & 24 deletions src/rust/engine/logging/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,36 @@
// Licensed under the Apache License, Version 2.0 (see LICENSE).

// Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to include inner attributes from a common source.
#![cfg_attr(
feature = "cargo-clippy",
deny(
clippy,
default_trait_access,
expl_impl_clone_on_copy,
if_not_else,
needless_continue,
single_match_else,
unseparated_literal_suffix,
used_underscore_binding
)
#![deny(
clippy::all,
clippy::default_trait_access,
clippy::expl_impl_clone_on_copy,
clippy::if_not_else,
clippy::needless_continue,
clippy::single_match_else,
clippy::unseparated_literal_suffix,
clippy::used_underscore_binding
)]
// It is often more clear to show that nothing is being moved.
#![cfg_attr(feature = "cargo-clippy", allow(match_ref_pats))]
#![allow(clippy::match_ref_pats)]
// Subjective style.
#![cfg_attr(
feature = "cargo-clippy",
allow(len_without_is_empty, redundant_field_names)
)]
#![allow(clippy::len_without_is_empty, clippy::redundant_field_names)]
// Default isn't as big a deal as people seem to think it is.
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
#![allow(
clippy::new_without_default,
clippy::new_without_default_derive,
clippy::new_ret_no_self
)]
// Arc<Mutex> can be more clear than needing to grok Orderings:
#![cfg_attr(feature = "cargo-clippy", allow(mutex_atomic))]

pub mod logger;
#![allow(clippy::mutex_atomic)]

extern crate lazy_static;
extern crate log;
extern crate num_enum;
extern crate parking_lot;
extern crate simplelog;
extern crate ui;

pub mod logger;

pub type Logger = logger::Logger;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

use crate::TryIntoPythonLogLevel;
use lazy_static::lazy_static;
use log::{log, set_logger, set_max_level, LevelFilter, Log, Metadata, Record};
use parking_lot::Mutex;
Expand All @@ -10,7 +11,6 @@ use std::fs::File;
use std::fs::OpenOptions;
use std::io::{stderr, Stderr, Write};
use std::path::PathBuf;
use TryIntoPythonLogLevel;

lazy_static! {
pub static ref LOGGER: Logger = Logger::new();
Expand Down Expand Up @@ -64,7 +64,8 @@ impl Logger {
.open(log_file_path)
.map(|file| {
*self.pantsd_log.lock() = MaybeWriteLogger::new(file, level.into());
}).map_err(|err| format!("Error opening pantsd logfile: {}", err))
})
.map_err(|err| format!("Error opening pantsd logfile: {}", err))
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/rust/engine/src/externs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::interning::Interns;
use lazy_static::lazy_static;
use parking_lot::RwLock;

use logger::Logger;
use logging::Logger;

pub fn eval(python: &str) -> Result<Value, Failure> {
with_externs(|e| (e.eval)(e.context, python.as_ptr(), python.len() as u64)).into()
Expand Down
3 changes: 0 additions & 3 deletions src/rust/engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@
// other unsafeness.
#![allow(clippy::not_unsafe_ptr_arg_deref)]


pub mod cffi_externs;
mod context;
mod core;
mod externs;
mod handles;
mod interning;
mod logger;
mod nodes;
mod rule_graph;
mod scheduler;
Expand Down Expand Up @@ -86,7 +84,6 @@ use crate::types::Types;
use futures::Future;
use hashing::Digest;
use log::error;

use logging::logger::LOGGER;

// TODO: Consider renaming and making generic for collections of PyResults.
Expand Down

0 comments on commit 263bdf7

Please sign in to comment.