Skip to content

Enable profiles in toml #653

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
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
26 changes: 25 additions & 1 deletion src/fpm/manifest/package.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
!>[library]
!>[dependencies]
!>[dev-dependencies]
!>[profiles]
!>[build]
!>[install]
!>[[ executable ]]
Expand All @@ -34,6 +35,7 @@
module fpm_manifest_package
use fpm_manifest_build, only: build_config_t, new_build_config
use fpm_manifest_dependency, only : dependency_config_t, new_dependencies
use fpm_manifest_profile, only : profile_config_t, new_profiles, get_default_profiles
use fpm_manifest_example, only : example_config_t, new_example
use fpm_manifest_executable, only : executable_config_t, new_executable
use fpm_manifest_library, only : library_config_t, new_library
Expand All @@ -45,6 +47,7 @@ module fpm_manifest_package
use fpm_toml, only : toml_table, toml_array, toml_key, toml_stat, get_value, &
& len
use fpm_versioning, only : version_t, new_version
use fpm_filesystem, only: join_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is on line 345.

implicit none
private

Expand Down Expand Up @@ -84,6 +87,9 @@ module fpm_manifest_package
!> Development dependency meta data
type(dependency_config_t), allocatable :: dev_dependency(:)

!> Profiles meta data
type(profile_config_t), allocatable :: profiles(:)

!> Example meta data
type(example_config_t), allocatable :: example(:)

Expand Down Expand Up @@ -208,6 +214,15 @@ subroutine new_package(self, table, root, error)
call new_library(self%library, child, error)
if (allocated(error)) return
end if

call get_value(table, "profiles", child, requested=.false.)
if (associated(child)) then
call new_profiles(self%profiles, child, error)
if (allocated(error)) return
else
self%profiles = get_default_profiles(error)
if (allocated(error)) return
end if

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

case("version", "license", "author", "maintainer", "copyright", &
& "description", "keywords", "categories", "homepage", "build", &
& "dependencies", "dev-dependencies", "test", "executable", &
& "dependencies", "dev-dependencies", "profiles", "test", "executable", &
& "example", "library", "install", "extra", "preprocess")
continue

Expand Down Expand Up @@ -409,6 +424,15 @@ subroutine info(self, unit, verbosity)
call self%dev_dependency(ii)%info(unit, pr - 1)
end do
end if

if (allocated(self%profiles)) then
if (size(self%profiles) > 1 .or. pr > 2) then
write(unit, fmti) "- profiles", size(self%profiles)
end if
do ii = 1, size(self%profiles)
call self%profiles(ii)%info(unit, pr - 1)
end do
end if

end subroutine info

Expand Down
Loading