Skip to content

Commit 61839e4

Browse files
committed
Use llvm command line.
1 parent 7833703 commit 61839e4

17 files changed

Lines changed: 211 additions & 221 deletions

File tree

cppan.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ projects:
114114

115115
client:
116116
root_directory: src/client
117-
executable_type: win32
117+
#executable_type: win32
118118
files:
119119
- .*
120120
exclude_from_build:
@@ -126,11 +126,10 @@ projects:
126126
dependencies:
127127
- builder
128128
- driver.cpp
129-
- pvt.cppan.demo.taywee.args: "*"
130-
- name: pvt.egorpugin.primitives.minidump
131-
version: master
132-
local: primitives.minidump
133129
- pvt.cppan.demo.giovannidicanio.winreg: master
130+
- name: pvt.egorpugin.primitives.sw.main
131+
version: master
132+
local: primitives.sw.main
134133

135134
post_sources: |
136135
file(GLOB_RECURSE x "${SDIR}/*")
@@ -335,6 +334,9 @@ projects:
335334
version: master
336335
ref: embedder
337336
local: primitives.tools.embedder
337+
- name: pvt.egorpugin.primitives.sw.settings
338+
version: master
339+
local: primitives.sw.settings
338340

339341
post_sources: |
340342
file(GLOB_RECURSE x "${SDIR}/*")

include/sw/builder/command.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ struct SW_BUILDER_API Command : std::enable_shared_from_this<Command>,
132132
path redirectStderr(const path &p);
133133
virtual bool isHashable() const { return true; }
134134
virtual size_t getHash() const;
135+
size_t getHashAndSave() const;
135136
size_t calculateFilesHash() const;
136137
void updateFilesHash() const;
137138

include/sw/builder/driver.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ struct SW_BUILDER_API Driver
120120
virtual bool execute(const path &file_or_dir) const;
121121

122122
//virtual bool build_package(const PackageId &pkg) const = 0;
123+
124+
// maybe inherit from target with all these properties?
125+
virtual String getName() const = 0;
126+
// getDesc()?
123127
};
124128

125129
using DriverPtr = std::unique_ptr<Driver>;

include/sw/driver/cpp/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct SW_DRIVER_CPP_API Driver : ::sw::Driver
2121
PackageScriptPtr fetch_and_load(const path &file_or_dir) const override;
2222
PackageScriptPtr load(const path &file_or_dir) const override;
2323
bool execute(const path &file_or_dir) const override;
24+
String getName() const override { return "cpp"; }
2425
};
2526

2627
} // namespace sw::driver

src/builder/command.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ size_t Command::getHash() const
141141
for (auto &a : args_sorted)
142142
hash_combine(h, std::hash<String>()(a));
143143
// add wdir, env?
144-
return hash = h;
144+
return h;
145+
}
146+
147+
size_t Command::getHashAndSave() const
148+
{
149+
return hash = getHash();
145150
}
146151

147152
size_t Command::calculateFilesHash() const
@@ -278,7 +283,7 @@ void Command::prepare()
278283
return;
279284

280285
program = getProgram();
281-
getHash();
286+
getHashAndSave();
282287

283288
//DEBUG_BREAK_IF_PATH_HAS(program, "org.sw.sw.client.tools.self_builder-0.3.0.exe");
284289

@@ -300,7 +305,7 @@ void Command::execute1(std::error_code *ec)
300305
{
301306
prepare();
302307

303-
DEBUG_BREAK_IF_STRING_HAS(name, "sw.cpp");
308+
//DEBUG_BREAK_IF_STRING_HAS(name, "sw.cpp");
304309

305310
if (!isOutdated())
306311
{

src/builder/file.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <primitives/hash.h>
2121
#include <primitives/templates.h>
2222
#include <primitives/debug.h>
23+
#include <primitives/sw/settings.h>
2324

2425
#include <sstream>
2526

@@ -28,6 +29,8 @@ DECLARE_STATIC_LOGGER(logger, "file");
2829

2930
#define CPPAN_FILES_EXPLAIN_FILE (getUserDirectories().storage_dir_tmp / "explain.txt")
3031

32+
static cl::opt<bool> explain_outdated("explain-outdated", cl::desc("Explain outdated files"));
33+
3134
namespace sw
3235
{
3336

@@ -41,7 +44,7 @@ primitives::filesystem::FileMonitor &get_file_monitor()
4144

4245
void explainMessage(const String &subject, bool outdated, const String &reason, const String &name)
4346
{
44-
if (!Settings::get_local_settings().explain_outdated && 0)
47+
if (!explain_outdated)
4548
return;
4649
static Executor e(1);
4750
static std::ofstream o(CPPAN_FILES_EXPLAIN_FILE.string());
@@ -454,15 +457,16 @@ bool FileRecord::isChanged()
454457

455458
void FileRecord::setGenerator(const std::shared_ptr<builder::Command> &g)
456459
{
457-
//DEBUG_BREAK_IF_PATH_HAS(file, "settings.yy.cpp");
460+
DEBUG_BREAK_IF_PATH_HAS(file, "/primitives.filesystem-master.dll");
458461

459462
if (!g)
460463
return;
461464

462465
auto gold = generator.lock();
463-
if (gold && (gold != g && !gold->isExecuted() && !gold->maybe_unused
464-
/* && gold->getHash() != g->getHash()*/
465-
))
466+
if (gold && (gold != g &&
467+
!gold->isExecuted() &&
468+
!gold->maybe_unused &&
469+
gold->getHash() != g->getHash()))
466470
throw std::runtime_error("Setting generator twice on file: " + file.u8string());
467471
generator = g;
468472
generated_ = true;

0 commit comments

Comments
 (0)