@@ -0,0 +1,10 @@ | |||
Error: Invalid package filesystem | |||
################################# | |||
``dds`` prescribes a filesystem structure that must be followed for it to | |||
build and process packages and libraries. This structure isn't overly strict, | |||
and is thoroughly explained on the :doc:`/guide/packages` page. | |||
.. . | |||
TODO: Create are more detailed reference page for package and library layout, | |||
and include those links in a `seealso`. |
@@ -45,6 +45,8 @@ std::string error_url_suffix(dds::errc ec) noexcept { | |||
return "invalid-version-string.html"; | |||
case errc::invalid_config_key: | |||
return "invalid-config-key.html"; | |||
case errc::invalid_lib_filesystem: | |||
return "invalid-pkg-filesystem.html"; | |||
case errc::none: | |||
break; | |||
} | |||
@@ -157,6 +159,12 @@ information. | |||
)"; | |||
case errc::invalid_config_key: | |||
return R"(The `key' in a `key: value' pair was not recognized.)"; | |||
case errc::invalid_lib_filesystem: | |||
return R"( | |||
`dds` prescribes a specific filesystem structure that must be obeyed by | |||
libraries and packages. Refer to the documentation for an explanation and | |||
reference on these prescriptions. | |||
)"; | |||
case errc::none: | |||
break; | |||
} | |||
@@ -205,6 +213,9 @@ std::string_view dds::default_error_string(dds::errc ec) noexcept { | |||
case errc::invalid_config_key: | |||
return "Found an invalid configuration key. <- (Seeing this text is a `dds` bug. Please " | |||
"report it.)"; | |||
case errc::invalid_lib_filesystem: | |||
return "The filesystem structure of the package/library is invalid. <- (Seeing this text " | |||
"is a `dds` bug. Please report it.)"; | |||
case errc::none: | |||
break; | |||
} |
@@ -30,6 +30,8 @@ enum class errc { | |||
invalid_version_range_string, | |||
invalid_version_string, | |||
invalid_config_key, | |||
invalid_lib_filesystem, | |||
}; | |||
std::string error_reference_of(errc) noexcept; |
@@ -1,6 +1,7 @@ | |||
#include <dds/library/library.hpp> | |||
#include <dds/build/plan/compile_file.hpp> | |||
#include <dds/error/errors.hpp> | |||
#include <dds/source/dir.hpp> | |||
#include <dds/util/algo.hpp> | |||
@@ -20,7 +21,8 @@ auto collect_pf_sources(path_ref path) { | |||
if (include_dir.exists()) { | |||
if (!fs::is_directory(include_dir.path)) { | |||
throw std::runtime_error("The `include` at the root of the project is not a directory"); | |||
throw_user_error<errc::invalid_lib_filesystem>( | |||
"The `include` at the library root [in {}] is a non-directory file", path.string()); | |||
} | |||
auto inc_sources = include_dir.collect_sources(); | |||
// Drop any source files we found within `include/` | |||
@@ -37,7 +39,8 @@ auto collect_pf_sources(path_ref path) { | |||
if (src_dir.exists()) { | |||
if (!fs::is_directory(src_dir.path)) { | |||
throw std::runtime_error("The `src` at the root of the project is not a directory"); | |||
throw_user_error<errc::invalid_lib_filesystem>( | |||
"The `src` at the library root [in {}] is a non-directory file", path.string()); | |||
} | |||
auto src_sources = src_dir.collect_sources(); | |||
extend(sources, src_sources); |