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

Write files on CTFE #250

Open
andre2007 opened this issue Jun 18, 2020 · 0 comments
Open

Write files on CTFE #250

andre2007 opened this issue Jun 18, 2020 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@andre2007
Copy link

I might have a solution for the missing write files on CTFE issue. Or more precise, with next version of Dub it will be possible.

  • Add a new function to the shared object library which returns the metadata of the modules to be wrapped. (Either as JSON or better using structs). e.g. here https://github.com/symmetryinvestments/autowrap/blob/master/csharp/source/autowrap/csharp/boilerplate.d#L290
  • Add to dub.sdl of autowrap a post generate command: "postGenerateCommands": ["$DUB postgen.d $ROOT_PACKAGE_DIR"],
  • Create in autowrap folder a new file postgen.d. Every dub package which has a dependency to autowrap will automatically call the postgen.d application while executing dub build.

The app postgen.d gets the folder path to the dub package, which has a dependency to autowrap, as console argument. In addition it reads the 3 new environment variables DUB_ROOT_PACKAGE_TARGET_TYPE, DUB_ROOT_PACKAGE_TARGET_PATH and DUB_ROOT_PACKAGE_TARGET_NAME. Therefore it knows the shared object file which was built and can call the metadata function. The metadata can now be used to create the `cs´ files.

The benefit is, you do not longer need 2 different configurations (wrap and emit). Just executing dub build will create the SO and also the cs files are automatically created.

The drawback is, you need a very recent dub version (The 3 new environment variable were just added to master).

@atilaneves atilaneves added enhancement New feature or request help wanted Extra attention is needed labels Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants