Fix issue 17392 - Add Dub file for the lexer and parser#6771
Fix issue 17392 - Add Dub file for the lexer and parser#6771andralex merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request, @jacob-carlborg! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Some tips to help speed things up:
Bear in mind that large or tricky changes may require multiple rounds of review and revision. Please see CONTRIBUTING.md for more information. Bugzilla references
|
98a248c to
46c49bd
Compare
|
@andralex @RazvanN7 @MartinNowak ping. |
|
Someone from the D foundation or the D core team would need to create an account on code.dlang.org to make the Dub package available. |
dub.sdl
Outdated
| sourcePaths "docs" | ||
|
|
||
| // This is required because Dub needs to have at lease one source file | ||
| sourceFiles "src/ddmd/package.d" |
There was a problem hiding this comment.
Is there really no better solution here? Having to put hacks for our official package manager in our official compiler's package description is ... not great.
There was a problem hiding this comment.
As far as I can see, changing to targetType "none" would allow dropping the sourcePaths and sourceFiles directives and should otherwise behave the same (except that it doesn't generate the extra dummy library).
There was a problem hiding this comment.
Then it's not possible to build the main package:
Main package must have a binary target type, not none. Cannot build.
There was a problem hiding this comment.
Although it seems like it can still be used as a dependency without any problems. But the natural dub build doesn't work anymore.
There was a problem hiding this comment.
Fixed, but not sure if it's correct.
There was a problem hiding this comment.
True, that's indeed a difference. But dub build would only build the dummy library. Dependencies are only built for dynamic library or executable targets. There is dlang/dub#97, which would solve this issue.
There was a problem hiding this comment.
Aha, I see. At some point an executable or dynamic library needs to be built for a library to be useful. So I guess it kind of solves itself.
dub.sdl
Outdated
| subPackage { | ||
| name "parser" | ||
| targetType "library" | ||
| sourcePaths "docs" |
There was a problem hiding this comment.
@s-ludwig Thanks! Is there a similar solution here to avoid the dummy sourcePaths, where only two sourceFiles are needed?
There was a problem hiding this comment.
sourcePaths "docs" can be replaced by an empty sourcePaths. Defining an empty list of source paths is enough to inhibit the auto-detection of the "src" folder.
There was a problem hiding this comment.
That worked, thanks.
46c49bd to
7e832a2
Compare
|
Anything else that needs to be taken care of before this can be merged? |
|
Cool beans! I'm on board with this, though it's a bit early :o). @MartinNowak could you do the honors of merging if all looks good? |
Yes, but if we are very clear that we don't provide any stable API between release and use version "Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable" We can append the DMD version as metadata, i.e. |
|
The problems with idgen really need to be fixed instead of hacked around. It looks like we can replace idgen with ctfe, since we don't need |
|
This uses sdl :sadder: |
Can we wait with that for another pull request? |
Why? This PR should wait for that PR IMO, since nobody is likely to actually use this until we have at least a working parser exposed. (See the existing dub package that exposes the lexer.) I don't want the idgen hacks in master. |
Because I'm trying to keep the PR as small as possible. I've learned the hard way to not create too big PR's or change too much. |
|
Yeah I'm not asking for that fix in this PR, I want it done in another PR first before this PR is merged. Which would end up making this PR smaller. |
|
@jacob-carlborg idgen can be run as a prebuild step. |
@UplinkCoder it already is run as a prebuild step [1], but #6771 (comment). I don't care which approach we use, please just come to an agreement. [1] https://github.com/dlang/dmd/pull/6771/files#diff-406ece895a5b70a272cd76a2ef902836R41 |
|
@jacob-carlborg FYI: dlang/dlang.org#1671 will expose the documentation pages for dmd on dlang.org ;-) |
The Dub file is intended to make the the compiler available as a library through Dub.
7e832a2 to
b5e6ed4
Compare
See also #6999 for using the built compiler to run the test instead of the host compiler as all other test in this file do. |
|
Btw @MartinNowak @CyberShadow (see private email for credentials) - I tried to add dlang/dmd to code.dlang.org, but I got this nice error: So how about pushing |
Well you are using an older version of gdc. The failure itself is dmd frontend that doesn't have the same c++ support as more recent versions. |
@wilzbach We could also set the version scheme that is currently used as metadata, i.e. |
|
By the way, doesn't the auto-merge label prevent broken PRs from being committed? FYI @andralex on why you should not use merge directly. |
|
Hmm, and I suppose the autotester only merges if all of its tests pass. So I guess I'm misremembering a time when this was not the case. |
|
In the gdc repo, I protect master, and make it so that not even admins can force a merge if any required tests are failing. Couldn't this be applied here too? |
|
Yes, we do that too. Jenkins is not currently required because Dub/Vibe tests fail sporadically. |
|
@CyberShadow but in this case the Jenkins tests passed but not Travis (gdc) |
|
Oops, that's right. Travis is not set as required here either. I don't know why, though. |
|
IIRC, someone said that the macOS test on Travis were failing from time to time. |
|
Not sure if it's possible to specify some of the tests from Travis to be required. |
|
Travis has allow_failures or something akin to. |
It's not only that, we also have random failures due to
Just browse https://travis-ci.org/dlang/dmd/builds yourself.
Yes, but allowing failures for all builds isn't very useful. |
Basically all of the ones I looked at was failing due to exceeding the time limit. One was failing due to |
|
I thought builds averaged 20 minutes. Is travisci that terrible now? Or is the CI tests just doing that much more. |
Martin was a bit worried that this might jeopardize the plans to rectify SemVer at DMD and confuse users. @s-ludwig would it be possible to add DMD manually, s.t. only its branches can be used? I guess |
|
Easiest would be to add a dummy v0.0.1 tag, add it, and then remove the tag again. It will stay registered in that case. |
OK temporarily added v0.0.1: https://github.com/dlang/dmd/releases/tag/v0.0.1 But I am still getting the error message - do I need to wait until it the cache is emptied? |
|
Hm, just looked at the source and the registry pick up only the last 100 tags (in lexicographical order). Will open a ticket. You can try with v3.0.0 for the time being. |
That's good. At least our previous work has shown some fruits :) What do you think @CyberShadow?
I think it's a combination: performance of Travis is degrading over time due to more users and constantly new tests are added to the testsuite. |
-> http://code.dlang.org/packages/dmd @jacob-carlborg's unittest modified to an example: #!/usr/bin/env dub
/++ dub.sdl:
name "dmd_lexer_example"
dependency "dmd" version="~master"
+/
void main()
{
import ddmd.lexer;
import ddmd.tokens;
import std.stdio;
immutable sourceCode = "void test() {} // foobar";
scope lexer = new Lexer("test", sourceCode.ptr, 0, sourceCode.length, 0, 0);
while (lexer.nextToken != TOKeof)
writeln(lexer.token.value);
}@jacob-carlborg how about making an announcement of your great work? |
We can try it I guess. Stable too? |
Yes. That's a good idea 👍. |



The Dub file is intended to make the the compiler available as a library through Dub.
Currently the Dub package is only tested in Travis CI. I don't know if Dub is available in the autotester or not.