Skip to content

Commit

Permalink
Clear up two deprecations triggering in unittest
Browse files Browse the repository at this point in the history
Those are trivially fixed by using the new way of doing things.
  • Loading branch information
Geod24 committed Jun 4, 2024
1 parent 3ed84c3 commit db30e43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions source/dub/generators/build.d
Original file line number Diff line number Diff line change
Expand Up @@ -766,15 +766,17 @@ unittest {
}

unittest { // issue #1235 - pass no library files to compiler command line when building a static lib
import dub.internal.vibecompat.data.json : parseJsonString;
import dub.recipe.io : parsePackageRecipe;
import dub.compilers.gdc : GDCCompiler;
import dub.platform : determinePlatform;

version (Windows) auto libfile = "bar.lib";
else auto libfile = "bar.a";

auto desc = parseJsonString(`{"name": "test", "targetType": "library", "sourceFiles": ["foo.d", "`~libfile~`"]}`);
auto pack = new Package(desc, NativePath("/tmp/fooproject"));
auto recipe = parsePackageRecipe(
`{"name":"test", "targetType":"library", "sourceFiles":["foo.d", "`~libfile~`"]}`,
`/tmp/fooproject/dub.json`);
auto pack = new Package(recipe, NativePath("/tmp/fooproject"));
auto pman = new PackageManager(pack.path, NativePath("/tmp/foo/"), NativePath("/tmp/foo/"), false);
auto prj = new Project(pman, pack);

Expand Down
8 changes: 5 additions & 3 deletions source/dub/generators/generator.d
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ private void storeRecursiveInvokations(ref const(string[string])[] env, string[]
version(Posix) {
// https://github.com/dlang/dub/issues/2238
unittest {
import dub.internal.vibecompat.data.json : parseJsonString;
import dub.recipe.io : parsePackageRecipe;
import dub.compilers.gdc : GDCCompiler;
import std.algorithm : canFind;
import std.path : absolutePath;
Expand All @@ -1235,8 +1235,10 @@ version(Posix) {
write("dubtest/preGen/source/foo.d", "");
scope(exit) rmdirRecurse("dubtest");

auto desc = parseJsonString(`{"name": "test", "targetType": "library", "preGenerateCommands": ["touch $PACKAGE_DIR/source/bar.d"]}`);
auto pack = new Package(desc, NativePath("dubtest/preGen".absolutePath));
auto recipe = parsePackageRecipe(
`{"name":"test", "targetType":"library", "preGenerateCommands":["touch $PACKAGE_DIR/source/bar.d"]}`,
`dubtest/preGen/dub.json`);
auto pack = new Package(recipe, NativePath("dubtest/preGen".absolutePath));
auto pman = new PackageManager(pack.path, NativePath("/tmp/foo/"), NativePath("/tmp/foo/"), false);
auto prj = new Project(pman, pack);

Expand Down

0 comments on commit db30e43

Please sign in to comment.