Skip to content

Commit

Permalink
build: remove submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed May 21, 2021
1 parent 076776c commit 8d3c769
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 66 deletions.
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

33 changes: 33 additions & 0 deletions Cargo.lock

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

25 changes: 12 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@ description = """
Guarding is a guardians for code, architecture, layered. Guarding crate a architecture aguard DSL which based on ArchUnit.
"""
categories = ["text-processing", "command-line-interface", "development-tools"]
#exclude = [
# ".github/*",
# ".gitattributes",
# ".adr.json",
#]

include = [
"tree-sitter-java/*",
"tree-sitter-javascript/*",
"tree-sitter-rust/*",
"src/*"
exclude = [
".github/*",
".gitattributes",
".adr.json",
"guarding.guarding",
"_fixtures",
"docs",
"examples",
]

[lib]
path = "src/lib.rs"


[dependencies]
tree-sitter = "0.19.3"
tree-sitter-java = "0.19.0"
tree-sitter-javascript = "0.19.0"
tree-sitter-rust = "0.19.0"

# serialize
serde = { version = "1.0", features = ["derive"] }
Expand All @@ -46,4 +45,4 @@ walkdir = "2"
clap = "3.0.0-beta.2"

[build-dependencies]
cc="*"
cc = "1.0"
25 changes: 0 additions & 25 deletions build.rs

This file was deleted.

3 changes: 1 addition & 2 deletions src/identify/java_ident.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use tree_sitter::{Node, Parser, Query, QueryCursor};

use crate::tree_sitter_java;
use crate::identify::code_model::{CodeClass, CodeFile};
use crate::identify::code_ident::CodeIdent;

Expand Down Expand Up @@ -37,7 +36,7 @@ pub struct JavaIdent {
impl JavaIdent {
pub fn new() -> JavaIdent {
let mut parser = Parser::new();
let language = unsafe { tree_sitter_java() };
let language = tree_sitter_java::language();
parser.set_language(language).unwrap();

let query = Query::new(language, &JAVA_QUERY)
Expand Down
3 changes: 1 addition & 2 deletions src/identify/js_ident.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use tree_sitter::{Node, Parser, Query, QueryCursor};

use crate::identify::code_model::{CodeClass, CodeFile};
use crate::tree_sitter_javascript;
use crate::identify::code_ident::CodeIdent;

const JS_QUERY: &'static str = "
Expand Down Expand Up @@ -36,7 +35,7 @@ impl JsIdent {
fn new() -> JsIdent {
let mut parser = Parser::new();

let language = unsafe { tree_sitter_javascript() };
let language = tree_sitter_javascript::language();
parser.set_language(language).unwrap();

let query = Query::new(language, &JS_QUERY)
Expand Down
3 changes: 1 addition & 2 deletions src/identify/rust_ident.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use tree_sitter::{Node, Parser, Query, QueryCursor};

use crate::tree_sitter_rust;
use crate::identify::code_model::{CodeClass, CodeFile, CodeFunction};
use std::collections::HashMap;
use crate::identify::code_ident::CodeIdent;
Expand Down Expand Up @@ -39,7 +38,7 @@ impl RustIdent {
fn new() -> RustIdent {
let mut parser = Parser::new();

let language = unsafe { tree_sitter_rust() };
let language = tree_sitter_rust::language();
parser.set_language(language).unwrap();

let query = Query::new(language, &RUST_QUERY)
Expand Down
8 changes: 0 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ extern crate pest;
extern crate pest_derive;
extern crate serde;

use tree_sitter::Language;

extern "C" { fn tree_sitter_rust() -> Language; }

extern "C" { fn tree_sitter_java() -> Language; }

extern "C" { fn tree_sitter_javascript() -> Language; }

pub mod identify;
pub mod parser;
pub mod rule_executor;
Expand Down
4 changes: 2 additions & 2 deletions src/rule_executor/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ impl RuleExecutor {

// filter package to class assert
// filter class to class assert
self.filter_classes(&rule, &mut filtered_models);
self.filter_classes_by_scope(&rule, &mut filtered_models);

self.execute_classes_assert(&rule, index, filtered_models)
}

fn filter_classes(&mut self, rule: &&GuardRule, filtered_models: &mut Vec<CodeClass>) {
fn filter_classes_by_scope(&mut self, rule: &&GuardRule, filtered_models: &mut Vec<CodeClass>) {
match &rule.scope {
RuleScope::PathDefine(str) => {
if str.as_str() == "." {
Expand Down
1 change: 0 additions & 1 deletion tree-sitter-java
Submodule tree-sitter-java deleted from 2efe37
1 change: 0 additions & 1 deletion tree-sitter-javascript
Submodule tree-sitter-javascript deleted from 6c8cfa
1 change: 0 additions & 1 deletion tree-sitter-rust
Submodule tree-sitter-rust deleted from a360da

0 comments on commit 8d3c769

Please sign in to comment.