Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY .git .
COPY Makefile .
COPY include ./include/
COPY lib ./lib/
COPY rustify ./rustify/
COPY rs-cpp ./rs-cpp/
COPY src ./src/
RUN make BUILD=release install

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CUSTOM_CXXFLAGS := $(shell grep -m1 cxxflags cabin.toml | sed 's/cxxflags = \[//

# Git dependency versions
TOML11_VER := $(shell grep -m1 toml11 cabin.toml | sed 's/.*tag = \(.*\)}/\1/' | tr -d '"')
RESULT_VER := $(shell grep -m1 cpp-result rustify/cabin.toml | sed 's/.*tag = \(.*\)}/\1/' | tr -d '"')
RESULT_VER := $(shell grep -m1 cpp-result rs-cpp/cabin.toml | sed 's/.*tag = \(.*\)}/\1/' | tr -d '"')

GIT_DEPS := $(O)/DEPS/toml11 $(O)/DEPS/mitama-cpp-result

Expand All @@ -44,7 +44,7 @@ DEFINES := -DCABIN_CABIN_PKG_VERSION='"$(VERSION)"' \
-DCABIN_CABIN_COMMIT_HASH='"$(COMMIT_HASH)"' \
-DCABIN_CABIN_COMMIT_SHORT_HASH='"$(COMMIT_SHORT_HASH)"' \
-DCABIN_CABIN_COMMIT_DATE='"$(COMMIT_DATE)"'
INCLUDES := -Iinclude -Isrc -Irustify/include -isystem $(O)/DEPS/toml11/include \
INCLUDES := -Iinclude -Isrc -Irs-cpp/include -isystem $(O)/DEPS/toml11/include \
-isystem $(O)/DEPS/mitama-cpp-result/include

CXXFLAGS := -std=c++$(EDITION) -fdiagnostics-color $(CUSTOM_CXXFLAGS) \
Expand Down
2 changes: 1 addition & 1 deletion cabin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ libcurl = {version = ">=7.79.1 && <9", system = true}
libgit2 = {version = ">=1.7 && <1.10", system = true}
nlohmann_json = {version = "3.10.5", system = true}
tbb = {version = ">=2021.5.0 && <2023.0.0", system = true}
rustify = {path = "rustify"}
rs-cpp = {path = "./rs-cpp"}

[dev-dependencies]
boost-ut = {git = "https://github.com/boost-ext/ut.git", tag = "v2.3.1"}
Expand Down
2 changes: 1 addition & 1 deletion include/Algos.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include "Command.hpp"
#include "Rustify/Result.hpp"

#include <algorithm>
#include <cstddef>
#include <optional>
#include <rs/result.hpp>
#include <span>
#include <string>
#include <string_view>
Expand Down
2 changes: 1 addition & 1 deletion include/Builder/BuildGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include "Builder/SourceLayout.hpp"
#include "Command.hpp"
#include "Manifest.hpp"
#include "Rustify/Result.hpp"

#include <cstdint>
#include <filesystem>
#include <optional>
#include <rs/result.hpp>
#include <string>
#include <string_view>
#include <tbb/spin_mutex.h>
Expand Down
2 changes: 1 addition & 1 deletion include/Builder/Compiler.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "Command.hpp"
#include "Rustify/Result.hpp"
#include "VersionReq.hpp"

#include <filesystem>
#include <fmt/format.h>
#include <fmt/std.h>
#include <rs/result.hpp>
#include <string>
#include <string_view>
#include <utility>
Expand Down
2 changes: 1 addition & 1 deletion include/Builder/DepGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include "Builder/BuildGraph.hpp"
#include "Builder/BuildProfile.hpp"
#include "Manifest.hpp"
#include "Rustify/Result.hpp"

#include <filesystem>
#include <optional>
#include <rs/result.hpp>
#include <utility>

namespace cabin {
Expand Down
3 changes: 1 addition & 2 deletions include/Command.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#pragma once

#include "Rustify/Result.hpp"

#include <cstdint>
#include <cstdlib>
#include <filesystem>
#include <fmt/format.h>
#include <rs/result.hpp>
#include <span>
#include <string>
#include <string_view>
Expand Down
2 changes: 1 addition & 1 deletion include/Dependency.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include "Builder/Compiler.hpp"
#include "Rustify/Result.hpp"
#include "VersionReq.hpp"

#include <optional>
#include <rs/result.hpp>
#include <string>
#include <utility>
#include <variant>
Expand Down
2 changes: 1 addition & 1 deletion include/Manifest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
#include "Builder/BuildProfile.hpp"
#include "Builder/Compiler.hpp"
#include "Dependency.hpp"
#include "Rustify/Result.hpp"
#include "Semver.hpp"

#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <fmt/ostream.h>
#include <fmt/ranges.h>
#include <rs/result.hpp>
#include <string>
#include <string_view>
#include <toml.hpp>
Expand Down
3 changes: 1 addition & 2 deletions include/Semver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
// ident ::= [a-zA-Z0-9][a-zA-Z0-9-]*
#pragma once

#include "Rustify/Result.hpp"

#include <cstddef>
#include <cstdint>
#include <fmt/ostream.h>
#include <ostream>
#include <rs/result.hpp>
#include <string>
#include <string_view>
#include <utility>
Expand Down
5 changes: 2 additions & 3 deletions lib/Algos.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "Algos.hpp"

#include "Command.hpp"
#include "Rustify/Result.hpp"

#include <cctype>
#include <chrono>
#include <cstdlib>
#include <optional>
#include <rs/result.hpp>
#include <spdlog/spdlog.h>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -89,10 +89,9 @@ bool commandExists(const std::string_view cmd) noexcept {

#ifdef CABIN_TEST

# include "Rustify/Tests.hpp"

# include <array>
# include <limits>
# include <rs/tests.hpp>

namespace tests {

Expand Down
4 changes: 2 additions & 2 deletions lib/Builder/Compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

#include "Algos.hpp"
#include "Command.hpp"
#include "Rustify/Result.hpp"

#include <array>
#include <cctype>
#include <cstdint>
#include <cstdlib>
#include <optional>
#include <rs/result.hpp>
#include <sstream>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -369,7 +369,7 @@ std::string Compiler::detectArchiver(const bool useLTO) const {

#ifdef CABIN_TEST

# include "Rustify/Tests.hpp"
# include <rs/tests.hpp>

namespace tests {

Expand Down
3 changes: 1 addition & 2 deletions lib/Command.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include "Command.hpp"

#include "Rustify/Result.hpp"

#include <algorithm>
#include <array>
#include <cstdio>
#include <cstdlib>
#include <fcntl.h>
#include <fmt/format.h>
#include <rs/result.hpp>
#include <string>
#include <sys/select.h>
#include <sys/wait.h>
Expand Down
5 changes: 2 additions & 3 deletions lib/Manifest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "Builder/BuildProfile.hpp"
#include "Builder/Compiler.hpp"
#include "Rustify/Result.hpp"
#include "Semver.hpp"
#include "TermColor.hpp"
#include "VersionReq.hpp"
Expand All @@ -14,6 +13,7 @@
#include <fmt/core.h>
#include <optional>
#include <ranges>
#include <rs/result.hpp>
#include <spdlog/spdlog.h>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -674,10 +674,9 @@ Result<void> validatePackageName(const std::string_view name) noexcept {

#ifdef CABIN_TEST

# include "Rustify/Tests.hpp"

# include <climits>
# include <fmt/ranges.h>
# include <rs/tests.hpp>
# include <toml11/fwd/literal_fwd.hpp>

namespace tests {
Expand Down
2 changes: 1 addition & 1 deletion lib/Semver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ Result<Version> Version::parse(const std::string_view str) noexcept {

#ifdef CABIN_TEST

# include "Rustify/Tests.hpp"
# include <rs/tests.hpp>

namespace tests {

Expand Down
6 changes: 2 additions & 4 deletions lib/VersionReq.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include "VersionReq.hpp"

#include "Rustify/Result.hpp"

#include <cctype>
#include <cstddef>
#include <cstdint>
#include <ostream>
#include <rs/result.hpp>
#include <string>
#include <string_view>
#include <utility>
Expand Down Expand Up @@ -848,8 +847,7 @@ std::ostream& operator<<(std::ostream& os, const VersionReq& req) {

#ifdef CABIN_TEST

# include "Rustify/Tests.hpp"

# include <rs/tests.hpp>
# include <source_location>
# include <span>

Expand Down
2 changes: 1 addition & 1 deletion rustify/cabin.toml → rs-cpp/cabin.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "rustify"
name = "rs-cpp"
version = "0.1.0"
edition = "23"

Expand Down
7 changes: 7 additions & 0 deletions rs-cpp/include/rs.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef RS_HPP
#define RS_HPP

#include <rs/result.hpp>
#include <rs/tests.hpp>

#endif // RS_HPP
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
#pragma once
#ifndef RS_RESULT_HPP
#define RS_RESULT_HPP

#include <exception>
#include <fmt/core.h>
#include <memory>
#include <mitama/anyhow/anyhow.hpp>
#include <mitama/result/result.hpp>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>

namespace anyhow = mitama::anyhow;

// NOLINTBEGIN(readability-identifier-naming,cppcoreguidelines-macro-usage)

#define Try(...) MITAMA_TRY(__VA_ARGS__)
#define Bail(...) MITAMA_BAIL(__VA_ARGS__)
#define Ensure(...) MITAMA_ENSURE(__VA_ARGS__)

namespace anyhow = mitama::anyhow;

// FIXME: shared_ptr is an implementation detail. Upstream the fix.
using AnyhowErr = mitama::failure_t<std::shared_ptr<anyhow::error>>;

Expand Down Expand Up @@ -48,3 +45,5 @@ inline constexpr auto to_anyhow = [](auto... xs) {
};

// NOLINTEND(readability-identifier-naming,cppcoreguidelines-macro-usage)

#endif // RS_RESULT_HPP
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#ifndef RS_TESTS_HPP
#define RS_TESTS_HPP

#include <concepts>
#include <cstddef>
Expand Down Expand Up @@ -215,3 +216,5 @@ assertLt(Lhs&& lhs, Rhs&& rhs, const std::string_view msg = "",
}

} // namespace tests

#endif // RS_TESTS_HPP
2 changes: 1 addition & 1 deletion src/Builder/Builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include "Builder/BuildGraph.hpp"
#include "Builder/BuildProfile.hpp"
#include "Builder/DepGraph.hpp"
#include "Rustify/Result.hpp"

#include <filesystem>
#include <optional>
#include <rs/result.hpp>
#include <string>
#include <vector>

Expand Down
4 changes: 2 additions & 2 deletions src/Builder/Project.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include "Algos.hpp"
#include "Builder/BuildProfile.hpp"
#include "Git2.hpp"
#include "Rustify/Result.hpp"
#include "TermColor.hpp"

#include <filesystem>
#include <rs/result.hpp>
#include <spdlog/spdlog.h>
#include <string>
#include <unordered_map>
Expand Down Expand Up @@ -199,7 +199,7 @@ Result<Project> Project::init(const BuildProfile& buildProfile,

#ifdef CABIN_TEST

# include "Rustify/Tests.hpp"
# include <rs/tests.hpp>

namespace tests {

Expand Down
2 changes: 1 addition & 1 deletion src/Builder/Project.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include "Builder/BuildProfile.hpp"
#include "Builder/Compiler.hpp"
#include "Manifest.hpp"
#include "Rustify/Result.hpp"

#include <filesystem>
#include <rs/result.hpp>

namespace cabin {

Expand Down
4 changes: 2 additions & 2 deletions src/Cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "Algos.hpp"
#include "Diag.hpp"
#include "Rustify/Result.hpp"
#include "TermColor.hpp"

#include <algorithm>
Expand All @@ -11,6 +10,7 @@
#include <cstdlib>
#include <fmt/core.h>
#include <functional>
#include <rs/result.hpp>
#include <span>
#include <string>
#include <string_view>
Expand Down Expand Up @@ -709,7 +709,7 @@ Cli::printHelp(const CliArgsView args) const noexcept {

#ifdef CABIN_TEST

# include "Rustify/Tests.hpp"
# include <rs/tests.hpp>

namespace cabin {

Expand Down
Loading
Loading