@@ -53,7 +53,7 @@ recursive subroutine add_libsources_from_package(sources,package_list,package, &
53
53
! Add library sources from dependencies
54
54
if (allocated (package% dependency)) then
55
55
56
- call add_local_dependencies (package% dependency)
56
+ call add_dependencies (package% dependency)
57
57
58
58
if (allocated (error)) then
59
59
return
@@ -64,7 +64,7 @@ recursive subroutine add_libsources_from_package(sources,package_list,package, &
64
64
! Add library sources from dev-dependencies
65
65
if (dev_depends .and. allocated (package% dev_dependency)) then
66
66
67
- call add_local_dependencies (package% dev_dependency)
67
+ call add_dependencies (package% dev_dependency)
68
68
69
69
if (allocated (error)) then
70
70
return
@@ -74,13 +74,15 @@ recursive subroutine add_libsources_from_package(sources,package_list,package, &
74
74
75
75
contains
76
76
77
- subroutine add_local_dependencies (dependency_list )
77
+ subroutine add_dependencies (dependency_list )
78
78
type (dependency_t) :: dependency_list(:)
79
79
80
80
integer :: i
81
81
type (string_t) :: dep_name
82
82
type (package_t) :: dependency
83
83
84
+ character (:), allocatable :: dependency_path
85
+
84
86
do i= 1 ,size (dependency_list)
85
87
86
88
if (dependency_list(i)% name .in . package_list) then
@@ -89,49 +91,53 @@ subroutine add_local_dependencies(dependency_list)
89
91
90
92
if (allocated (dependency_list(i)% git)) then
91
93
92
- call fatal_error(error,' Remote dependencies not implemented' )
93
- return
94
+ dependency_path = join_path(' build' ,' dependencies' ,dependency_list(i)% name)
94
95
95
- end if
96
-
97
- if (allocated (dependency_list(i)% path)) then
96
+ if (.not. exists(join_path(dependency_path,' fpm.toml' ))) then
97
+ call dependency_list(i)% git% checkout(dependency_path, error)
98
+ if (allocated (error)) return
99
+ end if
98
100
99
- call get_package_data(dependency, &
100
- join_path(package_root,dependency_list(i)% path," fpm.toml" ), error)
101
+ else if (allocated (dependency_list(i)% path)) then
102
+
103
+ dependency_path = join_path(package_root,dependency_list(i)% path)
101
104
102
- if (allocated (error)) then
103
- error% message = ' Error while parsing manifest for dependency package at:' // &
104
- new_line(' a' )// join_path(package_root,dependency_list(i)% path," fpm.toml" )// &
105
- new_line(' a' )// error% message
106
- return
107
- end if
105
+ end if
108
106
109
- if (.not. allocated (dependency% library) .and. &
110
- exists(join_path(package_root,dependency_list(i)% path," src" ))) then
111
- allocate (dependency% library)
112
- dependency% library% source_dir = " src"
113
- end if
107
+ call get_package_data(dependency, &
108
+ join_path(dependency_path," fpm.toml" ), error)
114
109
115
-
116
- call add_libsources_from_package(sources,package_list,dependency, &
117
- package_root= join_path(package_root,dependency_list(i)% path), &
118
- dev_depends= dev_depends, error= error)
119
-
120
- if (allocated (error)) then
121
- error% message = ' Error while processing sources for dependency package "' // &
122
- new_line(' a' )// dependency% name// ' "' // &
123
- new_line(' a' )// error% message
124
- return
125
- end if
110
+ if (allocated (error)) then
111
+ error% message = ' Error while parsing manifest for dependency package at:' // &
112
+ new_line(' a' )// join_path(dependency_path," fpm.toml" )// &
113
+ new_line(' a' )// error% message
114
+ return
115
+ end if
126
116
127
- dep_name% s = dependency_list(i)% name
128
- package_list = [package_list, dep_name]
117
+ if (.not. allocated (dependency% library) .and. &
118
+ exists(join_path(dependency_path," src" ))) then
119
+ allocate (dependency% library)
120
+ dependency% library% source_dir = " src"
121
+ end if
129
122
123
+
124
+ call add_libsources_from_package(sources,package_list,dependency, &
125
+ package_root= dependency_path, &
126
+ dev_depends= dev_depends, error= error)
127
+
128
+ if (allocated (error)) then
129
+ error% message = ' Error while processing sources for dependency package "' // &
130
+ new_line(' a' )// dependency% name// ' "' // &
131
+ new_line(' a' )// error% message
132
+ return
130
133
end if
131
134
135
+ dep_name% s = dependency_list(i)% name
136
+ package_list = [package_list, dep_name]
137
+
132
138
end do
133
139
134
- end subroutine add_local_dependencies
140
+ end subroutine add_dependencies
135
141
136
142
end subroutine add_libsources_from_package
137
143
0 commit comments