Recent

Author Topic: Issues publishing a project (No subdirectories incl., no non-Pas. files incl.?)  (Read 21187 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
@GetMem
performed steps 1 - 4.

not all files from project inspector are exported. including screen capture.
looks like the B1 and C1 to be exported scenario failed as:
a. files were not exported
b. new path of these files in project inspector does not appear. old path appears with files missing
« Last Edit: August 09, 2018, 02:56:19 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

balazsszekely

  • Guest
@howardpc
I think *.res files are considered binary files. There is a FileIsText function which will return false for res.

@tudi_x
B1 and C1 are subfolders of your project? Otherwise it won't work. Please test with the attached project.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
B1 and C1 are not from subfolders of my project. there was never this assumption on this thread.

they are legit files added from the system.
in project inspector there is no limitation to add files only from subfolders.
if these files were added legit they would need to be published legit. based on this i can say that your assumption of subfolders is not consistent with the current IDE functionality.

i will resume testing once you start walking the project inspector tree for files.
« Last Edit: August 09, 2018, 03:39:35 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

balazsszekely

  • Guest
Quote
based on this i can say that your assumption of subfolders is not consistent with the current IDE functionality.
I did not assume anything.  :) I just see how the "publish project" feature is implemented. Unfortunately it wasn't designed for this kind of functionality, for example it doesn't care about project files(the ones you see in the project inspector). Simply searches the main folder and export files according to the include/exclude filters. By the way consider the following hypothetical situation:
Project files located at  d:\MyProjectfiles1\  and  d:\MyProjectFiles2\.  Kind of ridiculous, but OK let's move on.  I wish to export the project to c:\temp\published\. Where would you copy the directories? If both MyProjectFiles1 and MyProjctFiles2 goes inside c:\temp\published\ the IDE must update the relative paths in the project inspector, the exported project is no longer equivalent with the original one. Or am I missing something? How the project publishing should work in this particular case?
« Last Edit: August 09, 2018, 04:33:44 pm by GetMem »

BrainChemistry

  • Jr. Member
  • **
  • Posts: 79
Thanks everybody for your replies and efforts! I didn't expect to directly cause a bugfix request for the Publish Project-feature, to be honest :D.

What versions of FPC / Lazarus are you running, btw?

Laz. 1.8.4, Win 8.1 64bit.

I just see how the "publish project" feature is implemented. Unfortunately it wasn't designed for this kind of functionality, for example it doesn't care about project files(the ones you see in the project inspector. Simply searches the main folder and export files according to the include/exclude filters.)
I highlightened the important part. This is basically meaning this feature is useless, unfortunately. I mean, which (serious) project doesn't have sub dirs. at some point (at least for resource files, e.g. images, or what not). :)

What "Publish Project" should do at a bare minimum:
  • include ANY file which is found in the project inspector (regardless of file ending, ignoring incl./excl. filters)
  • include files which are found outside of main dir. (sub dir. is obvious, other dirs. may raise questions)
  • incl./excl. filters should also apply to sub dirs. (which are relevant to this project, hence contain project related files)

I guess, to be able to have a good Publish Project feature, it is necessary to have a look at a typical work flow for it to be useful.

PS:
1. Download attached zip
2. Extract zip to $(LazarusDir/IDE) folder(make backup first)
3. Rebuild Lazarus(Tools-->Build Lazarus with profile...)
4. Export your project

I did it, anyway, this solves the problem only partially for me. For some reason this time ALL sub dirs. of my main dir. have been published, even if they did not contain files which were mentioned in the project inspector or haven't been filtered out by the excl. filters. Keep up the good work, I stay beta testing.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
@GetMem
say you have project file B1.pas, B2.pas in folder /home/user/B and C1.pas in /home/user/C and C2.pas in /home/user/C/extra.
publish target is /home/user/publish.

folders  /home/user/B,  /home/user/C and /home/user/C/extra should not be copied to /home/user/publish, only the files B1.pas, B2.pas, C1.pas, C2.pas should be copied to /home/user/publish.
now B1, B2, C1 and C2 are in the publish folder. to work you just need to update the file name value for these files in the project lpi file in the Units section for each corresponding entry.

the exported project is no longer equivalent to the original one and that is fine. but it compiles also on a different machine given i have the same packages installed.

note: i would not copy but the files in the project inspector tree. do not agree with latest post from BrainChemistry
from a business perspective with publishing i make something formal or bring it to another level, in this case my possible garbage notes from the main directory should not be passed along.
the export should concentrate only on the files in project inspector - nothing else. the target is to have a folder that compiles in any computer with same dependencies and the executable is the same.
this of course is more difficult as based on the file name you would need to pick the corresponding lpr, lps, ico ... files.


ps. not ridiculous :). based on SOLID the best classes do not depend on other classes. pure functions? so i can use my class in several projects.
have a project to test and develop this class and another project where i am slowly integrating this class. i will not create a package immediately.
« Last Edit: August 09, 2018, 05:11:49 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

BrainChemistry

  • Jr. Member
  • **
  • Posts: 79
@GetMem
say you have project file B1.pas, B2.pas in folder /home/user/B and C1.pas in /home/user/C and C2.pas in /home/user/C/extra.
publish target is /home/user/publish.

folders  /home/user/B,  /home/user/C and /home/user/C/extra should not be copied to /home/user/publish, only the files B1.pas, B2.pas, C1.pas, C2.pas should be copied to /home/user/publish.
now B1, B2, C1 and C2 are in the publish folder. to work you just need to update the file name value for these files in the project lpi file in the Units section for each corresponding entry.

the exported project is no longer equivalent to the original one and that is fine. but it compiles also on a different machine given i have the same packages installed.

I understand what you are saying. For a better understanding, could you elaborate on how this is an advantage compare to a situation where the files stay in the folders they originally have been? I think of a situation where you have a beautiful folder structure and many files spread into them, and on publication the whole structure is dismissed and all the files are just dumped into the main folder. This doesn't sound good to me.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
@BrainChemistry
please check event #6 for the goal of the publishing action.
the publishing project action would touch only PROJECT files.
if a file is not in the Project Inspector it is not a project file (and we do not publish installed packages).

you might be having a folder structure but that structure is not part of Project Inspector tree thus not part of the project.
if files remain in the original folders you cannot transport the published folder to another machine and continue work and this is failing the publishing action goal.

note: In the industry, publishing the project makes the most current information available to others, including the team members assigned to the project’s tasks.
Others might not be so much interested in the folder structure. They are only interested that the project compiles on their laptops given OPM installed same package list.
If folder structure is important a package should be considered as a way to distribute the code.
« Last Edit: August 09, 2018, 06:18:55 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

balazsszekely

  • Guest
@tudi_x

Now every project file is copied into a single "published" folder. Paths are renamed in OI. I will continue to improve the feature next week. Please test. The steps are the same as yesterday:
1. Download attached zip
2. Extract zip to $(LazarusDir/IDE) folder(make backup first)
3. Rebuild Lazarus(Tools-->Build Lazarus with profile...)
4. Export your project


PS: Remember that yesterday you already replaced a few files. Make sure you restore the original ones first. Alternatively you can test it on a "clean" Lazarus install.
« Last Edit: August 10, 2018, 12:00:50 pm by GetMem »

balazsszekely

  • Guest
I also attach the patch, if somebody wish to test it in trunk.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
@GetMem
tested:
a. created project structure - attached
b. test: project files are copied - FAIL
c1.pas file is not copied. b1.pas file is copied
c. test: project files are shown in published project - PASS
d. test: project files are shown in published project with new path - PASS
e. test: only project files are considered to be published - PASS

including test project A with files from B and C for testing and my exported folder.
thank you
Lazarus 2.0.2 64b on Debian LXDE 10

wp

  • Hero Member
  • *****
  • Posts: 11858
Now every project file is copied into a single "published" folder. Paths are renamed in OI.
ATM this function does not yet seem to work. I tested it with a large project containing subfolders forms, frames, units. Only the files in the main project folder are copied.

Do I understand correctly that files in subfolders of a project will be copied to a single published folder? Sorry, but I don't like this at all. The fact that there are subfolders indicates that the programmer had some reason to do so and this will be lost. Why isn't it possible to retain the folder structure of the project folder in the published folder?

Maybe I don't understand, but tudi_x's example indicates that several independent projects should be merged into a single published folder (ignore the rest if I am wrong). Basically I think this could be a useful function, but not as "Publish project" - this is a feature for a single project - I think it should be an option for the project groups: "Publish project groups". But in any case, the folder structure within the project group and its constituent projects should be retained. What if the different projects contain files with different content but equal file names?

tudi_x

  • Hero Member
  • *****
  • Posts: 532
@wp
you cannot have equal file names as only files shown in project inspector are published and in project inspector the file names are unique.

maybe we could have a check box if to retain the folder structure in the folder where the lpr file is?
for files outside of this folder, like B or C folders no folder structure, files are just copied.
same level / panel with ignore binaries - would that be fine?
« Last Edit: August 10, 2018, 01:29:37 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

balazsszekely

  • Guest
I think I'm gonna give up. Apparently everyone has a slightly different idea on how the publish project feature should work(which is perfectly fine by the way), but I spent way too much time on a feature that I really don't use.

@tudi_x
You should write an IDE plugin, which can publish the current project the way you want. The bulk of the work is already implemented in the zip ttached in my previous post. By the way I fixed the last bug, you can test with the new attached zip.
« Last Edit: August 10, 2018, 01:45:56 pm by GetMem »

tudi_x

  • Hero Member
  • *****
  • Posts: 532
@GetMemm, wp
please advise if it would be fine to integrate the code as it is in event #28 (tested also and was fine) because:
a. current publish behavior does not do what wp describes as his needs so wp has nothing to loose
b. fix in event #28 solves the initial problem #1 from BrainChemistry
wp can also benefit because now that the project compiles
c. i do not know how to write an IDE plugin, so this publish feature would remain completely broken, frustrating users with projects that do not compile?
thank you
Lazarus 2.0.2 64b on Debian LXDE 10

 

TinyPortal © 2005-2018