Skip to content

Commit

Permalink
Replace git submodules for protos with download of archive file. (#2160)
Browse files Browse the repository at this point in the history
* Replace git submodules for protos with download of archive file.

* Add docs for proto and remove junk
  • Loading branch information
Anuraag Agrawal authored Dec 1, 2020
1 parent 09d371b commit c3261b4
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 21 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/patch-release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pr-examples-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

20 changes: 13 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
39 changes: 39 additions & 0 deletions proto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id "maven-publish"

id "com.google.protobuf"
id "de.undercouch.download"
id "ru.vyarus.animalsniffer"
}

Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion proto/src/main/proto
Submodule proto deleted from 59c488
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c3261b4

Please sign in to comment.