-
Notifications
You must be signed in to change notification settings - Fork 25
/
gsl.copy_properties.sh
executable file
·123 lines (105 loc) · 4.26 KB
/
gsl.copy_properties.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
.template 0
###############################################################################
# Copyright (c) 2014-2023 libbitcoin developers (see COPYING).
#
# GSL generate copy_properties.sh.
#
# This is a code generator built using the iMatix GSL code generation
# language. See https://github.com/imatix/gsl for details.
###############################################################################
# Macros
###############################################################################
.endtemplate
.template 1
.
.macro emit_initialize(vs)
. define my.vs = emit_initialize.vs
# Exit this script on the first build error.
set -e
# Do everything relative to this file location.
cd `dirname "$0"`
declare -a vs_version=( \\
. for my.vs.version as _version
"$(_version.value)" \\
. endfor
)
.endmacro
.
.macro emit_import_copy(repository, source, output, import_name)
. define my.repository = emit_import_copy.repository
.
for version in "\${vs_version[@]}"
do
mkdir -p $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
eval cp -f props/$(my.source)/import/$(my.import_name).import.* $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
done
.endmacro
.
.macro emit_project_props_copy(repository, source, output)
. define my.repository = emit_project_props_copy.repository
.
for version in "\${vs_version[@]}"
do
mkdir -p $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
eval cp -rf props/$(my.source)/project/$(my.repository.name)/* $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/\$version/
done
mkdir -p $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/build/
eval cp -rf props/$(my.source)/nuget.config $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/
eval cp -rf props/$(my.source)/build/build_base.bat $(my.output)/$(canonical_path_name(my.repository))/builds/msvc/build/
.endmacro
.
.macro emit_cumulative_dependencies(repositories, repository, dependencies)
. define my.repositories = emit_cumulative_dependencies.repositories
. define my.repository = emit_cumulative_dependencies.repository
. define my.dependencies = emit_cumulative_dependencies.dependencies
.
<< project: $(_repository.name) >>
. for my.dependencies.dependency as _dependency where\
(count(my.repositories.repository, (count->package.library = _dependency.name)) > 0)
. define my.match = my.repositories->repository(repository->package.library = _dependency.name)
<< name: $(_dependency.name) repo_name: $(my.match.name) >>
. endfor
<</ project: $(_repository.name) >>
.endmacro
.
.endtemplate
.template 0
###############################################################################
# Generation
###############################################################################
function generate_artifacts(path_prefix)
define out_file = "copy_properties.sh"
notify(out_file)
output(out_file)
shebang("bash")
copyleft("libbitcoin-build")
emit_initialize(generate->vs)
for generate.repository by name as _repository
echo(" Evaluating repository: $(_repository.name)")
new configure as _dependencies
cumulative_dependencies(_dependencies, generate, _repository)
for _dependencies.dependency as _dependency where\
(count(generate.repository,\
(count->package.library = _dependency.name)) > 0)
define my.match = generate->repository(\
repository->package.library = _dependency.name)
emit_import_copy(_repository, generate->vs.path, my.path_prefix, my.match.name)
endfor
endnew
emit_import_copy(_repository, generate->vs.path, my.path_prefix, _repository.name)
emit_project_props_copy(_repository, generate->vs.path, my.path_prefix)
endfor
endfunction
###############################################################################
# Execution
###############################################################################
[global].root = ".."
[global].trace = 0
[gsl].ignorecase = 0
# Note: expected context root libbitcoin-build directory
gsl from "library/math.gsl"
gsl from "library/string.gsl"
gsl from "library/collections.gsl"
gsl from "utilities.gsl"
generate_artifacts("output")
.endtemplate