-
-
Notifications
You must be signed in to change notification settings - Fork 230
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
Allow custom dflags to be defined for dependencies #2040
Conversation
Thanks for your pull request and interest in making D better, @omerfirmak! 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. |
Would this need a changelog entry? |
4bd9748
to
ed81428
Compare
ed81428
to
3a4d694
Compare
Definitely. CC @s-ludwig , how do you feel about this ? The issue is that currently, we cannot propagate flags from the parent packages to the child packages. Things like |
And a test :) |
3a4d694
to
6327ba1
Compare
test/depen-build-settings/dub.json
Outdated
"name": "depen-build-settings", | ||
|
||
"dependencies": { | ||
"depend1": { "version" : "*", "dflags" : ["-version=depen_build_settings"] } |
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.
Using -version
is a pretty bad example, because DUB handles it, and will give you a warning on this.
Use something like -fPIC
instead, something that needs to be propagated and won't go away.
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 dont see any warning while building, at which point should I receive it? Both depen1
and depend2
need -version=depen_build_settings
to successfully compile. If I remove or change it to something else, compilation fails as expected.
depen1
depends on depen2
, so test also checks that the flags are applied transitively to all of the dependency chain.
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.
{
"name": "mytest",
"dflags": [ "-version=Hello" ]
}
Leads to:
$ dub build :(
## Warning for package mytest ##
The following compiler flags have been specified in the package description
file. They are handled by DUB and direct use in packages is discouraged.
Alternatively, you can set the DFLAGS environment variable to pass custom flags
to the compiler, or use one of the suggestions below:
-version=Hello: Use "versions" to specify version constants in a compiler independent way
Performing "debug" build using dmd for x86_64.
mytest ~master: building configuration "application"...
Linking...
Also the test needs to make sure that the |
Would solve #279 |
Changing the dflags of a dependency should also trigger a new compilation of the dependency. Maybe a check for this could also be added to the test. |
0156d69
to
af2b316
Compare
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, any opinion @PetarKirov @s-ludwig @wilzbach ?
f5b6e8b
to
e61a1d5
Compare
` | ||
{ | ||
"description": "A simple vibe.d server application.", | ||
"license": "proprietary", | ||
"name": "dubtest", | ||
|
||
"dependencies": { | ||
"vibe-d": { "version" : "~>0.9.2", "dflags" : ["-preview=in"] } | ||
} | ||
} | ||
` |
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.
` | |
{ | |
"description": "A simple vibe.d server application.", | |
"license": "proprietary", | |
"name": "dubtest", | |
"dependencies": { | |
"vibe-d": { "version" : "~>0.9.2", "dflags" : ["-preview=in"] } | |
} | |
} | |
` | |
--- | |
{ | |
"description": "A simple vibe.d server application.", | |
"license": "proprietary", | |
"name": "dubtest", | |
"dependencies": { | |
"vibe-d": { "version" : "~>0.9.2", "dflags" : ["-preview=in"] } | |
} | |
} | |
--- |
And there seems to be some tabs in there
For now, only "dflags" is used
Fixed the changelog (and slightly improved it), merging since no opposition was voiced. |
@omerfirmak : This is missing the implementation for SDL. |
For example;
-preview=in
will be applied tovibe-d
and all of its dependencies. AnyBuildSettings
field can be used, parsing support is present. But, for now only,dflags
is taken into account when compiling.