Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ EXIT_CODE=0
FPM_JOBS=two "$fpm" build -C $dir || EXIT_CODE=$?
test $EXIT_CODE -eq 1

# fpm export writes each requested file, and nothing else
rm -f $dir/manifest.json $dir/model.json $dir/dependencies.json $dir/filename
"$fpm" export -C $dir --manifest manifest.json
test -f $dir/manifest.json
test ! -e $dir/filename
"$fpm" export -C $dir --model model.json --dependencies dependencies.json
test -f $dir/model.json
test -f $dir/dependencies.json
test ! -e $dir/filename
rm $dir/manifest.json $dir/model.json $dir/dependencies.json

# --verbose prints long flags and commands on one line, however fpm was compiled (#1405)
long_macro=FPM_VERBOSE_LINE_$(printf '%0100d' 0)
verbose_on_one_line() {
Expand Down
20 changes: 14 additions & 6 deletions src/fpm/cmd/export.f90
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ subroutine cmd_export(settings)

character(len=:), allocatable :: filename

if (len_trim(settings%dump_manifest)<=0 .and. &
len_trim(settings%dump_model)<=0 .and. &
len_trim(settings%dump_dependencies)<=0) then
if (.not. (requested(settings%dump_manifest) .or. &
requested(settings%dump_model) .or. &
requested(settings%dump_dependencies))) then
call fpm_stop(0,'*cmd_export* exiting: no manifest/model/dependencies keyword provided')
end if

Expand All @@ -37,13 +37,13 @@ subroutine cmd_export(settings)
call handle_error(error, lock)

!> Export manifest
if (len_trim(settings%dump_manifest)>0) then
if (requested(settings%dump_manifest)) then
filename = trim(settings%dump_manifest)
call package%dump(filename, error, json=name_is_json(filename))
end if

!> Export dependency tree
if (len_trim(settings%dump_dependencies)>0) then
if (requested(settings%dump_dependencies)) then

!> Wait for other fpm processes that use the same build directory
call lock%acquire(settings%build_dir)
Expand All @@ -61,7 +61,7 @@ subroutine cmd_export(settings)
end if

!> Export full model
if (len_trim(settings%dump_model)>0) then
if (requested(settings%dump_model)) then

!> Wait for other fpm processes that use the same build directory
call lock%acquire(settings%build_dir)
Expand All @@ -81,6 +81,14 @@ subroutine cmd_export(settings)

end subroutine cmd_export

!> Whether an export option was given a file name
logical function requested(filename)
!> File name from the command line, unallocated when the option is not given
character(len=:), allocatable, intent(in) :: filename
requested = .false.
if (allocated(filename)) requested = len_trim(filename) > 0
end function requested

!> Error handling for this command: release the lock and stop
subroutine handle_error(error, lock)
!> Potential error
Expand Down
7 changes: 4 additions & 3 deletions src/fpm_command_line.f90
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,10 @@ subroutine get_command_line_settings(cmd_settings)
case('export')

call set_args(common_args // compiler_args // '&
& --manifest "filename" &
& --model "filename" &
& --dependencies "filename" ', &
& --manifest " " &
& --model " " &
& --dependencies " " &
& --config-file " " ', &
help_build, version_text)
call check_no_unnamed_args('export')

Expand Down
Loading