Skip to content

Commit

Permalink
Reorganize directory structure (#28)
Browse files Browse the repository at this point in the history
* Regorganize directory structure

* Regorganize directory structure
  • Loading branch information
ashbeitz authored May 18, 2023
1 parent 026e432 commit 59c030d
Show file tree
Hide file tree
Showing 49 changed files with 227 additions and 353 deletions.
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "opendigitaltwins-dtdl"]
path = opendigitaltwins-dtdl
[submodule "external/opendigitaltwins-dtdl"]
path = external/opendigitaltwins-dtdl
url = https://github.com/Azure/opendigitaltwins-dtdl
[submodule "iot-plugandplay-models"]
path = iot-plugandplay-models
[submodule "external/iot-plugandplay-models"]
path = external/iot-plugandplay-models
url = https://github.com/Azure/iot-plugandplay-models
23 changes: 13 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@
[workspace]

members = [
"common",
"common-test",
# core
"core/protobuf_data_access",
"core/in-vehicle-digital-twin",

# digital twin model
"digital-twin-model",

# DTDL parser
"dtdl-parser",
"in-vehicle-digital-twin",

# samples
"samples/common",
"samples/proto",
"samples/command/consumer",
"samples/command/provider",
"samples/mixed/consumer",
"samples/mixed/provider",
"samples/property/consumer",
"samples/property/provider"
"samples/protobuf_data_access",
"samples/command",
"samples/mixed",
"samples/property",
]

[workspace.dependencies]
Expand Down
12 changes: 0 additions & 12 deletions common-test/Cargo.toml

This file was deleted.

62 changes: 0 additions & 62 deletions common-test/src/lib.rs

This file was deleted.

12 changes: 0 additions & 12 deletions common/Cargo.toml

This file was deleted.

64 changes: 0 additions & 64 deletions common/src/lib.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ license = "MIT"
[dependencies]
async-std = { workspace = true, features = ["attributes"] }
env_logger= { workspace = true }
ibeji-common = { path = "../common" }
ibeji-common_test = { path = "../common-test" }
dtdl-parser = { path = "../dtdl-parser" }
iref = { workspace = true }
json-ld = { git = "https://github.com/blast-hardcheese/json-ld", branch = "resolve-issue-40" }
log = { workspace = true }
parking_lot = { workspace = true }
prost = { workspace = true }
proto = { path = "../proto" }
core-protobuf-data-access = { path = "../protobuf_data_access" }
serde_json = { workspace = true }
tokio = { workspace = true , features = ["macros", "rt-multi-thread"] }
tonic = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

extern crate iref;

use log::{debug, info};
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use proto::digital_twin::digital_twin_server::DigitalTwin;
use proto::digital_twin::{
use core_protobuf_data_access::digital_twin::v1::digital_twin_server::DigitalTwin;
use core_protobuf_data_access::digital_twin::v1::{
EntityAccessInfo, FindByIdRequest, FindByIdResponse, RegisterRequest, RegisterResponse,
};
use log::{debug, info};
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
use std::collections::HashMap;
use std::sync::Arc;
use tonic::{Request, Response, Status};
Expand Down Expand Up @@ -108,13 +108,10 @@ impl DigitalTwinImpl {
#[cfg(test)]
mod digitaltwin_impl_tests {
use super::*;
use ibeji_common_test::set_dtdl_path;
use proto::digital_twin::EndpointInfo;
use core_protobuf_data_access::digital_twin::v1::EndpointInfo;

#[tokio::test]
async fn find_by_id_test() {
set_dtdl_path();

let operations = vec![String::from("Subscribe"), String::from("Unsubscribe")];

let endpoint_info = EndpointInfo {
Expand Down Expand Up @@ -168,8 +165,6 @@ mod digitaltwin_impl_tests {

#[tokio::test]
async fn register_test() {
set_dtdl_path();

let endpoint_info = EndpointInfo {
protocol: String::from("grpc"),
uri: String::from("http://[::1]:40010"), // Devskim: ignore DS137138
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// Licensed under the MIT license.
// SPDX-License-Identifier: MIT

use core_protobuf_data_access::digital_twin::v1::digital_twin_server::DigitalTwinServer;
use env_logger::{Builder, Target};
use log::{debug, info, LevelFilter};
use parking_lot::RwLock;
use proto::digital_twin::digital_twin_server::DigitalTwinServer;
use std::collections::HashMap;
use std::net::SocketAddr;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion proto/Cargo.toml → core/protobuf_data_access/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT

[package]
name = "proto"
name = "core-protobuf-data-access"
version = "0.1.0"
edition = "2021"
license = "MIT"
Expand Down
5 changes: 4 additions & 1 deletion proto/build.rs → core/protobuf_data_access/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
.message_attribute("EndpointInfo", "#[derive(serde::Deserialize, serde::Serialize)]")
.message_attribute("EntityAccessInfo", "#[derive(serde::Deserialize, serde::Serialize)]")
.compile(&["digital_twin/v1/digital_twin.proto"], &["digital_twin/v1/"])?;
.compile(
&["../../interfaces/digital_twin/v1/digital_twin.proto"],
&["../../interfaces/digital_twin/v1/"],
)?;

Ok(())
}
5 changes: 3 additions & 2 deletions proto/src/lib.rs → core/protobuf_data_access/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: MIT

pub mod digital_twin {
#![allow(clippy::derive_partial_eq_without_eq)]
tonic::include_proto!("digital_twin");
pub mod v1 {
tonic::include_proto!("digital_twin");
}
}
2 changes: 0 additions & 2 deletions dtdl-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ license = "MIT"

[dependencies]
async-std = { workspace = true, features = ["attributes"] }
ibeji-common = { path = "../common" }
ibeji-common_test = { path = "../common-test" }
futures = { workspace = true }
generic-json = { workspace = true, features = ["serde_json-impl"] }
iref = { workspace = true }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 59c030d

Please sign in to comment.