Re: Set output location for dub --single

2022-02-28 Thread Chris Piker via Digitalmars-d-learn

On Monday, 28 February 2022 at 08:03:24 UTC, Basile B. wrote:


That 's not exactly what you ask for but you can define the 
path in the embedded recipe (targetPath)


```d
#!/usr/bin/env dub
/+ dub.sdl:
   dependency "mypackage" version="*" path=".."
   targetPath "./bin"
+/
```


Hey thanks!  Not perfect, but it'll probably work.

I'll bring up the idea of overriding some settings (such as 
targetPath) on the command line in a similar manner to ssh in the 
dub [discussions](https://github.com/dlang/dub/discussions) area 
and see how well that goes over.


Re: Set output location for dub --single

2022-02-28 Thread Basile B. via Digitalmars-d-learn

On Sunday, 27 February 2022 at 16:58:34 UTC, Chris Piker wrote:

Hi D

Coming from a python background it's worked well to organize my 
D projects as a dub `sourceLibrary` and then to put top level 
programs in a directory named `scripts` that are just dub 
single file projects.  So the layout looks like this:


[...]

After reading over the dub documentation I don't see a general 
way to override project options via the command line, but maybe 
it's there and I couldn't understand what the dub docs were 
trying to say.


That 's not exactly what you ask for but you can define the path 
in the embedded recipe (targetPath)


```d
#!/usr/bin/env dub
/+ dub.sdl:
   dependency "mypackage" version="*" path=".."
   targetPath "./bin"
+/
```



Set output location for dub --single

2022-02-27 Thread Chris Piker via Digitalmars-d-learn

Hi D

Coming from a python background it's worked well to organize my D 
projects as a dub `sourceLibrary` and then to put top level 
programs in a directory named `scripts` that are just dub single 
file projects.  So the layout looks like this:


```
rootdir/
  |
  +- mypackage/
  ||
  |+- libfile1.d
  |+- libfile2.d
  |
  +- scripts/
  ||
  |+- prog1.d
  |+- prog2.d
  |
  +- dub.json
```
In dub.json "scripts" are ignored via 
`"excludedSourceFiles":["scripts/*"]`.  Each "script" includes 
`mypackage` via:

```d
#!/usr/bin/env dub
/+ dub.sdl:
   dependency "mypackage" version="*" path=".."
   dependency (other nonlocal packages)
+/
```

...and all seems rather familiar to a python programmer and I 
avoid the complexities of dub sub-projects.


For building the individual "scripts" as binaries, it be nice 
output the binaries to another directory, say `bin`.  Is there an 
override for the dub command line that would specify the output 
location?  Maybe something like:

```bash
dub --single -o targetPath=./bin ./script/prog1.d
```
?
(Here the mythical argument `-o` overrides a single build 
configuration setting.)


After reading over the dub documentation I don't see a general 
way to override project options via the command line, but maybe 
it's there and I couldn't understand what the dub docs were 
trying to say.