Skip to content

Commit 50d54f1

Browse files
committed
Improve configs, file storages.
1 parent 0dcc05c commit 50d54f1

28 files changed

Lines changed: 217 additions & 5731 deletions

src/sw/builder/command.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <mutex>
1616

1717
#define SW_INTERNAL_INIT_COMMAND(name, target) \
18-
name->fs = (target).getSolution().fs; \
18+
name->fs = &(target).getFs(); \
1919
(target).setupCommand(*name)
2020

2121
#define SW_MAKE_CUSTOM_COMMAND(type, name, target, ...) \

src/sw/driver/build.cpp

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ String BuildSettings::getConfig() const
270270
addConfigElement(c, toString(TargetOS.Arch));
271271
if (TargetOS.Arch == ArchType::arm || TargetOS.Arch == ArchType::aarch64)
272272
addConfigElement(c, toString(TargetOS.SubArch)); // concat with previous?
273-
boost::to_lower(c);
274273

275274
//addConfigElement(c, Native.getConfig());
276275
/*addConfigElement(c, toString(Native.CompilerType));
@@ -281,7 +280,6 @@ String BuildSettings::getConfig() const
281280
addConfigElement(c, toString(Native.LibrariesType));
282281
if (TargetOS.Type == OSType::Windows && Native.MT)
283282
addConfigElement(c, "mt");
284-
boost::to_lower(c);
285283
addConfigElement(c, toString(Native.ConfigurationType));
286284

287285
return c;
@@ -496,9 +494,6 @@ Build::Build(const SwContext &swctx)
496494
//addSettings(ss);
497495
//host_settings = &addSettings(ss);
498496

499-
// load service local fs by default
500-
fs = &swctx.getServiceFileStorage();
501-
502497
// canonical makes disk letter uppercase on windows
503498
setSourceDir(swctx.source_dir);
504499
BinaryDir = SourceDir / SW_BINARY_DIR;
@@ -511,7 +506,6 @@ Build::Build(const Build &rhs)
511506
//, show_output(rhs.show_output) // don't pass to checks
512507
//, knownTargets(rhs.knownTargets)
513508
, source_dirs_by_source(rhs.source_dirs_by_source)
514-
, fs(rhs.fs)
515509
, fetch_dir(rhs.fetch_dir)
516510
, with_testing(rhs.with_testing)
517511
, ide_solution_name(rhs.ide_solution_name)
@@ -535,8 +529,9 @@ Build::~Build()
535529
// or are they solution-specific?
536530

537531
// do not clear modules on exception, because it may come from there
538-
if (!std::uncaught_exceptions())
539-
getModuleStorage(*this).modules.clear();
532+
// TODO: cleanup modules data first
533+
//if (!std::uncaught_exceptions())
534+
//getModuleStorage(*this).modules.clear();
540535
}
541536

542537
BuildSettings Build::createSettings() const
@@ -592,18 +587,6 @@ path Build::getChecksDir() const
592587
return getServiceDir() / "checks";
593588
}
594589

595-
void Build::performChecks()
596-
{
597-
LOG_DEBUG(logger, "Performing checks");
598-
599-
ScopedTime t;
600-
601-
checker.performChecks(swctx.getLocalStorage().storage_dir_etc / "sw" / "checks"/* / getConfig()*/);
602-
603-
if (!silent)
604-
LOG_DEBUG(logger, "Checks time: " << t.getTimeFloat() << " s.");
605-
}
606-
607590
void Build::build_and_resolve(int n_runs)
608591
{
609592
auto ud = gatherUnresolvedDependencies(n_runs);
@@ -673,7 +656,6 @@ void Build::build_and_resolve(int n_runs)
673656

674657
sw_check_abi_version(getModuleStorage(*this).get(dll).sw_get_module_abi_version());
675658
getModuleStorage(*this).get(dll).check(*this, checker);
676-
performChecks();
677659
// we can use new (clone of this) solution, then copy known targets
678660
// to allow multiple passes-builds
679661
getModuleStorage(*this).get(dll).build(*this);
@@ -1366,7 +1348,6 @@ FilesMap Build::build_configs_separate(const Files &files)
13661348
if (!once)
13671349
{
13681350
check_self(checker);
1369-
performChecks();
13701351
build_self();
13711352
addDeps(lib, *this);
13721353
once = true;
@@ -1557,7 +1538,6 @@ path Build::build_configs(const std::unordered_set<LocalPackage> &pkgs)
15571538
if (init)
15581539
{
15591540
check_self(solution.checker);
1560-
solution.performChecks();
15611541
build_self();
15621542
}
15631543
addDeps(lib, solution);
@@ -1583,8 +1563,8 @@ path Build::build_configs(const std::unordered_set<LocalPackage> &pkgs)
15831563
if (auto f = lib[p].as<NativeSourceFile>(); f)
15841564
{
15851565
return
1586-
File(p, *fs).isChanged() ||
1587-
File(f->compiler->getOutputFile(), *fs).isChanged()
1566+
File(p, swctx.getServiceFileStorage()).isChanged() ||
1567+
File(f->compiler->getOutputFile(), swctx.getServiceFileStorage()).isChanged()
15881568
;
15891569
}
15901570
return true;
@@ -1882,7 +1862,7 @@ path Build::build(const path &fn)
18821862
auto r = b.build_configs_separate({ fn });
18831863
auto dll = r.begin()->second;
18841864
if (do_not_rebuild_config &&
1885-
(File(fn, *fs).isChanged() || File(dll, *fs).isChanged()))
1865+
(File(fn, swctx.getServiceFileStorage()).isChanged() || File(dll, swctx.getServiceFileStorage()).isChanged()))
18861866
{
18871867
remove_ide_explans = true;
18881868
do_not_rebuild_config = false;
@@ -2026,7 +2006,7 @@ static Build::CommandExecutionPlan load(const SwContext &swctx, const path &fn,
20262006
break;
20272007
}
20282008
commands[id] = c;
2029-
c->fs = s.fs;
2009+
c->fs = &swctx.getServiceFileStorage();
20302010
return c;
20312011
}
20322012
return it->second;
@@ -2235,7 +2215,7 @@ void Build::execute()
22352215
if (fs::exists(fn))
22362216
{
22372217
// prevent double assign generators
2238-
fs->reset();
2218+
swctx.getServiceFileStorage().reset();
22392219

22402220
SW_UNIMPLEMENTED;
22412221
//auto p = ::sw::load(swctx, fn, s);
@@ -3087,7 +3067,6 @@ void Build::load_dll(const path &dll, bool usedll)
30873067
for (auto &s : settings)
30883068
getModuleStorage(*this).get(dll).check(*this, checker);
30893069
}
3090-
performChecks();
30913070
}
30923071

30933072
// build
@@ -3324,7 +3303,7 @@ PackageDescriptionMap Build::getPackages() const
33243303
Files files;
33253304
for (auto &f : t->gatherAllFiles())
33263305
{
3327-
if (File(f, *fs).isGeneratedAtAll())
3306+
if (File(f, t->getFs()).isGeneratedAtAll())
33283307
continue;
33293308
files.insert(f.lexically_normal());
33303309
}

src/sw/driver/build.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ struct SW_DRIVER_CPP_API Build : TargetBase
132132
//std::map<String, std::vector<TargetSettingsData>> target_settings; // regex, some data
133133

134134
//
135-
FileStorage *fs = nullptr;
136135
int command_storage = 0;
137136
String current_module;
138137
PackageVersionGroupNumber current_gn = 0; // for checks
@@ -322,7 +321,6 @@ struct SW_DRIVER_CPP_API Build : TargetBase
322321
//const Solution *getHostSolution();
323322
//const Solution *getHostSolution() const;
324323

325-
void performChecks();
326324
FilesMap build_configs_separate(const Files &files);
327325

328326
void generateBuildSystem();

0 commit comments

Comments
 (0)