Jump to content

Programmatically modifying buildspec


Recommended Posts

I will use the VI BuildTargetBuildSpecification.vi to programmatically build a project but I first need to set some buildspec properties such as the destination folder and version number.

Are there VIs or properties I can use for this? I looked into the Properties and AppBuilder folder and I did not figured anything useful.

The only solution for the moment is to edit the project file (XML).

Any better ideas?

Link to comment

I will use the VI BuildTargetBuildSpecification.vi to programmatically build a project but I first need to set some buildspec properties such as the destination folder and version number.

Are there VIs or properties I can use for this? I looked into the Properties and AppBuilder folder and I did not figured anything useful.

The only solution for the moment is to edit the project file (XML).

Any better ideas?

This won't be too detailed, but it should point you in the right direction -

From the Application class properties you can get an array of all open Projects and from there you can get a ref to a specific Project. Then from the Project MyComputer property you can get the TargetItem and from there you can get BuildSpecs. Now you have a reference to the BuildSpecs and you can get a ref to the Children[] of the BuildSpecs and finally from there get a ref to the particular BuildSpec you want. Now, with a ref to the BuildSpec you want to modify, you can modify items inside the XML project file using ProjectItem Set Tag method. So, you do end up editing the project file but you can do it programatically using LabVIEW so the process can be automated.

Mark

Link to comment

From the Application class properties you can get an array of all open Projects and from there you can get a ref to a specific Project. Then from the Project MyComputer property you can get the TargetItem and from there you can get BuildSpecs. Now you have a reference to the BuildSpecs and you can get a ref to the Children[] of the BuildSpecs and finally from there get a ref to the particular BuildSpec you want. Now, with a ref to the BuildSpec you want to modify, you can modify items inside the XML project file using ProjectItem Set Tag method. So, you do end up editing the project file but you can do it programatically using LabVIEW so the process can be automated.

I am trying to programmatically find the Startup VI, if any, of the build spec. I went through the steps you outlined above, and have found Tags SourceItem[5].Inclusion and SourceItem[5].ItemID which are "Startup VI" and "0xA1B0048A", respectively. I don't know what that hex number is. Using a similar process, I went through the project heirarchy and get the ProjectItem "ItemID" of the VI which I know is the Startup VI, but the two numbers are not equal. How can I get from the BuildSpec ItemID to the VI name/reference.

Link to comment

I am trying to programmatically find the Startup VI, if any, of the build spec. I went through the steps you outlined above, and have found Tags SourceItem[5].Inclusion and SourceItem[5].ItemID which are "Startup VI" and "0xA1B0048A", respectively. I don't know what that hex number is. Using a similar process, I went through the project heirarchy and get the ProjectItem "ItemID" of the VI which I know is the Startup VI, but the two numbers are not equal. How can I get from the BuildSpec ItemID to the VI name/reference.

Figured it out. Take that hex value, which is in variant form, and convert it to a ProjectItem class. This throws an error, but can be ignored, because a ProjectItem Property node will return the right Name and Path, anyways. Weird how the key to the problem was "ignoring the error."

Link to comment

This won't be too detailed, but it should point you in the right direction -

From the Application class properties you can get an array of all open Projects and from there you can get a ref to a specific Project. Then from the Project MyComputer property you can get the TargetItem and from there you can get BuildSpecs. Now you have a reference to the BuildSpecs and you can get a ref to the Children[] of the BuildSpecs and finally from there get a ref to the particular BuildSpec you want. Now, with a ref to the BuildSpec you want to modify, you can modify items inside the XML project file using ProjectItem Set Tag method. So, you do end up editing the project file but you can do it programatically using LabVIEW so the process can be automated.

Mark

It worked. Thanks a lot :thumbup1:

Link to comment

This is how I auto increment an executable's version (build # only) in my build script.

The child reference of the BuildSpec[] is passed to the Executable Auto Increment Build VI.

The Get and Set just read or writes to the XML tags.

post-10325-124956856218_thumb.png

Jgcode,

thanks for the info!

This is very usefull. Could you share this code via OpenG or Lava CR?

:worshippy:

Ton

Link to comment

Jgcode,

thanks for the info!

This is very usefull. Could you share this code via OpenG or Lava CR?

:worshippy:

Ton

No worries - it was a bit late, but I posted in case it helped.

I can't post the VIs but can you PM me your email and I will get them to you.

I also have been working on a build script that you might find useful (as I am guessing that is what you are doing?).

Its all in LV 8.6 - let me know what version you are using as well and I will try to convert down if needed.

Cheers

JG

Link to comment
  • 4 years later...

I'm working on a Real-Time project and wanted a way to programmatically update the Version Number in the Build Specs for both the Host and Remote targets.  A Web search led me here for the solution.  My code differs a little, as I'm doing this from within the Project -- in addition, the names of the Version Tags seem to have changed (in LabVIEW 2012).

 

I tried to post snippets of my VIs here, but couldn't figure out how to do so!  I'm using Chrome (if that matters).  I'm guessing I should use the "Image" button, but don't know what to put in for URL (the PNG images are on my desktop machine).

 

Bob Schor

Link to comment
I tried to post snippets of my VIs here, but couldn't figure out how to do so!  I'm using Chrome (if that matters).  I'm guessing I should use the "Image" button, but don't know what to put in for URL (the PNG images are on my desktop machine).

post-107-0-96555800-1385408792.png

Link to comment
  • 5 months later...

I was looking to automatize defining the build specifications as well but I never did scripting of this sort before, so I'm a little lost. Basically I wanted to take care of, well, this http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/compiler_optimizing_for_execution_speed/ (400+ VI's, Select each VI and clickety click click... NOPE). Anyway, I didn't get much further than being able to edit the tags I saw were already there. How would I, for instance, go through every source file/VI and define both of those properties (Uncheck "Use VI Property" and "Allow Debugging")?

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.