Recent

Author Topic: Synchronizing Self made UNIT files from a repository per application.  (Read 2162 times)

jamie

  • Hero Member
  • *****
  • Posts: 7516
Does laz have a feature that allows for checking a repository folder against self made units with source to that of what is currently in the project folder..?

 I know I can point the repository path to the project via project path settings but I don't like doing that because if I package up the project folder those files are not there..

 What I would like for it to test the repository folder for newer versions of what is already in the project folder and if exist optionally copying it over to the project folder.

 The idea is when I create a unit that is usable via a text project it can be stored there and when I make changes to it etc..

 Any project that is using one of those files in the repository can make a quick check for a newer one and move it over to the project folder.. Of course I guess we could also have a backup incase something goes wrong..

 Does Laz have sync feature like that so I don't need to do this manually ?
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #1 on: April 11, 2020, 01:48:54 am »
Looks like laz has an option to add a tool to it with optional given variables..

I am use to using a tool that has a Project Manager before you even start a new project or open one, it can get all your resources up to date etc.. "Wonderware " If any one has every heard of that.
The only true wisdom is knowing you know nothing

lainz

  • Hero Member
  • *****
  • Posts: 4740
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #2 on: April 11, 2020, 05:20:40 am »
There's something like git submodules on svn there are externals

https://www.atlassian.com/git/articles/git-and-project-dependencies

lainz

  • Hero Member
  • *****
  • Posts: 4740
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #3 on: April 11, 2020, 05:26:24 am »
Looks nice to have. You can make a simple script that runs all the git code to update the submodules in all your repositories if I understand it well

https://www.atlassian.com/git/tutorials/git-submodule

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #4 on: April 11, 2020, 01:17:12 pm »
I would prefer to keep my files local however, I guess an option could be made otherwise.

I can use a git account to automate this if I were to expect to be remote looking for newer files of what I already have...

  Its a big program when you have libraries you use that aren't part of the dev package or not in the same project folder..

 I am sure you have looked at many projects where it used a compiled unit with no source and it won't work with your tools or the project pointed to a external folder path from the dev's private stash...

  It makes the project uncompilable and un-useable if you don't have source code.
The only true wisdom is knowing you know nothing

lainz

  • Hero Member
  • *****
  • Posts: 4740
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #5 on: April 11, 2020, 03:03:02 pm »
I can understand, is easier a repository with all in one included, also you know what exact version of everything is installed and that it will not break the build process.

Yes, maybe a tool can be made for that purpose, but for local repositories, you just need to define the external folder source and the destination, comparing the files and updating according the changed ones every time you open a project. Seems a tool that's not hard to create, you can compare file dates for example. The hard thing maybe is integrating it with the IDE, or maybe not?

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #6 on: April 11, 2020, 03:06:41 pm »
Exactly, you have it  :)

The way Wonderware software does it is nice. It has a project manager that you can ether start a new project from there or ensure all resources are up to date before starting an existing project.. From that point on it simply starts up the IDE with said project.
« Last Edit: April 11, 2020, 03:08:39 pm by jamie »
The only true wisdom is knowing you know nothing

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #7 on: April 11, 2020, 04:01:32 pm »
I have looked around and there are various options out there however, none of which works closely with Lazarus so.. I have decided to build my own tool and also could offer it up for public consumption.

 List of what it must do..

 1. Enter a specific source file in the project to be stored in the repository.

 2. The File name must be unique and can not use the basic UNIT1, 2....

 3. The project will have a config file of the list of files for it to maintain;

 4. If entering a new file in the list and it already exists in the repository it must first decide if we are fetching it for use or and if not WARN to not use that file unless you know what you are doing otherwise it will overwrite an exiting one that is totally different..

 and the list goes on!

EDIT:
  I don't see a way for Laz to configure the app to auto start it on Project opening and closing ?
  if that feature does not exist I may file a request because it would be nice..

« Last Edit: April 11, 2020, 04:24:26 pm by jamie »
The only true wisdom is knowing you know nothing

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4672
  • I like bugs.
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #8 on: April 11, 2020, 09:47:36 pm »
I don't see a way for Laz to configure the app to auto start it on Project opening and closing ?
if that feature does not exist I may file a request because it would be nice..
If project opening and closing events are missing, they should be added.
Otherwise I think revision control tools solve all your problems. For some reason you try to invent the wheel again.
Or, there may be something I didn't understand...
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4672
  • I like bugs.
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #9 on: April 23, 2020, 06:16:39 am »
Jamie, please give feedback for issue
 https://bugs.freepascal.org/view.php?id=36899
What other events are needed? They can be added.
Now there is ProjectOpened and ProjectClose.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #10 on: April 23, 2020, 03:48:45 pm »
Yes I will look. Been busy on the app.
I need a way to configure it so it can start before or after project opening
And maybe an optional variable to be passed with it indicating the step it was opened in

 The idea is to inform the tool app the way it was started so can take different action.
For example : closing the app would signal the tool to backup curtain files.
But a trigger of being to receive a variable to if the project is getting ready to terminate so operations can done. And trigger for when it actually terminates.
 This way you have 4 options each can be entered but need that variable so the tool knows in which way it got started.
The only true wisdom is knowing you know nothing

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4672
  • I like bugs.
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #11 on: April 23, 2020, 10:18:41 pm »
This way you have 4 options each can be entered but need that variable so the tool knows in which way it got started.
So 4 events: BeforeProjectOpen, AfterProjectOpen, BeforeProjectClose, AfterProjectClose.
You assign handlers for those events in your IDE plugin package. It is not an external tool that gets started with a parameter. It is code in a package that gets linked into the IDE itself.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #12 on: April 23, 2020, 10:50:31 pm »
Yes I guess that would be it .. More or less a drop down list of how it should be launched, manually  as it is now or from a list of events in the IDE, project loading and unloading is one set of options..

 So lets say I want this same tool to auto start at two different points during the coding session, would just enter the same tool setup as another additional external tool but only with a different define for auto running it. This way it makes it simple to
to configure any tool app that may need to run more than a single reason automatically..
 
 Also for tool apps that are configured this way we should be able to select where in the list these apps are so they run in correct order if needed because you may have a case where a different Tool may also want to run for the same reason..

 And lastly, we need an $variable added to the list that will report the reason as why it started because the same tool app could have several options in it depending on how it got started...

 For example
 
 $AutoStartMethod = ('asmManually', 'asmBeforeProjectLoading', 'amsAfterProjectLoading') etc

So we can add this to the command line parameters along with other $variables that already exist..
 Or I guess we could hard code that info per setup since if these are all entered as a separated setup per start condition we could simply put our own custom flag in there so maybe the variable isn't needed.


The only true wisdom is knowing you know nothing

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4672
  • I like bugs.
Re: Synchronizing Self made UNIT files from a repository per application.
« Reply #13 on: April 26, 2020, 10:05:31 pm »
jamie, see my latest update in issue #36899.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018