Use shadow plugin to generate bundled jars. (#2641)
* Use shadow plugin to generate bundled jars. * Update workflow * Fix workflow command
This commit is contained in:
		
							parent
							
								
									94955b958f
								
							
						
					
					
						commit
						393420dd1c
					
				| 
						 | 
				
			
			@ -36,6 +36,6 @@ jobs:
 | 
			
		|||
      - uses: burrunan/gradle-cache-action@v1.6
 | 
			
		||||
        with:
 | 
			
		||||
          remote-build-cache-proxy-enabled: false
 | 
			
		||||
          arguments: clean check fatJar
 | 
			
		||||
          arguments: clean check shadowJar
 | 
			
		||||
          build-root-directory: examples
 | 
			
		||||
      - run: java -cp examples/sdk-usage/build/libs/opentelemetry-examples-sdk-usage-all-0.1.0-SNAPSHOT.jar io.opentelemetry.sdk.example.ConfigureSpanProcessorExample
 | 
			
		||||
      - run: java -cp examples/sdk-usage/build/libs/opentelemetry-examples-sdk-usage-0.1.0-SNAPSHOT-all.jar io.opentelemetry.sdk.example.ConfigureSpanProcessorExample
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
plugins {
 | 
			
		||||
    id "com.diffplug.spotless"
 | 
			
		||||
    id "com.github.johnrengelman.shadow" apply false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
subprojects {
 | 
			
		||||
| 
						 | 
				
			
			@ -8,6 +9,7 @@ subprojects {
 | 
			
		|||
    apply plugin: 'java-library'
 | 
			
		||||
    apply plugin: 'idea'
 | 
			
		||||
    apply plugin: 'com.diffplug.spotless'
 | 
			
		||||
    apply plugin: 'com.github.johnrengelman.shadow'
 | 
			
		||||
 | 
			
		||||
    group = "io.opentelemetry"
 | 
			
		||||
    version = "0.1.0-SNAPSHOT"
 | 
			
		||||
| 
						 | 
				
			
			@ -39,11 +41,4 @@ subprojects {
 | 
			
		|||
            googleJavaFormat("1.9")
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //create a single Jar with all dependencies
 | 
			
		||||
    task fatJar(type: Jar) {
 | 
			
		||||
        archiveBaseName = project.name + '-all'
 | 
			
		||||
        from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
 | 
			
		||||
        with jar
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,17 +15,17 @@ and create a **Child Span**.
 | 
			
		|||
 | 
			
		||||
## 1 - Compile 
 | 
			
		||||
```shell script
 | 
			
		||||
../gradlew fatJar
 | 
			
		||||
../gradlew shadowJar
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 2 - Start the Server
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-grpc-all-0.1.0-SNAPSHOT.jar io.opentelemetry.example.grpc.HelloWorldServer
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-grpc-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.grpc.HelloWorldServer
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
## 3 - Start the normal Client
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-grpc-all-0.1.0-SNAPSHOT.jar io.opentelemetry.example.grpc.HelloWorldClient
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-grpc-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.grpc.HelloWorldClient
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 4 - Start the streamed Client
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,15 +16,15 @@ and create a **Child Span** with attached a **Span Event**.
 | 
			
		|||
 | 
			
		||||
## 1 - Compile 
 | 
			
		||||
```shell script
 | 
			
		||||
../gradlew fatJar
 | 
			
		||||
../gradlew shadowJar
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## 2 - Start the Server
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-http-all-0.1.0-SNAPSHOT.jar io.opentelemetry.example.http.HttpServer
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-http-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.http.HttpServer
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
## 3 - Start the Client
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-http-all-0.1.0-SNAPSHOT.jar io.opentelemetry.example.http.HttpClient
 | 
			
		||||
java -cp ./build/libs/opentelemetry-examples-http-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.http.HttpClient
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ to instrument a simple application using Jaeger as trace exporter.
 | 
			
		|||
 | 
			
		||||
## 1 - Compile 
 | 
			
		||||
```shell script
 | 
			
		||||
../gradlew fatJar
 | 
			
		||||
../gradlew shadowJar
 | 
			
		||||
```
 | 
			
		||||
## 2 - Run Jaeger
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ docker run --rm -it --name jaeger\
 | 
			
		|||
 | 
			
		||||
## 3 - Start the Application
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-jaeger-all-0.1.0-SNAPSHOT.jar io.opentelemetry.example.jaeger.JaegerExample localhost 14250
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-jaeger-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.jaeger.JaegerExample localhost 14250
 | 
			
		||||
```
 | 
			
		||||
## 4 - Open the Jaeger UI
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ These are collected by a Prometheus instance which is configured to pull these m
 | 
			
		|||
 | 
			
		||||
## 1 - Compile 
 | 
			
		||||
```shell script
 | 
			
		||||
../gradlew fatJar
 | 
			
		||||
../gradlew shadowJar
 | 
			
		||||
```
 | 
			
		||||
## 2 - Run Prometheus
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ docker run --network="host" --rm -it \
 | 
			
		|||
 | 
			
		||||
## 3 - Start the Application
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-prometheus-all-0.1.0-SNAPSHOT.jar io.opentelemetry.example.prometheus.PrometheusExample 19090
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-prometheus-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.prometheus.PrometheusExample 19090
 | 
			
		||||
```
 | 
			
		||||
## 4 - Open the Prometheus UI
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,15 +9,15 @@ This is a simple example that demonstrates how to use and configure the OpenTele
 | 
			
		|||
## Compile
 | 
			
		||||
Compile with 
 | 
			
		||||
```shell script
 | 
			
		||||
../gradlew fatJar
 | 
			
		||||
../gradlew shadowJar
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Run
 | 
			
		||||
 | 
			
		||||
The following commands are used to run the examples.
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-sdk-usage-all-0.1.0-SNAPSHOT.jar io.opentelemetry.sdk.example.ConfigureTraceExample
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-sdk-usage-0.1.0-SNAPSHOT-all.jar io.opentelemetry.sdk.example.ConfigureTraceExample
 | 
			
		||||
```
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-sdk-usage-all-0.1.0-SNAPSHOT.jar io.opentelemetry.sdk.example.ConfigureSpanProcessorExample
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-sdk-usage-0.1.0-SNAPSHOT-all.jar io.opentelemetry.sdk.example.ConfigureSpanProcessorExample
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
pluginManagement {
 | 
			
		||||
    plugins {
 | 
			
		||||
        id "com.diffplug.spotless" version "5.6.1"
 | 
			
		||||
        id "com.github.johnrengelman.shadow" version "6.1.0"
 | 
			
		||||
        id 'com.google.protobuf' version '0.8.8'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ to instrument a simple application using Zipkin as trace exporter.
 | 
			
		|||
 | 
			
		||||
## 1 - Compile 
 | 
			
		||||
```shell script
 | 
			
		||||
../gradlew fatJar
 | 
			
		||||
../gradlew shadowJar
 | 
			
		||||
```
 | 
			
		||||
## 2 - Run Zipkin
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ docker run --rm -it --name zipkin \
 | 
			
		|||
 | 
			
		||||
## 3 - Start the Application
 | 
			
		||||
```shell script
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-zipkin-all-0.1.0-SNAPSHOT.jar io.opentelemetry.example.zipkin.ZipkinExample localhost 9411
 | 
			
		||||
java -cp build/libs/opentelemetry-examples-zipkin-0.1.0-SNAPSHOT-all.jar io.opentelemetry.example.zipkin.ZipkinExample localhost 9411
 | 
			
		||||
```
 | 
			
		||||
## 4 - Open the Zipkin UI
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,17 +1,12 @@
 | 
			
		|||
plugins {
 | 
			
		||||
    id "java"
 | 
			
		||||
 | 
			
		||||
    id "com.github.johnrengelman.shadow"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
description = 'OpenTelemetry Integration Tests'
 | 
			
		||||
ext.moduleName = "io.opentelemetry.integration.tests"
 | 
			
		||||
 | 
			
		||||
// create a single Jar with all dependencies
 | 
			
		||||
task fatJar(type: Jar) {
 | 
			
		||||
    baseName = project.name + '-all'
 | 
			
		||||
    from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
 | 
			
		||||
    with jar
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
    implementation project(':sdk:all'),
 | 
			
		||||
            project(':exporters:jaeger'),
 | 
			
		||||
| 
						 | 
				
			
			@ -24,8 +19,8 @@ dependencies {
 | 
			
		|||
            "com.squareup.okhttp3:okhttp"
 | 
			
		||||
 | 
			
		||||
    tasks.withType(Test) {
 | 
			
		||||
        dependsOn fatJar
 | 
			
		||||
        systemProperty 'archive.name', fatJar.outputs.files[0].path
 | 
			
		||||
        dependsOn shadowJar
 | 
			
		||||
        systemProperty 'archive.name', shadowJar.archiveFile.get().asFile.absolutePath
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,19 +1,18 @@
 | 
			
		|||
plugins {
 | 
			
		||||
    id 'java'
 | 
			
		||||
 | 
			
		||||
    id "com.github.johnrengelman.shadow"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
description = 'OpenTelemetry W3C Context Propagation Integration Tests'
 | 
			
		||||
ext.moduleName = "io.opentelemetry.tracecontext.integration.tests"
 | 
			
		||||
 | 
			
		||||
shadowJar {
 | 
			
		||||
    archiveFileName = 'tracecontext-tests.jar'
 | 
			
		||||
 | 
			
		||||
// create a single Jar with all dependencies
 | 
			
		||||
task fatJar(type: Jar) {
 | 
			
		||||
    manifest {
 | 
			
		||||
        attributes 'Main-Class': 'io.opentelemetry.Application'
 | 
			
		||||
    }
 | 
			
		||||
    archiveName = 'tracecontext-tests.jar'
 | 
			
		||||
    from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
 | 
			
		||||
    with jar
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ git clone https://github.com/w3c/trace-context ./target/trace-context
 | 
			
		|||
cd ./target/trace-context && git checkout $TRACECONTEXT_GIT_TAG && cd -
 | 
			
		||||
pip3 install setuptools;
 | 
			
		||||
pip3 install aiohttp;
 | 
			
		||||
../../gradlew fatJar
 | 
			
		||||
../../gradlew shadowJar
 | 
			
		||||
java -jar build/libs/tracecontext-tests.jar 1>&2 &
 | 
			
		||||
EXAMPLE_SERVER_PID=$!
 | 
			
		||||
# give the app server a little time to start up. Not adding some sort
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ pluginManagement {
 | 
			
		|||
    plugins {
 | 
			
		||||
        id "com.diffplug.spotless" version "5.9.0"
 | 
			
		||||
        id "com.github.ben-manes.versions" version "0.36.0"
 | 
			
		||||
        id "com.github.johnrengelman.shadow" version "6.1.0"
 | 
			
		||||
        id "com.google.protobuf" version "0.8.14"
 | 
			
		||||
        id "de.marcphilipp.nexus-publish" version "0.4.0"
 | 
			
		||||
        id "de.undercouch.download" version "4.1.1"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue