|
12 | 12 | #include "eval-cache.hh" |
13 | 13 | #include "url.hh" |
14 | 14 | #include "registry.hh" |
| 15 | +#include "build-result.hh" |
15 | 16 |
|
16 | 17 | #include <regex> |
17 | 18 | #include <queue> |
@@ -769,8 +770,7 @@ BuiltPaths getBuiltPaths(ref<Store> evalStore, ref<Store> store, const DerivedPa |
769 | 770 | throw Error( |
770 | 771 | "the derivation '%s' doesn't have an output named '%s'", |
771 | 772 | store->printStorePath(bfd.drvPath), output); |
772 | | - if (settings.isExperimentalFeatureEnabled( |
773 | | - Xp::CaDerivations)) { |
| 773 | + if (settings.isExperimentalFeatureEnabled(Xp::CaDerivations)) { |
774 | 774 | auto outputId = |
775 | 775 | DrvOutput{outputHashes.at(output), output}; |
776 | 776 | auto realisation = |
@@ -816,12 +816,33 @@ BuiltPaths Installable::build( |
816 | 816 | pathsToBuild.insert(pathsToBuild.end(), b.begin(), b.end()); |
817 | 817 | } |
818 | 818 |
|
819 | | - if (mode == Realise::Nothing || mode == Realise::Derivation) |
| 819 | + switch (mode) { |
| 820 | + case Realise::Nothing: |
| 821 | + case Realise::Derivation: |
820 | 822 | printMissing(store, pathsToBuild, lvlError); |
821 | | - else if (mode == Realise::Outputs) |
822 | | - store->buildPaths(pathsToBuild, bMode, evalStore); |
823 | | - |
824 | | - return getBuiltPaths(evalStore, store, pathsToBuild); |
| 823 | + return getBuiltPaths(evalStore, store, pathsToBuild); |
| 824 | + case Realise::Outputs: { |
| 825 | + BuiltPaths res; |
| 826 | + for (auto & buildResult : store->buildPathsWithResults(pathsToBuild, bMode, evalStore)) { |
| 827 | + if (!buildResult.success()) |
| 828 | + buildResult.rethrow(); |
| 829 | + std::visit(overloaded { |
| 830 | + [&](const DerivedPath::Built & bfd) { |
| 831 | + std::map<std::string, StorePath> outputs; |
| 832 | + for (auto & path : buildResult.builtOutputs) |
| 833 | + outputs.emplace(path.first.outputName, path.second.outPath); |
| 834 | + res.push_back(BuiltPath::Built { bfd.drvPath, outputs }); |
| 835 | + }, |
| 836 | + [&](const DerivedPath::Opaque & bo) { |
| 837 | + res.push_back(BuiltPath::Opaque { bo.path }); |
| 838 | + }, |
| 839 | + }, buildResult.path.raw()); |
| 840 | + } |
| 841 | + return res; |
| 842 | + } |
| 843 | + default: |
| 844 | + assert(false); |
| 845 | + } |
825 | 846 | } |
826 | 847 |
|
827 | 848 | BuiltPaths Installable::toBuiltPaths( |
|
0 commit comments