Dismiss Notice

REGISTRATION IS AFTER ADMIN ACTIVATION

DONATIONS WITH PAYPAL CLICK TO BUTTON

3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$

DONATIONS WITH Bitcoin Address:3NRs3CK3fhXifrNYxHEZKpETDd9vNLMsMD

Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Automated deployment of a Delphi OSX project from the command line

Discussion in 'Delphi Android And IOS' started by N0body, Aug 5, 2014.

  1. N0body
    Online

    N0bodyN0body is a Verified Member DelphiFan Administrator Staff Member DF Staff

    Recent versions of Delphi have a tool called PAclient.exe that is used for deploying and debugging apps on a remote Windows or OSX machine. ‘PA’ is short for Platform Assistant. It is not mentioned much in the help, probably because it is used internally by Delphi.

    Every time a project with an associated remote profile is debugged, ran or deployed, Delphi passes different parameters to PAclient to communicate with the PAServer running remotely.

    To build an OSX App bundle the recommended way is to use the Delphi IDE through Project > Deployment. This builds the app and deploys it to the remote OSX machine in a folder named “<projectname>.app”. This is just a folder with a predefined structure that contains the executable, icons, code signatures and any other resources or libraries used. Then you can Zip the folder and distribute it.

    This works well from the IDE, but not with a build automation tool, and I wanted to automate the building of Win and OSX apps and uploading the release versions on a server. It is possible to make a script that copies the executable and source files in the App folder structure without an OSX machine, but it is not possible to produce an Appstore version without OSX. The Appstore applications are signed and distributed as PKG files with the help of “codesign” and “productbuild” utilities on OSX.
    To do this the IDE issues a series of commands to PAClient, but there is no single command to deploy a project.

    Such functionality would be very useful, but is not available yet, so I had to write my own comand line tool automate the task. For the lack of a better name I called it “Embdeploy”.
    The “.dproj” file is an XML and contains the various project settings. The “<Deployment>” sections has a list of all the files to be deployed and their local and remote locations for each platform. The only thing needed was to parse the section and build a list of files to be deployed. The source and a compiled binary of the tool are available on GitHub.

    Here is some sample usage:


    Code:
    embdeploy.exe -deploy myproject.dproj
    embdeploy.exe -platform OSX32 -config Release -deploy myproject.dproj
    embdeploy.exe -profile <remote profile> -platform OSX32 -deploy myproject.dproj
    
    The Embdeploy tool also detects the default platform, profile, configuration from the project if they are not given in the command line. You can define the deployment options in the Delphi IDE and then use the tool to do the deployment automatically.
    To clean the remote project folder and do the actual deployment the tool uses paclient.exe and executes it with the appropriate parameters. Paclient.exe is detected from Delphi’s install path.

    There is another issue that the tool solved for me. My project includes additional bundled binaries, which are deployed with the app, but the Delphi IDE doesn’t give enough control in this case. E.g. it deploys the additional binaries, but it doesn’t set the Execute permission on the OSX, which have to be set by hand later. It is also not possible to ‘codesign’ those binaries and this is required for publishing the app to the Appstore.

    To fix that I added the functionality to execute custom commands on the remote machine after deploying the file.
    This is done like this:


    Code:
    embdeploy.exe -cmd "chmod +x myproject.app/Contents/MacOS/somebinary" myproject.dproj
    embdeploy.exe -cmd "codesign .... myproject.app/Contents/MacOS/somebinary" myproject.dproj
    
    This is done again with paclient.exe. The Embarcadero tool provides an option to deploy a script file, execute it and then delete it. I used this to execute my own commands by making a temporary shell file with the command, deploying it and executing it.
    This way I could use “chmod”, “productbuild” and whatever else I needed.

    An additional function is to produce a ZIP file with the App bundle in it without the need to deploy to OSX. It is useful for making an archive with the app and uploading it somewhere directly from your build automation script, without the need to switch from Windows to OSX.


    Code:
    embdeploy.exe -bundle c:\myrelease\myproject.zip myproject.dproj
     
  2. itognet
    Online

    itognet Guest

    RE:

    I really hope that somebody is using your tool. 
    It is awesome, well I havnt tried it yet - but it is really time consuming to do it the manual way.

    Guess you havnt found a way to increase the build version at itunesconnect yet - then it would be fully automatick ;-)
     

Share This Page

Laws
Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
DONATIONS WITH PAYPAL CLICK TO BUTTON
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block