Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Generate protos #4

Merged
merged 11 commits into from
Oct 11, 2022
Merged
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
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* text=auto eol=lf

*.bat text eol=crlf
*.cmd text eol=crlf

*.jar -text
*.png -text

36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,39 @@

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

# Gradle
build
.gradle
local.properties
out/

# Maven (proto)
target

# IntelliJ IDEA
.idea
*.iml

# Eclipse
.classpath
.project
.settings
bin

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

# VS Code
.vscode

# OS X
.DS_Store

# Emacs
*~
\#*\#

# Vim
.swp
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "opamp-spec"]
path = opamp-spec
url = [email protected]:open-telemetry/opamp-spec.git
branch = v0.6.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with .gitmodules files, but the info in here points to the wrong repository. We don't have these files in opentelemetry-java or opentelemetry-java-instrumentation. Care to summarize their purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the opamp-spec repo is used to get the proto definitions, as suggested in the issue. Here I set up a submodule and pinned it to the latest release.

8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id("otel.java-conventions")
}

repositories {
mavenCentral()
mavenLocal()
}
13 changes: 13 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
gradlePluginPortal()
mavenLocal()
}

dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:5.16.0")
}
88 changes: 88 additions & 0 deletions buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

plugins {
`java-library`

eclipse
idea

id("otel.spotless-conventions")
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}

withJavadocJar()
withSourcesJar()
}

tasks {
withType<JavaCompile>().configureEach {
with(options) {
release.set(8)

//disable deprecation warnings for the protobuf module
compilerArgs.add("-Xlint:-deprecation")

encoding = "UTF-8"
}
}

withType<Test>().configureEach {
useJUnitPlatform()

testLogging {
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
maxHeapSize = "1500m"
}

withType<Javadoc>().configureEach {
exclude("io/opentelemetry/**/internal/**")

with(options as StandardJavadocDocletOptions) {
source = "8"
encoding = "UTF-8"
docEncoding = "UTF-8"
breakIterator(true)

addBooleanOption("html5", true)

links("https://docs.oracle.com/javase/8/docs/api/")
addBooleanOption("Xdoclint:all,-missing", true)
}
}

withType<Jar>().configureEach {
manifest {
attributes(
"Automatic-Module-Name" to "io.opentelemetry.proto",
"Built-By" to System.getProperty("user.name"),
"Built-JDK" to System.getProperty("java.version"),
"Implementation-Title" to project.name,
"Implementation-Version" to project.version)
}
}

afterEvaluate {
withType<Javadoc>().configureEach {
with(options as StandardJavadocDocletOptions) {
val title = "${project.description}"
docTitle = title
windowTitle = title
}
}
}
}

configurations.configureEach {
resolutionStrategy {
failOnVersionConflict()
preferProjectModules()
}
}
47 changes: 47 additions & 0 deletions buildSrc/src/main/kotlin/otel.spotless-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
plugins {
id("com.diffplug.spotless")
}

spotless {
java {
googleJavaFormat()
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|public|// Includes work from:)")
target("src/**/*.java")
}
plugins.withId("groovy") {
groovy {
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|class)")
}
}
plugins.withId("scala") {
scala {
scalafmt()
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|public)")
target("src/**/*.scala")
}
}
plugins.withId("org.jetbrains.kotlin.jvm") {
kotlin {
ktlint().userData(mapOf("indent_size" to "2", "continuation_indent_size" to "2", "disabled_rules" to "no-wildcard-imports"))
licenseHeaderFile(rootProject.file("buildscripts/spotless.license.java"), "(package|import|class|// Includes work from:)")
}
}
kotlinGradle {
ktlint().userData(mapOf("indent_size" to "2", "continuation_indent_size" to "2", "disabled_rules" to "no-wildcard-imports"))
}
format("misc") {
// not using "**/..." to help keep spotless fast
target(
".gitattributes",
".gitconfig",
".editorconfig",
"*.md",
"src/**/*.md",
"docs/**/*.md",
"*.sh",
"src/**/*.properties")
indentWithSpaces()
trimTrailingWhitespace()
endWithNewline()
}
}
5 changes: 5 additions & 0 deletions buildscripts/spotless.license.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

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-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading