Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspaces #101

Draft
wants to merge 72 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
5ddd70e
#fix - solving an error generated in the latest release for the tests…
TheRustifyer Mar 5, 2023
88a55c9
Merge branch 'zerodaycode:main' into main
TheRustifyer Mar 5, 2023
7812281
#fix - disabling the cache for Clang when process BMI's, since Unix s…
TheRustifyer Mar 5, 2023
ffa3a7d
#fix - Cleaned useless logs in the BMIs generation
TheRustifyer Mar 5, 2023
35a5845
Joining the base paths to the module files when the reader assembles …
TheRustifyer Mar 5, 2023
6e2bd84
Enabling a boolean flag to indicate whenever the user wants to genera…
TheRustifyer Mar 5, 2023
dd8506d
Initial implementation of the generation of a database compilation
TheRustifyer Mar 5, 2023
af08d69
Denying all the unknown fields, instead of silently ignore them when …
TheRustifyer Mar 5, 2023
24db40a
Full paths for the compilation database 'directory' property. NEW att…
TheRustifyer Mar 5, 2023
a004540
Caching how the files are flagged to avoid rebuild them. Now they are…
TheRustifyer Mar 5, 2023
ff61f1e
Removing reference types for project_model::CppCompiler, which is che…
TheRustifyer Mar 6, 2023
a8b9898
Solved the need of MSVC for storing the output generated files paths …
TheRustifyer Mar 6, 2023
7029d16
WIP - Working with absolute paths since the creation of the project m…
TheRustifyer Mar 6, 2023
80d2c62
Rework of the translation unit trait
TheRustifyer Mar 6, 2023
453b69c
WIP - Refactoring the whole flux, since the initial parsing to the ge…
TheRustifyer Mar 7, 2023
8ecbb54
Removed `test_mode` function parameter from the run_generated_command…
TheRustifyer Mar 8, 2023
eb4b08b
WIP - Non module source files with their own build and assemble proce…
TheRustifyer Mar 9, 2023
63104f1
Giving to the linker the correct object files, and not the sources
TheRustifyer Mar 9, 2023
cef0a1b
Upgraded the lookup algorithm for retrieve the details of a cached so…
TheRustifyer Mar 9, 2023
ad7fd9a
System modules now deserves their own place, without being merged wit…
TheRustifyer Mar 9, 2023
edb5e13
Cleaned and merged the logic for executing commands for interfaces, i…
TheRustifyer Mar 9, 2023
c5327f8
Cleaned and merged the logic for executing commands for interfaces, i…
TheRustifyer Mar 9, 2023
cf04806
Merge branch 'sources-compiled-without-linking'
TheRustifyer Mar 9, 2023
9f4055c
Removing the generated command lines for the per cycle cache executio…
TheRustifyer Mar 9, 2023
763f645
Distinction for the cached main command line command, depending on if…
TheRustifyer Mar 9, 2023
d5ca4c6
Readjusted the example file
TheRustifyer Mar 9, 2023
ad8c849
More adjusts
TheRustifyer Mar 10, 2023
ae4587f
Reworking the test for the project model because the full paths now s…
Mar 10, 2023
788b152
Refactored and generified the work of convert the generated command l…
TheRustifyer Mar 12, 2023
b8ee0dd
Added the compiler's driver name to the beginning of the generated co…
TheRustifyer Mar 12, 2023
879dbeb
Reenabled the addition of the linker command to the last_generated_co…
TheRustifyer Mar 12, 2023
a4e19e0
Reworking the compilation database, and moving their components into …
TheRustifyer Mar 12, 2023
ea1c57f
Solving the problem of the double incremental time of the cache loadi…
TheRustifyer Mar 12, 2023
1972a06
Code reworked to remove the interior mutability pattern in favor or r…
TheRustifyer Mar 12, 2023
bf27d6a
Merge branch 'zerodaycode:main' into main
TheRustifyer Mar 12, 2023
668d180
Version 0.8.0
TheRustifyer Mar 12, 2023
2e8a464
Merge branch 'zerodaycode:main' into main
TheRustifyer Mar 14, 2023
33d0a7b
removed the restriction of choose the standard library only in OS tha…
TheRustifyer Mar 14, 2023
5d2846f
The output directory now is an absolute path
TheRustifyer Mar 14, 2023
38f8534
Solved issues with absolute paths for unit tests that was using mocke…
TheRustifyer Mar 15, 2023
c5b917e
Updating the CHANGELOG.md to reflect the upcoming ideas that will be …
TheRustifyer Mar 15, 2023
37ca2a6
Version 0.8.1
Mar 15, 2023
8bde361
Cleaning death code
TheRustifyer Mar 16, 2023
a7e3e0b
Version 0.8.2 - Vec<Argument> now it's replaced by Argument, a strong…
TheRustifyer Mar 16, 2023
b0026d8
Version 0.8.3 - The modules key of the configuration file got a new p…
TheRustifyer Mar 16, 2023
4819dfb
Formatting adjustements and deactivating Clang's test because the Cla…
TheRustifyer Mar 17, 2023
17ca263
Merge branch 'main' of https://github.com/zerodaycode/Zork
Apr 2, 2023
701236b
Solved the duplicated error message when some compiler execution retu…
Apr 2, 2023
ec5c836
Shortened the error message when the build fails for a concrete file
Apr 2, 2023
6d1d853
V0.8.4
TheRustifyer Apr 2, 2023
319ae9b
Merge branch 'zerodaycode:main' into main
TheRustifyer Apr 5, 2023
5e06bd0
Merge branch 'zerodaycode:main' into main
TheRustifyer Apr 5, 2023
c3f85a9
Started initial work for implement workspaces like Cargo in Zork++
TheRustifyer Apr 26, 2023
27d0f8b
WIP - Refactoring the main processor loop for the config files parsing
TheRustifyer Apr 28, 2023
c90dee6
Solved the issues with the toml deserialization lifetimes. Now, we ha…
Jul 30, 2023
b16ae51
code: merged changes of the latest release with the workspaces PR
TheRustifyer Nov 28, 2023
9208bc3
Merge branch 'zerodaycode:main' into main
TheRustifyer Jan 17, 2024
39abe8e
Merge branch 'main' into workspaces
TheRustifyer Apr 13, 2024
4625dd4
Merge branch 'main' into workspaces
TheRustifyer Apr 13, 2024
4d54022
fix: Build error due to missplaced duplicated line
TheRustifyer Apr 14, 2024
8dd7687
fix: Linux integration tests for GCC due to the gcm.cache folder left…
TheRustifyer Apr 14, 2024
1e31f2c
fix: Isolated Linux GCC IT. Removed missing driver flag for Clang tests
TheRustifyer Apr 14, 2024
f323764
feat: Adding Clang 18 to the matrix of the upstream tests
TheRustifyer Apr 14, 2024
21bfe04
Merge branch 'main' into workspaces
TheRustifyer May 2, 2024
789bd7a
chore: discarding the workflow for testing the buid with Clang when i…
TheRustifyer May 2, 2024
4a4fc76
feat(WIP)!: Re-enabling the Windows tests
TheRustifyer May 2, 2024
b7a1370
feat: Separating the tests from the code quality workflows
TheRustifyer May 2, 2024
1ff0c94
feat: Splitting the integration tests per compiler
TheRustifyer May 2, 2024
bae2dc5
fix: Missing use statements for conditional tests
TheRustifyer May 2, 2024
cc4fac0
feat: Adding a Rust toolchain for the MSVC workflow on Windows
TheRustifyer May 2, 2024
2771710
feat: solving Clippy issues up to Rust 1.78.0 (29/04/2024)
TheRustifyer May 2, 2024
d15a6dc
feat: cleaned the commentary on the GCC tests, since GCC is already w…
TheRustifyer May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 10 additions & 44 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Code quality and sanity

on:
push:
branches: '*'
branches: 'main'
pull_request:
branches: '*'

Expand All @@ -22,12 +22,12 @@ jobs:
- uses: hecrj/setup-rust-action@v1
with:
components: clippy
- name: Verifiying the code quality with Clippy

- name: Verifiying the code quality with Clippy
run: |
cd zork++
cargo clippy --all-targets --all-features

rustfmt:
name: Verify code formatting
runs-on: ubuntu-latest
Expand All @@ -36,51 +36,17 @@ jobs:
- name: Caching project dependencies
id: project-cache
uses: Swatinem/rust-cache@v2
- uses: hecrj/setup-rust-action@v1

- uses: hecrj/setup-rust-action@v2
with:
components: rustfmt

- name: Checking the format sanity of the project
run: |
cd zork++
cargo fmt --all -- --check

tests:
name: Run the tests - Clang
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
clang_version: [15, 16, 17]
steps:
- uses: actions/checkout@v3
- name: Caching project dependencies
id: project-cache
uses: Swatinem/rust-cache@v2
- name: Install Clang ${{ matrix.clang_version }}
run: |
# Exit on error
set -e
# Download and execute the LLVM installation script for the specified Clang version
echo "-----> Downloading and executing the LLVM installation script for Clang ${{ matrix.clang_version }}"
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{ matrix.clang_version }}

echo "-----> Installing libc++"
sudo apt-get install -y libc++-${{ matrix.clang_version }}-dev libc++abi-${{ matrix.clang_version }}-dev libunwind-${{ matrix.clang_version }} libunwind-${{ matrix.clang_version }}-dev libc6 libzstd1

# Update the symbolic link to point to the newly installed Clang version
echo "-----> Updating the symbolic link to point to Clang ${{ matrix.clang_version }}"
sudo rm -f /usr/bin/clang++
sudo ln -s /usr/bin/clang++-${{ matrix.clang_version }} /usr/bin/clang++


# Display the installation directory and version of the installed Clang
echo "-----> Clang-${{ matrix.clang_version }} was installed on:"
which clang-${{ matrix.clang_version }}
echo "-----> Clang++ was installed on:"
which clang++-${{ matrix.clang_version }}
- name: Running the tests for the project
- name: Run Unit and Doc tests
run: |
cd zork++
RUST_LOG=trace cargo test 2>&1 --all --color=always --no-fail-fast -- --nocapture --show-output --test-threads=1
cargo test --workspace --lib --color=always --no-fail-fast
cargo test --workspace --doc --color=always --no-fail-fast
52 changes: 52 additions & 0 deletions .github/workflows/tests-clang-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Clang Tests For Linux builds

on:
push:
branches: 'main'
pull_request:
branches: '*'

jobs:
tests:
name: Run the tests - Clang
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
clang_version: [15, 16, 17, 18]
steps:
- uses: actions/checkout@v3
- name: Caching project dependencies
id: project-cache
uses: Swatinem/rust-cache@v2

- if: ${{ matrix.clang_version < 18 }}
name: Install Clang ${{ matrix.clang_version }}
run: |
# Exit on error
set -e
# Download and execute the LLVM installation script for the specified Clang version
echo "-----> Downloading and executing the LLVM installation script for Clang ${{ matrix.clang_version }}"
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{ matrix.clang_version }}

echo "-----> Installing libc++"
sudo apt-get install -y libc++-${{ matrix.clang_version }}-dev libc++abi-${{ matrix.clang_version }}-dev libunwind-${{ matrix.clang_version }} libunwind-${{ matrix.clang_version }}-dev libc6 libzstd1

# Update the symbolic link to point to the newly installed Clang version
echo "-----> Updating the symbolic link to point to Clang ${{ matrix.clang_version }}"
sudo rm -f /usr/bin/clang++
sudo ln -s /usr/bin/clang++-${{ matrix.clang_version }} /usr/bin/clang++

# Display the installation directory and version of the installed Clang
echo "-----> Clang-${{ matrix.clang_version }} was installed on:"
which clang-${{ matrix.clang_version }}
echo "-----> Clang++ was installed on:"
which clang++-${{ matrix.clang_version }}

- if: ${{ matrix.clang_version < 18 }}
name: Running the tests for the project
run: |
cd zork++
RUST_LOG=trace cargo test 2>&1 clang --color=always --no-fail-fast -- --nocapture --show-output --test-threads=1
25 changes: 25 additions & 0 deletions .github/workflows/tests-gcc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: GCC Tests For Linux builds

on:
push:
branches: 'main'
pull_request:
branches: '*'

jobs:
tests:
name: Run the tests - GCC
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3

- name: Caching project dependencies
id: project-cache
uses: Swatinem/rust-cache@v2

- name: Running the tests for the project
run: |
cd zork++
RUST_LOG=trace cargo test 2>&1 gcc --color=always --no-fail-fast -- --nocapture --show-output --test-threads=1
30 changes: 30 additions & 0 deletions .github/workflows/tests-msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: MSVC Tests For Windows builds

on:
push:
branches: 'main'
pull_request:
branches: '*'

jobs:
tests:
name: Run the tests - MSVC
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3

- name: Caching project dependencies
id: project-cache
uses: Swatinem/rust-cache@v2

- name: Setting up Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: stable

- name: Running the tests for the project
run: |
cd zork++
cargo test 2>&1 msvc --color=always --no-fail-fast -- --nocapture --show-output --test-threads=1
2 changes: 1 addition & 1 deletion zork++/src/lib/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl ZorkCache {
.entry(PathBuf::from(named_target))
.and_modify(|e| {
if !(*e).eq(&commands_details.main.command) {
*e = commands_details.main.command.clone()
e.clone_from(&commands_details.main.command)
}
})
.or_insert(commands_details.main.command.clone());
Expand Down
2 changes: 1 addition & 1 deletion zork++/src/lib/config_file/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use serde::*;
///
/// assert_eq!(config.output_dir, Some("out"));
/// ```
#[derive(Deserialize, Debug, PartialEq)]
#[derive(Deserialize, Debug, PartialEq, Clone)]
#[serde(deny_unknown_fields)]
pub struct BuildAttribute<'a> {
#[serde(borrow)]
Expand Down
2 changes: 1 addition & 1 deletion zork++/src/lib/config_file/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ use crate::project_model;
///
/// For a test over a real example, please look at the
/// [`zork::config_file::ZorkConfigFile`] doc-test
#[derive(Deserialize, Debug, PartialEq, Default)]
#[derive(Deserialize, Debug, PartialEq, Default, Clone)]
#[serde(deny_unknown_fields)]
pub struct CompilerAttribute<'a> {
pub cpp_compiler: CppCompiler,
Expand Down
6 changes: 5 additions & 1 deletion zork++/src/lib/config_file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ pub mod executable;
pub mod modules;
pub mod project;
pub mod tests;
pub mod workspace;

use std::fmt::Debug;

use crate::config_file::workspace::WorkspaceAttribute;
use serde::Deserialize;

use self::{
Expand Down Expand Up @@ -42,8 +44,10 @@ use self::{
/// The [`ZorkConfigFile`] is the type that holds
/// the whole hierarchy of Zork++ config file attributes
/// and properties
#[derive(Deserialize, Debug, Default)]
#[derive(Deserialize, Debug, Default, Clone)]
pub struct ZorkConfigFile<'a> {
#[serde(borrow)]
pub workspace: Option<WorkspaceAttribute<'a>>,
#[serde(borrow)]
pub project: ProjectAttribute<'a>,
#[serde(borrow)]
Expand Down
8 changes: 4 additions & 4 deletions zork++/src/lib/config_file/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use serde::Deserialize;
/// assert_eq!(&gcc_sys_headers[3], &"type_traits");
/// assert_eq!(&gcc_sys_headers[4], &"functional");
/// ```
#[derive(Deserialize, Debug, PartialEq)]
#[derive(Deserialize, Debug, PartialEq, Clone)]
pub struct ModulesAttribute<'a> {
#[serde(borrow)]
pub base_ifcs_dir: Option<&'a str>,
Expand Down Expand Up @@ -132,7 +132,7 @@ pub struct ModulesAttribute<'a> {
/// assert_eq!(ifc_3.file, "some_module_part.cppm");
/// assert_eq!(ifc_3.module_name, Some("math_part"));
/// ```
#[derive(Deserialize, Debug, PartialEq)]
#[derive(Deserialize, Debug, PartialEq, Clone)]
#[serde(deny_unknown_fields)]
pub struct ModuleInterface<'a> {
#[serde(borrow)]
Expand All @@ -158,7 +158,7 @@ pub struct ModuleInterface<'a> {
/// * `is_internal_partition` - Optional field for declare that the module is actually
/// a module for hold implementation details, known as module implementation partitions.
/// This option only takes effect with MSVC
#[derive(Deserialize, Debug, PartialEq)]
#[derive(Deserialize, Debug, PartialEq, Clone)]
pub struct ModulePartition<'a> {
#[serde(borrow)]
pub module: &'a str,
Expand Down Expand Up @@ -200,7 +200,7 @@ pub struct ModulePartition<'a> {
/// assert_eq!(deps[1], "type_traits");
/// assert_eq!(deps[2], "iostream");
/// ```
#[derive(Deserialize, Debug, PartialEq)]
#[derive(Deserialize, Debug, PartialEq, Clone)]
pub struct ModuleImplementation<'a> {
#[serde(borrow)]
pub file: &'a str,
Expand Down
2 changes: 1 addition & 1 deletion zork++/src/lib/config_file/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use serde::*;
///
/// For a test over a real example, please look at the
/// [`zork::config_file::ZorkConfigFile`] doc-test
#[derive(Deserialize, Debug, PartialEq, Default)]
#[derive(Deserialize, Debug, PartialEq, Default, Clone)]
#[serde(deny_unknown_fields)]
pub struct ProjectAttribute<'a> {
pub name: &'a str,
Expand Down
2 changes: 1 addition & 1 deletion zork++/src/lib/config_file/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use serde::*;
///
/// For a test over a real example, please look at the
/// [`zork::config_file::ZorkConfigFile`] doc-test
#[derive(Deserialize, Debug, PartialEq)]
#[derive(Deserialize, Debug, PartialEq, Clone)]
pub struct TestsAttribute<'a> {
#[serde(borrow)]
pub test_executable_name: Option<&'a str>,
Expand Down
39 changes: 39 additions & 0 deletions zork++/src/lib/config_file/workspace.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use serde::Deserialize;

/// [`WorkspaceAttribute`] - Defines the characteristics of a `Zork++` workspace.
///
/// A `Zork++` workspace is a similar concept to Cargo workspaces, where the managed by
/// the workspace collection of projects shares dependencies, a common output directory,
/// metadata attributes... Commands applied to a workspace are propagated down to the
/// workspace members.
///
/// This allows the user to divide a project into smaller pieces, or create new organization
/// structures for more complex configurations.
///
/// * `members` - A collection of the names by which the dependent projects (every member of the ws)
/// has been defined in their own `zork**.toml` config file in the **project_name** key
///
/// ### Tests
///
/// ```rust
/// use zork::config_file::workspace::{
/// WorkspaceAttribute
/// };
///

/// ```
///
/// > Note: TOML table are toml commented (#) to allow us to parse
/// the inner attributes as the direct type that they belongs to.
/// That commented tables aren't the real TOML, they are just there
/// for testing and exemplification purposes of the inner attributes
/// of the configuration file.
///
/// For a test over a real example, please look at the
/// [`zork::config_file::ZorkConfigFile`] doc-test
#[derive(Deserialize, Debug, PartialEq, Default, Clone)]
#[serde(deny_unknown_fields)]
pub struct WorkspaceAttribute<'a> {
#[serde(borrow)]
pub members: Vec<&'a str>,
}
Loading
Loading