LAVA: [Discuss] Build Script - LAVA

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Discuss] Build Script Rate Topic: ***** 1 Votes

#1 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 14 November 2009 - 04:20 AM

Posted Image

Name: Build Script
Submitter: jgcode
Submitted: 14 Nov 2009
File Updated: 16 Nov 2009
Category: *Uncertified*
Version: 1.1.0
LabVIEW Version: 8.6
License Type: BSD (Most common)

Build Script v1.1.0

Copyright © 2009, Jonathon Green; JGCODE
All rights reserved.

Author: Jonathon Green
LAVA Name: jgcode
Contact Info: Contact via PM on lavag.org

LabVIEW Versions:
LabVIEW 8.6
LabVIEW 2009

Dependencies:
jki_lib_state_machine >= 2.0.0
jki_rsc_toolkits_palette >= 1.1
oglib_array >= 2.0
oglib_appcontrol >= 2.0
ogrsc_dynamicpalette >= 0.2
oglib_error >= 2.0
oglib_file >= 2.5
Unit Test Framework (optional)

Description:
Contains a build script for a LabVIEW Project. Use a build script in your development to automate the task of, and avoid errors when, creating deliverables. A sample project is included that creates an application, installer then archive (.zip) for a project. This build script supports the new 9.x build format by building the specs in a high level temp folder (e.g. C:\dist) to minimise errors occurring from the OS exceeding maximum number of characters in path. NI's Unit Test Framework (UTF) is supported or code can be added for other Unit Test APIs (see Unit Test Framwork.png for demo code).

Installation and instructions:
The dist folder contains build.vit and a library (.llb) of support code. See Examples section on how to use code.

Examples:
1. Open example\Project.lvprj
2. Open and run build.vi, VI should complete execution with no errors
3. Once build script has completed explore example\dist to view all builds (application, installer, zip)
4. Unzip zip folder and install application
5. Run the application
6. "Build Works!" dialog should appear to indicate sucessful build
7. Reuse script
a. Use build.vit as starting template for project
b. Edit the project details on the block diagram to match to new project

Known Issues:
No Known Issues

Acknowledgements:
Justin Goeres (JKI)
Joel Spolsky
JKI (JKI State Machine)
OpenG
ICON Technologies

Version History (Changelist):
1.1.0 2009 11 15
[Fix] Code saved to LabVIEW 8.6 on request from LAVA member. Unit Test Framework VIs were removed due to build issue.
[Fix] SubVIs added to a .lvlib within a .llb.

1.0.0 2009 11 14
[Feature] Initial release of the code (LabVIEW 2009).

License:
BSD

Support:
If you have any problems with this code or want to suggest features:
please go to lavag.org and Navigate to LAVA > Resources > Code Repository (Certified) and
search for the Build Script support page.

Distribution:
This code was downloaded from the LAVA Code Repository found at lavag.org

Click here to download this file
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
2

#2 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 14 November 2009 - 05:15 AM

Imitation is the sincerest form of flattery - Charles Caleb Colton (1780-1832)

Firstly I would like to say that I did not originate this idea, I first saw it posted on the JKI Blog by Justin Goeres. However, no code was posted, so I took what was there (GUI screenshot, BD screenshot, explanations etc..), said thank you, and came up with this. Of course I read Joel on Software and other books on (java) build scripts and seen other posts discussing LabVIEW build scripts etc.. but I wanted to make the above point up front as it is going to be very similar, but it was a great blog post about a great idea with a great example and I decided to implement it, use it and share it - with LAVA. So I hope its all ok. Thanks for listening.

Below are some notes on the code:

Attached Image

Since I was going to make this a template (.vit) a put a bit of extra GUI code in it. I wanted a clear visual sign when I came back to my desk that this thing had worked.

Attached Image

Or something had happened to make it fail. I also wanted to know the time it takes to build the project. With classes and libraries the build time can blow out from seconds to minutes (over 10) for some projects. Although 2009 seems much faster than 8.6. So I added another thread for a simple timer.

Attached Image

This script has support for 9.x builds. I found straight away I would get errors if my src code and dist folder where deeply nested in the folder hierarchy on the OS. 9.x solved the ugly build problem of files outside the exe, but it left me with a sour taste as my build frequently stopped due to error. This script solves the problem by transparently build in other folder (e.g. D:\dist) then coping these back to the Project. The only catch is (because reading the file XML tags in the project looks daunting) the 9.x Root path must match the start of the path in the build spec. Because I use the same location D:\dist I add a Project folder for each Project e.g. D:\dist\Project. the all the builds get located under here e.g. D:\dist\Project\application or D:\dist\Project\installer etc..

Attached Image

The architecture of the template is implemented using the JKI State Machine. Which is great for building GUI's quickly.

Attached Image

If you want to copy then edit this build for other projects (I had it as a .vit) then you will need to update the Project Details. The folder structure is hard-coded as this is a standard I use. All folders are relative to the project though. And there are some example files copied to the zip (for the creation of a CD).

Attached Image

I use NI's UTF a lot and this can run tests in the Project automatically. It can even decide to kill the build if tests fail. It is disabled in the distribution in case it is not installed.

Other
The application build Version can be auto-incremented and the installer Version is matched to it.

Support code used can be found in ..\lib. The subVIs are from libraries I use. You may find some reuse options in there.

I have been playing around with an AUTO feature that essentially defines constants for the GUI and therefore this script could be called by something else (e.g. as subVI) for an automated build (e.g. nightly).

I am looking doing the following in the future
Converting the .zip to an ISO so it's ready to burn; Archiving zip if its a release to server, SCC actions,

This code is a start and I would love to see what other people are doing and add to this over time.

Hope you enjoy it.
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
2

#3 User is offline   jcarmody

  • Very Active
  • Icon
  • Group: Premium Member
  • Posts: 409
  • Joined: 18-January 07
  • Location:North Carolina, United (by force) States, Earth
  • Version:LabVIEW 8.6
  • Since:2007

Posted 14 November 2009 - 02:01 PM

Justin's blog post CHANGED MY LIFE!  I re-wrote my own interpretation of this earlier this week (I had made an ugly version after reading the post and wanted one that could be shared), but didn't go as far as you did.  I can't tell how far you went, however, because I don't have LabVIEW 2009 yet.  Can you save it back to 8.6 (at least)?  Short of that, could you show me how you managed the timer?  My timer keeps time but the interface frequently hangs/freezes when the builder is running.
Want a better way to work with Case Structures? Try my CaseSelect plugin for the JKI Right-Click Framework.
Don't just post pictures of your code. Post Snippets! Use the Code Capture Tool for all of your code-sharing needs.


Tu ne cede malis sed contra audentior ito (do not give in to evil but proceed ever more boldly against it) ~ Virgil
0

#4 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 14 November 2009 - 05:59 PM

View Postjcarmody, on 14 November 2009 - 10:01 PM, said:

Justin's blog post CHANGED MY LIFE!  I re-wrote my own interpretation of this earlier this week (I had made an ugly version after reading the post and wanted one that could be shared), but didn't go as far as you did.  I can't tell how far you went, however, because I don't have LabVIEW 2009 yet.  Can you save it back to 8.6 (at least)?  Short of that, could you show me how you managed the timer?  My timer keeps time but the interface frequently hangs/freezes when the builder is running.


Hi Jim

Yes, it was a great blog post! It's 2am here, but I will have a look at this tomorrow. I have just upgraded to Windows 7, so I don't have everything installed yet. But I will try to put on 8.6.1 if I have the time (delayed pay-per-view tomorrow) :). It should back save ok as the same XML tags are used in 8.6 and LabVIEW 2009. Don't know about 8.5 and I know 8.2 is different.

As you can see from the block diagram, the timer just runs in another thread however, using the NI Build VIs the updating gets blocked (maybe the build runs as a high priority ?? - someone from NI may be able to comment). So it periodically updates. Thats ok cause the idea is I can leave it running and go away from the desk, I really just want to find the total duration.

What else did you add? Are you able to share code or any screenshots?

Cheers

JG
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

#5 User is offline   jcarmody

  • Very Active
  • Icon
  • Group: Premium Member
  • Posts: 409
  • Joined: 18-January 07
  • Location:North Carolina, United (by force) States, Earth
  • Version:LabVIEW 8.6
  • Since:2007

Posted 14 November 2009 - 09:31 PM

View Postjgcode, on 14 November 2009 - 12:59 PM, said:

[...] the timer just runs in another thread however, using the NI Build VIs the updating gets blocked (maybe the build runs as a high priority ?? - someone from NI may be able to comment). So it periodically updates. Thats ok cause the idea is I can leave it running and go away from the desk[...]

It works, but it's not as nice as I'd like it.

Quote

What else did you add? Are you able to share code or any screenshots?

I don't have as much as you have.  Mine builds the executable and installer then closes LabVIEW and launches the installer.  I want to add a function to set file permission on the ini files to restrict editing to admins.  I'll be able to post it Monday, but it's not very fancy.
Want a better way to work with Case Structures? Try my CaseSelect plugin for the JKI Right-Click Framework.
Don't just post pictures of your code. Post Snippets! Use the Code Capture Tool for all of your code-sharing needs.


Tu ne cede malis sed contra audentior ito (do not give in to evil but proceed ever more boldly against it) ~ Virgil
0

#6 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 15 November 2009 - 01:34 AM

View Postjcarmody, on 15 November 2009 - 05:31 AM, said:

It works, but it's not as nice as I'd like it.

I don't know if there is a way around this? If LabVIEW itself it blocking execution of the second thread running (or the UI updating) then I don't know if there is a workaround.

View Postjcarmody, on 15 November 2009 - 05:31 AM, said:

I don't have as much as you have.  Mine builds the executable and installer then closes LabVIEW and launches the installer.  I want to add a function to set file permission on the ini files to restrict editing to admins.  I'll be able to post it Monday, but it's not very fancy.

Thats a cool idea to run the installer - (assuming its an NI Installer you are using??) are you able to somehow respond to the prompts so it can install automatically - that would be cool!

Which ini files are you talking about? Are these the "settings" of the application that you own? Or the default .ini file created by LabVIEW?

Look forward to seeing it Monday :beer_mug:
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

#7 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 15 November 2009 - 04:20 PM

View Postjcarmody, on 14 November 2009 - 10:01 PM, said:

Can you save it back to 8.6 (at least)?


Hi Jim

I have saved it back to 8.6 and tidied up the release a little. I had to take out the Unit Test Framework VIs for now - I will have another look tomorrow after work. I have included a VI with the disabled case at the moment so you all you have to do is just paste it in.

I will create a OpenG package for this next in the next release as well.

Hope you like it!

Cheers

JG

Attached Image

Attached File  UTF(86).vi (7.66K)
Number of downloads: 24
[LabVIEW8.6]
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

#8 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 15 November 2009 - 04:45 PM

I should also mention if everything goes well you should see this

Attached Image


;)
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

#9 User is offline   jcarmody

  • Very Active
  • Icon
  • Group: Premium Member
  • Posts: 409
  • Joined: 18-January 07
  • Location:North Carolina, United (by force) States, Earth
  • Version:LabVIEW 8.6
  • Since:2007

Posted 16 November 2009 - 11:34 AM

View Postjgcode, on 14 November 2009 - 08:34 PM, said:

[...] Thats a cool idea to run the installer - (assuming its an NI Installer you are using??) are you able to somehow respond to the prompts so it can install automatically - that would be cool!
 
Yes NI installer, no automatic prompt responses.

Quote

Which ini files are you talking about? Are these the "settings" of the application that you own? Or the default .ini file created by LabVIEW?

Application settings.  I use configuration files to make the system flexible when I'm working on it, but I want less flexibility when it's working in production.

Quote

Look forward to seeing it Monday
 

Attached File(s)


Want a better way to work with Case Structures? Try my CaseSelect plugin for the JKI Right-Click Framework.
Don't just post pictures of your code. Post Snippets! Use the Code Capture Tool for all of your code-sharing needs.


Tu ne cede malis sed contra audentior ito (do not give in to evil but proceed ever more boldly against it) ~ Virgil
1

#10 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 17 November 2009 - 04:32 AM

View Postjcarmody, on 16 November 2009 - 07:34 PM, said:

 
Yes NI installer, no automatic prompt responses.


Application settings.  I use configuration files to make the system flexible when I'm working on it, but I want less flexibility when it's working in production.

 


Hey Jim thanks for posting - I am checking it out now over lunch.
May I ask what project SmokeCal is about?
The name sounds very Bondish :)
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

#11 User is offline   jcarmody

  • Very Active
  • Icon
  • Group: Premium Member
  • Posts: 409
  • Joined: 18-January 07
  • Location:North Carolina, United (by force) States, Earth
  • Version:LabVIEW 8.6
  • Since:2007

Posted 17 November 2009 - 12:13 PM

View Postjgcode, on 16 November 2009 - 11:32 PM, said:

May I ask what project SmokeCal is about?

It's a system for calibrating smoke detectors.

Quote

I am checking it out now over lunch.

I don't use forums when I'm supposed to be working, either. :) 
Want a better way to work with Case Structures? Try my CaseSelect plugin for the JKI Right-Click Framework.
Don't just post pictures of your code. Post Snippets! Use the Code Capture Tool for all of your code-sharing needs.


Tu ne cede malis sed contra audentior ito (do not give in to evil but proceed ever more boldly against it) ~ Virgil
0

#12 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 17 November 2009 - 02:00 PM

View Postjcarmody, on 17 November 2009 - 08:13 PM, said:

I don't use forums when I'm supposed to be working, either. :) 


It was just in case the boss was reading it :P

But I have to say; all these forums help me with my work as well, I don't think I would be as productive, or inspired, without them. But I have to be careful, I could easily chew through an hour without even noticing! :unsure:
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

#13 User is offline   jcarmody

  • Very Active
  • Icon
  • Group: Premium Member
  • Posts: 409
  • Joined: 18-January 07
  • Location:North Carolina, United (by force) States, Earth
  • Version:LabVIEW 8.6
  • Since:2007

Posted 17 November 2009 - 02:06 PM

View Postjgcode, on 17 November 2009 - 09:00 AM, said:

But I have to say; all these forums help me with my work as well, I don't think I would be as productive, or inspired, without them.

My sentiments exactly.
Want a better way to work with Case Structures? Try my CaseSelect plugin for the JKI Right-Click Framework.
Don't just post pictures of your code. Post Snippets! Use the Code Capture Tool for all of your code-sharing needs.


Tu ne cede malis sed contra audentior ito (do not give in to evil but proceed ever more boldly against it) ~ Virgil
0

#14 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 17 November 2009 - 02:22 PM

View Postjcarmody, on 17 November 2009 - 10:06 PM, said:

My sentiments exactly.


Well, heres cheers to LAVA :beer_mug: :beer_mug: :beer_mug:
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

#15 User is offline   Jim Kring

  • I love to right-click on stuff
  • Icon
  • Group: JKI
  • Posts: 1,718
  • Joined: 22-October 02
  • Version:LabVIEW 8.6
  • Since:2009

Posted 17 November 2009 - 03:50 PM

Great work, jgcode! Thanks for sharing this.

My only complaint (I'm only joking, really) is that you're not using VI Tester ;)

Cheers,
0

#16 User is offline   jgcode

  • The 500 club
  • Icon
  • Group: Premium Member
  • Posts: 637
  • Joined: 01-January 08
  • Version:LabVIEW 2009
  • Since:2006

Posted 18 November 2009 - 03:03 AM

View PostJim Kring, on 17 November 2009 - 11:50 PM, said:

Great work, jgcode! Thanks for sharing this.

My only complaint (I'm only joking, really) is that you're not using VI Tester ;)

Cheers,


Thanks Jim much appreciate - and you guys as JKI inspired this one - so thank you too!

You will be happy to know I had to take out the UTF because I could create a dist with it in (I have to follow this up to check whether the error is a bug or not). :)

Anyways, I think VI Tester API will fit in there quite nicely.
Check out my stuff
--------------------
LAVA CR: LVOOP Custom User Scripting Hooks, Rename LVOOP FP Object Labels (Quick Drop Plugin), Icons, Application Build Script
Idea Exchange: Public Folder for Icon Templates in new Icon Editor
--------------------
All day... / Pay It Forward
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic