The root problem is that nix uses autoconf to build libxml2-2.9.14 instead of cmake, and a consequence of this is that the cmake-configuration is missing (details like version number, platform specific dependencies like ws2_32 etc which are needed by my project cmake scripts). libxml2-2.9.14 already comes with cmake configuration and works nicely, except that nix does not use it (I guess they have their own reasons).
Therefore I would like to reuse the libxml2-2.9.14 nix package and override the builder script with my own (which is a trivial cmake dance).
Here is my attempt:
defaultPackage = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
cmakeLibxml = pkgs.libxml2.overrideAttrs( o: rec {
PROJECT_ROOT = builtins.getEnv "PWD";
builder = "${PROJECT_ROOT}/nix-libxml2-builder.sh";
});
in
Where nix-libxml2-builder.sh is my script calling cmake with all the options I need. It fails like this:
last 1 log lines:
> bash: /nix-libxml2-builder.sh: No such file or directory
For full logs, run 'nix log /nix/store/andvld0jy9zxrscxyk96psal631awp01-libxml2-2.9.14.drv'.
As you can see the issue is that PROJECT_ROOT does not get set (ignored) and I do not know how to feed my builder script.
What am I doing wrong?
Guessing from the use of defaultPackage in your snippet, you use flakes. Flakes are evaluated in pure evaluation mode, which means there is no way to influence the build from outside. Hence, getEnv always returns an empty string (unfortunately, this is not properly documented).
There is no need to refer to the builder script via $PWD. The whole flake is copied to the nix store so you can use your files directly. For example:
builder = ./nix-libxml2-builder.sh;
That said, the build will probably still fail, because cmake will not be available in the build environment. You would have to override nativeBuildInputs attribute to add cmake there.
I want to have a structure like /project/functions /project/src. I would have a unit /project/functions/helloUnit.pas similar to:
unit helloUnit;
interface
implementation
uses classes;
procedure helloWorld(output);
begin
writeln('Hello, World');
end.
And a file /project/src/main.pas like:
uses helloUnit;
Begin
helloWorld;
End.
I've been trying to make it work but haven't found the way. I'm using fpc compiler on linux command line in case I'm not defining the path or something.
There are some things wrong with your example code, which it would be helpful to fix
before attempting to compile it from the command line.
Firstly, you need a project file for fpc to compile to produce your program. For this,
I created this file in the projects folder and named it hello.lpr:
program Hello;
uses
hellounit,
main;
begin
HelloWorld;
end.
Then correct Main.Pas as follows:
unit main;
interface
uses helloUnit;
procedure SayHello;
implementation
procedure SayHello;
Begin
helloWorld;
End;
End.
Note that procedure SayHello; has been added to the interface section and that End;
has been added to the end of the declaration of the procedure. The End. tells the
compiler that it has reached the end of the source code in the unit.
Next correct helloUnit as follows
unit helloUnit;
interface
procedure helloWorld;
implementation
uses classes;
procedure helloWorld;
begin
writeln('Hello, World');
end; {added}
end.
Now write a batch file CompileHello.Bat (assuming Windows) in the projects folder
containing
D:\Lazarus2\fpc\3.0.4\bin\i386-win32\fpc -Fufunctions;src hello.lpr
and then run it from a CMD prompt in the projects folder. The -Fu compiler switch tells fpc
where to find units which are not located in the same folder as the project
file. The paths after -Fu can be relative to the project folder. If you
have followed the steps above, it should comile successfully.
If you were using Lazarus, the companion IDE to fpc there would be at least two ways of doing what you asked.
With HelloUnit open in the IDE, use View | Add Editor File to Project from the IDE's menu to add HelloUnit to the project. This is probably the best way because it unambiguously identifies HelloUnit for the project.
Add the folder in which HelloUnit.Pas is located to the Project's Source Paths using Project | Options and, in the pop-up, under Compiler Options, add the folder to the Other Unit Files box on the RHS.
I had a project that source code including non-class file in package(eg:.sql,.ftl). I want to generate output including them but the artifacts always contains class file. How can I include them?
It's a web application, and below is source structure(java code part):
src
|
main
|
java
|
package1
|
Class1.java
Class2.java
sql1.sql
sql2.sql
template1.ftl
The output only contains compiled class.
I found a solution:
Project Structure->Module:at the bottom, Exclude files:*.java
Project Structure->Artifacts:Output Layout:add 'java' directory contents to classes
I am using IDEA 12. I cannot include /out directory into my project.
I tried Project Structure -> Modules -> MyModule -> Sources and then click on Exclude, but nothing happens. /out directory still remains excluded and red-colored.
Is this a bug or I am doing it wrongly?
Screenshot
I can't deselect Exclude to make folder included.
'Exclude output paths' option on 'Paths' tab relates to the module output path. The project output specified in File | Project Structure | Project | 'Project compiler output' is always excluded. If you really need to include it you can do the following:
Switch to 'Use module compile output path' option on 'Paths' tab for all modules.
Select 'Project' item in the left list and clear 'Project compiler output' field.
Reopen the project.
After that 'out' directory should become visible in the 'Project View'. However I recommend you to exclude actual module output subdirectories in the 'Sources' tab by hand. Otherwise IDEA may rescan and reindex output files generated by the compiler after each compilation and this can lead to performance problems.
It looks like Android specific bug, I've created a new issue, please vote:
IDEA-97776 Output is excluded from the project view regardless the "excluded folders" and "exclude output paths" settings
In Intellij, if I have an error in a source file, then when building I can choose "Exclude from Compile" by right-clicking on the file in the build output.
But, now I would like to include the file again. Where is the menu item that lets me put it back into the build? (The file shows in the Project window, and has a small 'x' in its icon to show it is excluded, but I see no way to get this to go away.)
Edit - I found there is a compiler.xml file, and I found I can delete the file from the "excludeFromCompile" section, but still, there must be a menu item somewhere to do this.
Settings | Compiler | Excludes.
For Intellij 14.0 on Windows, undo excludes from compilation
File -> Settings
Then inside Settings -> Build, Execution, Deployment -> Compiler -> Excludes
or just search for "excludes" to find it.
Note in IDEA v12, there is no longer a File | Settings menu option.
I'm not sure how to exclude/re-include individual files, but this is how it works for folders...
Now the menu item is File | Project Structure... and that brings up a multi-column dialog.
In the rightmost column, click Modules, then select the directory that contains the excluded folder in the second column.
If it is a folder you are trying to re-include, it is listed in the third column's directory list, and excluded folders are at the bottom, in red.
If you click on the red 'X' to the right of the folder name, it will remove the folder from the "excluded" list which has the effect of including it back in the project. Awkward and counter-intuitive, but that's how it works.
I found that johnkaplantech's answer didn't work because Idea would complain about multiple modules sharing the same root.
So I manually edited the project files to remove the exclusion. File modified was %ProjectRoot%/.idea/modules/<ModuleName>.iml. Inside module/component/content of this XML file was a tag excludeFolder. Remove that.
In IntelliJ IDEA 15.0.3 File | Settings | Build, Execution, Deployment | Compiler | Excludes | (Remove path from right list).
For Mac it would be :
1) Go to Preferences:
2) Expand Build, Execution,Deployment section
3) Expand Compiler sub section
4) All the excluded classes will be available in the Excludes
5) Delete the classes you want include for compilation and press Ok.
Hope it helps.
From menu:
File | Settings | Compiler | Excludes: you can add/remove excluded files to be compiled in the dialog.
For me excluded folders did not appear neither under File > Settings> Compiler > Excludes nor File > Project Structure > Modules > Sources > Exclude.
What I did was: I clicked on the excluded folder with right-click of the mouse. In the menu which opened there is an option "Mark Directory as". I chose "Not Excluded".
A simple workflow is to create a directory in your project and exclude the entire directory.. For example, create a directory called, 'excluded'... add files to exclude... right click directory > mark directory as excluded... If you want to add or remove files from that directory reverse the process... cancel exclusion on the directory, get/put files... mark as excluded again.
To configure classes to be excluded from import open:
Editor / General node, then click Auto-Import.
This works for me. You can also find this in the documentation:
IntelliJ was still excluding a file after I removed it from the compiler exclude folder. It turns out I had also excluded it in File > Project Structure > Modules > Sources > Exclude files (at the bottom of the window).
Nothing to worry about. Simply follow this steps Mac/ windows
File > Settings >
Build, execution, deployment > Excludes
Select the file that you selected as exclude from compile (mistakenly)
Finally delete it and Press ok.
Now you can run the program/code again.
Congratulations!! Problem solved
I had the same problem of exclude things, and my solutions where:
Tuve el mismo problema de sacar sin querer cosas que no debía y mi soluciones fueron:
Case 1:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment ->Build Tools (my case) -> Maven -> Maven ->IgnoredFiles (uncheck the relevant option )
Caso 1:
Me pasó lo mismo y mi solución fue ir (en Mac) a:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment ->Build Tools (en mi caso) -> Maven -> IgnoredFiles (destildar la opción, en mi caso el file en cuestión
Case 2:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment -> Compiler -> Excludes and select the relevant option -> minus or plus
Caso 2:
IntelliJ IDEA ->Preferences -> Build,Excecution, Deployment -> Compiler -> Excludes and select the relevant option -> clickear en el signo más o en menos según corresponda
Up-to-date in 2023:
Go to Editor > File Types > Ignored Files and Folders tab
Remove the file/folder pattern you want to include again.