Skip to content

Commit

Permalink
Initial gradle project
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Fitzpatrick committed Aug 19, 2020
1 parent 2bef20a commit d23263b
Show file tree
Hide file tree
Showing 19 changed files with 570 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
45 changes: 36 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,41 @@
# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# IntelliJ
*.idea
*.iml

# Gradle
build
.gradle
local.properties
out/

# Maven (proto)
target

# Eclipse
.classpath
.project
.settings
bin

# NetBeans
/.nb-gradle
/.nb-gradle-properties

# VS Code
.vscode

# etc
.DS_Store

# Emacs
*~
\#*\#

# Vim
.swp
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.DEFAULT_GOAL := build

.PHONY: build
build:
./gradlew build

.PHONY: lint
lint:
./gradlew spotlessApply

.PHONY: check
check:
./gradlew spotlessCheck

.PHONY: clean
clean:
./gradlew clean
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# OpenTelemetry Java Contrib

This project is intended to provide helpful libraries and standalone OpenTelemetry-based utilities that don't fit
the express scope of the [OpenTelemetry Java](https://github.com/open-telemetry/opentelemetry-java) or
[Java Instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation) projects. If you need an
easier way to bring observability to remote JVM-based applications and workflows that isn't easily satisfied by an SDK
feature or via bytecode instrumentation, this project is hopefully for you.

*This project is in its early stages and doesn't provide any assurances of stability or production readiness.*

## Getting Started

```bash
# Build the complete project
$ make build

# Clean artifacts
$ make clean

# Apply formatting
$ make lint
```

## Contributing

The Java Contrib project was initially formed to provide methods of easy remote JMX metric gathering and reporting,
which is actively in development. If you have an idea for a similar use case in the metrics, traces, or logging
domain we would be very interested in supporting it. Please
[open an issue](https://github.com/open-telemetry/opentelemetry-java-contrib/issues/new/choose) to share your idea or
suggestion. PRs are always welcome and greatly appreciated, but for larger functional changes a pre-coding introduction
can be helpful to ensure this is the correct place and that active or conflicting efforts don't exist.

## Owners

- [Anuraag Agrawal](https://github.com/anuraaga), AWS
- [Pablo Collins](https://github.com/pmcollins), Splunk
- [Ryan Fitzpatrick](https://github.com/rmfitzpatrick), Splunk (maintainer)
- [Trask Stalnaker](https://github.com/trask), Microsoft

For more information on the OpenTelemetry community please see the
[community content project](https://github.com/open-telemetry/community).
21 changes: 21 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id 'com.diffplug.spotless' version '5.1.1'
}

description = 'OpenTelemetry Contrib libraries and utilities for the JVM'

allprojects {
group = 'io.opentelemetry.contrib'
version = '0.0.1'

apply from: "$rootDir/gradle/spotless.gradle"
apply from: "$rootDir/gradle/dependencies.gradle"

it.ext.contrib = "$rootDir/gradle/contrib.gradle"

repositories {
mavenLocal()
jcenter()
mavenCentral()
}
}
3 changes: 3 additions & 0 deletions contrib/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example Library

This is an example library intended to be used as a template for easy additions to the OpenTelemetry Java Contrib project.
9 changes: 9 additions & 0 deletions contrib/example/example.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apply from: project.contrib

description = 'An example OpenTelemetry Java Contrib library'

jar {
manifest {
attributes('Main-Class': 'io.opentelemetry.contrib.example.Library')
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/

package io.opentelemetry.contrib.example;

public class Library {

public boolean myMethod() {
return true;
}

public static void main(String... args) {
System.out.println("ExampleLibrary.main");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/

package io.opentelemetry.contrib.example

import spock.lang.Specification

class LibraryTest extends Specification {

def 'testSomeLibraryMethod'() {
when: 'we create Library instance'
def classUnderTest = new Library()

then: 'it provides its method'
classUnderTest.myMethod() == true
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.daemon=false
org.gradle.parallel=true
22 changes: 22 additions & 0 deletions gradle/contrib.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apply plugin: 'java'
apply plugin: 'groovy'

ext.releaseJavaVersion = JavaVersion.VERSION_1_7
ext.testJavaVersion = JavaVersion.VERSION_1_8

java {
archivesBaseName = "${rootProject.name}-${project.name}"
sourceCompatibility = project.releaseJavaVersion
targetCompatibility = project.releaseJavaVersion
withJavadocJar()
withSourcesJar()
}

compileTestJava {
sourceCompatibility = project.testJavaVersion
targetCompatibility = project.testJavaVersion
}

dependencies {
testImplementation project.libraries.spock
}
23 changes: 23 additions & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ext {
versions = [
otelStable : '0.7.1'
]

libraries = [
// otel
otelApi : "io.opentelemetry:opentelemetry-api:${versions.otelStable}",
otelSdk : "io.opentelemetry:opentelemetry-sdk:${versions.otelStable}",
otelExporterInMemory : "io.opentelemetry:opentelemetry-exporters-inmemory:${versions.otelStable}",
otelExporterJaeger : "io.opentelemetry:opentelemetry-exporters-jaeger:${versions.otelStable}",
otelExporterLogging : "io.opentelemetry:opentelemetry-exporters-logging:${versions.otelStable}",
otelExporterOtlp : "io.opentelemetry:opentelemetry-exporters-otlp:${versions.otelStable}",
otelExporterPrometheus : "io.opentelemetry:opentelemetry-exporters-prometheus:${versions.otelStable}",
otelExporterZipkin : "io.opentelemetry:opentelemetry-exporters-zipkin:${versions.otelStable}",
otelProto : "io.opentelemetry:opentelemetry-proto:${versions.otelStable}",

// testing
spock : dependencies.create('org.spockframework:spock-core:1.3-groovy-2.5', {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
})
]
}
16 changes: 16 additions & 0 deletions gradle/java.license.header
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/

30 changes: 30 additions & 0 deletions gradle/spotless.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apply plugin: 'com.diffplug.spotless'
apply plugin: 'groovy'

spotless {
format 'misc', {
target '**/*.md', '.gitignore'
indentWithSpaces(20)
trimTrailingWhitespace()
endWithNewline()
}
java {
target '**/src/*/java/**/*.java'
googleJavaFormat()
indentWithSpaces()
licenseHeaderFile rootProject.file('gradle/java.license.header'), '(package|import|public)'
}
groovy {
target '**/*.groovy'
greclipse()
indentWithSpaces()
licenseHeaderFile rootProject.file('gradle/java.license.header'), '(package|import|class)'
}
groovyGradle {
target '**/*.gradle'
greclipse()
indentWithSpaces()
}
}

check.dependsOn 'spotlessCheck'
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit d23263b

Please sign in to comment.