summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/SConscript
blob: 92578718aef77ec2144eb4fb1efb103b52dbd57b (plain)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# -*- mode: python -*-

Import([
    'env',
    'get_option',
    'jsEngine',
    'serverJs',
])

env.Library(
    target='scripting_common',
    source=[
        'deadline_monitor.cpp',
        'deadline_monitor.idl',
        'dbdirectclient_factory.cpp',
        'engine.cpp',
        'jsexception.cpp',
        'utils.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/client/clientdriver_minimal',
        '$BUILD_DIR/mongo/db/server_base',
        '$BUILD_DIR/mongo/shell/mongojs',
        '$BUILD_DIR/mongo/util/md5',
        'bson_template_evaluator',
    ],
)

env.Library(
    target='bson_template_evaluator',
    source=[
        'bson_template_evaluator.cpp',
    ],
    LIBDEPS=[
        '$BUILD_DIR/mongo/base',
    ],
)

env.Library(
    target='scripting_none',
    source=[
        'engine_none.cpp',
    ],
    LIBDEPS=[
        'scripting_common',
    ],
)

if jsEngine:
    scriptingEnv = env.Clone()

    scriptingEnv.Append(
        CXXFLAGS=[] if scriptingEnv.TargetOSIs('windows') else [
            # TODO(SERVER-59992): Remove -Wno-class-memacces where possible.
            '-Wno-unknown-warning-option',
            '-Wno-class-memaccess',
        ], )

    scriptingEnv.InjectMozJS()

    scriptingEnv.JSHeader(
        target='mozjs/mongohelpers_js.cpp',
        source=['mozjs/mongohelpers.js'],
    )

    env.Alias('generated-sources', 'mozjs/mongohelpers_js.cpp')

    scriptingEnv.Library(
        target='scripting',
        source=[
            'mozjs/base.cpp',
            'mozjs/bindata.cpp',
            'mozjs/bson.cpp',
            'mozjs/code.cpp',
            'mozjs/countdownlatch.cpp',
            'mozjs/cursor.cpp',
            'mozjs/cursor_handle.cpp',
            'mozjs/db.cpp',
            'mozjs/dbcollection.cpp',
            'mozjs/dbpointer.cpp',
            'mozjs/dbquery.cpp',
            'mozjs/dbref.cpp',
            'mozjs/engine.cpp',
            'mozjs/error.cpp',
            'mozjs/exception.cpp',
            'mozjs/global.cpp',
            'mozjs/idwrapper.cpp',
            'mozjs/implscope.cpp',
            'mozjs/internedstring.cpp',
            'mozjs/jscustomallocator.cpp',
            'mozjs/jsstringwrapper.cpp',
            'mozjs/jsthread.cpp',
            'mozjs/maxkey.cpp',
            'mozjs/minkey.cpp',
            'mozjs/mongo.cpp',
            'mozjs/mongohelpers.cpp',
            'mozjs/mongohelpers_js.cpp',
            'mozjs/nativefunction.cpp',
            'mozjs/numberdecimal.cpp',
            'mozjs/numberint.cpp',
            'mozjs/numberlong.cpp',
            'mozjs/object.cpp',
            'mozjs/objectwrapper.cpp',
            'mozjs/oid.cpp',
            'mozjs/PosixNSPR.cpp',
            'mozjs/proxyscope.cpp',
            'mozjs/regexp.cpp',
            'mozjs/session.cpp',
            'mozjs/status.cpp',
            'mozjs/timestamp.cpp',
            'mozjs/uri.cpp',
            'mozjs/valuereader.cpp',
            'mozjs/valuewriter.cpp',
            'mozjs/engine.idl',
            'mozjs/scripting_util.idl',
        ],
        LIBDEPS=[
            'scripting_common',
        ],
        LIBDEPS_PRIVATE=[
            '$BUILD_DIR/mongo/client/clientdriver_network',
            '$BUILD_DIR/mongo/db/service_context',
            '$BUILD_DIR/third_party/mozjs/mozjs',
        ],
    )
else:
    env.Library(
        target='scripting',
        source=[
            'scripting_none.cpp',
        ],
        LIBDEPS=[
            'scripting_common',
        ],
        LIBDEPS_PRIVATE=[
            'scripting_none',
        ],
    )

env.Library(
    target='scripting_server',
    source=[
        'scripting_server.cpp',
    ],
    LIBDEPS=[
        'scripting' if serverJs else 'scripting_none',
    ],
)

env.CppUnitTest(
    target='scripting_test',
    source=[
        'bson_template_evaluator_test.cpp',
        'deadline_monitor_test.cpp',
    ],
    LIBDEPS=[
        'scripting_common',
    ],
)