Skip to content

Commit

Permalink
Adds Graal hints for the shaded dependencies (#4832)
Browse files Browse the repository at this point in the history
* Adds Graal hints for the shaded dependencies

* Moved the file to the proper location

* Added Graal VM Github Action build

* Polish

* Updated graal plugin

* Updated graal plugin to 0.9.14

* Updated graal native plugin

* Applied changes following the review
  • Loading branch information
marcingrzejszczak committed Oct 18, 2022
1 parent db1d065 commit 9a1996c
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/build-graal.yml
@@ -0,0 +1,20 @@
name: GraalVM Community Edition build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '11'
components: 'native-image'
- name: Running test
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
gu --version
native-image --version
./gradlew nativeTest
29 changes: 29 additions & 0 deletions integration-tests/graal/build.gradle.kts
@@ -0,0 +1,29 @@
plugins {
id("otel.java-conventions")
id("org.graalvm.buildtools.native")
}

description = "OpenTelemetry Graal Integration Tests"
otelJava.moduleName.set("io.opentelemetry.graal.integration.tests")

sourceSets {
main {
// We need to ensure that we have the shadowed classes on the classpath, without this
// we will get the <:sdk:trace-shaded-deps> classes only, without the shadowed ones
val traceShadedDeps = project(":sdk:trace-shaded-deps")
output.dir(traceShadedDeps.file("build/extracted/shadow"), "builtBy" to ":sdk:trace-shaded-deps:extractShadowJar")
}
}

dependencies {
implementation(project(path = ":sdk:trace-shaded-deps"))
}

graalvmNative {
binaries {
named("main") {
verbose.set(true)
}
}
toolchainDetection.set(false)
}
@@ -0,0 +1,2 @@
org.slf4j.simpleLogger.defaultLogLevel=info
org.slf4j.simpleLogger.log.org.eclipse.jetty=warn
@@ -0,0 +1,26 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.integrationtests.graal;

import static org.assertj.core.api.Assertions.assertThat;

import io.opentelemetry.sdk.trace.internal.JcTools;
import java.util.Queue;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;

class JcToolsTest {

@Test
@EnabledInNativeImage
void insert_oneElementToTheQueue() {
Queue<Object> objects = JcTools.newFixedSizeQueue(10);

objects.add(new Object());

assertThat(objects).hasSize(1);
}
}
@@ -0,0 +1,35 @@
[
{
"condition": {
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueConsumerIndexField"
},
"name": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueConsumerIndexField",
"fields": [
{
"name": "consumerIndex"
}
]
},
{
"condition": {
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField"
},
"name": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField",
"fields": [
{
"name": "producerIndex"
}
]
},
{
"condition": {
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerLimitField"
},
"name": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerLimitField",
"fields": [
{
"name": "producerLimit"
}
]
}
]
2 changes: 2 additions & 0 deletions settings.gradle.kts
Expand Up @@ -5,6 +5,7 @@ pluginManagement {
id("com.gradle.enterprise") version "3.11.2"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("org.jetbrains.kotlin.jvm") version "1.7.20"
id("org.graalvm.buildtools.native") version "0.9.14"
}
}

Expand Down Expand Up @@ -47,6 +48,7 @@ include(":exporters:zipkin")
include(":integration-tests")
include(":integration-tests:otlp")
include(":integration-tests:tracecontext")
include(":integration-tests:graal")
include(":opencensus-shim")
include(":opentracing-shim")
include(":perf-harness")
Expand Down

0 comments on commit 9a1996c

Please sign in to comment.