From 5df65ad6dc1496aace93be58a952e3410fe88afa Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Sat, 13 Jan 2024 21:15:46 +0100 Subject: [PATCH] Deprecate unused getSubPackagePath While looking at the subpackage code, I was wondering why more places didn't call getSubPackagePath instead of getSubPackageName, and that is because subpackages can only be one level deep. --- source/dub/recipe/packagerecipe.d | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/dub/recipe/packagerecipe.d b/source/dub/recipe/packagerecipe.d index 5573018b3..20926eea1 100644 --- a/source/dub/recipe/packagerecipe.d +++ b/source/dub/recipe/packagerecipe.d @@ -32,11 +32,18 @@ import std.process : environment; example, "packa:packb:packc" references a package named "packc" that is a sub package of "packb", which in turn is a sub package of "packa". */ +deprecated("This function is not supported as subpackages cannot be nested") string[] getSubPackagePath(string package_name) @safe pure { return package_name.split(":"); } +deprecated @safe unittest +{ + assert(getSubPackagePath("packa:packb:packc") == ["packa", "packb", "packc"]); + assert(getSubPackagePath("pack") == ["pack"]); +} + /** Returns the name of the top level package for a given (sub) package name of format `"basePackageName"` or `"basePackageName:subPackageName"`. @@ -62,8 +69,6 @@ string getSubPackageName(string package_name) @safe pure @safe unittest { - assert(getSubPackagePath("packa:packb:packc") == ["packa", "packb", "packc"]); - assert(getSubPackagePath("pack") == ["pack"]); assert(getBasePackageName("packa:packb:packc") == "packa"); assert(getBasePackageName("pack") == "pack"); assert(getSubPackageName("packa:packb:packc") == "packb:packc");