Skip to content

Commit 1c5ada4

Browse files
Merge pull request #65 from Neko-Box-Coder/UsingResult
Using DS::Result for most of the runcpp2 functions, simplying & removing ssTest
2 parents d76f6ee + b8f0309 commit 1c5ada4

38 files changed

+3046
-5061
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
[submodule "dylib"]
1717
path = External/dylib
1818
url = https://github.com/martin-olivier/dylib.git
19-
[submodule "ssTest"]
20-
path = External/ssTest
21-
url = https://github.com/Neko-Box-Coder/ssTest.git
2219
[submodule "CppOverride"]
2320
path = External/CppOverride
2421
url = https://github.com/Neko-Box-Coder/CppOverride.git

Build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pushd Build || goto :error
88

99
cmake .. || goto :error
1010
cmake --build . --target Embed2C || goto :error
11-
cmake .. -DssLOG_LEVEL=DEBUG "%*" || goto :error
11+
cmake .. -DssLOG_LEVEL=INFO "%*" || goto :error
1212
cmake --build . -j 16 --config Debug || goto :error
1313

1414
popd

Build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pushd ./Build
66

77
cmake ..
88
cmake --build . --target Embed2C
9-
cmake .. -DssLOG_LEVEL=DEBUG -DCMAKE_BUILD_TYPE=Debug "$@"
9+
cmake .. -DssLOG_LEVEL=INFO -DCMAKE_BUILD_TYPE=Debug "$@"
1010
cmake --build . -j 16
1111

1212
popd

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ else()
2424
option(RUNCPP2_BUILD_TESTS "Build runcpp2 tests" OFF)
2525
endif()
2626

27+
# Don't build any tests for now until we have rewritten th
28+
option(RUNCPP2_BUILD_TESTS "Build runcpp2 tests" OFF)
29+
2730
# =========================================================================
2831
# Retrieving Version String
2932
# =========================================================================
@@ -105,6 +108,7 @@ add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/variant")
105108

106109
set(EXPECTED_BUILD_PACKAGE OFF)
107110
set(BUILD_TESTING OFF)
111+
set(DS_USE_DEBUG_BREAK ON)
108112
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/DSResult")
109113

110114
set(BUILD_TESTING ON)
@@ -121,9 +125,6 @@ target_include_directories( string-view-lite INTERFACE
121125
configure_file( "${CMAKE_CURRENT_LIST_DIR}/External/cfgpath/cfgpath.h"
122126
"${CMAKE_CURRENT_LIST_DIR}/Include/cfgpath.h" COPYONLY)
123127

124-
if(RUNCPP2_BUILD_TESTS)
125-
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/ssTest")
126-
endif()
127128
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/CppOverride")
128129

129130
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/External/MacroPowerToys")

External/ssTest

Lines changed: 0 additions & 1 deletion
This file was deleted.

Include/runcpp2/CompilingLinking.hpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,30 @@
1414

1515
namespace runcpp2
1616
{
17-
bool CompileScriptOnly( const ghc::filesystem::path& buildDir,
17+
DS::Result<void>
18+
CompileScriptOnly( const ghc::filesystem::path& buildDir,
19+
const ghc::filesystem::path& scriptPath,
20+
const std::vector<ghc::filesystem::path>& sourceFiles,
21+
const std::vector<bool>& sourceHasCache,
22+
const std::vector<ghc::filesystem::path>& includePaths,
23+
const Data::ScriptInfo& scriptInfo,
24+
const std::vector<Data::DependencyInfo*>& availableDependencies,
25+
const Data::Profile& profile,
26+
const int maxThreads);
27+
28+
//TODO: Convert string paths to filesystem paths
29+
DS::Result<void>
30+
CompileAndLinkScript( const ghc::filesystem::path& buildDir,
1831
const ghc::filesystem::path& scriptPath,
32+
const std::string& outputName,
1933
const std::vector<ghc::filesystem::path>& sourceFiles,
2034
const std::vector<bool>& sourceHasCache,
2135
const std::vector<ghc::filesystem::path>& includePaths,
2236
const Data::ScriptInfo& scriptInfo,
2337
const std::vector<Data::DependencyInfo*>& availableDependencies,
2438
const Data::Profile& profile,
39+
const std::vector<std::string>& compiledObjectsPaths,
2540
const int maxThreads);
26-
27-
//TODO: Convert string paths to filesystem paths
28-
bool CompileAndLinkScript( const ghc::filesystem::path& buildDir,
29-
const ghc::filesystem::path& scriptPath,
30-
const std::string& outputName,
31-
const std::vector<ghc::filesystem::path>& sourceFiles,
32-
const std::vector<bool>& sourceHasCache,
33-
const std::vector<ghc::filesystem::path>& includePaths,
34-
const Data::ScriptInfo& scriptInfo,
35-
const std::vector<Data::DependencyInfo*>& availableDependencies,
36-
const Data::Profile& profile,
37-
const std::vector<std::string>& compiledObjectsPaths,
38-
const int maxThreads);
3941
}
4042

4143
#endif

Include/runcpp2/ConfigParsing.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
#include <vector>
1111
namespace runcpp2
1212
{
13-
std::string GetConfigFilePath();
13+
DS::Result<std::string> GetConfigFilePath();
1414

15-
bool WriteDefaultConfigs( const ghc::filesystem::path& userConfigPath,
16-
const bool writeUserConfig,
17-
const bool writeDefaultConfigs);
15+
DS::Result<void> WriteDefaultConfigs( const ghc::filesystem::path& userConfigPath,
16+
const bool writeUserConfig,
17+
const bool writeDefaultConfigs);
1818

19-
bool ReadUserConfig(std::vector<Data::Profile>& outProfiles,
20-
std::string& outPreferredProfile,
21-
const std::string& customConfigPath = "");
19+
DS::Result<void> ReadUserConfig(std::vector<Data::Profile>& outProfiles,
20+
std::string& outPreferredProfile,
21+
const std::string& customConfigPath = "");
2222

23-
bool ParseScriptInfo(const std::string& scriptInfo, Data::ScriptInfo& outScriptInfo);
23+
DS::Result<void> ParseScriptInfo(const std::string& scriptInfo, Data::ScriptInfo& outScriptInfo);
2424
}
2525

2626
#endif

Include/runcpp2/DependenciesHelper.hpp

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,64 @@
99
#define NOMINMAX 1
1010
#endif
1111

12+
#include "DSResult/DSResult.hpp"
1213
#include "ghc/filesystem.hpp"
1314
#include <vector>
1415

1516
namespace runcpp2
1617
{
17-
bool GetDependenciesPaths( const std::vector<Data::DependencyInfo*>& availableDependencies,
18-
std::vector<std::string>& outCopiesPaths,
19-
std::vector<std::string>& outSourcesPaths,
20-
const ghc::filesystem::path& scriptPath,
21-
const ghc::filesystem::path& buildDir);
18+
DS::Result<void>
19+
GetDependenciesPaths( const std::vector<Data::DependencyInfo*>& availableDependencies,
20+
std::vector<std::string>& outCopiesPaths,
21+
std::vector<std::string>& outSourcesPaths,
22+
const ghc::filesystem::path& scriptPath,
23+
const ghc::filesystem::path& buildDir);
2224

2325
bool IsDependencyAvailableForThisPlatform(const Data::DependencyInfo& dependency);
2426

25-
bool CleanupDependencies( const runcpp2::Data::Profile& profile,
27+
DS::Result<void>
28+
CleanupDependencies(const runcpp2::Data::Profile& profile,
29+
const Data::ScriptInfo& scriptInfo,
30+
const std::vector<Data::DependencyInfo*>& availableDependencies,
31+
const std::vector<std::string>& dependenciesLocalCopiesPaths,
32+
const std::string& dependenciesToReset);
33+
34+
DS::Result<void>
35+
SetupDependenciesIfNeeded( const runcpp2::Data::Profile& profile,
36+
const ghc::filesystem::path& buildDir,
2637
const Data::ScriptInfo& scriptInfo,
27-
const std::vector<Data::DependencyInfo*>& availableDependencies,
38+
std::vector<Data::DependencyInfo*>& availableDependencies,
2839
const std::vector<std::string>& dependenciesLocalCopiesPaths,
29-
const std::string& dependenciesToReset);
30-
31-
bool SetupDependenciesIfNeeded( const runcpp2::Data::Profile& profile,
32-
const ghc::filesystem::path& buildDir,
33-
const Data::ScriptInfo& scriptInfo,
34-
std::vector<Data::DependencyInfo*>& availableDependencies,
35-
const std::vector<std::string>& dependenciesLocalCopiesPaths,
36-
const std::vector<std::string>& dependenciesSourcePaths,
37-
const int maxThreads);
40+
const std::vector<std::string>& dependenciesSourcePaths,
41+
const int maxThreads);
3842

39-
bool BuildDependencies( const runcpp2::Data::Profile& profile,
40-
const Data::ScriptInfo& scriptInfo,
41-
const std::vector<Data::DependencyInfo*>& availableDependencies,
42-
const std::vector<std::string>& dependenciesLocalCopiesPaths,
43-
const int maxThreads);
43+
DS::Result<void>
44+
BuildDependencies( const runcpp2::Data::Profile& profile,
45+
const Data::ScriptInfo& scriptInfo,
46+
const std::vector<Data::DependencyInfo*>& availableDependencies,
47+
const std::vector<std::string>& dependenciesLocalCopiesPaths,
48+
const int maxThreads);
4449

45-
bool GatherDependenciesBinaries(const std::vector<Data::DependencyInfo*>& availableDependencies,
46-
const std::vector<std::string>& dependenciesCopiesPaths,
47-
const Data::Profile& profile,
48-
std::vector<std::string>& outBinariesPaths);
50+
DS::Result<void>
51+
GatherDependenciesBinaries( const std::vector<Data::DependencyInfo*>& availableDependencies,
52+
const std::vector<std::string>& dependenciesCopiesPaths,
53+
const Data::Profile& profile,
54+
std::vector<std::string>& outBinariesPaths);
4955

50-
bool HandleImport(Data::DependencyInfo& dependency, const ghc::filesystem::path& basePath);
56+
DS::Result<void> HandleImport( Data::DependencyInfo& dependency,
57+
const ghc::filesystem::path& basePath);
5158

52-
bool ResolveImports(Data::ScriptInfo& scriptInfo,
53-
const ghc::filesystem::path& scriptPath,
54-
const ghc::filesystem::path& buildDir);
59+
DS::Result<void> ResolveImports(Data::ScriptInfo& scriptInfo,
60+
const ghc::filesystem::path& scriptPath,
61+
const ghc::filesystem::path& buildDir);
5562

56-
bool SyncLocalDependency( const Data::DependencyInfo& dependency,
57-
const ghc::filesystem::path& sourcePath,
58-
const ghc::filesystem::path& copyPath);
63+
DS::Result<void> SyncLocalDependency( const Data::DependencyInfo& dependency,
64+
const ghc::filesystem::path& sourcePath,
65+
const ghc::filesystem::path& copyPath);
5966

60-
bool SyncLocalDependencies( const std::vector<Data::DependencyInfo*>& dependencies,
61-
const std::vector<std::string>& dependenciesSourcePaths,
62-
const std::vector<std::string>& dependenciesCopiesPaths);
67+
DS::Result<void> SyncLocalDependencies(const std::vector<Data::DependencyInfo*>& dependencies,
68+
const std::vector<std::string>& dependenciesSourcePaths,
69+
const std::vector<std::string>& dependenciesCopiesPaths);
6370
}
6471

6572
#endif

Include/runcpp2/IncludeManager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <vector>
1111

1212
#if INTERNAL_RUNCPP2_UNIT_TESTS
13-
class IncludeManagerAccessor;
13+
struct IncludeManagerAccessor;
1414
#endif
1515

1616
namespace runcpp2
@@ -36,7 +36,7 @@ namespace runcpp2
3636

3737
private:
3838
#if INTERNAL_RUNCPP2_UNIT_TESTS
39-
friend class ::IncludeManagerAccessor;
39+
friend struct ::IncludeManagerAccessor;
4040
#endif
4141

4242
ghc::filesystem::path GetRecordPath(const ghc::filesystem::path& sourceFile) const;

0 commit comments

Comments
 (0)