Skip to content

Commit bb44917

Browse files
Merge pull request #653 from kubajj/enable_profiles_in_toml
Enable profiles in toml
2 parents 07a725b + f508dba commit bb44917

File tree

3 files changed

+1060
-1
lines changed

3 files changed

+1060
-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
@@ -45,6 +47,7 @@ module fpm_manifest_package
4547
use fpm_toml, only : toml_table, toml_array, toml_key, toml_stat, get_value, &
4648
& len
4749
use fpm_versioning, only : version_t, new_version
50+
use fpm_filesystem, only: join_path
4851
implicit none
4952
private
5053

@@ -84,6 +87,9 @@ module fpm_manifest_package
8487
!> Development dependency meta data
8588
type(dependency_config_t), allocatable :: dev_dependency(:)
8689

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

@@ -208,6 +214,15 @@ subroutine new_package(self, table, root, error)
208214
call new_library(self%library, child, error)
209215
if (allocated(error)) return
210216
end if
217+
218+
call get_value(table, "profiles", child, requested=.false.)
219+
if (associated(child)) then
220+
call new_profiles(self%profiles, child, error)
221+
if (allocated(error)) return
222+
else
223+
self%profiles = get_default_profiles(error)
224+
if (allocated(error)) return
225+
end if
211226

212227
call get_value(table, "executable", children, requested=.false.)
213228
if (associated(children)) then
@@ -312,7 +327,7 @@ subroutine check(table, error)
312327

313328
case("version", "license", "author", "maintainer", "copyright", &
314329
& "description", "keywords", "categories", "homepage", "build", &
315-
& "dependencies", "dev-dependencies", "test", "executable", &
330+
& "dependencies", "dev-dependencies", "profiles", "test", "executable", &
316331
& "example", "library", "install", "extra", "preprocess")
317332
continue
318333

@@ -409,6 +424,15 @@ subroutine info(self, unit, verbosity)
409424
call self%dev_dependency(ii)%info(unit, pr - 1)
410425
end do
411426
end if
427+
428+
if (allocated(self%profiles)) then
429+
if (size(self%profiles) > 1 .or. pr > 2) then
430+
write(unit, fmti) "- profiles", size(self%profiles)
431+
end if
432+
do ii = 1, size(self%profiles)
433+
call self%profiles(ii)%info(unit, pr - 1)
434+
end do
435+
end if
412436

413437
end subroutine info
414438

0 commit comments

Comments
 (0)