eldritch horrors
3f7519526f
these can be unique rather than shared because shared_ptr has a
converting constructor. preparatory refactor for something else
and not necessary on its own, and the extra allocations we must
do for shared_ptr control blocks isn't usually relevant anyway.
Change-Id: I5391715545240c6ec8e83a031206edafdfc6462f
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
#include "local-store.hh"
|
|
#include "build/local-derivation-goal.hh"
|
|
|
|
#if __linux__
|
|
#include "platform/linux.hh"
|
|
#elif __APPLE__
|
|
#include "platform/darwin.hh"
|
|
#elif __FreeBSD__
|
|
#include "platform/freebsd.hh"
|
|
#else
|
|
#include "platform/fallback.hh"
|
|
#endif
|
|
|
|
namespace nix {
|
|
std::shared_ptr<LocalStore> LocalStore::makeLocalStore(const Params & params)
|
|
{
|
|
#if __linux__
|
|
return std::shared_ptr<LocalStore>(new LinuxLocalStore(params));
|
|
#elif __APPLE__
|
|
return std::shared_ptr<LocalStore>(new DarwinLocalStore(params));
|
|
#elif __FreeBSD__
|
|
return std::shared_ptr<LocalStore>(new FreeBSDLocalStore(params));
|
|
#else
|
|
return std::shared_ptr<LocalStore>(new FallbackLocalStore(params));
|
|
#endif
|
|
}
|
|
|
|
std::unique_ptr<LocalDerivationGoal> LocalDerivationGoal::makeLocalDerivationGoal(
|
|
const StorePath & drvPath,
|
|
const OutputsSpec & wantedOutputs,
|
|
Worker & worker,
|
|
bool isDependency,
|
|
BuildMode buildMode
|
|
)
|
|
{
|
|
#if __linux__
|
|
return std::make_unique<LinuxLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
|
|
#elif __APPLE__
|
|
return std::make_unique<DarwinLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
|
|
#elif __FreeBSD__
|
|
return std::make_unique<FreeBSDLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
|
|
#else
|
|
return std::make_unique<FallbackLocalDerivationGoal>(drvPath, wantedOutputs, worker, isDependency, buildMode);
|
|
#endif
|
|
}
|
|
|
|
std::unique_ptr<LocalDerivationGoal> LocalDerivationGoal::makeLocalDerivationGoal(
|
|
const StorePath & drvPath,
|
|
const BasicDerivation & drv,
|
|
const OutputsSpec & wantedOutputs,
|
|
Worker & worker,
|
|
bool isDependency,
|
|
BuildMode buildMode
|
|
)
|
|
{
|
|
#if __linux__
|
|
return std::make_unique<LinuxLocalDerivationGoal>(
|
|
drvPath, drv, wantedOutputs, worker, isDependency, buildMode
|
|
);
|
|
#elif __APPLE__
|
|
return std::make_unique<DarwinLocalDerivationGoal>(
|
|
drvPath, drv, wantedOutputs, worker, isDependency, buildMode
|
|
);
|
|
#elif __FreeBSD__
|
|
return std::make_unique<FreeBSDLocalDerivationGoal>(
|
|
drvPath, drv, wantedOutputs, worker, isDependency, buildMode
|
|
);
|
|
#else
|
|
return std::make_unique<FallbackLocalDerivationGoal>(
|
|
drvPath, drv, wantedOutputs, worker, isDependency, buildMode
|
|
);
|
|
#endif
|
|
}
|
|
}
|