-
-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement "minDubVersion" field #1532
Conversation
Thanks for your pull request and interest in making D better, @rtbo! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, add a changelog entry and imo this can be merged
let's speed this up a little, I think this is a fairly straightforward change that wouldn't get a lot of negative feedback and formally everything is there: changelog, tests, code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea, but please add a real test script for this.
source/dub/package_.d
Outdated
static assert(isValidVersion(dv)); | ||
|
||
enforce(compareVersions(dv, mdv) >= 0, | ||
"dub-"~dv~" does not comply with minDubVersion specification: "~mdv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe state something like: "please upgrade your D installation to at least dub X.Y.Z"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did this:
dub-1.10.0 does not comply with minDubVersion specification: 99.0.0.
Please consider upgrading your dub installation.
@@ -0,0 +1,3 @@ | |||
module app; | |||
|
|||
void main() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is never run!
It needs a shell test (see the .sh
scripts in the test
folder).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run_unittest.sh
also iterates the directories under test.
i.e. the package is built and build passes or fail depending on the minDubVersion
specified. (checked out a one that passes)
$ DUB=... test/run_unittest.sh
Testing summary:
[INFO] Building /home/remi/dev/dlang/dub/test/issue1531-min-dub-version/...
Now I guess I can have a script to test for both success and failure.
changelog/minDubVersion.dd
Outdated
@@ -0,0 +1,6 @@ | |||
Dub now supports a $(D_INLINECODE "minDubVersion") field, that will abort build if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just using backticks would be fine too...
the user does not have a recent enough version of dub and miss essential feature | ||
to perform the build. | ||
------- | ||
"minDubVersion": "1.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minDubVersion
can be added to a projects's dub.json
:
{
...
"minDubVersion": "1.10"
...
}
Or the respective dub.sdl
:
minDubVersion "1.10"
No this doesn't get tested at the moment. |
Discussing this in #1021 it got me thinking about Why don't we use some new namespace for that, for example: {
"name": "test",
...
"devDependencies": {
"dmd": "~>2.81.0",
"dub": "~>1.10.0"
}
} It could be @wilzbach, @WebFreak001 what's your opinion on that? Otherwise, this PR is fully complete with test and changelog. |
I like the idea but something else than devDependencies would be good. Node already uses it, making it even harder to differentiate between the files if they are called package.json and because they are not actual dependencies but only for checking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM minus:
- update to the docs (dub-docs)
- mutation of checked in files (in theory the test suite might stop any second and leave the source directory in a dirty state)
Feel free to merge this once these nits have been addressed.
test/issue1531-min-dub-version.sh
Outdated
rm -rf $DIR1531/.dub/ | ||
rm -rf $DIR1531/test-application* | ||
|
||
sed -i 's/^minDubVersion ".*"$/minDubVersion "1.0"/' ${DIR1531}/dub.sdl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a good idea to mutate files that are checked in the source tree by the testsuite, better put the dub.sdl
into a temporary directory.
Also since the last version dub supports passing files in from stdin, so you could use --single
plus pass the file in via stdin which would eliminate the need for a temporary directory entirely.
test/issue1531-min-dub-version.sh
Outdated
|
||
sed -i 's/^minDubVersion ".*"$/minDubVersion "99.0"/' $DIR1531/dub.sdl | ||
! ${DUB} run --root ${DIR1531} || die "Did pass minDubVersion \"99.0\"!" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a good idea to add one test that works, e.g. with 2.068
or similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by this? I already test for success and for failure.
Seems to be good now, will merge if there are no more objections |
I think this change was aiming in the right direction, but it has one significant drawback - it doesn't integrate through the established dependency system. |
I mean essentially what @ohdatboi was proposing, but either putting dub, dmd, ldc, etc. next to the other dependencies, or having a separate |
Compatibility is a reasonable argument for |
I agree with this. We should have this done before the first |
Kudos for taking action on this, was a bit sad to see this leaking into the release. Very glad to see #1571 :). |
@MartinNowak this shouldn't be part of the real release anymore as it's reverted: #1581 |
This has leaked in changelog and beta1unfortunately. |
Yes, and that's not ideal, but it won't be part of the official release and that's what really matters. |
see #1531