Jump to content

Using scripting to relink to a different copy of dependencies


Daklu

Recommended Posts

I have a few foundational reuse packages (such as a messaging library) that I use in almost all of my code, including when I'm writing other reuse code. These higher level packages will use the messaging library internally, but it is not exposed to clients. To avoid cross-linking my packages and potential version conflicts I want to include dependent packages as members of my new package's library. What I'd like is a pre-build script I could use in VIPM that would copy my reuse libraries from vi.lib to the project's directory, include them as private members of the project's library, and relink all the project source code to the new, private copies of the reuse code. Relinking needs to update the sub vis called as well as inheritance chains.

So... as scripting ignorant as I am I have no idea how big a task this will be to implement or exactly what scripting nodes I should be looking at. The algorithm is mostly pretty straightforward:

1. Traverse the source code dependency trees. When I find a vi (or class) that depends on a reuse library, add the vi ref to a 'depends on' list and the reused vi ref to a 'depended on' list.

2. Iterate through the 'depended on' list, getting references to each unique top-level lvlib.

3. Copy the library's entire directory to the project directory.**

4. Add the reuse library copies to the current package's library.

5. Iterate through the 'depends on' list, replacing all instances of reuse library code with instances of the private copy.

(**This might not work. I think it depends on when exactly VIPM calls the build script during the build process. I posted a question about it on JKI's forums.)

Any tips or ideas on the easiest way to do this?

Link to comment

Ideas:

* Just use the OpenG builder to create a source distribution.

* Inside the OpenG builder there is a method used to relinke the vi's.

* The OpenG builder prebuild script allows you to change the build specs before the actual build process, so you can add the additional files to the build spec. I guess that VIPM isn't doing it different.

Felix

Link to comment

I have a few foundational reuse packages (such as a messaging library) that I use in almost all of my code, including when I'm writing other reuse code. These higher level packages will use the messaging library internally, but it is not exposed to clients. To avoid cross-linking my packages and potential version conflicts I want to include dependent packages as members of my new package's library. What I'd like is a pre-build script I could use in VIPM that would copy my reuse libraries from vi.lib to the project's directory, include them as private members of the project's library, and relink all the project source code to the new, private copies of the reuse code. Relinking needs to update the sub vis called as well as inheritance chains.

So... as scripting ignorant as I am I have no idea how big a task this will be to implement or exactly what scripting nodes I should be looking at. The algorithm is mostly pretty straightforward:

1. Traverse the source code dependency trees. When I find a vi (or class) that depends on a reuse library, add the vi ref to a 'depends on' list and the reused vi ref to a 'depended on' list.

2. Iterate through the 'depended on' list, getting references to each unique top-level lvlib.

3. Copy the library's entire directory to the project directory.**

4. Add the reuse library copies to the current package's library.

5. Iterate through the 'depends on' list, replacing all instances of reuse library code with instances of the private copy.

(**This might not work. I think it depends on when exactly VIPM calls the build script during the build process. I posted a question about it on JKI's forums.)

Any tips or ideas on the easiest way to do this?

[Cross-posted to JKI]

I have posted this before I think but here is how I do it:

  • Start with a LabVIEW Project
  • Create a top level Project Library that is used to namespace my distribution
  • Add a virtual folder to the LabVIEW Project called support
  • Add all the reuse VIs that will be made private to it, normally done by dragging and dropping from the dependencies item in the LabVIEW Project
  • NI Builder assign the support folder to a Project Library during the build process
  • Run my build script that adds the support Project Library to top level Project Library
  • Then makes the support Project Library a private member of its parent (top level Project Library)
  • Now all the VIs in the support folder are private to the distribution and namespaced so they won't collide with the actual reuse VIs under <LabVIEW>

Currently this workflow is for NI Builder + OGPB, but I am wanting to move it to VIPM 2010.

I think it shouldn't be an issue, all I have to do is handle adding the support VIs to a Project Library as part of a script - all the rest I already have code for.

But I am interested in anyones else's thoughts

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.