From c3261b427e09a59fd1928bd5b158516b8be46d05 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Tue, 1 Dec 2020 13:23:03 +0900 Subject: [PATCH] Replace git submodules for protos with download of archive file. (#2160) * Replace git submodules for protos with download of archive file. * Add docs for proto and remove junk --- .github/workflows/master-build.yml | 2 -- .github/workflows/patch-release-build.yml | 3 -- .github/workflows/pr-build.yml | 1 - .github/workflows/pr-examples-build.yml | 2 -- .github/workflows/release-build.yml | 2 -- .gitmodules | 3 -- CONTRIBUTING.md | 20 ++++++++---- proto/build.gradle | 39 +++++++++++++++++++++++ proto/src/main/proto | 1 - settings.gradle | 1 + 10 files changed, 53 insertions(+), 21 deletions(-) delete mode 100644 .gitmodules delete mode 160000 proto/src/main/proto diff --git a/.github/workflows/master-build.yml b/.github/workflows/master-build.yml index 18b867356c..e0dd7a0626 100644 --- a/.github/workflows/master-build.yml +++ b/.github/workflows/master-build.yml @@ -22,7 +22,6 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - submodules: true - id: setup-java-8 name: Setup Java 8 uses: actions/setup-java@v1 @@ -51,7 +50,6 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - submodules: true - id: setup-java-11 name: Setup Java 11 uses: actions/setup-java@v1 diff --git a/.github/workflows/patch-release-build.yml b/.github/workflows/patch-release-build.yml index ea5ea1b4d5..98ac761f0e 100644 --- a/.github/workflows/patch-release-build.yml +++ b/.github/workflows/patch-release-build.yml @@ -49,7 +49,6 @@ jobs: uses: actions/checkout@v2 with: ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }} - submodules: true - uses: actions/setup-java@v1 with: java-version: 11 @@ -84,8 +83,6 @@ jobs: - run: git push - name: Checkout master uses: actions/checkout@v2 - with: - submodules: true - uses: burrunan/gradle-cache-action@v1.5 with: job-id: jdk11 diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 0e34952889..177e4dcf50 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -22,7 +22,6 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - submodules: true - id: setup-java-8 name: Setup Java 8 uses: actions/setup-java@v1 diff --git a/.github/workflows/pr-examples-build.yml b/.github/workflows/pr-examples-build.yml index 1712be68cc..eff7744f31 100644 --- a/.github/workflows/pr-examples-build.yml +++ b/.github/workflows/pr-examples-build.yml @@ -21,8 +21,6 @@ jobs: coverage: true steps: - uses: actions/checkout@v2 - with: - submodules: true - id: setup-java-8 name: Setup Java 8 uses: actions/setup-java@v1 diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 362fb7e9dc..bc2060a5ec 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -13,8 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: - submodules: true - uses: actions/setup-java@v1 with: java-version: 11 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index bf5cae3ad3..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "proto/src/main/proto"] - path = proto/src/main/proto - url = https://github.com/open-telemetry/opentelemetry-proto.git diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c5be0e003..16411eb806 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,14 +28,9 @@ types of static analysis. The tests that require docker are disabled if docker is not present. If you wish to run them, you must run a local docker daemon. -2. Clone the repository recursively +2. Clone the repository - `git clone https://github.com/open-telemetry/opentelemetry-java.git --recursive` - -or alternatively initialize submodules for an existing clone. - - `git submodule init` - `git submodule update` + `git clone https://github.com/open-telemetry/opentelemetry-java.git` 3. Run the following commands to build, run tests and most static analysis, and check formatting: @@ -116,3 +111,14 @@ It does not support all required rules, so you still have to run `spotlessApply` ### Unit Tests * Unit tests target Java 8, so language features such as lambda and streams can be used in tests. + +## Common tasks + +### Updating OTLP proto dependency version + +The OTLP proto dependency version is defined [here](proto/build.gradle). To bump the version, + +1. Find the latest release version [here](https://github.com/open-telemetry/opentelemetry-proto/releases/latest) +2. Download the zip source code archive +3. Run `shasum -a 256 ~/path/to/downloaded.zip` to compute its checksum +4. Update `protoVersion` and `protoChecksum` in the build file with the new version and checksum \ No newline at end of file diff --git a/proto/build.gradle b/proto/build.gradle index 279de9534d..d842390b8c 100644 --- a/proto/build.gradle +++ b/proto/build.gradle @@ -3,6 +3,7 @@ plugins { id "maven-publish" id "com.google.protobuf" + id "de.undercouch.download" id "ru.vyarus.animalsniffer" } @@ -43,6 +44,44 @@ protobuf { } } +def protoVersion = "0.6.0" +// To generate checksum, download the file and run "shasum -a 256 ~/path/to/vfoo.zip" +def protoChecksum = "a40003d50a565c989283d6b5b93b6189c28378387b715bdd54bf4600bb9c17c1" +def protoArchivePath = "$buildDir/archives/opentelemetry-proto-${protoVersion}.zip" + +def downloadProtoArchive = tasks.register("downloadProtoArchive", Download) { + onlyIf { !file(protoArchivePath).exists() } + src "https://github.com/open-telemetry/opentelemetry-proto/archive/v${protoVersion}.zip" + dest protoArchivePath +} + +def verifyProtoArchive = tasks.register("verifyProtoArchive", Verify) { + dependsOn(downloadProtoArchive) + src protoArchivePath + algorithm "SHA-256" + checksum protoChecksum +} + +def unzipProtoArchive = tasks.register("unzipProtoArchive", Copy) { + dependsOn(verifyProtoArchive) + from zipTree(protoArchivePath) + into "$buildDir/protos" +} + +sourceSets { + main { + proto { + srcDir "$buildDir/protos/opentelemetry-proto-${protoVersion}" + } + } +} + +afterEvaluate { + tasks.named("generateProto") { + dependsOn(unzipProtoArchive) + } +} + // IntelliJ complains that the generated classes are not found, ask IntelliJ to include the // generated Java directories as source folders. idea { diff --git a/proto/src/main/proto b/proto/src/main/proto deleted file mode 160000 index 59c488bfb8..0000000000 --- a/proto/src/main/proto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 59c488bfb8fb6d0458ad6425758b70259ff4a2bd diff --git a/settings.gradle b/settings.gradle index d0f6212d81..496238b5ab 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,7 @@ pluginManagement { id "com.google.protobuf" version "0.8.14" id "com.jfrog.artifactory" version "4.18.0" id "com.jfrog.bintray" version "1.8.5" + id "de.undercouch.download" version "4.1.1" id "io.morethan.jmhreport" version "0.9.0" id "me.champeau.gradle.jmh" version "0.5.2" id "nebula.release" version "15.3.0"