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`. |
return "invalid-version-string.html"; | return "invalid-version-string.html"; | ||||
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: | |||||
return "invalid-pkg-filesystem.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: | |||||
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: | case errc::none: | ||||
break; | break; | ||||
} | } | ||||
case errc::invalid_config_key: | case errc::invalid_config_key: | ||||
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: | |||||
return "The filesystem structure of the package/library is invalid. <- (Seeing this text " | |||||
"is a `dds` bug. Please report it.)"; | |||||
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, | ||||
invalid_lib_filesystem, | |||||
}; | }; | ||||
std::string error_reference_of(errc) noexcept; | std::string error_reference_of(errc) noexcept; |
#include <dds/library/library.hpp> | #include <dds/library/library.hpp> | ||||
#include <dds/build/plan/compile_file.hpp> | #include <dds/build/plan/compile_file.hpp> | ||||
#include <dds/error/errors.hpp> | |||||
#include <dds/source/dir.hpp> | #include <dds/source/dir.hpp> | ||||
#include <dds/util/algo.hpp> | #include <dds/util/algo.hpp> | ||||
if (include_dir.exists()) { | if (include_dir.exists()) { | ||||
if (!fs::is_directory(include_dir.path)) { | 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(); | auto inc_sources = include_dir.collect_sources(); | ||||
// Drop any source files we found within `include/` | // Drop any source files we found within `include/` | ||||
if (src_dir.exists()) { | if (src_dir.exists()) { | ||||
if (!fs::is_directory(src_dir.path)) { | 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(); | auto src_sources = src_dir.collect_sources(); | ||||
extend(sources, src_sources); | extend(sources, src_sources); |