-
Notifications
You must be signed in to change notification settings - Fork 118
Auto discovery of executables #190
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
124e696
Add: auto discovery of executables
LKedward 04fd387
Add: example package with program discovery
LKedward 8c55874
Fix: allow app modules to use modules in same folder
LKedward 70f0039
Add: error handling to module dependency resolution
LKedward e04de5a
Add: test suite for module dependency resolution logic
LKedward 0fde601
Merge remote-tracking branch 'upstream/master' into auto-discovery
LKedward a82a071
Add: path canonicalizer for path comparison
LKedward c058c12
Fix: matching of program sources with fpm executables
LKedward f10b174
Add: source-level flag to enable/disable auto-discovery
LKedward 99da449
Add: [build] table to manifest with flags for auto-discovery
LKedward 1d0c99e
Add: tests for new [build] table in manifest
LKedward ad02416
Add: test package with auto-discovery disabled
LKedward fc8cab5
Let toml-f make [build] table while querying the data structure
LKedward d09aa6a
Update: package%build_config not allocatable
LKedward 83cdb72
Merge remote-tracking branch 'upstream/master' into auto-discovery
LKedward 0fe14b8
Update fpm/src/fpm_filesystem.f90
LKedward File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| !> Implementation of the build configuration data. | ||
| ! | ||
| ! A build table can currently have the following fields | ||
| ! | ||
| ! ```toml | ||
| ! [build] | ||
| ! auto-executables = <bool> | ||
| ! auto-tests = <bool> | ||
| ! ``` | ||
| module fpm_manifest_build_config | ||
| use fpm_error, only : error_t, syntax_error, fatal_error | ||
| use fpm_toml, only : toml_table, toml_key, toml_stat, get_value | ||
| implicit none | ||
| private | ||
|
|
||
| public :: build_config_t, new_build_config | ||
|
|
||
|
|
||
| !> Configuration data for build | ||
| type :: build_config_t | ||
|
|
||
| !> Automatic discovery of executables | ||
| logical :: auto_executables | ||
|
|
||
| !> Automatic discovery of tests | ||
| logical :: auto_tests | ||
|
|
||
| contains | ||
|
|
||
| !> Print information on this instance | ||
| procedure :: info | ||
|
|
||
| end type build_config_t | ||
|
|
||
|
|
||
| contains | ||
|
|
||
|
|
||
| !> Construct a new build configuration from a TOML data structure | ||
| subroutine new_build_config(self, table, error) | ||
|
|
||
| !> Instance of the build configuration | ||
| type(build_config_t), intent(out) :: self | ||
|
|
||
| !> Instance of the TOML data structure | ||
| type(toml_table), intent(inout) :: table | ||
|
|
||
| !> Error handling | ||
| type(error_t), allocatable, intent(out) :: error | ||
|
|
||
| !> Status | ||
| integer :: stat | ||
|
|
||
| call check(table, error) | ||
| if (allocated(error)) return | ||
|
|
||
| call get_value(table, "auto-executables", self%auto_executables, .true., stat=stat) | ||
|
|
||
| if (stat /= toml_stat%success) then | ||
| call fatal_error(error,"Error while reading value for 'auto-executables' in fpm.toml, expecting logical") | ||
| return | ||
| end if | ||
|
|
||
| call get_value(table, "auto-tests", self%auto_tests, .true., stat=stat) | ||
|
|
||
| if (stat /= toml_stat%success) then | ||
| call fatal_error(error,"Error while reading value for 'auto-tests' in fpm.toml, expecting logical") | ||
| return | ||
| end if | ||
|
|
||
| end subroutine new_build_config | ||
|
|
||
|
|
||
| !> Check local schema for allowed entries | ||
| subroutine check(table, error) | ||
|
|
||
| !> Instance of the TOML data structure | ||
| type(toml_table), intent(inout) :: table | ||
|
|
||
| !> Error handling | ||
| type(error_t), allocatable, intent(out) :: error | ||
|
|
||
| type(toml_key), allocatable :: list(:) | ||
| integer :: ikey | ||
|
|
||
| call table%get_keys(list) | ||
|
|
||
| ! table can be empty | ||
| if (size(list) < 1) return | ||
|
|
||
| do ikey = 1, size(list) | ||
| select case(list(ikey)%key) | ||
|
|
||
| case("auto-executables", "auto-tests") | ||
| continue | ||
|
|
||
| case default | ||
| call syntax_error(error, "Key "//list(ikey)%key//" is not allowed in [build]") | ||
| exit | ||
|
|
||
| end select | ||
| end do | ||
|
|
||
| end subroutine check | ||
|
|
||
|
|
||
| !> Write information on build configuration instance | ||
| subroutine info(self, unit, verbosity) | ||
|
|
||
| !> Instance of the build configuration | ||
| class(build_config_t), intent(in) :: self | ||
|
|
||
| !> Unit for IO | ||
| integer, intent(in) :: unit | ||
|
|
||
| !> Verbosity of the printout | ||
| integer, intent(in), optional :: verbosity | ||
|
|
||
| integer :: pr | ||
| character(len=*), parameter :: fmt = '("#", 1x, a, t30, a)' | ||
|
|
||
| if (present(verbosity)) then | ||
| pr = verbosity | ||
| else | ||
| pr = 1 | ||
| end if | ||
|
|
||
| if (pr < 1) return | ||
|
|
||
| write(unit, fmt) "Build configuration" | ||
| ! if (allocated(self%auto_executables)) then | ||
| write(unit, fmt) " - auto-discovery (apps) ", merge("enabled ", "disabled", self%auto_executables) | ||
| ! end if | ||
| ! if (allocated(self%auto_tests)) then | ||
| write(unit, fmt) " - auto-discovery (tests) ", merge("enabled ", "disabled", self%auto_tests) | ||
| ! end if | ||
|
|
||
| end subroutine info | ||
|
|
||
| end module fpm_manifest_build_config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.