Skip to content
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

[PoC] Regenerate buildSettings after preGenerateCommands #1708

Closed
wants to merge 2 commits into from

Conversation

wilzbach
Copy link
Member

@wilzbach wilzbach commented May 11, 2019

Fixes #1474

This fixes the problem, but obviously we should be smarter

TODO:

  • add test case (or add the the examples to the CI)
  • check whether there actually was a preGenerateCommand run and only do the regeneration then
  • try to find a better solution than this

FWIW it looks like even with the simple hello world example the buildSettings regeneration is already regenerated 4 times before.

@dlang-bot
Copy link
Collaborator

Thanks for your pull request, @wilzbach!

@@ -2,6 +2,6 @@
"name": "generated-sources",
"description": "Example of using pre generate commands to generate source code.",
"preGenerateCommands": [
"echo int fun() { return 42; } > source/test.d"
"echo 'int fun() { return 42; }' > source/test.d"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the ticks added? I just tested it and the file test.d is created as

'int fun() { return 42; }' 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that the ticks cause problems, at least on Windows.

@andre2007
Copy link
Contributor

andre2007 commented Dec 11, 2019

@wilzbach
I tested the PR and get a linker error the first time:

C:\Users\pc\git\dub\examples\generated-sources>dub build
Running pre-generate commands for generated-sources...
Performing "debug" build using dmd for x86_64.
generated-sources ~master: building configuration "application"...
Linking...
lld-link: error: undefined symbol: _D4test3funFZi

referenced by C:\Users\pc\git\dub\examples\generated-sources\source\app.d:6
.dub\build\application-debug-windows-x86_64-dmd_2089-F8E1F3627CAEA609227D49EB76DB892B\generated-sources.obj:(_Dmain)
Error: linker exited with status 1
dmd failed with exit code 1.

it works only the second time.

@Geod24
Copy link
Member

Geod24 commented Jun 7, 2021

Fixed in #2035

@Geod24 Geod24 closed this Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

examples/generated-source does not work. Regression in preGenerateCommands.
5 participants