Skip to content

Commit

Permalink
Merge pull request #4 from digao-dalpiaz/output-path
Browse files Browse the repository at this point in the history
Output path
  • Loading branch information
digao-dalpiaz authored Feb 21, 2024
2 parents a4ae80f + 3a1d111 commit da85293
Show file tree
Hide file tree
Showing 14 changed files with 591 additions and 985 deletions.
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
*.identcache
*.local
*.stat
/Win32
/Win64
/Design
*/Win32
8 changes: 4 additions & 4 deletions CompInstall.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ program CompInstall;

uses
Vcl.Forms,
System.SysUtils,
UFrm in 'UFrm.pas' {Frm},
UCmdExecBuffer in 'UCmdExecBuffer.pas',
UCommon in 'UCommon.pas',
UDefinitions in 'UDefinitions.pas',
UDelphiVersionCombo in 'UDelphiVersionCombo.pas',
UFrm in 'UFrm.pas' {Frm},
UGitHub in 'UGitHub.pas',
UProcess in 'UProcess.pas',
UCommon in 'UCommon.pas',
UDelphiVersionCombo in 'UDelphiVersionCombo.pas';
UFrmOldFiles in 'UFrmOldFiles.pas' {FrmOldFiles};

{$R *.res}

Expand Down
933 changes: 30 additions & 903 deletions CompInstall.dproj

Large diffs are not rendered by default.

42 changes: 32 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Component Installer

## Delphi VCL app utility to auto-install component packages into IDE.
## Delphi app utility to auto-install component packages into IDE.

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/C0C53LVFN)

Expand All @@ -14,13 +14,20 @@

## What's New

- 09/12/2021 (Version 2.5)
- 02/20/2024 (Version 2.6)

- Delphi 11 support.
- Delphi 12 support.
- New ini properties: IniVersion, OutputPath and Package\Path
- PublishFiles now supports sub-folder.
- Clear all files and sub-folders when updating from GitHub.

<details>
<summary>Click here to view the entire changelog</summary>

- 09/12/2021 (Version 2.5)

- Delphi 11 support.

- 03/25/2021 (Version 2.4)

- As it is not a good practice to embed the Component Installer EXE in the GitHub component sources, the update of the GitHub repository has been modified to not update the Component Installer EXE, but only the configured component sources.
Expand Down Expand Up @@ -81,37 +88,47 @@ Then put the **CompInstall.exe** and **CompInstall.ini** into your component pac
## CompInstall.ini structure

**`[Template]` section**

`IniVersion` (required) = Version of ini structure (**Current version = 2**)

> If ini version is higher than current app supported version, the app will display an error message and block installation.
**`[General]` section**

`Name` (required) = Component name displayed at install form and registered into Delphi Packages.

`Version` (required) = Component version displayed at install form and used by GitHub auto-update control (if enabled).

`DelphiVersions` (required) = It's a list splited by ";" with all Delphi versions supported by the component. According to Delphi versions installed in Windows and combining with this parameter, a combobox in the install form will list all possible Delphi versions.
`DelphiVersions` (required) = It's a list splitted by ";" with all Delphi versions supported by the component. According to Delphi versions installed in Windows and combining with this parameter, a combobox in the install form will list all possible Delphi versions.

> Supported values: 2005;2006;2007;2009;2010;XE;XE2;XE3;XE4;XE5;XE6;XE7;XE8;10;10.1;10.2;10.3;10.4
> Supported values: 2005;2006;2007;2009;2010;XE;XE2;XE3;XE4;XE5;XE6;XE7;XE8;10;10.1;10.2;10.3;10.4;11;12
`Packages` (required) = It's a list splited by ";" with packages to be compiled, in correct order. Just type the package name without the file extension.
`Packages` (required) = It's a list splitted by ";" with packages to be compiled, in correct order. Just type the package name without the file extension.

`AddLibrary` (optional) = 0 or 1. When 1, the path of release folders of component will be registered into Delphi library path.

`OutputPath` (optional) = Relative folder where compiled files are stored (must be the same configured in package settings). You can use `{PLATFORM}` and `{CONFIG}` variables. Default value is: `{PLATFORM}\{CONFIG}` (By now, {CONFIG} is always "Release").

**Package section**

To specify package parameters, create a section with the name of the package with the `P_` prefix, like:

`[P_MyPackage]`

`Path` (optional) = Relative folder where package file is. If blank, package must be at component root folder.

`Allow64bit` (optional) = 0 or 1. When 1, specify this package to be compiled twice, with 32-bit and 64-bit versions. Remember to create this platform at Delphi Project Manager, otherwise the 64-bit compilation will fail.

If any package has this option enabled, it will be display a checkbox allowing install 64-bit version of component (the checkbox starts checked by default).

`PublishFiles` (optional) = It's a list splited by ";" with all files you want to copy into release folders (usually DFM form files used at runtime and resource files).
`PublishFiles` (optional) = It's a list splitted by ";" with all files you want to copy into release folders (usually DFM form files used at runtime and resource files).

`Install` (optional) = 0 or 1. When 1, this package will be installed into Delphi IDE. You need to set this option for design-time packages when you want to register components into Delphi IDE.

>Note: The app compiles your component using **Release** target. This means all packages need to be configured at default output folder (Win32\Release and Win64\Release).
> Note: The app compiles your component using always **Release** target.
**GitHub section**
**`[GitHub]` section**

`Repository` (optional) = Allows you to specify a GitHub repository (syntax: `GitHub account`/`Repository name`), so when app starts, it will check for component update using GitHub API, reading the latest existing release and comparing its version with current version. If the versions don't match, a dialog will be displayed asking if you want to auto-update files.

Expand All @@ -120,16 +137,21 @@ If any package has this option enabled, it will be display a checkbox allowing i
In this example, there are two Delphi packages (DamPackage and DamDesignPackage). The design-time package (DamDesignPackage) is configured to install into Delphi IDE. The runtime package (DamPackage) is configured to copy dfm form file and resource file to release folder.

```
[Template]
IniVersion=2
[General]
Name=Dam Component
Version=1.0
DelphiVersions=XE2;XE3;XE4;XE5;XE6;XE7;XE8;10;10.1;10.2;10.3;10.4
Packages=DamPackage;DamDesignPackage
AddLibrary=1
OutputPath=Library\{PLATFORM}\{CONFIG}
[P_DamPackage]
Path=Source\Code
Allow64bit=1
PublishFiles=DamDialog.dfm;Dam_Resource.res
PublishFiles=DamDialog.dfm;Resources\Dam_Resource.res
[P_DamDesignPackage]
Install=1
Expand Down
5 changes: 4 additions & 1 deletion UCommon.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ interface

const BDS_KEY = 'Software\Embarcadero\BDS';

const INI_FILE_NAME = 'CompInstall.ini';

var AppDir: string;

function HasInList(const Item, List: string): Boolean;
Expand All @@ -21,7 +23,8 @@ function HasInList(const Item, List: string): Boolean;
end;

function NormalizeAndRemoveFirstDir(Path: string): string;
var I: Integer;
var
I: Integer;
begin
Path := Path.Replace('/', '\');

Expand Down
17 changes: 15 additions & 2 deletions UDefinitions.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ interface

uses System.Generics.Collections, System.Classes;

const DEFINITIONS_VERSION = 2; //current definitions template

type
TPackage = class
public
Name: string;
Path: string;
Allow64bit: Boolean;
PublishFiles: TStringList;
Install: Boolean;
Expand All @@ -19,10 +22,12 @@ TPackages = class(TObjectList<TPackage>);

TDefinitions = class
public
IniVersion: Integer;
CompName: string;
CompVersion: string;
DelphiVersions: string;
AddLibrary: Boolean;
OutputPath: string;
Packages: TPackages;

GitHubRepository: string;
Expand All @@ -46,7 +51,8 @@ function PVToEnter(const A: string): string;
end;

procedure TDefinitions.LoadIniFile(const aFile: string);
var Ini: TIniFile;
var
Ini: TIniFile;
A, Sec: string;
S: TStringList;
P: TPackage;
Expand All @@ -56,6 +62,10 @@ procedure TDefinitions.LoadIniFile(const aFile: string);

Ini := TIniFile.Create(aFile);
try
IniVersion := Ini.ReadInteger('Template', 'IniVersion', 1);
if IniVersion>DEFINITIONS_VERSION then
raise Exception.Create('Unsupported ini version. You probably need to update Component Installer!');

CompName := Ini.ReadString('General', 'Name', '');
if CompName='' then
raise Exception.Create('Component name not specifyed at ini file');
Expand All @@ -69,6 +79,7 @@ procedure TDefinitions.LoadIniFile(const aFile: string);
raise Exception.Create('No Delphi version specifyed at ini file');

AddLibrary := Ini.ReadBool('General', 'AddLibrary', False);
OutputPath := Ini.ReadString('General', 'OutputPath', '');

S := TStringList.Create;
try
Expand All @@ -84,6 +95,7 @@ procedure TDefinitions.LoadIniFile(const aFile: string);
Sec := 'P_'+A;

P.Name := A;
P.Path := Ini.ReadString(Sec, 'Path', '');
P.Allow64bit := Ini.ReadBool(Sec, 'Allow64bit', False);
P.PublishFiles.Text := PVToEnter( Ini.ReadString(Sec, 'PublishFiles', '') );
P.Install := Ini.ReadBool(Sec, 'Install', False);
Expand Down Expand Up @@ -115,7 +127,8 @@ destructor TDefinitions.Destroy;
end;

function TDefinitions.HasAny64bit: Boolean;
var P: TPackage;
var
P: TPackage;
begin
Result := False;

Expand Down
1 change: 1 addition & 0 deletions UDelphiVersionCombo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class procedure TDelphiVersionComboLoader.Load(Combo: TComboBox;
Add('20.0', '10.3', 'Delphi 10.3 Rio');
Add('21.0', '10.4', 'Delphi 10.4 Sydney');
Add('22.0', '11', 'Delphi 11 Alexandria');
Add('23.0', '12', 'Delphi 12 Athens');
end;
finally
R.Free;
Expand Down
57 changes: 27 additions & 30 deletions UFrm.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ object Frm: TFrm
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'Component Installer'
ClientHeight = 542
ClientWidth = 729
ClientHeight = 589
ClientWidth = 874
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Segoe UI'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
OnDestroy = FormDestroy
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object LbComponentName: TLabel
Left = 16
Expand All @@ -41,11 +39,11 @@ object Frm: TFrm
Caption = 'Installation Log'
end
object LbVersion: TLabel
Left = 592
Left = 726
Top = 16
Width = 123
Height = 13
Caption = 'Component Installer 2.5'
Caption = 'Component Installer 2.6'
Font.Charset = ANSI_CHARSET
Font.Color = clGreen
Font.Height = -11
Expand All @@ -54,7 +52,7 @@ object Frm: TFrm
ParentFont = False
end
object LbComponentVersion: TLabel
Left = 456
Left = 528
Top = 16
Width = 41
Height = 13
Expand All @@ -63,7 +61,7 @@ object Frm: TFrm
object EdCompName: TEdit
Left = 16
Top = 32
Width = 433
Width = 505
Height = 21
TabStop = False
Color = clBtnFace
Expand All @@ -79,24 +77,24 @@ object Frm: TFrm
object EdDV: TComboBox
Left = 16
Top = 80
Width = 201
Width = 225
Height = 21
Style = csDropDownList
TabOrder = 2
TabOrder = 3
end
object Ck64bit: TCheckBox
Left = 248
Left = 272
Top = 80
Width = 137
Height = 17
Caption = 'Install 64-bit support'
Checked = True
State = cbChecked
TabOrder = 3
TabOrder = 4
end
object BtnInstall: TBitBtn
Left = 256
Top = 496
Left = 320
Top = 544
Width = 105
Height = 33
Caption = 'Install'
Expand Down Expand Up @@ -212,12 +210,12 @@ object Frm: TFrm
FFC080FFC080FF929596899396819195788F95708C95708C95788F9581919589
9396929596C080FFC080FFC080FFC080FFC080FFC080FFC080FF}
NumGlyphs = 2
TabOrder = 5
TabOrder = 6
OnClick = BtnInstallClick
end
object BtnExit: TBitBtn
Left = 368
Top = 496
Left = 432
Top = 544
Width = 105
Height = 33
Caption = 'Exit'
Expand Down Expand Up @@ -333,40 +331,39 @@ object Frm: TFrm
78807A78807A78807A78807A78807A78807A78807A78807A78807A78807A7888
8483C080FFC080FFC080FFC080FFC080FFC080FFC080FFC080FF}
NumGlyphs = 2
TabOrder = 6
TabOrder = 7
OnClick = BtnExitClick
end
object M: TRichEdit
Left = 16
Top = 128
Width = 697
Height = 361
Width = 841
Height = 410
TabStop = False
HideScrollBars = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 4
Zoom = 100
TabOrder = 5
end
object LinkLabel1: TLinkLabel
Left = 640
object LbDigaoDalpiaz: TLinkLabel
Left = 774
Top = 40
Width = 76
Height = 17
Caption =
'<a href="https://github.com/digao-dalpiaz/CompInstall">Dig'#227'o Dal' +
'piaz</a>'
TabOrder = 1
OnLinkClick = LinkLabel1LinkClick
TabOrder = 2
OnLinkClick = LbDigaoDalpiazLinkClick
end
object EdCompVersion: TEdit
Left = 456
Left = 528
Top = 32
Width = 121
Width = 161
Height = 21
TabStop = False
Color = clBtnFace
ReadOnly = True
TabOrder = 7
TabOrder = 1
end
end
Loading

0 comments on commit da85293

Please sign in to comment.