Skip to content

add version.gradle.kts #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ nebulaRelease {
addReleaseBranchPattern("""v\d+\.\d+\.x""")
}

apply(from = "version.gradle.kts")

nexusPublishing {
repositories {
sonatype {
Expand Down Expand Up @@ -71,7 +73,7 @@ allprojects {
ktlint("1.4.0").editorConfigOverride(mapOf("indent_size" to "2", "continuation_indent_size" to "2"))

// Doesn't support pluginManagement block
targetExclude("settings.gradle.kts")
targetExclude("settings.gradle.kts", "version.gradle.kts")

if (!project.path.startsWith(":sample-apps:")) {
licenseHeaderFile("${rootProject.projectDir}/config/license/header.java", "plugins|include|import")
Expand Down
17 changes: 12 additions & 5 deletions lambda-layer/build-layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ set -e
SOURCEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"


## Get ADOT version
echo "Info: Getting ADOT Version"
pushd "$SOURCEDIR"/..
version=$(./gradlew -q printVersion)
echo "Found ADOT Version: ${version}"
popd

## Get OTel version
echo "Info: Getting OTEL Version"
file="$SOURCEDIR/../.github/patches/versions"
version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file")
echo "Found OTEL Version: ${version}"
otel_instrumentation_version=$(awk -F'=v' '/OTEL_JAVA_INSTRUMENTATION_VERSION/ {print $2}' "$file")
echo "Found OTEL Version: ${otel_instrumentation_version}"
# Exit if the version is empty or null
if [[ -z "$version" ]]; then
if [[ -z "$otel_instrumentation_version" ]]; then
echo "Error: Version could not be found in ${file}."
exit 1
fi
Expand All @@ -20,7 +27,7 @@ fi
echo "Info: Cloning and Patching OpenTelemetry Java Instrumentation Repository"
git clone https://github.com/open-telemetry/opentelemetry-java-instrumentation.git
pushd opentelemetry-java-instrumentation
git checkout v${version} -b tag-v${version}
git checkout v${otel_instrumentation_version} -b tag-v${otel_instrumentation_version}

# There is another patch in the .github/patches directory for other changes. We should apply them too for consistency.
patch -p1 < "$SOURCEDIR"/../.github/patches/opentelemetry-java-instrumentation.patch
Expand Down Expand Up @@ -61,7 +68,7 @@ popd

## Build ADOT Lambda Java SDK Layer Code
echo "Info: Building ADOT Lambda Java SDK Layer Code"
./gradlew build -PotelVersion=${version}
./gradlew build -PotelVersion=${otel_instrumentation_version} -Pversion=${version}


## Copy ADOT Java Agent downloaded using Gradle task and bundle it with the Lambda handler script
Expand Down
3 changes: 2 additions & 1 deletion lambda-layer/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ val javaagentDependency by configurations.creating {
extendsFrom()
}

val version: String by project
val otelVersion: String by project

dependencies {
Expand All @@ -35,7 +36,7 @@ dependencies {
// Already included in wrapper so compileOnly
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-aws")
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:$otelVersion-adot-lambda1")
javaagentDependency("software.amazon.opentelemetry:aws-opentelemetry-agent:$version-adot-lambda1")
}

tasks.register<Copy>("download") {
Expand Down
24 changes: 24 additions & 0 deletions version.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Amazon.com, Inc. or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

val adotVersion = "2.11.1-dev0"

allprojects {
version = if (project.hasProperty("release.version")) {
project.property("release.version") as String
} else {
adotVersion
}
}
Loading