Skip to content

Commit 52c096a

Browse files
committed
basic new,test,run added to build subcommands
1 parent 95d0df6 commit 52c096a

File tree

2 files changed

+17
-39
lines changed

2 files changed

+17
-39
lines changed

fpm/src/fpm/manifest.f90

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ module fpm_manifest
1212
use fpm_manifest_package, only : package_t, new_package
1313
use fpm_error, only : error_t, fatal_error, file_not_found_error
1414
use fpm_toml, only : toml_table, read_package_file
15+
use fpm_manifest_test, only : test_t
1516
implicit none
1617
private
1718

18-
public :: get_package_data, default_executable, default_library
19+
public :: get_package_data, default_executable, default_library, default_test
1920
public :: package_t
2021

2122

@@ -48,6 +49,21 @@ subroutine default_executable(self, name)
4849

4950
end subroutine default_executable
5051

52+
!> Populate test in case we find the default test/ directory
53+
subroutine default_test(self, name)
54+
55+
!> Instance of the executable meta data
56+
type(test_t), intent(out) :: self
57+
58+
!> Name of the package
59+
character(len=*), intent(in) :: name
60+
61+
self%name = name
62+
self%source_dir = "test"
63+
self%main = "main.f90"
64+
65+
end subroutine default_test
66+
5167

5268
!> Obtain package meta data from a configuation file
5369
subroutine get_package_data(package, file, error)

fpm/src/fpm_command_line.f90

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ subroutine get_command_line_settings(cmd_settings)
182182
cmd_settings=fpm_build_settings( release=lget('release'),list=lget('list') )
183183

184184
case('new')
185-
<<<<<<< HEAD
186185
help_text=[character(len=80) :: &
187186
'NAME ', &
188187
' new(1) - the fpm(1) subcommand to initialize a new project ', &
@@ -227,39 +226,6 @@ subroutine get_command_line_settings(cmd_settings)
227226
' The fpm(1) home page is https://github.com/fortran-lang/fpm ', &
228227
' ', &
229228
' Registered packages are at https://fortran-lang.org/packages ', &
230-
=======
231-
help_text=[character(len=80) :: &
232-
'NAME ', &
233-
' new(1) - the fpm(1) subcommand to initialize a new project ', &
234-
'SYNOPSIS ', &
235-
' fpm new NAME [--with-executable] [--with-test] ', &
236-
' ', &
237-
' fpm new --help|--version ', &
238-
' ', &
239-
'DESCRIPTION ', &
240-
' Create a new programming project in a new directory ', &
241-
' ', &
242-
' The "new" subcommand creates a directory and runs the command ', &
243-
' "git init" in that directory and makes an example "fpm.toml" ', &
244-
' file, a src/ directory, and optionally a test/ and app/ ', &
245-
' directory with trivial example Fortran source files. ', &
246-
' ', &
247-
' Remember to update the information in the sample "fpm.toml" ', &
248-
' file with such information as your name and e-mail address. ', &
249-
' ', &
250-
'EXAMPLES ', &
251-
' Sample use ', &
252-
' ', &
253-
' # create new project directory and seed it ', &
254-
' fpm new myproject ', &
255-
' # Enter the new directory ', &
256-
' cd myproject ', &
257-
' # and run commands such as ', &
258-
' fpm build ', &
259-
' fpm run # if you selected --with-executable ', &
260-
' fpm test # if you selected --with-test ', &
261-
' ', &
262-
>>>>>>> try one more like previous build to clear error
263229
'' ]
264230
call set_args(' --with-executable F --with-test F --lib F --app F --test F', help_text, version_text)
265231
select case(size(unnamed))
@@ -443,11 +409,7 @@ subroutine get_command_line_settings(cmd_settings)
443409
endif
444410
help_text=[character(len=80) :: &
445411
'USAGE: fpm [ SUBCOMMAND [SUBCOMMAND_OPTIONS] ] | [|--help|--version] ', &
446-
<<<<<<< HEAD
447412
' Enter "fpm --help" for more information ', &
448-
=======
449-
' Enter "fpm --help" for more information , &
450-
>>>>>>> try one more like previous build to clear error
451413
'' ]
452414
write(stderr,'(g0)')(trim(help_text(i)), i=1, size(help_text) )
453415
!!stop 3 ! causes github site tests to fail

0 commit comments

Comments
 (0)