aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2020-11-21 13:09:11 +0000
committerLKedward <laurence.kedward@bristol.ac.uk>2020-11-21 13:09:27 +0000
commitd90e4c318f527d3b26f66e91df5fc34ea5c1d35d (patch)
treec5c959122ff564d157f68d8da4efbe60f5920b8d
parent09e7c7d9c255e2cda5eaf59fb0c5e1706cdfc69b (diff)
downloadfpm-d90e4c318f527d3b26f66e91df5fc34ea5c1d35d.tar.gz
fpm-d90e4c318f527d3b26f66e91df5fc34ea5c1d35d.zip
Update: source processing with file hashes
-rw-r--r--fpm/src/fpm_model.f903
-rw-r--r--fpm/src/fpm_sources.f906
2 files changed, 8 insertions, 1 deletions
diff --git a/fpm/src/fpm_model.f90 b/fpm/src/fpm_model.f90
index 20f174b..94dde91 100644
--- a/fpm/src/fpm_model.f90
+++ b/fpm/src/fpm_model.f90
@@ -1,5 +1,6 @@
module fpm_model
! Definition and validation of the backend model
+use iso_fortran_env, only: int64
use fpm_strings, only: string_t
implicit none
@@ -53,6 +54,8 @@ type srcfile_t
! Files INCLUDEd by this source file
type(string_t), allocatable :: link_libraries(:)
! Native libraries to link against
+ integer(int64) :: digest
+ ! Current hash
end type srcfile_t
type build_target_ptr
diff --git a/fpm/src/fpm_sources.f90 b/fpm/src/fpm_sources.f90
index fa5c6e7..7428662 100644
--- a/fpm/src/fpm_sources.f90
+++ b/fpm/src/fpm_sources.f90
@@ -7,7 +7,7 @@ use fpm_model, only: srcfile_t, fpm_model_t, &
FPM_SCOPE_LIB, FPM_SCOPE_DEP, FPM_SCOPE_APP, FPM_SCOPE_TEST
use fpm_filesystem, only: basename, canon_path, dirname, join_path, read_lines, list_files
-use fpm_strings, only: lower, split, str_ends_with, string_t, operator(.in.)
+use fpm_strings, only: lower, split, str_ends_with, string_t, operator(.in.), fnv_1a
use fpm_manifest_executable, only: executable_t
implicit none
@@ -233,6 +233,8 @@ function parse_f_source(f_filename,error) result(f_source)
file_lines = read_lines(fh)
close(fh)
+ f_source%digest = fnv_1a(file_lines)
+
do pass = 1,2
n_use = 0
n_include = 0
@@ -512,6 +514,8 @@ function parse_c_source(c_filename,error) result(c_source)
file_lines = read_lines(fh)
close(fh)
+ c_source%digest = fnv_1a(file_lines)
+
do pass = 1,2
n_include = 0
file_loop: do i=1,size(file_lines)