diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-17 07:32:30 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-17 07:36:57 +0100 |
| commit | 20252df698106283d15ddf7d53f4e0dd9462666d (patch) | |
| tree | bf77733ab5fddd3f09962cde9a22e9f1d485b6c9 /dev/BuildKit | |
| parent | caecbd4e6eb2877b7e9bdd4fb2e4f3e370b336c9 (diff) | |
refactor! Lots of breaking changes to the codebase.
feat: Rename ‘btb‘ to ‘nebuild‘ to match nekernel.org's naming scheme.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/BuildKit')
| -rw-r--r-- | dev/BuildKit/IManifestBuilder.h | 32 | ||||
| -rw-r--r-- | dev/BuildKit/Includes.h | 17 | ||||
| -rw-r--r-- | dev/BuildKit/JSONManifestBuilder.h | 30 | ||||
| -rw-r--r-- | dev/BuildKit/Macros.h | 34 |
4 files changed, 113 insertions, 0 deletions
diff --git a/dev/BuildKit/IManifestBuilder.h b/dev/BuildKit/IManifestBuilder.h new file mode 100644 index 0000000..1c160c4 --- /dev/null +++ b/dev/BuildKit/IManifestBuilder.h @@ -0,0 +1,32 @@ +// ============================================================= // +// nebuild +// Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. +// ============================================================= // + +#pragma once + +#include <BuildKit/Includes.h> +#include <BuildKit/Macros.h> + +#define BTB_MANIFEST_BUILDER : public BTB::IManifestBuilder + +namespace BTB { +/// @brief Builder interface class. +/// @note This class is meant to be used as an interface. +class IManifestBuilder { + public: + IManifestBuilder() = default; + virtual ~IManifestBuilder() = default; + + IManifestBuilder& operator=(const IManifestBuilder&) = default; + IManifestBuilder(const IManifestBuilder&) = default; + + /// @brief Builds a target using the implemented laguage. + /// @param arg_sz filename size + /// @param arg_val filename path. + /// @retval true succeeded. + /// @retval false failed. + virtual bool buildTarget(int arg_sz, const char* arg_val, const bool dry_run = false) = 0; + virtual const char* buildSystem() = 0; +}; +} // namespace BTB
\ No newline at end of file diff --git a/dev/BuildKit/Includes.h b/dev/BuildKit/Includes.h new file mode 100644 index 0000000..e321483 --- /dev/null +++ b/dev/BuildKit/Includes.h @@ -0,0 +1,17 @@ +// ============================================================= // +// nebuild +// Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. +// ============================================================= // + +#ifndef BTB_INCLUDES_H +#define BTB_INCLUDES_H + +#include <cstddef> +#include <cstdio> +#include <fstream> +#include <iostream> +#include <sstream> +#include <string> +#include <thread> + +#endif // BTB_INCLUDES_H diff --git a/dev/BuildKit/JSONManifestBuilder.h b/dev/BuildKit/JSONManifestBuilder.h new file mode 100644 index 0000000..a4fe66b --- /dev/null +++ b/dev/BuildKit/JSONManifestBuilder.h @@ -0,0 +1,30 @@ +// ============================================================= // +// nebuild +// Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. +// ============================================================= // + +#pragma once + +#include <BuildKit/IManifestBuilder.h> +#include <json.h> + +namespace BTB { +/// @brief JSON builder +class JSONManifestBuilder final BTB_MANIFEST_BUILDER { + public: + JSONManifestBuilder() = default; + ~JSONManifestBuilder() override = default; + + JSONManifestBuilder& operator=(const JSONManifestBuilder&) = default; + JSONManifestBuilder(const JSONManifestBuilder&) = default; + + public: + /// @brief Builds a JSON target. + /// @param arg_sz filename size + /// @param arg_val filename path. + /// @retval true build succeeded. + /// @retval false failed to build. + bool buildTarget(int arg_sz, const char* arg_val, const bool dry_run = false) override; + const char* buildSystem() override; +}; +} // namespace BTB
\ No newline at end of file diff --git a/dev/BuildKit/Macros.h b/dev/BuildKit/Macros.h new file mode 100644 index 0000000..1b1613d --- /dev/null +++ b/dev/BuildKit/Macros.h @@ -0,0 +1,34 @@ +// ============================================================= // +// nebuild +// Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. +// ============================================================= // + +#pragma once + +extern "C" { +#include <assert.h> +} + +#include <rang.h> + +#define LIKELY(ARG) ((ARG) ? assert(false) : ((void) 0)) +#define UNLIKELY(ARG) LIKELY(!(ARG)) + +#define LIBBTB_VERSION "v0.0.1-libBTB" + +#define LIBBTB_VERSION_BCD 0x0001 + +#define LIBBTB_VERSION_MAJOR 1 +#define LIBBTB_VERSION_MINOR 1 +#define LIBBTB_VERSION_PATCH 0 + +#define LIBBTB_UNUSED(X) ((void) X) + +namespace BTB::Logger { +/// @brief replacement for std::cout for BTB logging. +inline std::ostream& info() noexcept { + auto& out = std::cout; + out << rang::fg::red << "nebuild: " << rang::style::reset; + return out; +} +} // namespace BTB::Logger |
