forked from zeromq/zproject
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zproject_projects.gsl
111 lines (96 loc) · 3.2 KB
/
zproject_projects.gsl
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
# Resolve standard CLASS projects
#
# This is a code generator built using the iMatix GSL code generation
# language. See https://github.com/imatix/gsl for details.
#
# Copyright (c) the Contributors as noted in the AUTHORS file.
# This file is part of zproject.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
function resolve_project_dependency (use)
my.known_projects = XML.load_file ("zproject_known_projects.xml")
# Use known values to fill in gaps if it is a known project
for my.known_projects.use as known where known.project = my.use.project
my.use.repository ?= known.repository?
my.use.test ?= known.test?
my.use.header ?= known.header?
my.use.prefix ?= known.prefix?
my.use.linkname ?= known.linkname?
my.use.libname ?= known.libname?
my.use.release ?= known.release?
my.use.debian_name ?= known.debian_name?
my.use.spec_name ?= known.spec_name?
# Copy known implied dependencies into this dependency
for known.use as implied_use
if !count (my.use.use, use.project = implied_use.project)
move implied_use to my.use as use
endif
endfor
endfor
# Use reasonable fallback values to fill in any remaining gaps
my.use.prefix ?= my.use.project
my.use.linkname ?= my.use.prefix
my.use.header ?= my.use.prefix + ".h"
my.use.libname ?= my.use.project
my.use.optional ?= 0
my.use.min_major ?= 0
my.use.min_minor ?= 0
my.use.min_patch ?= 0
# For values with no reasonable fallback, print error
if !defined (my.use.test)
echo "Project $(my.use.project) needs a 'test' attribute"
endif
# Calculate all non-model values from model values
my.use.min_version = "$(min_major).$(min_minor).$(min_patch)"
# Copy all dependencies implied by this one into the project
for my.use.use as implied_use
if !count (project.use, use.project = implied_use.project)
move implied_use before my.use as use
implied_use.implied = "1"
resolve_project_dependency (implied_use)
endif
endfor
endfunction
function resolve_scope (item)
if my.item.private ?= 1
my.item.scope = "private"
else
my.item.scope = "public"
endif
endfunction
for use
resolve_project_dependency (use)
endfor
for main
resolve_scope (main)
endfor
for actor
actor.selftest ?= 1
new class to project
class.name = actor.name
class.private = actor.private?
class.description = actor.description?
class.selftest = actor.selftest
endnew
resolve_scope (actor)
endfor
for class
resolve_scope (class)
class.selftest ?= 1
endfor
for constant
resolve_scope (constant)
endfor
for header
resolve_scope (header)
endfor
# All projects with classes contain a selftest main
if count (project.class)
new main to project
main.name = "$(prefix)_selftest"
main.test = 1
main.scope = "private"
endnew
endif