Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread Dariusz Mazur

On 2013-09-27 17:03, Mattias Gaertner wrote:

On Fri, 27 Sep 2013 16:59:04 +0200
Dariusz Mazur dar...@emadar.com wrote:


Hi

I've noticed than lazarus (1.0.12) don't recompile units, which are
include in program on relative path
code
   program p;
uses
u1 in '..\..\test\u1.pas';
begin
   ...
end;
/code

Is ..\..\test\u1.pas listed in the project inspector?

no,
only mention u1 with name in main file.


After change something in u1, even in full build u1 is not recompile.

What do you mean with full build?


Shift F9



I've made some test

1. When u1 is not compiled (u1.o and u1.ppu removed) everything is OK. 
FPC prepare units, program work .
2.After this I change u1.pas, and press Shift-F9.  Source is saved, buf 
ppu is not changed. Program is linking with old ppu.



Darek


PS. Sorry for late answer, I must leave for some days.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread Mattias Gaertner
On Mon, 30 Sep 2013 16:35:30 +0200
Dariusz Mazur dar...@emadar.com wrote:

 On 2013-09-27 17:03, Mattias Gaertner wrote:
  On Fri, 27 Sep 2013 16:59:04 +0200
  Dariusz Mazur dar...@emadar.com wrote:
 
  Hi
 
  I've noticed than lazarus (1.0.12) don't recompile units, which are
  include in program on relative path
  code
 program p;
  uses
  u1 in '..\..\test\u1.pas';
  begin
 ...
  end;
  /code
  Is ..\..\test\u1.pas listed in the project inspector?
 no,
 only mention u1 with name in main file.

Add it. Then the IDE will check the file date.

 
  After change something in u1, even in full build u1 is not recompile.
  What do you mean with full build?
 
 Shift F9
 
 
 
 I've made some test
 
 1. When u1 is not compiled (u1.o and u1.ppu removed) everything is OK. 
 FPC prepare units, program work .
 2.After this I change u1.pas, and press Shift-F9.  Source is saved, buf 
 ppu is not changed. Program is linking with old ppu.

Sounds like compiler bug.

Please create a bug report.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread patspiper

On 30/09/13 18:13, Mattias Gaertner wrote:

On Mon, 30 Sep 2013 16:35:30 +0200
Dariusz Mazur dar...@emadar.com wrote:


On 2013-09-27 17:03, Mattias Gaertner wrote:

On Fri, 27 Sep 2013 16:59:04 +0200
Dariusz Mazur dar...@emadar.com wrote:


Hi

I've noticed than lazarus (1.0.12) don't recompile units, which are
include in program on relative path
code
program p;
uses
 u1 in '..\..\test\u1.pas';
begin
...
end;
/code

Is ..\..\test\u1.pas listed in the project inspector?

no,
only mention u1 with name in main file.

Add it. Then the IDE will check the file date.


Does the IDE check for lfm and include files date? I tried even to 
include the lfm with the project but the IDE neglected that.


Stephano

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread Dariusz Mazur

On 2013-09-30 17:13, Mattias Gaertner wrote:

On Mon, 30 Sep 2013 16:35:30 +0200
Dariusz Mazur dar...@emadar.com wrote:


On 2013-09-27 17:03, Mattias Gaertner wrote:

On Fri, 27 Sep 2013 16:59:04 +0200
Dariusz Mazur dar...@emadar.com wrote:


Hi

I've noticed than lazarus (1.0.12) don't recompile units, which are
include in program on relative path
code
program p;
uses
 u1 in '..\..\test\u1.pas';
begin
...
end;
/code

Is ..\..\test\u1.pas listed in the project inspector?

no,
only mention u1 with name in main file.

Add it. Then the IDE will check the file date.

  

After change something in u1, even in full build u1 is not recompile.

What do you mean with full build?


Shift F9



I've made some test

1. When u1 is not compiled (u1.o and u1.ppu removed) everything is OK.
FPC prepare units, program work .
2.After this I change u1.pas, and press Shift-F9.  Source is saved, buf
ppu is not changed. Program is linking with old ppu.

Sounds like compiler bug.

Please create a bug report.


done:
http://bugs.freepascal.org/view.php?id=25119

Darek

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread Mattias Gaertner
On Mon, 30 Sep 2013 18:26:41 +0300
patspiper patspi...@gmail.com wrote:

 On 30/09/13 18:13, Mattias Gaertner wrote:
  On Mon, 30 Sep 2013 16:35:30 +0200
  Dariusz Mazur dar...@emadar.com wrote:
 
  On 2013-09-27 17:03, Mattias Gaertner wrote:
  On Fri, 27 Sep 2013 16:59:04 +0200
  Dariusz Mazur dar...@emadar.com wrote:
 
  Hi
 
  I've noticed than lazarus (1.0.12) don't recompile units, which are
  include in program on relative path
  code
  program p;
  uses
   u1 in '..\..\test\u1.pas';
  begin
  ...
  end;
  /code
  Is ..\..\test\u1.pas listed in the project inspector?
  no,
  only mention u1 with name in main file.
  Add it. Then the IDE will check the file date.
 
 Does the IDE check for lfm and include files date?

lfm yes, include files must be added.

 I tried even to include the lfm with the project but the IDE neglected that.

The compiler ignores changes to lfm. That means if you only change the
lfm and not the pas, the IDE will call the compiler, but the compiler
does not check resources and will not update the lfm in the exe. You
have to change the pas file too.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread Mattias Gaertner
On Mon, 30 Sep 2013 19:10:54 +0300
patspiper patspi...@gmail.com wrote:

[...]
 Should lfm's be added to projects and packages?

You don't need to add lfm files to projects.
Add them to packages.
You can add a feature request to let the IDE check lfm files for
packages.

 
 Is it OK if include files are added by several packages and projects 
 using these packages?

Add the include file to the package and remove it from all
packages/projects using that package.
Each file should have only one owner at a time. 


  I tried even to include the lfm with the project but the IDE neglected 
  that.
  The compiler ignores changes to lfm. That means if you only change the
  lfm and not the pas, the IDE will call the compiler, but the compiler
  does not check resources and will not update the lfm in the exe. You
  have to change the pas file too.
 
 Does the compiler check include files (added and not added to the 
 project/package)?

Yes, unless a unit was compiled with -Ur.

 
 Finally, does adding defines to the project (-d) or to an include file 
 ($DEFINE) trigger the necessary rebuild?

Yes, the IDE compiles with -B.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread patspiper

On 30/09/13 19:53, Mattias Gaertner wrote:

On Mon, 30 Sep 2013 19:10:54 +0300
patspiper patspi...@gmail.com wrote:


[...]
Should lfm's be added to projects and packages?

You don't need to add lfm files to projects.
Add them to packages.
You can add a feature request to let the IDE check lfm files for
packages.


Done:
http://bugs.freepascal.org/view.php?id=25120

Is it OK if include files are added by several packages and projects
using these packages?

Add the include file to the package and remove it from all
packages/projects using that package.
Each file should have only one owner at a time.


The problem is with include files that hold for example global defines 
and is used by several packages. Example:


Package A's and B's units all include myfile.inc, and package A uses 
package B.


But anyway, since the compiler checks include files even if they are not 
added to the project or package (as you mentioned below), there is no 
need to add them in the first place.

I tried even to include the lfm with the project but the IDE neglected that.

The compiler ignores changes to lfm. That means if you only change the
lfm and not the pas, the IDE will call the compiler, but the compiler
does not check resources and will not update the lfm in the exe. You
have to change the pas file too.

Does the compiler check include files (added and not added to the
project/package)?

Yes, unless a unit was compiled with -Ur.

  

Finally, does adding defines to the project (-d) or to an include file
($DEFINE) trigger the necessary rebuild?

Yes, the IDE compiles with -B.


Thanks,
Stephano

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread Mattias Gaertner
On Mon, 30 Sep 2013 20:25:03 +0300
patspiper patspi...@gmail.com wrote:

 On 30/09/13 19:53, Mattias Gaertner wrote:
  On Mon, 30 Sep 2013 19:10:54 +0300
  patspiper patspi...@gmail.com wrote:
 
  [...]
  Should lfm's be added to projects and packages?
  You don't need to add lfm files to projects.
  Add them to packages.
  You can add a feature request to let the IDE check lfm files for
  packages.
 
 Done:
 http://bugs.freepascal.org/view.php?id=25120
  Is it OK if include files are added by several packages and projects
  using these packages?
  Add the include file to the package and remove it from all
  packages/projects using that package.
  Each file should have only one owner at a time.
 
 The problem is with include files that hold for example global defines 
 and is used by several packages.

That's not a problem.

There are at least two solutions:

Solution  1:
The package can extend the include path of the project.
Package Editor / Options / Usage / Include Path. Use the point . for
the directory where the myfile.lpk is.

It works like this:
You change the myfile.inc and compile the project.
The myfile.inc is part of the package B, which is used by the project.
The IDE detects, that myfile.inc is newer than the myfile.compiled file
and compiles the package.
Then the project.compiled file is older than the myfile.compiled and
therefore the IDE compiles the project.

Disadvantages:
- This does not work if you compile with the -Ur flag.
- Often such shared include files contain flags only needed by the
  package and only a few flags are needed by the project. So the
  project gets too many flags.


Solution  2:
Because packages can inherit flags as well, you don't need the
include file in Lazarus. Just add the flags to the usage options
of the package and all projects and packages using that package have the
defines. See the lcl.lpk for an example.

Advantages:
- This does work with the -Ur flag.
- Flags only used by the package are not defined for the project.


[...]


Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread patspiper

On 30/09/13 20:50, Mattias Gaertner wrote:

On Mon, 30 Sep 2013 20:25:03 +0300
patspiper patspi...@gmail.com wrote:



The problem is with include files that hold for example global defines
and is used by several packages.

That's not a problem.

There are at least two solutions:

Solution  1:
The package can extend the include path of the project.
Package Editor / Options / Usage / Include Path. Use the point . for
the directory where the myfile.lpk is.

It works like this:
You change the myfile.inc and compile the project.
The myfile.inc is part of the package B, which is used by the project.
The IDE detects, that myfile.inc is newer than the myfile.compiled file
and compiles the package.
Then the project.compiled file is older than the myfile.compiled and
therefore the IDE compiles the project.

Disadvantages:
- This does not work if you compile with the -Ur flag.
- Often such shared include files contain flags only needed by the
   package and only a few flags are needed by the project. So the
   project gets too many flags.


Solution  2:
Because packages can inherit flags as well, you don't need the
include file in Lazarus. Just add the flags to the usage options
of the package and all projects and packages using that package have the
defines. See the lcl.lpk for an example.

Advantages:
- This does work with the -Ur flag.
- Flags only used by the package are not defined for the project.


I am contemplating solution 1 because the include file is usually shared 
among packages, but not the project. Maybe a wiki page/paragraph for IDE 
myths is due. I'll list what I have in mind now. Pls correct as needed.


General guidelines:
- The project/package directory is implicitly added to the Other unit 
files (-Fu) of that project/package.
- Always add the directories of added units to the project/package to 
the Other unit files (-Fu) of that project/package. The IDE will prompt 
the user in such cases.
- A dot (.) can be used to add the project/package folder to the 
'Include Files' or other path setting.

- There is no need to add lfm files to projects/packages.
- Never add a unit to several packages.
- Never add a unit to a package and a project.
- ToDo: sharing of folders between packages

What triggers automatic recompilation of a project/package:
- Modifying units added to the project/package.
- Modifying  include files included in units added to the 
project/package, provided they are located in the 'Include Files' 
folders (-Fi).

- ToDo: Changing project options

What does not trigger automatic recompilation of a project/package:
- Modifying units not added to the project/package, even if they are 
located in the 'Other Unit Files' folders.
- Modifying include files included in units added to the project/package 
but that are not located in the 'Include Files' folders (-Fi).

- Modifying lfm files without a corresponding pas file modification.
- Modifying res files.

Note: Modification is a change of file timestamp.


What triggers automatic reloading of files in the IDE:
- Modifying units added to the project/package.
- Modifying  include files included in units added to the 
project/package, irrespective if they are located in the 'Include Files' 
folders (-Fi) or not

- Modifying lfm files with or without a corresponding pas file modification.
- Modifying the project/package main file.

What does not trigger automatic reloading of files in the IDE:
- Modifying units not added to the project/package, even if they are 
located in the 'Other Unit Files' folders.


Note: Modification is a change of file timestamp (unless a special IDE 
option is set).


Stephano


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-30 Thread Mattias Gaertner
On Mon, 30 Sep 2013 22:34:14 +0300
patspiper patspi...@gmail.com wrote:

[...]
 General guidelines:
 - The project/package directory is implicitly added to the Other unit 
 files (-Fu) of that project/package.

yes

 - Always add the directories of added units to the project/package to 
 the Other unit files (-Fu) of that project/package. The IDE will prompt 
 the user in such cases.

yes, with exception: If a directory is used only on one platform you can
use macros and/or conditionals.


 - A dot (.) can be used to add the project/package folder to the 
 'Include Files' or other path setting.

Let me rephrase this:
A dot (.) in the Usage / Include Path can be used to add the package
folder to depending projects/packages.


 - There is no need to add lfm files to projects/packages.

yes, since 1.3

 - Never add a unit to several packages.

Yes, with exception: If you have two packages that are never used in
the same project then you can do that.

 - Never add a unit to a package and a project.

Yes.

 - ToDo: sharing of folders between packages

A package is basically a shared directory plus information how to
share it.
So to share a folder between packages, you add the files to a package.

 
 What triggers automatic recompilation of a project/package:
 - Modifying units added to the project/package.
 - Modifying  include files included in units added to the 
 project/package, provided they are located in the 'Include Files' 
 folders (-Fi).
 - ToDo: Changing project options

Changes of project options trigger rebuilds too.

 
 What does not trigger automatic recompilation of a project/package:
 - Modifying units not added to the project/package, even if they are 
 located in the 'Other Unit Files' folders.

yes.


 - Modifying include files included in units added to the project/package 
 but that are not located in the 'Include Files' folders (-Fi).

yes

 - Modifying lfm files without a corresponding pas file modification.

The IDE triggers the build, but the compiler does not compile the unit.


 - Modifying res files.

Yes.

 
 Note: Modification is a change of file timestamp.
 
 
 What triggers automatic reloading of files in the IDE:

If you mean the file changed on disk dialog: 
It checks the open files. For example the files of the source editor and
the open lpi, lpk, lpr and lfm files.
The IDE has more files open, but they are silently reloaded.

 - Modifying units added to the project/package.

no

 - Modifying  include files included in units added to the 
 project/package, irrespective if they are located in the 'Include Files' 
 folders (-Fi) or not

no

 - Modifying lfm files with or without a corresponding pas file modification.

no

 - Modifying the project/package main file.

yes

 
 What does not trigger automatic reloading of files in the IDE:
 - Modifying units not added to the project/package, even if they are 
 located in the 'Other Unit Files' folders.
 
 Note: Modification is a change of file timestamp (unless a special IDE 
 option is set).

The above dialog and the rebuild-needed-checks are independent.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] unit on relative path is not recompile

2013-09-27 Thread Dariusz Mazur

Hi

I've noticed than lazarus (1.0.12) don't recompile units, which are 
include in program on relative path

code
 program p;
uses
  u1 in '..\..\test\u1.pas';
begin
 ...
end;
/code

After change something in u1, even in full build u1 is not recompile.
If I added path '..\..\test\' to directory options everything is ok.
Is this bug or I've miss something

Darek


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] unit on relative path is not recompile

2013-09-27 Thread Mattias Gaertner
On Fri, 27 Sep 2013 16:59:04 +0200
Dariusz Mazur dar...@emadar.com wrote:

 Hi
 
 I've noticed than lazarus (1.0.12) don't recompile units, which are 
 include in program on relative path
 code
   program p;
 uses
u1 in '..\..\test\u1.pas';
 begin
   ...
 end;
 /code

Is ..\..\test\u1.pas listed in the project inspector?

 
 After change something in u1, even in full build u1 is not recompile.

What do you mean with full build?

 If I added path '..\..\test\' to directory options everything is ok.
 Is this bug or I've miss something


Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus