RejectedSoftware Forums

Sign up

internals: staticLibrary dependencies not in BuildSettings?

I'm working on a PR
(https://github.com/Abscissa/dub/commits/more-details), and I noticed
that if the main project has dependency on a staticLibrary, the
path/name for the actual built static library is nowhere to be found in
BuildSettings, not even in BuildSettings.libs (which only lists non-dub
libs).

Does that sound correct? If so, is there a correct place to obtain
these, or it is just to be manually pieced together by navigating the
dependencies and looking for static libraries and grabbing their target
names and target paths?

If it matters, I'm constructing the BuildSettings using addBuildSettings
in the same manner used by "dub test", which seems to work right for all
other data AFAICT.

Perhaps addBuildSettings should be adjusted to populate
BuildSettings.libs with dub-based static libs? Or would that be a wrong
approach?

Re: internals: staticLibrary dependencies not in BuildSettings?

On Mon, 11 May 2015 12:43:21 -0400, Nick Sabalausky wrote:

I'm working on a PR
(https://github.com/Abscissa/dub/commits/more-details), and I noticed
that if the main project has dependency on a staticLibrary, the
path/name for the actual built static library is nowhere to be found in
BuildSettings, not even in BuildSettings.libs (which only lists non-dub
libs).

Does that sound correct? If so, is there a correct place to obtain
these, or it is just to be manually pieced together by navigating the
dependencies and looking for static libraries and grabbing their target
names and target paths?

If it matters, I'm constructing the BuildSettings using addBuildSettings
in the same manner used by "dub test", which seems to work right for all
other data AFAICT.

Perhaps addBuildSettings should be adjusted to populate
BuildSettings.libs with dub-based static libs? Or would that be a wrong
approach?

This part is left to the specific ProjectGenerator implementation. See the "build" generator for an example:

https://github.com/D-Programming-Language/dub/blob/acec413687aefcfb76362b22cf439612b9a1743a/source/dub/generators/build.d#L64

In this case it constructs the final target binary path. Other generators, such as the VisualD one may leave this choice up to the IDE/build tool and just forward the linkDependencies accordingly.

I couldn't see how you implemented the --data switch from a quick look, so that the following may not apply. But just to make sure - for any kind of build related information you should write a ProjectGenerator derived class, so that the logic to assemble the build settings is the same as for all other generators. Inside of the overridden generateTargets method it's then possible to extract all necessary information.

In fact, I had recently started to improve dub describe and partially implemented such a special purpose generator class: https://github.com/D-Programming-Language/dub/commits/refactor1
I got distracted by other things, but it probably makes sense to finish that and then base your additions on top of that (at least as far as I understand).

Re: internals: staticLibrary dependencies not in BuildSettings?

On 05/13/2015 08:01 AM, Sönke Ludwig wrote:

This part is left to the specific ProjectGenerator implementation. See the "build" generator for an example:

https://github.com/D-Programming-Language/dub/blob/acec413687aefcfb76362b22cf439612b9a1743a/source/dub/generators/build.d#L64

In this case it constructs the final target binary path. Other generators, such as the VisualD one may leave this choice up to the IDE/build tool and just forward the linkDependencies accordingly.

I couldn't see how you implemented the --data switch from a quick look, so that the following may not apply. But just to make sure - for any kind of build related information you should write a ProjectGenerator derived class, so that the logic to assemble the build settings is the same as for all other generators. Inside of the overridden generateTargets method it's then possible to extract all necessary information.

In fact, I had recently started to improve dub describe and partially implemented such a special purpose generator class: https://github.com/D-Programming-Language/dub/commits/refactor1
I got distracted by other things, but it probably makes sense to finish that and then base your additions on top of that (at least as far as I understand).

Ok, I see, thanks.

However, as a side note, it does appear that the
dub.project.addBuildSettings function may be redundant with the
project generators. It seems to cover much the same purpose and
functionality that the new TargetDescriptionGenerator will, except with
somewhat less complete/versatile information. Plus, it's only being used
by dub.Dub.testProject and nothing else. So perhaps
dub.project.addBuildSettings should be eliminated and
dub.Dub.testProject adjusted to use TargetDescriptionGenerator?

Re: internals: staticLibrary dependencies not in BuildSettings?

On 05/13/2015 08:01 AM, Sönke Ludwig wrote:

In fact, I had recently started to improve dub describe and partially implemented such a special purpose generator class: https://github.com/D-Programming-Language/dub/commits/refactor1
I got distracted by other things, but it probably makes sense to finish that and then base your additions on top of that (at least as far as I understand).

Just saw your latest batch of pushed to that branch. Seems I duplicated
some effort on that yesterday, don't know if there's anything you want
to use:

https://github.com/Abscissa/dub/commits/refactor1

It's possible I may have approached some of that the wrong way,
obviously you have more familiarity with dub's internals ;)

Re: internals: staticLibrary dependencies not in BuildSettings?

On 05/14/2015 11:41 AM, Nick Sabalausky wrote:

Just saw your latest batch of pushed to that branch. Seems I duplicated
some effort on that yesterday, don't know if there's anything you want
to use:

https://github.com/Abscissa/dub/commits/refactor1

It's possible I may have approached some of that the wrong way,
obviously you have more familiarity with dub's internals ;)

FWIW, I just rebased my changes on top of your latest refactor1 stuff,
and pushed to a separate branch, just to make it easier to see:

https://github.com/Abscissa/dub/commits/refactor1-rebased