Recent

Author Topic: BGRA Version Number  (Read 4331 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
BGRA Version Number
« on: April 22, 2019, 09:50:32 pm »
Hi!

Is the BGRA Version Number somewhere stored inside the units?

I didn't find  anything.

If not, this is a wish for future releases:

Put the Version Number somewhere into BGRA.

Thanx, Winni

dsiders

  • Hero Member
  • *****
  • Posts: 1045
Re: BGRA Version Number
« Reply #1 on: April 22, 2019, 10:00:30 pm »
Hi!

Is the BGRA Version Number somewhere stored inside the units?

I didn't find  anything.

If not, this is a wish for future releases:

Put the Version Number somewhere into BGRA.

Thanx, Winni

I don't see any version constants defined in source code. But version information is in the update_*.json files for the OPM downloads.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: BGRA Version Number
« Reply #2 on: April 22, 2019, 10:24:11 pm »
https://github.com/bgrabitmap/bgrabitmap/releases

It's easier to see with open eyes ...  :P  :)
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRA Version Number
« Reply #3 on: April 22, 2019, 10:25:34 pm »
Hi!

Is the BGRA Version Number somewhere stored inside the units?

I didn't find  anything.

If not, this is a wish for future releases:

Put the Version Number somewhere into BGRA.

Thanx, Winni

You need to read it from code? for some reason?

dsiders

  • Hero Member
  • *****
  • Posts: 1045
Re: BGRA Version Number
« Reply #4 on: April 22, 2019, 10:36:06 pm »
https://github.com/bgrabitmap/bgrabitmap/releases

It's easier to see with open eyes ...  :P  :)

Well that's certainly nice. But how is it relevant to version numbers in uniits?
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: BGRA Version Number
« Reply #5 on: April 22, 2019, 11:11:20 pm »
@dsiders: It's as relevant as the version number in Lazarurs/LCL is and as the version number in fpc is.

@ RAW: you didn't understand my question

Thanx
Winni

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: BGRA Version Number
« Reply #6 on: April 22, 2019, 11:27:46 pm »
@lainz: to write some code like

Code: Pascal  [Select][+][-]
  1. const fpcVersion = {$I %FPCVERSION%};
  2. var s : string;
  3.  
  4. begin
  5. s := 'Made with' + lineEnding +
  6.        'fpc version '+ fpcVersion + LineEnding+
  7.        'Lazarus  version '+ LCLVersion + LineEnding +
  8.        'BGRA Version ' + ??BGRAVersion??;
  9. showMessage (s);
  10. end;    
  11.  
  12.  

Got me?

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRA Version Number
« Reply #7 on: April 22, 2019, 11:38:54 pm »
It's a good use.

Maybe you can report a bug so this don't get lost:
https://github.com/bgrabitmap/bgrabitmap/issues

Asking to add version number as a constant in the package.

dsiders

  • Hero Member
  • *****
  • Posts: 1045
Re: BGRA Version Number
« Reply #8 on: April 23, 2019, 12:27:49 am »
@dsiders: It's as relevant as the version number in Lazarurs/LCL is and as the version number in fpc is.

Glad you think so. Have at it.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: BGRA Version Number
« Reply #9 on: April 23, 2019, 03:32:57 pm »
Hi!

Add a new issue to BGRA:

https://github.com/bgrabitmap/bgrabitmap/issues/57

Perhaps it doesn't get lost ....

Winni




circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #10 on: April 24, 2019, 09:00:14 pm »
I wonder how to retrieve the package version inside a unit. Is it possible ?

Because I would prefer not to have more litteral copies of the version number.
Conscience is the debugger of the mind

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: BGRA Version Number
« Reply #11 on: April 24, 2019, 10:22:19 pm »
As there are the package names with version number in the two listboxes in Package --> Configure installed packages (ger.: Installierte Pakete einrichten) one could reach it with following steps:

1) Inside a BGRA unit is a const like
BGRAversion = {$I BGRAversion.inc};
2) Get the package version from the IDE - no idea how to get.
3) If PackageVersion <> BGRAVersion then
     begin
      delete BGRAVersion.inc
       write PackageVersion to new BGRAversion.inc
    end else exit;

Anybody who knows details about the package names inside the IDE??

Winni

lainz

  • Hero Member
  • *****
  • Posts: 4449
    • https://lainz.github.io/
Re: BGRA Version Number
« Reply #12 on: April 25, 2019, 12:58:32 am »
What you can try to do is execute a program every new release is added.

That program reads the version number from the package and stores it into a BGRAVersion.pas for example.

As well it will be usefull to store the version number in the updates JSON for OPM.

Anyways you need to change the version number when releasing, is just another step that can be automatic with that program.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: BGRA Version Number
« Reply #13 on: April 25, 2019, 01:07:11 am »
What you can try to do is execute a program every new release is added.

That program reads the version number from the package and stores it into a BGRAVersion.pas for example.

Indeed, since the maintainer has to update the JSON with evry release, it wouldn't be too onerous to write a litle utility to which you pass the version number and which updates both the JSON file and a "bgraversion.inc".

It could then be run automatically before/after a "release" mode compilation, with v.g. a couple switches "--include" and "--json" to know which file to update, so before compilation it may run as "updateversion --include X.Y.Z" and after compilation as "updateversion --json X.Y.Z".

And "updateversion --json" would get the version from the "version.inc" and viceversa ...

And maybe ..

Well, just a thought. Design brainstorming ;)

ETA: Thining about, it could be fully automatic, getting the version from the LPI if you have "Version Info" on in the project options. Is that valid for packages?

Ah ... sorry ... I'm stopping now.
« Last Edit: April 25, 2019, 01:20:59 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

circular

  • Hero Member
  • *****
  • Posts: 4181
    • Personal webpage
Re: BGRA Version Number
« Reply #14 on: April 25, 2019, 09:59:53 am »
Indeed one could do an update program. One of the reason is the JSON file and there is another reason: there are several BGRABitmap packages which are supposed to have the same version number (regular, for fpGUI and for noGUI).

Though I was hoping some compiler directive like:
Code: Delphi  [Select][+][-]
  1. const MyPackageVersion={$PACKAGEVERSION};

@lucamar
About updating, I see you mention the JSON update to be separate from the rest. In some way I agree because the proper way is:
- first update packages with the new version (and merge with master branch)
- make a release on the repository with the new version to get the zip file
- update the JSON file with version number and zip file (and merge with master branch)
- package manager is aware of new version

As a matter of fact, I did the latest releases like this:
- update package and JSON file with new version (and merge with master branch)
- hope package manager does not read it in the next seconds
- make a release to get the zip file

I wonder if that could be a problem.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018