|
2 | 2 | set -e |
3 | 3 |
|
4 | 4 | SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
| 5 | +file="$SOURCEDIR/../.github/patches/versions" |
5 | 6 |
|
| 7 | +contrib_version=$(awk -F'=v' '/OTEL_JAVA_CONTRIB_VERSION/ {print $2}' "$file") |
| 8 | +if [[ -n "$contrib_version" ]]; then |
| 9 | + echo "Found OTEL Contrib Version: ${contrib_version}" |
| 10 | + ## Clone and Patch the OpenTelemetry Java contrib Repository |
| 11 | + echo "Info: Cloning and Patching OpenTelemetry Java contrib Repository" |
| 12 | + git clone https://github.com/open-telemetry/opentelemetry-java-contrib.git |
| 13 | + pushd opentelemetry-java-contrib |
| 14 | + git checkout v${contrib_version} -b tag-v${contrib_version} |
6 | 15 |
|
7 | | -## Get ADOT version |
8 | | -echo "Info: Getting ADOT Version" |
9 | | -pushd "$SOURCEDIR"/.. |
10 | | -version=$(./gradlew -q printVersion) |
11 | | -echo "Found ADOT Version: ${version}" |
12 | | -popd |
| 16 | + # There is another patch in the .github/patches directory for other changes. We should apply them too for consistency. |
| 17 | + patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-contrib.patch |
| 18 | + |
| 19 | + ./gradlew publishToMavenLocal |
| 20 | + popd |
| 21 | + rm -rf opentelemetry-java-contrib |
| 22 | +fi |
13 | 23 |
|
14 | 24 | ## Get OTel version |
15 | 25 | echo "Info: Getting OTEL Version" |
16 | | -file="$SOURCEDIR/../.github/patches/versions" |
17 | | -otel_instrumentation_version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file") |
18 | | -echo "Found OTEL Version: ${otel_instrumentation_version}" |
| 26 | +version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file") |
| 27 | +echo "Found OTEL Version: ${version}" |
19 | 28 | # Exit if the version is empty or null |
20 | | -if [[ -z "$otel_instrumentation_version" ]]; then |
| 29 | +if [[ -z "$version" ]]; then |
21 | 30 | echo "Error: Version could not be found in ${file}." |
22 | 31 | exit 1 |
23 | 32 | fi |
|
27 | 36 | echo "Info: Cloning and Patching OpenTelemetry Java Instrumentation Repository" |
28 | 37 | git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git |
29 | 38 | pushd opentelemetry-java-instrumentation |
30 | | -git checkout v${otel_instrumentation_version} -b tag-v${otel_instrumentation_version} |
| 39 | +git checkout v${version} -b tag-v${version} |
| 40 | + |
| 41 | +# There is another patch in the .github/patches directory for other changes. We should apply them too for consistency. |
| 42 | +patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-instrumentation.patch |
31 | 43 |
|
32 | 44 | # This patch is for Lambda related context propagation |
33 | 45 | patch -p1 < "$SOURCEDIR"/patches/opentelemetry-java-instrumentation.patch |
34 | 46 |
|
| 47 | +patch -p1 < "$SOURCEDIR"/patches/StreamHandlerInstrumentation.patch |
| 48 | + |
35 | 49 | ./gradlew publishToMavenLocal |
36 | 50 | popd |
37 | 51 | rm -rf opentelemetry-java-instrumentation |
38 | 52 |
|
39 | | -contrib_version=$(awk -F'=v' '/OTEL_JAVA_CONTRIB_VERSION/ {print $2}' "$file") |
40 | | -if [[ -n "$contrib_version" ]]; then |
41 | | - echo "Found OTEL Contrib Version: ${contrib_version}" |
42 | | - ## Clone and Patch the OpenTelemetry Java contrib Repository |
43 | | - echo "Info: Cloning and Patching OpenTelemetry Java contrib Repository" |
44 | | - git clone https://github.com/open-telemetry/opentelemetry-java-contrib.git |
45 | | - pushd opentelemetry-java-contrib |
46 | | - git checkout v${contrib_version} -b tag-v${contrib_version} |
47 | | - |
48 | | - # There is another patch in the .github/patches directory for other changes. We should apply them too for consistency. |
49 | | - patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-contrib.patch |
50 | | - |
51 | | - ./gradlew publishToMavenLocal |
52 | | - popd |
53 | | - rm -rf opentelemetry-java-contrib |
54 | | -fi |
55 | | - |
56 | 53 | ## Build the ADOT Java from current source |
57 | 54 | echo "Info: Building ADOT Java from current source" |
58 | 55 | pushd "$SOURCEDIR"/.. |
|
0 commit comments