Skip to content

Commit b19ab4c

Browse files
committed
Enable profiles in toml
1 parent 2ae0581 commit b19ab4c

File tree

3 files changed

+1003
-1
lines changed

3 files changed

+1003
-1
lines changed

src/fpm/manifest/package.f90

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
!>[library]
2525
!>[dependencies]
2626
!>[dev-dependencies]
27+
!>[profiles]
2728
!>[build]
2829
!>[install]
2930
!>[[ executable ]]
@@ -34,6 +35,7 @@
3435
module fpm_manifest_package
3536
use fpm_manifest_build, only: build_config_t, new_build_config
3637
use fpm_manifest_dependency, only : dependency_config_t, new_dependencies
38+
use fpm_manifest_profile, only : profile_config_t, new_profiles, get_default_profiles
3739
use fpm_manifest_example, only : example_config_t, new_example
3840
use fpm_manifest_executable, only : executable_config_t, new_executable
3941
use fpm_manifest_library, only : library_config_t, new_library
@@ -44,6 +46,7 @@ module fpm_manifest_package
4446
use fpm_toml, only : toml_table, toml_array, toml_key, toml_stat, get_value, &
4547
& len
4648
use fpm_versioning, only : version_t, new_version
49+
use fpm_filesystem, only: join_path
4750
implicit none
4851
private
4952

@@ -83,6 +86,9 @@ module fpm_manifest_package
8386
!> Development dependency meta data
8487
type(dependency_config_t), allocatable :: dev_dependency(:)
8588

89+
!> Profiles meta data
90+
type(profile_config_t), allocatable :: profiles(:)
91+
8692
!> Example meta data
8793
type(example_config_t), allocatable :: example(:)
8894

@@ -204,6 +210,15 @@ subroutine new_package(self, table, root, error)
204210
call new_library(self%library, child, error)
205211
if (allocated(error)) return
206212
end if
213+
214+
call get_value(table, "profiles", child, requested=.false.)
215+
if (associated(child)) then
216+
call new_profiles(self%profiles, child, error)
217+
if (allocated(error)) return
218+
else
219+
self%profiles = get_default_profiles(error)
220+
if (allocated(error)) return
221+
end if
207222

208223
call get_value(table, "executable", children, requested=.false.)
209224
if (associated(children)) then
@@ -303,7 +318,7 @@ subroutine check(table, error)
303318

304319
case("version", "license", "author", "maintainer", "copyright", &
305320
& "description", "keywords", "categories", "homepage", "build", &
306-
& "dependencies", "dev-dependencies", "test", "executable", &
321+
& "dependencies", "dev-dependencies", "profiles", "test", "executable", &
307322
& "example", "library", "install", "extra")
308323
continue
309324

@@ -400,6 +415,15 @@ subroutine info(self, unit, verbosity)
400415
call self%dev_dependency(ii)%info(unit, pr - 1)
401416
end do
402417
end if
418+
419+
if (allocated(self%profiles)) then
420+
if (size(self%profiles) > 1 .or. pr > 2) then
421+
write(unit, fmti) "- profiles", size(self%profiles)
422+
end if
423+
do ii = 1, size(self%profiles)
424+
call self%profiles(ii)%info(unit, pr - 1)
425+
end do
426+
end if
403427

404428
end subroutine info
405429

0 commit comments

Comments
 (0)