Build Automation.rbbas 4.86 KB
Newer Older
1
#tag BuildAutomation
			Begin BuildStepList Linux
				Begin BuildProjectStep Build
				End
			End
			Begin BuildStepList Mac OS X
				Begin IDEScriptBuildStep SaveProject , AppliesTo = 0
					DoCommand "SaveFile"
				End
				Begin BuildProjectStep Build
				End
				Begin IDEScriptBuildStep UnDock , AppliesTo = 0
					Dim AppLocation as String = CurrentBuildAppName + ".app"
					AppLocation = AppLocation.ReplaceAll( " ", "\ " )
					AppLocation = CurrentBuildLocation + "/" + AppLocation
					
					//@ More cocoa info.plist keys here:
					//  https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html
					
					Call DoShellCommand("/usr/bin/defaults write " + AppLocation + "/Contents/Info ""LSBackgroundOnly"" -bool ""true""")
					Call DoShellCommand("/bin/chmod 644 " + AppLocation + "/Contents/Info.plist")
					
				End
				Begin IDEScriptBuildStep tarProject , AppliesTo = 0
					/// Set Variables
					dim packageLoc, res, tarname as string
					tarname = "Idle-Logout.tar.bz2"
					packageLoc = "/Users/rzm102/Documents/_Programing/Git/IdleLogout/"
					
					//print "Build Location: "+CurrentBuildLocation
					
					'if CurrentBuildLocation="/Users/rzm102/Documents/_Programing/Git/IdleLogout/Builds\ \-\ psuIdleLogout.rbvcp/OS\ X\ 64\ bit" then
					'
					'// Tar up folder
					'res = DoShellCommand _
					'("cd "+CurrentBuildLocation+"; /usr/bin/tar -c --exclude='.svn' -vjf "+tarname+" *")
					'if res = "" then
					'print "Results: "+res
					'end
					'// Delete old tar
					'// print "rm "+packageLoc+tarname
					'res = DoShellCommand _
					'("rm "+packageLoc+tarname)
					'
					'// Move tar to luggage folder
					'// print "mv "+CurrentBuildLocation+"/"+tarname+" "+packageLoc
					'// res = DoShellCommand _
					'("mv "+CurrentBuildLocation+"/"+tarname+" "+packageLoc)
					'
					'// Make package
					'// res = DoShellCommand _
					'("cd "+packageLoc+"; make pkg; open "+packageLoc)
					'// print res
					'else
					'// print "Not on rusty's mac. Skipping pkg creation"
					'//print CurrentBuildLocation//print "Build Location: "+CurrentBuildLocation
					'end
					
				End
				Begin IDEScriptBuildStep PkgApp , AppliesTo = 0
					Dim result as String
					Dim command As String
					Dim source as String
					Dim dest as String
					
					// Path to Build Path
					Dim ProjectPath as String = " " + CurrentBuildLocation
					print ProjectPath
					
					// Path to Project Root
					Dim ProjectRoot as String = ProjectShellPath.ReplaceAll( " ", "\ " )
					ProjectRoot = Replace(ProjectRoot, "psuIdleLogout.rbvcp", "")
					print ProjectRoot
					
					// Path to Application
					Dim AppLocation as String = CurrentBuildAppName + ".app"
					AppLocation = AppLocation.ReplaceAll( " ", "\ " )
					AppLocation = CurrentBuildLocation + "/" + AppLocation
					print AppLocation
					
					// Path to Pkg Output
					Dim BuildOutput as String = ProjectShellPath + "IdleLogout Builds/IdleLogout-" + PropertyValue("IdleLogout.ShortVersion") + ".pkg"
					BuildOutput = BuildOutput.ReplaceAll( " ", "\ " )
					BuildOutput = Replace(BuildOutput, "psuIdleLogout.rbvcp", "")
					
					// Delete the project root
					command = "rm -R /tmp/root" ' + ProjectPath
					result = DoShellCommand(command)
					
					// Make root dirs
					'command = "mkdir -p " + CurrentBuildLocation + "/Library/LaunchAgents/"
					'result = DoShellCommand(command)
					'command = "mkdir -p " + CurrentBuildLocation + "/Library/CLMshared/Startup\ Items/"
					'result = DoShellCommand(command)
					command = "mkdir -p /tmp/root/Library/LaunchAgents/"
					result = DoShellCommand(command)
					command = "mkdir -p /tmp/root/Library/CLMshared/Startup\ Items/"
					result = DoShellCommand(command)
					
					// Move App
					source = " " + AppLocation
					dest = " /tmp/root/Library/CLMshared/Startup\ Items/"
					command = "cp -R " + source + dest
					print command
					result = DoShellCommand(command)
					
					// Copy LaunchAgent
					source = " " + ProjectRoot + "/IdleLogout\ Builds/LaunchAgent/edu.psu.idlelogout.plist"
					dest =  " /tmp/root/Library/LaunchAgents/"
					command = "cp" + source + dest
					result = DoShellCommand(command)
					
					// Build Pkg
					command = "/usr/bin/pkgbuild --version " + PropertyValue("IdleLogout.ShortVersion") +" --identifier edu.psu.idlelogout --root /tmp/root/ " + BuildOutput
					result = DoShellCommand(command)
					print result
					
					// Delete the project root
					command = "rm -R /tmp/root" ' + ProjectPath
					result = DoShellCommand(command)
					
					// Run AutoPkg Recipe
					command = "/usr/local/bin/autopkg run -vvv IdleLogout.bigfix -k pathname=" + BuildOutput + " -k version=" + PropertyValue("IdleLogout.ShortVersion")
					print command
					'result = DoShellCommand(command)
					'print result
				End
			End
			Begin BuildStepList Windows
				Begin BuildProjectStep Build
				End
			End
#tag EndBuildAutomation