diff --git a/.gitignore b/.gitignore index 2920504..a008eb9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,14 @@ Thumbs.db #ignore Delphi build directories Android/ -iOSDevice/ -iOSDevice32/ +Android64/ iOSDevice64/ iOSSimulator/ +iOSSimARM64/ +Linux64/ OSX32/ +OSX64/ +OSXARM64/ Win32/ Win64/ #ignore Delphi build files @@ -28,4 +31,4 @@ Win64/ HtmlHelp/ Html/ #ignore DUnitX output -dunitx-results.xml \ No newline at end of file +dunitx-results.xml diff --git a/Models/Model.Common.pas b/Models/Model.Common.pas index 45f82ed..935807e 100644 --- a/Models/Model.Common.pas +++ b/Models/Model.Common.pas @@ -6,7 +6,7 @@ interface type { Supported target platforms } - TTargetPlatform = (Unknown, iOS, Android); + TTargetPlatform = (Unknown, iOS, Android, MacOS, Linux); implementation diff --git a/Models/Model.DelphiProjectFile.pas b/Models/Model.DelphiProjectFile.pas index 8d59c47..edd3899 100644 --- a/Models/Model.DelphiProjectFile.pas +++ b/Models/Model.DelphiProjectFile.pas @@ -88,7 +88,7 @@ TDeployFile = record ALocalName: the name (including directory) on the local file system of the file to be deployed. ARemoteDirectory: the target directory on the device to deploy to. - APlatform: the target platform for the file (iOS or Android) + APlatform: the target platform for the file (iOS, Android, MacOS or Linux) AForConfigurations: the build configurations to add the file to. Can be nil (empty) to apply to all configurations. } procedure Add(const ALocalName, ARemoteDir: String; @@ -146,9 +146,12 @@ implementation Supported platforms: * iOSDevice64 - * iOSSimulator + * iOSSimARM64 * Android - * Android64 } + * Android64 + * OSX64 + * OSXARM64 + * Linux64 } { TDelphiProjectFile.TDeployFile } @@ -165,9 +168,11 @@ procedure TDelphiProjectFile.Add(const ALocalName, ARemoteDir: String; const APlatform: TTargetPlatform; const AForConfigurations: TArray); const PLATFORM_NAMES: array [TTargetPlatform, 0..2] of String = - (('', '', ''), // Unknown - ('iOSDevice64', 'iOSSimulator', ''), // iOS - ('Android', 'Android64', '')); // Android + (('', '', ''), // Unknown + ('iOSDevice64', 'iOSSimARM64', ''), // iOS + ('Android', 'Android64', ''), // Android + ('OSX64', 'OSXARM64', ''), // MacOS + ('Linux64', '', '')); // Linux begin if (FDeploymentElement = nil) then Exit; @@ -343,8 +348,12 @@ procedure TDelphiProjectFile.LoadPlatform(const ALocalName: String; var Name := AElement.AttributeByName('Name').Value; if (Name = 'Android') then Platf := TTargetPlatform.Android - else if (Name = 'iOSDevice64') or (Name = 'iOSSimulator') then + else if (Name = 'iOSDevice64') or (Name = 'iOSSimARM64') then Platf := TTargetPlatform.iOS + else if (Name = 'OSX64') or (Name = 'OSXARM64') then + Platf := TTargetPlatform.MacOS + else if Name = 'Linux64' then + Platf := TTargetPlatform.Linux else Exit; diff --git a/Models/Model.GrijjyDeployFile.pas b/Models/Model.GrijjyDeployFile.pas index 08062ee..53d2e57 100644 --- a/Models/Model.GrijjyDeployFile.pas +++ b/Models/Model.GrijjyDeployFile.pas @@ -52,6 +52,12 @@ TDeployData = record { All deployment entries for the Android platform } Android: TDeployEntries; + + { All deployment entries for the MacOS platform } + MacOS: TDeployEntries; + + { All deployment entries for the Linux platform } + Linux: TDeployEntries; public procedure Initialize; end; @@ -94,7 +100,7 @@ TDeployFile = class { Adds a file or directory to be deployed. Parameters: - APlatform: the target platform (iOS or Android) + APlatform: the target platform (iOS, Android, MacOS or Linux) ALocalName: the name of the file or directory to deploy (on the local file system) ARemoteDir: the target directory on the device to deploy to. @@ -113,7 +119,7 @@ TDeployFile = class Parameters: ALocalName: the name of the file or directory to remove (on the local file system) - APlatform: the target platform (iOS or Android) + APlatform: the target platform (iOS, Android, MacOS or Linux) Returns: True if there was an entry for ALocalName, of False if not. } @@ -156,6 +162,8 @@ procedure TDeployData.Initialize; Configurations := nil; iOS := nil; Android := nil; + MacOS := nil; + Linux := nil; end; { TDeployFile } @@ -228,6 +236,8 @@ procedure TDeployFile.Load; FConfigurations := Data.Configurations; AddEntries(TTargetPlatform.iOS, Data.iOS); AddEntries(TTargetPlatform.Android, Data.Android); + AddEntries(TTargetPlatform.MacOS, Data.MacOS); + AddEntries(TTargetPlatform.Linux, Data.Linux); end; function TDeployFile.Remove(const ALocalName: String; @@ -251,6 +261,8 @@ procedure TDeployFile.Save; Data.Configurations := FConfigurations; Data.iOS := FDeployEntries[TTargetPlatform.iOS].Values.ToArray; Data.Android := FDeployEntries[TTargetPlatform.Android].Values.ToArray; + Data.MacOS := FDeployEntries[TTargetPlatform.MacOS].Values.ToArray; + Data.Linux := FDeployEntries[TTargetPlatform.Linux].Values.ToArray; var Json: String; TgoBsonSerializer.Serialize(Data, TgoJsonWriterSettings.Pretty, Json); diff --git a/README.md b/README.md index bba1865..5805332 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Grijjy Deployment Manager -The Grijjy Deployment Manager (DeployMan) is a tool to simplify the deployment of files and folders for iOS and Android apps written in Delphi. It is especially useful if you need to deploy a lot of files, such as 3rd party SDKs. +The Grijjy Deployment Manager (DeployMan) is a tool to simplify the deployment of files and folders for Android, iOS, MacOS and Linux apps written in Delphi. It is especially useful if you need to deploy a lot of files, such as 3rd party SDKs. ## Usage @@ -33,6 +33,6 @@ Contributions are welcome! If you want to contribute, you can either create a pu ## License -The Grijjy Deployment Manager is licensed under the Simplified BSD License. +The Grijjy Deployment Manager is licensed under the Simplified BSD License. -See License.txt for details. \ No newline at end of file +See License.txt for details. diff --git a/Views/View.Main.dfm b/Views/View.Main.dfm index 8288b54..c757a0f 100644 --- a/Views/View.Main.dfm +++ b/Views/View.Main.dfm @@ -27,7 +27,9 @@ object ViewMain: TViewMain TabOrder = 0 Tabs.Strings = ( 'iOS' - 'Android') + 'Android' + 'MacOS' + 'Linux') TabIndex = 0 OnChange = TabControlChange object ListViewEntries: TListView diff --git a/Views/View.Main.pas b/Views/View.Main.pas index 68b2080..4d8a748 100644 --- a/Views/View.Main.pas +++ b/Views/View.Main.pas @@ -111,8 +111,12 @@ TViewMain = class(TForm) const ADst: TDelphiProjectFile); overload; procedure SetModified(const AValue: Boolean); procedure ViewConfigurationsHide(Sender: TObject); + procedure WMDropFiles(var AMessage: TWMDropFiles); message WM_DROPFILES; private class function ConfigurationsToString(const AConfigs: TArray): String; static; + protected + procedure CreateWnd; override; + procedure DestroyWnd; override; public { Public declarations } end; @@ -125,6 +129,7 @@ implementation {$R *.dfm} uses + Winapi.ShellAPI, System.Types, System.UITypes, System.IOUtils; @@ -339,6 +344,18 @@ class function TViewMain.ConfigurationsToString( Result := Result + ']'; end; +procedure TViewMain.CreateWnd; +begin + inherited; + DragAcceptFiles(Handle, True); +end; + +procedure TViewMain.DestroyWnd; +begin + DragAcceptFiles(Handle, False); + inherited; +end; + procedure TViewMain.FormActivate(Sender: TObject); begin if Assigned(FViewConfigurations) and (FViewConfigurations.Visible) then @@ -500,13 +517,27 @@ procedure TViewMain.ShowSettings(const APlatform: TTargetPlatform); try ComboBoxTargetDir.Items.Clear; ComboBoxTargetDir.Items.Add('.\'); - if (APlatform = TTargetPlatform.iOS) then - ComboBoxTargetDir.Items.Add('StartUp\Documents\') + case APlatform of + TTargetPlatform.iOS: + begin + ComboBoxTargetDir.Items.Add('StartUp\Documents\'); + ComboBoxTargetDir.Items.Add('StartUp\Library\'); + ComboBoxTargetDir.Items.Add('StartUp\Library\Caches\'); + end; + TTargetPlatform.Android: + begin + ComboBoxTargetDir.Items.Add('assets\internal'); + ComboBoxTargetDir.Items.Add('assets\external'); + ComboBoxTargetDir.Items.Add('res\values\'); + end; + TTargetPlatform.MacOS: + begin + ComboBoxTargetDir.Items.Add('Contents\MacOS\'); + ComboBoxTargetDir.Items.Add('Contents\Resources\'); + ComboBoxTargetDir.Items.Add('Contents\Resources\StartUp\'); + end; + TTargetPlatform.Linux: ComboBoxTargetDir.Items.Add('StartUp\'); else - begin - ComboBoxTargetDir.Items.Add('assets\internal'); - ComboBoxTargetDir.Items.Add('assets\external'); - ComboBoxTargetDir.Items.Add('res\values\'); end; finally ComboBoxTargetDir.Items.EndUpdate; @@ -540,10 +571,13 @@ procedure TViewMain.ShowSettings; procedure TViewMain.TabControlChange(Sender: TObject); begin - if (TabControl.TabIndex = 0) then - ShowSettings(TTargetPlatform.iOS) + case TabControl.TabIndex of + 0: ShowSettings(TTargetPlatform.iOS); + 1: ShowSettings(TTargetPlatform.Android); + 2: ShowSettings(TTargetPlatform.MacOS); + 3: ShowSettings(TTargetPlatform.Linux); else - ShowSettings(TTargetPlatform.Android); + end; end; procedure TViewMain.UpdateCaption; @@ -583,4 +617,19 @@ procedure TViewMain.ViewConfigurationsHide(Sender: TObject); SetModified(True); end; +procedure TViewMain.WMDropFiles(var AMessage: TWMDropFiles); +var + LCount: Integer; + LFileName: array[0..MAX_PATH - 1] of Char; +begin + LCount := DragQueryFile(AMessage.Drop, $FFFFFFFF, LFileName, MAX_PATH); + if (LCount = 1) and (DragQueryFile(AMessage.Drop, 0, LFileName, MAX_PATH) <> 0) and + string(LFileName).EndsWith('.grdeploy', True) then + begin + if (not CheckSave) then + Exit; + Open(LFileName); + end; +end; + end.