Skip to content

Commit 4e4fdeb

Browse files
committed
refactor: add commit hash to version string
1 parent 4d7f41a commit 4e4fdeb

8 files changed

Lines changed: 24 additions & 16 deletions

File tree

meson.build

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,21 @@ project(
33
'fortran',
44
version: '6.8.0.dev0',
55
license: 'CC0',
6-
meson_version: '>= 1.3.1',
6+
meson_version: '>= 1.7.0',
77
default_options : [
88
'b_vscrt=static_from_buildtype', # Link runtime libraries statically on Windows
99
'buildtype=release',
1010
'debug=false',
1111
'fortran_std=f2018',
1212
])
1313

14+
version_f90 = vcs_tag(
15+
command: ['git', 'rev-parse', '--short', 'HEAD'],
16+
input: 'src/Utilities/version.f90.in',
17+
output: 'version.f90',
18+
replace_string: '@VCS_TAG@',
19+
)
20+
1421
if get_option('buildtype') == 'release'
1522
profile = 'release'
1623
else

pixi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ gitpython = "*"
1717
jinja2 = ">=3.1.5,<4"
1818
jupytext = "*"
1919
matplotlib = "*"
20-
meson = ">=1.3.1"
20+
meson = ">=1.7.0"
2121
netCDF4 = "*"
2222
networkx = "*"
2323
ninja = "*"

src/Utilities/Export/NCModel.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ end subroutine epkg_destroy
199199
!> @brief set netcdf file scoped attributes
200200
!<
201201
subroutine set(this, modelname, modeltype, modelfname, nctype, disenum)
202-
use VersionModule, only: VERSION
202+
use VersionModule, only: FULLVERSION
203203
class(NCExportAnnotation), intent(inout) :: this
204204
character(len=*), intent(in) :: modelname
205205
character(len=*), intent(in) :: modeltype
@@ -260,7 +260,7 @@ subroutine set(this, modelname, modeltype, modelfname, nctype, disenum)
260260
this%model = trim(modeltype)//'6: '//trim(modelname)
261261

262262
! modflow6 version string
263-
this%source = 'MODFLOW 6 '//trim(adjustl(VERSION))
263+
this%source = 'MODFLOW 6 '//trim(adjustl(FULLVERSION))
264264

265265
! create timestamp
266266
call date_and_time(values=values)

src/Utilities/comarg.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module CommandArguments
33
use ConstantsModule, only: LINELENGTH, LENBIGLINE, LENHUGELINE, &
44
VSUMMARY, VALL, VDEBUG, &
55
MVALIDATE
6-
use VersionModule, only: VERSION, MFVNAM, IDEVELOPMODE, &
6+
use VersionModule, only: VERSION, FULLVERSION, MFVNAM, IDEVELOPMODE, &
77
FMTDISCLAIMER, write_license
88
use CompilerVersion
99
use SimVariablesModule, only: istdout, isim_level, &
@@ -72,7 +72,7 @@ subroutine GetCommandLineArguments()
7272
call get_compile_date(cdate)
7373
write (header, '(a,4(1x,a),a)') &
7474
trim(adjustl(cexe)), '- MODFLOW', &
75-
trim(adjustl(VERSION)), '(compiled', trim(adjustl(cdate)), ')'
75+
trim(adjustl(FULLVERSION)), '(compiled', trim(adjustl(cdate)), ')'
7676
!
7777
! -- check for silent option
7878
do iarg = 1, icountcmd
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ module VersionModule
1818
! -- modflow 6 version
1919
integer(I4B), parameter :: IDEVELOPMODE = 1
2020
character(len=*), parameter :: VERSIONNUMBER = '6.8.0.dev0'
21-
character(len=*), parameter :: VERSIONTAG = ' (preliminary) 02/06/2026'
22-
character(len=40), parameter :: VERSION = VERSIONNUMBER//VERSIONTAG
21+
character(len=*), parameter :: VERSIONQUALIFIER = ' (preliminary) 02/06/2026'
22+
character(len=40), parameter :: VERSIONTAG = "@VCS_TAG@"
23+
character(len=40), parameter :: FULLVERSION = VERSIONNUMBER//VERSIONQUALIFIER
24+
character(len=40), parameter :: VERSION = VERSIONNUMBER//'+'//VERSIONTAG
2325
character(len=2), parameter :: MFVNAM = ' 6'
2426
character(len=*), parameter :: MFTITLE = &
2527
&'U.S. GEOLOGICAL SURVEY MODULAR HYDROLOGIC MODEL'
@@ -129,7 +131,7 @@ subroutine write_listfile_header(iout, cmodel_type, write_sys_command, &
129131
end if
130132
!
131133
! -- Write version
132-
call write_message_centered(text='VERSION '//VERSION, &
134+
call write_message_centered(text='VERSION '//FULLVERSION, &
133135
linelen=iheader_width, iunit=iout)
134136
!
135137
! -- Write if develop mode

src/meson.build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,13 +495,12 @@ modflow_sources = files(
495495
'Utilities' / 'Table.f90',
496496
'Utilities' / 'TableTerm.f90',
497497
'Utilities' / 'Timer.f90',
498-
'Utilities' / 'version.f90',
499498
'mf6core.f90',
500499
'mf6lists.f90',
501500
'SimulationCreate.f90',
502501
'RunControl.f90',
503502
'RunControlFactory.F90'
504-
)
503+
) + [version_f90]
505504

506505
modflow_petsc_sources = files(
507506
'Utilities' / 'Vector' / 'PetscVector.F90',

utils/mf5to6/src/Preproc/GlobalVariables.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module GlobalVariablesModule
22

33
use ConstantsModule, only: MAXCHARLEN
4-
use VersionModule, only: VERSION
4+
use VersionModule, only: FULLVERSION
55
use OpenSpecModule, only: ACCESS, ACTION, FORM
66

77
implicit none
@@ -16,7 +16,7 @@ module GlobalVariablesModule
1616
character(len=48) :: mfvnam
1717
parameter (prognamconv='Mf5to6')
1818
parameter (prognamlong=trim(prognamconv)//' - Converter for MODFLOW (2005, NWT, LGR) to MODFLOW 6')
19-
parameter (mfvnam='Version ' // VERSION)
19+
parameter (mfvnam='Version ' // FULLVERSION)
2020
integer :: ngrid = 0
2121
integer :: ilgr, ilunit, ngrids
2222
integer, parameter :: NIUNIT=100

utils/zonebudget/src/zbud6.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
program zonbudmf6
22
use KindModule
33
use ConstantsModule, only: LINELENGTH, LENHUGELINE
4-
use VersionModule, only: VERSION
4+
use VersionModule, only: FULLVERSION
55
use SimVariablesModule, only: iout, errmsg
66
use SimModule, only: store_error
77
use MessageModule, only: write_message, write_message_centered
@@ -23,7 +23,7 @@ program zonbudmf6
2323
! -- Write title to screen
2424
call write_message_centered('ZONEBUDGET'//mfvnam, 80)
2525
call write_message_centered('U.S. GEOLOGICAL SURVEY', 80)
26-
call write_message_centered('VERSION '//VERSION, 80)
26+
call write_message_centered('VERSION '//FULLVERSION, 80)
2727
!
2828
! -- Find name of zone budget name file and lst file
2929
fnam = 'zbud.nam'
@@ -39,7 +39,7 @@ program zonbudmf6
3939
call openfile(iunit_lst, 0, flst, 'LIST', filstat_opt='REPLACE')
4040
call write_message_centered('ZONEBUDGET'//mfvnam, 80, iunit=iout)
4141
call write_message_centered('U.S. GEOLOGICAL SURVEY', 80, iunit=iout)
42-
call write_message_centered('VERSION '//VERSION, 80, iunit=iout)
42+
call write_message_centered('VERSION '//FULLVERSION, 80, iunit=iout)
4343
!
4444
! -- Open name file, read name file, and open csv file
4545
call openfile(iunit_nam, iout, fnam, 'NAM')

0 commit comments

Comments
 (0)