2018R4 ide script for compilation

Hi there… I have 2 big projects that have 3 variants of compilation… When I build my app I launch an IDE script that do something like this

[code]SelectWindow “Gest 2010.rbp”
PropertyValue(“App.MacOSXAppName”) = “Gest-L autonoleggi”
PropertyValue(“App.WindowsAppName”) = “Gest-L autonoleggi”
ConstantValue(“MAS.Trasporti”) = “False”
ConstantValue(“MAS.Autonoleggio”) = “True”
ConstantValue(“Server.ServerMode”) = “False”
ConstantValue(“BundleID.MyBundleID”) = “com.system-i.gestlautonol”
PropertyValue(“App.Application Identifier”) = “com.system-i.gestlautonol”
DoCommand “BuildApp”

SelectWindow “Gest 2010.rbp”
PropertyValue(“App.MacOSXAppName”) = “Gest-L trasporti”
PropertyValue(“App.WindowsAppName”) = “Gest-L trasporti”
ConstantValue(“MAS.Autonoleggio”) = “False”
ConstantValue(“MAS.Trasporti”) = “True”
ConstantValue(“Server.ServerMode”) = “False”
ConstantValue(“BundleID.MyBundleID”) = “com.system-i.gestltrasp”
PropertyValue(“App.Application Identifier”) = “com.system-i.gestltrasp”
DoCommand “BuildApp”

SelectWindow “Gest 2010.rbp”
PropertyValue(“App.MacOSXAppName”) = “Gest-L”
PropertyValue(“App.WindowsAppName”) = “Gest-L”
ConstantValue(“MAS.Trasporti”) = “False”
ConstantValue(“Server.ServerMode”) = “False”
ConstantValue(“BundleID.MyBundleID”) = “com.system-i.gestl”
PropertyValue(“App.Application Identifier”) = “com.system-i.gestl”
DoCommand “BuildApp”[/code]

So now that script is unusable, because the IDE, before every build, delete all the build folder content… Until 2018R3 in my build folder (after the build process) I can see my 3 subfolders with my builds… Is there any explanation for this? Is there a workaround or a solution?

The build folder should have been deleted anyways before building. Copy your apps somewhere else.

Ok, so I have to do this operations manually when before was all automated. So that script is unusable now…
Thanks for the sad answer.

I understand that before the IDE was giving errors if the build folder already existing but… Now I’m gonna try with xojoscript if that can be helpful…

I’m still not sure what the problem is. You relied on an error. And you don’t need to do anything manually. Ditto is working fine for this type of stuff.

At the end of your script, use DoShellCommand to copy the build results.

Sorry but this is not true. Before my builds folder contains all my builds and now only the last one. Have you tried my script?

I think this is the only way, but I can’t find any help about this command… Any suggestion? I have to copy the build outside the build folder I think…

Beware of the potential name collision(s)…

You can see the available build script commands here:
http://developer.xojo.com/userguide/ide-scripting-commands

You’ll need to manually build a path as a string and then provide it to DoShellCommand as part of a command. For instance, on macOS you would use:

dim builtApp as String = CurrentBuildLocation + “/“ + CurrentBuildAppName + “.app”

To get the full path to the bundle.

If you are moving the app within the same drive, you can probably use the “mv “ command to move it.

dim cmd as string = “mv “ + builtApp + “ your/new/path”

[quote=418366:@Greg O’Lone]You can see the available build script commands here:
http://developer.xojo.com/userguide/ide-scripting-commands

You’ll need to manually build a path as a string and then provide it to DoShellCommand as part of a command. For instance, on macOS you would use:

dim builtApp as String = CurrentBuildLocation + “/“ + CurrentBuildAppName + “.app”

To get the full path to the bundle.

If you are moving the app within the same drive, you can probably use the “mv “ command to move it.

dim cmd as string = “mv “ + builtApp + “ your/new/path”

ok, seems good but… why my script do nothing? I’ve put under the macos build… the second question is: how can I debug it?

[code]dim builtApp as String
dim cmd as string
dim s As String

builtApp = CurrentBuildLocation + “/” + CurrentBuildAppName + “.app”
cmd = “mv " + builtApp + " /Users/sergio/Documents/Work/Work\ Inprogress/Gest-L/Builds\ -\ Gest\ 2010.xojo_binary_project/Compiled”
s = doshellcommand(cmd)[/code]

I tried with this too

cmd = "mv """ + builtApp + """ /Users/sergio/Documents/Work/Work\\ Inprogress/Gest-L/Builds\\ -\\ Gest\\ 2010.xojo_binary_project/Compiled"

It is possible that the DoShellCommand is timing out before the move completes. Change the command to:

s = DoShellCommand(cmd, 30000) Print s

Debugging those scripts is a pain in the behind.

First make sure that the script executes fine in the Terminal.
Then copy them verbatim to the IDE script.
Then start replacing the paths with relative paths. Sprinkle with “print cmd” before running the IDE script and “print s” after the script.

And use ditto instead of mv to preserve everything.

The macOS mv and cp commands now preserve everything that’s needed for modern (10.6+) versions of macOS. Using ditto is no longer required. One of the few bug reports that I filed in RADAR back in the 10.4 days that finally got implemented.

Ok, I’ve got it!!!

Thanks for the help… print s and print cmd was a great debug mode… Now, my problem was that in my app name there was one space… So, the right script is the following (posted if anyone other needs this help). Note the “-f” parameter for the mv command.

[code]dim builtApp as String
dim cmd as string
dim s As String

builtApp = CurrentBuildLocation + “/” + replaceall(CurrentBuildAppName," “,”\ “) + “.app”
cmd = “mv -f " + builtApp + " /Users/sergio/Documents/Lavoro/Lavori\ Realbasic/Gest-L/Builds\ -\ Gest\ 2010.xojo_binary_project/Compilati/”’”+ CurrentBuildAppName + “.app”
s = doshellcommand(cmd,3000)
'print s
'print cmd[/code]

So I’m trying for the windows built.

And this variant is for windows build

[code]dim builtApp as String
dim cmd as string
dim s As String

builtApp = CurrentBuildLocation + “/”
cmd = “mv -f " + builtApp + " /Users/sergio/Documents/Lavoro/Lavori\ Realbasic/Gest-L/Builds\ -\ Gest\ 2010.xojo_binary_project/Compilati/”’"+ CurrentBuildAppName + “.app”
s = doshellcommand(cmd,3000)
'print s
'print cmd[/code]

Just updated to 2018r4 and now, because the IDE deletes all folders inside the build folder, my IDE scripts are useless. Also, it follows any alias’s in there and deletes them too, even if they’re outside the build folder! Thank f**k for time machine backups etc. Good grief. Why oh why did you do this. Hours of work ahead of me now, for nowt. Gah.

Sorry… if you read above there is an helpful solution for this “annoying” “new feature”. I find useful to have an external build folder… I use for all my projects.

Just so very frustrating that we get used to a certain way of working - them boom! All change - quite a major one. I have around 14 current projects that all have fairly complex IDE scripts - all of which will need modification to work. A nice simple checkbox in preferences ‘don’t empty build folder’ would have been nice.

And a major flaw (well possible that this leads to data loss…!)…
The Xojo IDE should never-ever delete files outside of the BuildFolder…!
Thanks for mentioning this - I’ve just reported this as <https://xojo.com/issue/54912>

[quote=424743:@Jürg Otter]And a major flaw (well possible that this leads to data loss…!)…
The Xojo IDE should never-ever delete files outside of the BuildFolder…!
Thanks for mentioning this - I’ve just reported this as <https://xojo.com/issue/54912>[/quote]

It DID lead to major data loss! I’m just thankful I’m a backup maniac.