cnpack / cnvcl

CnPack VCL Components
http://www.cnpack.org
335 stars 102 forks source link

Add Delphinus package manager support #3

Closed Pawe1 closed 7 years ago

Pawe1 commented 7 years ago

:bulb: Advantages:

The Readme.md and line with keyword "Delphinus-Support" in readme is required to find repository via GitHub API.

I also added $IFDEF SUPPORT_ADO sections into dpk files because I was unable to compile them in Delphi Starter. And switched $DEFINE PERSONAL_EDITION as default option

Pawe1 commented 7 years ago

Thanks / Look like it works :) Screenshot

You can also do a test in Professional edition if everything is OK (especially about ADO stuff)

shanzhashu commented 7 years ago

OK. And, how to change the icon of CnVcl?

Pawe1 commented 7 years ago

You have to add picture with logo (in PNG / JPG format) somewhere inside repository Example here Then add "picture" parameter in Delphinus.Info.json with relative path Example here

Official documentation available is here

Maximum and optimal size is 128*128

Warning - all "\" chars in JSON file must be doubled ("\\")

I didn't add it because I haven't found it :wink:

shanzhashu commented 7 years ago

Ok. thanks.

And about the PERSONAL_EDITION definition in CnPack.inc, I prefer to keep it undefined for old users.

Pawe1 commented 7 years ago

You can revert this change if You like.

The only problem with PERSONAL_EDITION is that compilation of packages fails if You have Delphi Starter... :cry: Delphi Starter lacks for example ADO so Starter user will have to

So I thought that not enabling everything "out of the box" is more safe way because downloaded package will always compile.

Maybe it is possible to detect IDE version automatically? I have no idea...

Pawe1 commented 7 years ago

I am also not sure if .dpk files should or should not include {$I CnPack.inc} to make package condition {$IFDEF SUPPORT_ADO} work properly...

Pawe1 commented 7 years ago

It is probably possible to detect Starter version via this code (works in Delphi XE+)

function TDelphinusDialog.IsStarter: Boolean;
var
  LService: IOTAServices;
  LReg: TRegistry;
  LBase: string;
begin
  Result := False;
  LService := BorlandIDEServices as IOTAServices;
  LBase := LService.GetBaseRegistryKey();
  LReg := TRegistry.Create();
  try
    if LReg.OpenKeyReadOnly(LBase) then
    begin
      if LReg.ValueExists('Edition') then
        Result := SameText(LReg.ReadString('Edition'), 'Starter');
    end;
  finally
    LReg.Free;
  end;
end;

But I have no idea if this is possible to for example dynamically alter CnPack.inc before building. I have started a discussion here

Memnarch commented 7 years ago

Little Tip: Call it "CnPack VCL" or "CnPackVCL". Commandline users will thank you ;) (shorter names are easier to write :P)

In case none of you knew: Delphinus has a commandline interface which allows you to adress packages either by ID or their names.

Pawe1 commented 7 years ago

@Memnarch Maybe You have an idea for automated conditional compilation for Starter / Professional+ ?...

Memnarch commented 7 years ago

well i had a few ideas for specifying defines in a DelphinusPackage-File so that you could conditionally compile. However never ironed out the details and its implications. On systems like Linux where packagemanagers are omnipresent, you'd usually split things like this into different packages. Have CnPackVCL, CnPackDB and so on. However that thing(conditional/optional features) is a thing i want to add!

Memnarch commented 7 years ago

Oh and @shanzhashu consider adding regular releases to this repository, which allows Delphinus to notify/tell users about updates. The documentation has a topic about versioning and stuff. If you have any questions, feel free to ask me.

Pawe1 commented 7 years ago

I have another idea

a) Changes in CnPack VCL packages

  1. For every package open Project Options and switch Target to All configurations - All platforms

Screenshot

In Delphi Compiler > Conditional defines add $(DelphiEdition)

Screenshot

  1. In CnPack.inc Replace
    //{$DEFINE PERSONAL_EDITION}
    {$DEFINE ENTERPRISE_EDITION}

    with

    {$IFNDEF DelphiStarterEdition}
    {$DEFINE ENTERPRISE_EDITION}
    {$ELSE}
    {$DEFINE PERSONAL_EDITION}
    {$ENDIF}

    b) Ask people with Delphi Starter

    to open Tools > Options > Environment Options > Environment Variables > User overrides > New

Screenshot

and add variable with name DelphiEdition and value DelphiStarterEdition

Screenshot

@Memnarch Or maybe adding environment variables is possible using OTAPI?

Memnarch commented 7 years ago

well it is even possible to specify those values from Delphinus just for the running MSBuild(and therefore the DelphiCompiler). However things like that need more thinking and planning on my end.

Pawe1 commented 7 years ago

It's crazy that Starter has such a differences and Embarcadero didn't provide any easy way to figure out Delphi Edition... :dizzy_face: