Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude build, app, example and test folders when source-dir is project root #919

Open
samharrison7 opened this issue May 31, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@samharrison7
Copy link
Member

Description

Following on from this discussion: https://fortran-lang.discourse.group/t/fpm-builds-where-the-build-dir-is-in-the-source-dir/5882/5

If the user sets the source-dir folder as the project root, i.e.

[library]
source-dir = "./"

then currently, the fpm-generated build folder is included in the build. This is along with any other user-generated app, example and test folders, which I guess might not be named as such.

The problem with the build folder being included is that it might include dependencies from e.g. GitHub that are already being built separately to the main build. This means fpm tries to build them twice and you get an error <ERROR>*build_model*:Error: One or more duplicate module names found.

The two suggested options are to:

  • Raise an error in case the source-dir is set to ./ (forbid the source directory from being the project root)
  • Exclude the build, test, example, and app, directories, and consider everything else to be source.

Personally my preference would be the latter. Though it's not best practice, I suspect there is a lot of legacy code that has the source files in the project root and we don't want to arbitrarily exclude these (or force them to update their project structure) for fear of putting people off using fpm for being too prescriptive.

Expected Behaviour

When the user sets source-dir as the project root, either the build, app, test and example directories are excluded from the build, or the user is warned against / forbidden from doing so.

Version of fpm

0.8.2

Platform and Architecture

All

Additional Information

No response

@samharrison7 samharrison7 added the bug Something isn't working label May 31, 2023
@perazz perazz added enhancement New feature or request and removed bug Something isn't working labels May 31, 2023
@perazz
Copy link
Contributor

perazz commented May 31, 2023

Let me link to a relevant discussion at #847: current consensus is that all source files should be under src/, app/, test/

@samharrison7
Copy link
Member Author

I totally get that for new projects, but that rather limits fpm's usefulness for:

I would also support your PR for multiple source directories - that would actually fix the reason for which I initially set source-dir to the project root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants