Comments (11)
I am not 100% sure whether preBuildCommands
in user dub.json is needed at all. A preGenerateCommands
in your dub package should always be automatically called when user dub package is build.
from unit-threaded.
What preBuildCommands
?
from unit-threaded.
The README.md says this preBuildCommand is necessary to use the library in dub projects:
"preBuildCommands": ["$DUB run --compiler=$$DC unit-threaded -c gen_ut_main -- -f bin/ut.d -d $DUB"],
from unit-threaded.
Ah, that. I haven't used that so long myself that I'd forgotten about it. It seems the dub bug that was preventing me from doing so is now fixed.
Are you suggesting to put a preGenerateCommands
in unit-threaded itself to always generate the main file for reflection?
I don't understand how $SOURCE_FILES
helps.
from unit-threaded.
From the README.md it sounds like the whole purpose of gen_ut_main is to find out the modules of the dub package. This information is also located in the mentioned environment variable.
Unfortunately, due to the nature of D's compile-time reflection, to use this library a test runner file listing all modules to reflect on must exist. Since this is a tedious task and easily automated, unit-threaded has a dub configuration called gen_ut_main to do just that.
from unit-threaded.
You could give it a try (preGenerateCommands), this would ease the usage of this library.
from unit-threaded.
I tried using $SOURCE_FILES
in preBuildCommands
and preGenerateCommands
in a different project and dub complained about an invalid variable.
from unit-threaded.
@atilaneves
Just as explanation: As far as I remember there is a distinction between dub variables and environment variables.
You can not use them everywhere.
But the environment variable definitely exists https://github.com/dlang/dub/blob/79e312d042f66a0ea56879f13c2167bc66d35146/source/dub/generators/generator.d#L830
from unit-threaded.
I saw the code and the PR. Unfortunately the PR had no tests to accompany it, so I don't know what the diff actually does, if anything.
What I know is that trying to use $SOURCE_FILES
in the two directives where it'd make sense fails. Where else is it available?
In the documentation it lists $SOURCE_FILES
in the same column as a few variables that do work in those directives. And what precedes that is "Inside of custom command directives".
Right now I don't know how to use $SOURCE_FILES
. Given it shows up nowhere as an actual variable in the dub git repository I'd guess that nobody else does either.
from unit-threaded.
I just did a quick dub init test project and there
preBuildCommands "echo $$SOURCE_FILES"
prints the sources of the dub package when building. hope that helps. Not sure why a $$ is needed.
Full example:
dub.sdl:
name "source-files-test"
license "MIT"
preGenerateCommands "echo preGenerateCommands: $$SOURCE_FILES"
preBuildCommands "echo preBuildCommands: $$SOURCE_FILES"
source/app.d:
import std.stdio;
void main()
{
writeln("Edit source/app.d to start your project.");
}
> dub run
Running pre-generate commands for source-files-test...
preGenerateCommands: /Users/myuser/tmp/bla/source/app.d
Performing "debug" build using /Users/myuser/dlang/dmd-2.096.1/osx/bin/dmd for x86_64.
source-files-test ~master: building configuration "application"...
Running pre-build commands...
preBuildCommands: source/app.d
Linking...
Interestingly the path for preGenerateCommands is absolute, wheras the path in preBuildCommands is relative.
from unit-threaded.
@gizmomogwai Thanks! Weird that it needs to be escaped but other variables don't.
from unit-threaded.
Related Issues (20)
- Number parsing isn't IEEE compatible HOT 5
- Frequently incomplete output on Windows
- crash at exit with LDC HOT 1
- runTests panics on empty test suite
- @Serial doesn't work if the tests have dots in their names
- Latest release hanging up after "OK!" HOT 3
- Please run CI with more dmd versions HOT 3
- gen-ut-main can't look for folders in parent directory
- README outdated
- shouldNotEqual not necessarily @safe even when shouldEqual is
- Test arrays and nans HOT 1
- How do I mock a std.socket.Socket? HOT 1
- Full precision formatting is desirable for floating point numbers HOT 3
- Not informative output with unitthreaded HOT 1
- Error when running reflection over module with overloaded function on 2.102.2 and -de
- unit_threaded.assertions.convertToString logic is a bit messed up HOT 3
- shouldBeEmpty fails to compile
- shouldFail is expensive because it generates stack traces eagerly
- shouldBeEmpty broken with const arrays
- Better support for multi-line Expected / Got HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unit-threaded.