build and process packages and libraries. This structure isn't overly strict, | build and process packages and libraries. This structure isn't overly strict, | ||||
and is thoroughly explained on the :doc:`/guide/packages` page. | and is thoroughly explained on the :doc:`/guide/packages` page. | ||||
For exporting/generating a source distribution from a package, the *package | |||||
root* requires a ``package.dds`` file and each *library root* requires a | |||||
``library.dds`` file. | |||||
.. . | .. . | ||||
TODO: Create are more detailed reference page for package and library layout, | TODO: Create are more detailed reference page for package and library layout, | ||||
and include those links in a `seealso`. | and include those links in a `seealso`. |
Error: Unknown ``Test-Driver`` | |||||
############################## | |||||
``dds`` has a set of known ``Test-Driver``s built-in, and they may be specified | |||||
with the ``Test-Driver`` key. Receiving this error indicates that the specified | |||||
``Test-Driver`` was not recognized by ``dds``. Check your spelling, and check | |||||
that the driver you want to use is supported by ``dds``. Refer to the | |||||
:doc:`/guide/packages` page. |
case errc::invalid_config_key: | case errc::invalid_config_key: | ||||
return "invalid-config-key.html"; | return "invalid-config-key.html"; | ||||
case errc::invalid_lib_filesystem: | case errc::invalid_lib_filesystem: | ||||
case errc::invalid_pkg_filesystem: | |||||
return "invalid-pkg-filesystem.html"; | return "invalid-pkg-filesystem.html"; | ||||
case errc::unknown_test_driver: | |||||
return "unknown-test-driver.html"; | |||||
case errc::none: | case errc::none: | ||||
break; | break; | ||||
} | } | ||||
case errc::invalid_config_key: | case errc::invalid_config_key: | ||||
return R"(The `key' in a `key: value' pair was not recognized.)"; | return R"(The `key' in a `key: value' pair was not recognized.)"; | ||||
case errc::invalid_lib_filesystem: | case errc::invalid_lib_filesystem: | ||||
case errc::invalid_pkg_filesystem: | |||||
return R"( | return R"( | ||||
`dds` prescribes a specific filesystem structure that must be obeyed by | `dds` prescribes a specific filesystem structure that must be obeyed by | ||||
libraries and packages. Refer to the documentation for an explanation and | libraries and packages. Refer to the documentation for an explanation and | ||||
reference on these prescriptions. | reference on these prescriptions. | ||||
)"; | |||||
case errc::unknown_test_driver: | |||||
return R"( | |||||
`dds` has a pre-defined set of built-in test drivers, and the one specified is | |||||
not recognized. Check the documentation for more information. | |||||
)"; | )"; | ||||
case errc::none: | case errc::none: | ||||
break; | break; | ||||
return "Found an invalid configuration key. <- (Seeing this text is a `dds` bug. Please " | return "Found an invalid configuration key. <- (Seeing this text is a `dds` bug. Please " | ||||
"report it.)"; | "report it.)"; | ||||
case errc::invalid_lib_filesystem: | case errc::invalid_lib_filesystem: | ||||
case errc::invalid_pkg_filesystem: | |||||
return "The filesystem structure of the package/library is invalid. <- (Seeing this text " | return "The filesystem structure of the package/library is invalid. <- (Seeing this text " | ||||
"is a `dds` bug. Please report it.)"; | "is a `dds` bug. Please report it.)"; | ||||
case errc::unknown_test_driver: | |||||
return "The specified Test-Driver is not known to `dds`"; | |||||
case errc::none: | case errc::none: | ||||
break; | break; | ||||
} | } |
invalid_version_range_string, | invalid_version_range_string, | ||||
invalid_version_string, | invalid_version_string, | ||||
invalid_config_key, | invalid_config_key, | ||||
unknown_test_driver, | |||||
invalid_lib_filesystem, | invalid_lib_filesystem, | ||||
invalid_pkg_filesystem, | |||||
}; | }; | ||||
std::string error_reference_of(errc) noexcept; | std::string error_reference_of(errc) noexcept; |
#include "./manifest.hpp" | #include "./manifest.hpp" | ||||
#include <dds/dym.hpp> | #include <dds/dym.hpp> | ||||
#include <dds/error/errors.hpp> | |||||
#include <dds/util/string.hpp> | #include <dds/util/string.hpp> | ||||
#include <libman/parse.hpp> | #include <libman/parse.hpp> | ||||
} else if (test_driver_str == "Catch") { | } else if (test_driver_str == "Catch") { | ||||
ret.test_driver = test_lib::catch_; | ret.test_driver = test_lib::catch_; | ||||
} else { | } else { | ||||
throw std::runtime_error(fmt::format("Unknown 'Test-Driver': '{}'", test_driver_str)); | |||||
auto dym = *did_you_mean(test_driver_str, {"Catch-Main", "Catch"}); | |||||
throw_user_error< | |||||
errc::unknown_test_driver>("Unknown 'Test-Driver' '{}' (Did you mean '{}'?)", | |||||
test_driver_str, | |||||
dym); | |||||
} | } | ||||
} | } | ||||
#include "./dist.hpp" | #include "./dist.hpp" | ||||
#include <dds/error/errors.hpp> | |||||
#include <dds/library/library.hpp> | #include <dds/library/library.hpp> | ||||
#include <dds/temp.hpp> | #include <dds/temp.hpp> | ||||
#include <dds/util/fs.hpp> | #include <dds/util/fs.hpp> | ||||
auto lib_dds_path = lib.path() / "library.dds"; | auto lib_dds_path = lib.path() / "library.dds"; | ||||
if (!fs::is_regular_file(lib_dds_path)) { | if (!fs::is_regular_file(lib_dds_path)) { | ||||
throw std::runtime_error(fmt::format( | |||||
"Each library in a source distribution requires a library manifest (Expected [{}])", | |||||
lib_dds_path.string())); | |||||
throw_user_error<errc::invalid_lib_filesystem>( | |||||
"Each library root in a source distribution requires a library manifest (Expected " | |||||
"[{}])", | |||||
lib_dds_path.string()); | |||||
} | } | ||||
sdist_export_file(out_root, params.project_dir, lib_dds_path); | sdist_export_file(out_root, params.project_dir, lib_dds_path); | ||||
auto man_path = params.project_dir / "package.dds"; | auto man_path = params.project_dir / "package.dds"; | ||||
if (!fs::is_regular_file(man_path)) { | if (!fs::is_regular_file(man_path)) { | ||||
throw std::runtime_error(fmt::format( | |||||
"Creating a source distribution requires a package.dds file for the project")); | |||||
throw_user_error<errc::invalid_pkg_filesystem>( | |||||
"Creating a source distribution requires a package.dds file for the project (Expected " | |||||
"[{}])", | |||||
man_path.string()); | |||||
} | } | ||||
sdist_export_file(out, params.project_dir, man_path); | sdist_export_file(out, params.project_dir, man_path); | ||||
auto pkg_man = package_manifest::load_from_file(man_path); | auto pkg_man = package_manifest::load_from_file(man_path); |