Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to iOSSimARM64, MacOS and Linux #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,4 +31,4 @@ Win64/
HtmlHelp/
Html/
#ignore DUnitX output
dunitx-results.xml
dunitx-results.xml
2 changes: 1 addition & 1 deletion Models/Model.Common.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface

type
{ Supported target platforms }
TTargetPlatform = (Unknown, iOS, Android);
TTargetPlatform = (Unknown, iOS, Android, MacOS, Linux);

implementation

Expand Down
23 changes: 16 additions & 7 deletions Models/Model.DelphiProjectFile.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -146,9 +146,12 @@ implementation

Supported platforms:
* iOSDevice64
* iOSSimulator
* iOSSimARM64
* Android
* Android64 }
* Android64
* OSX64
* OSXARM64
* Linux64 }

{ TDelphiProjectFile.TDeployFile }

Expand All @@ -165,9 +168,11 @@ procedure TDelphiProjectFile.Add(const ALocalName, ARemoteDir: String;
const APlatform: TTargetPlatform; const AForConfigurations: TArray<String>);
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;
Expand Down Expand Up @@ -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;

Expand Down
16 changes: 14 additions & 2 deletions Models/Model.GrijjyDeployFile.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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. }
Expand Down Expand Up @@ -156,6 +162,8 @@ procedure TDeployData.Initialize;
Configurations := nil;
iOS := nil;
Android := nil;
MacOS := nil;
Linux := nil;
end;

{ TDeployFile }
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.
See License.txt for details.
4 changes: 3 additions & 1 deletion Views/View.Main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ object ViewMain: TViewMain
TabOrder = 0
Tabs.Strings = (
'iOS'
'Android')
'Android'
'MacOS'
'Linux')
TabIndex = 0
OnChange = TabControlChange
object ListViewEntries: TListView
Expand Down
67 changes: 58 additions & 9 deletions Views/View.Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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>): String; static;
protected
procedure CreateWnd; override;
procedure DestroyWnd; override;
public
{ Public declarations }
end;
Expand All @@ -125,6 +129,7 @@ implementation
{$R *.dfm}

uses
Winapi.ShellAPI,
System.Types,
System.UITypes,
System.IOUtils;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.