Skip to content

Commit 40a7f3f

Browse files
authored
Move web module in rust-code-analysis-cli workspace (#198)
* Move web module in rust-code-analysis-cli workspace * Update cargo test arguments in ci * Fix visibility
1 parent f38c51d commit 40a7f3f

16 files changed

Lines changed: 41 additions & 168 deletions

File tree

.taskcluster.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ tasks:
4949
git -c advice.detachedHead=false checkout ${head_rev} &&
5050
pip3 install --quiet pre-commit &&
5151
pre-commit run -a --show-diff-on-failure &&
52-
cargo test"
52+
cargo test --all --verbose --all-features"
5353
metadata:
5454
name: rust-code-analysis lint and test
5555
description: rust-code-analysis lint and test
@@ -80,7 +80,7 @@ tasks:
8080
git clone --recursive --quiet ${repository} &&
8181
cd rust-code-analysis &&
8282
git -c advice.detachedHead=false checkout ${head_rev} &&
83-
cargo test &&
83+
cargo test --all --verbose --all-features &&
8484
zip -0 ccov.zip `find . -name 'rust_code_analysis*.gc*' -print` &&
8585
../grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore '/*' -o lcov.info &&
8686
bash <(curl -s https://codecov.io/bash) -f lcov.info"
@@ -111,7 +111,7 @@ tasks:
111111
- git clone --recursive --quiet ${repository}
112112
- cd rust-code-analysis
113113
- git -c advice.detachedHead=false checkout ${head_rev}
114-
- cargo test --verbose --all-features
114+
- cargo test --all --verbose --all-features
115115
mounts:
116116
- content:
117117
url: https://win.rustup.rs/

Cargo.lock

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@ cc = "^1.0"
1010
phf_codegen = "^0.8"
1111

1212
[dependencies]
13-
actix-rt = "^1.0"
14-
actix-web = "^2.0"
1513
aho-corasick = "^0.7"
16-
bytes = "^0.5"
1714
enum-iterator = "^0.6"
18-
futures = "^0.3"
1915
fxhash = "0.2"
2016
json = "^0.12"
2117
lazy_static = "^1.3"
2218
num-format = "^0.4"
2319
petgraph = "^0.5"
2420
phf = { version = "^0.8", features = ["macros"] }
2521
regex = "^1.1"
26-
serde = "^1.0"
22+
serde = { version = "^1.0", features = ["derive"] }
2723
serde_cbor = "^0.11"
2824
serde_json = "^1.0"
2925
termcolor = "^1.0"

rust-code-analysis-cli/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ authors = ["Calixte Denizet <cdenizet@mozilla.com>"]
55
edition = "2018"
66

77
[dependencies]
8+
actix-rt = "^1.0"
9+
actix-web = "^2.0"
10+
bytes = "^0.5"
811
clap = "^2.33"
912
crossbeam = "^0.7"
13+
futures = "^0.3"
1014
globset = "^0.4"
1115
num_cpus = "^1.13"
1216
rust-code-analysis = { path = ".." }
17+
serde = "^1.0"
1318
serde_json = "^1.0"
1419
walkdir = "^2.2"
20+
21+
[dev-dependencies]
22+
pretty_assertions = "^0.6"

rust-code-analysis-cli/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
extern crate clap;
33
extern crate crossbeam;
44
extern crate num_cpus;
5+
#[macro_use]
6+
extern crate serde;
7+
#[cfg_attr(test, macro_use)]
58
extern crate serde_json;
69

10+
mod web;
11+
712
use clap::{App, Arg};
813
use crossbeam::channel::{Receiver, Sender};
914
use crossbeam::crossbeam_channel::unbounded;
@@ -16,8 +21,8 @@ use std::sync::{Arc, Mutex};
1621
use std::{process, thread};
1722
use walkdir::{DirEntry, WalkDir};
1823

19-
use rust_code_analysis::web::server;
2024
use rust_code_analysis::*;
25+
use web::server;
2126

2227
#[derive(Debug)]
2328
struct Config {
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use serde::{Deserialize, Serialize};
22

3-
use crate::comment_rm::rm_comments;
4-
use crate::traits::{Callback, TSParserTrait};
3+
use rust_code_analysis::{rm_comments, Callback, TSParserTrait};
54

65
#[derive(Debug, Deserialize, Serialize)]
76
pub struct WebCommentPayload {

src/web/function.rs renamed to rust-code-analysis-cli/src/web/function.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use serde::{Deserialize, Serialize};
22
use serde_json::{self, Value};
33

4-
use crate::function::{function, FunctionSpan};
5-
use crate::traits::{Callback, TSParserTrait};
4+
use rust_code_analysis::{function, Callback, FunctionSpan, TSParserTrait};
65

76
#[derive(Debug, Deserialize, Serialize)]
87
pub struct WebFunctionPayload {
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use serde::{Deserialize, Serialize};
22
use serde_json::{self, Value};
33
use std::path::PathBuf;
44

5-
use crate::spaces::{metrics, FuncSpace};
6-
use crate::traits::{Callback, TSParserTrait};
5+
use rust_code_analysis::{metrics, Callback, FuncSpace, TSParserTrait};
76

87
#[derive(Debug, Deserialize, Serialize)]
98
pub struct WebMetricsPayload {
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
pub mod alterator;
2-
pub mod ast;
31
pub mod comment;
42
pub mod function;
53
pub mod metrics;
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ use actix_web::{
88
use futures::StreamExt;
99
use std::path::PathBuf;
1010

11-
use super::ast::{AstCallback, AstCfg, AstPayload};
1211
use super::comment::{WebCommentCallback, WebCommentCfg, WebCommentInfo, WebCommentPayload};
1312
use super::function::{WebFunctionCallback, WebFunctionCfg, WebFunctionInfo, WebFunctionPayload};
1413
use super::metrics::{WebMetricsCallback, WebMetricsCfg, WebMetricsInfo, WebMetricsPayload};
15-
use crate::langs::action;
16-
use crate::tools::guess_language;
17-
use crate::LANG;
14+
15+
use rust_code_analysis::{action, guess_language, AstCallback, AstCfg, AstPayload, LANG};
1816

1917
const INVALID_LANGUAGE: &str = "The file extension doesn't correspond to a valid language";
2018

0 commit comments

Comments
 (0)