forked from open-telemetry/opentelemetry-swift-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.sh
More file actions
45 lines (34 loc) · 1.23 KB
/
generate.sh
File metadata and controls
45 lines (34 loc) · 1.23 KB
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
#!/bin/bash
set -e -x
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="${SCRIPT_DIR}/../.."
# freeze the spec & generator tools versions to make SemanticAttributes generation reproducible
# repository: https://github.com/open-telemetry/semantic-conventions
SEMCONV_VERSION=1.37.0
SPEC_VERSION=v$SEMCONV_VERSION
# repository: https://github.com/open-telemetry/build-tools
GENERATOR_VERSION=0.17.1
cd ${SCRIPT_DIR}
rm -rf semantic-conventions || true
mkdir semantic-conventions
cd semantic-conventions
git init
git remote add origin https://github.com/open-telemetry/semantic-conventions.git
git fetch origin "$SPEC_VERSION"
git reset --hard FETCH_HEAD
cd ${SCRIPT_DIR}
docker run --rm \
-v ${SCRIPT_DIR}/semantic-conventions/model:/source \
-v ${SCRIPT_DIR}/templates:/templates \
-v ${ROOT_DIR}/Sources/OpenTelemetryApi/Common/SemanticAttributes:/output \
otel/weaver:v$GENERATOR_VERSION \
registry \
generate \
--registry=/source \
--templates=/templates \
./ \
/output \
-Doutput=/output/ \
cd "$ROOT_DIR"
# update spec version reported by library
sed -E -i '' 's/public static var version = ".+"/public static var version = "'$SPEC_VERSION\"/ ${ROOT_DIR}/Sources/OpenTelemetryApi/OpenTelemetry.swift