Skip to content

Commit 5ee7d6b

Browse files
CyberShadowGeod24
authored andcommitted
Allow building deprecated modules without deprecation warnings
The compiler issues a deprecation warning only on a "non-deprecated" -> "deprecated" transition. As such, building or testing Dub packages which have deprecated modules when a dub_test_root.d file needs to be generated will cause deprecation warnings. This in turn makes it impossible to use `buildRequirements "disallowDeprecations"` in this situation. Fix this by simply making the auto-generated root module (dub_test_root) deprecated. As it is the compiler's entry point, the module itself will not cause a deprecation warning, and it importing deprecating modules will not cause deprecation warnings (as there is no longer a transition of deprecation state).
1 parent ee0fe9c commit 5ee7d6b

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

source/dub/project.d

+1
Original file line numberDiff line numberDiff line change
@@ -1970,6 +1970,7 @@ public class SelectedVersions {
19701970

19711971
/// The template code from which the test runner is generated
19721972
private immutable TestRunnerTemplate = q{
1973+
deprecated // allow silently using deprecated symbols
19731974
module dub_test_root;
19741975

19751976
import std.typetuple;

test/issue2650-deprecated-modules/.no_build

Whitespace-only changes.

test/issue2650-deprecated-modules/.no_run

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name "issue2650"
2+
targetType "sourceLibrary"
3+
buildRequirements "disallowDeprecations"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
deprecated module test;

0 commit comments

Comments
 (0)