-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.sh
More file actions
executable file
·44 lines (29 loc) · 858 Bytes
/
generator.sh
File metadata and controls
executable file
·44 lines (29 loc) · 858 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
mkdir -p "${script_dir}/source/Generated"
rm "${script_dir}/source/Generated"/* 2>/dev/null || true
# sleep for 0.1s - it simulates that this script would generate more files
sleep 0.1
echo "Creating ScriptObject.hpp"
cat > "${script_dir}/source/Generated/ScriptObject.hpp" <<< '
#pragma once
class ScriptObject {
int _x;
public:
ScriptObject(int x);
int getX() const { return _x; }
};
'
echo "Creating ScriptObject.cpp"
cat > "${script_dir}/source/Generated/ScriptObject.cpp"<<< '
#include "ScriptObject.hpp"
ScriptObject::ScriptObject(int x)
: _x(x) {}
'
if [ $# -eq 1 ] ; then
echo "Creating dummy.cpp"
timestamp=$(date +%s)
echo "//Created swig wrappers with timestamp: ${timestamp}" > "${1}"
fi