diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 5d4361f9c..dbf50d8a0 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -105,7 +105,7 @@ jobs: run: .\scripts\getLatestVersion.ps1 shell: pwsh - name: Create tag - uses: rickstaa/action-create-tag@v1.6.4 + uses: rickstaa/action-create-tag@v1.6.6 with: tag: ${{ steps.GetVersion.outputs.tag }} - name: Queue Git Release diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index c7b367340..02a328912 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -8,8 +8,24 @@ on: - feature/v2 pull_request: types: [opened, synchronize, reopened] + +env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + jobs: + checksecret: + name: check if SONAR_TOKEN is set in github secrets + runs-on: ubuntu-latest + outputs: + is_SONAR_TOKEN_set: ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }} + steps: + - name: Check whether unity activation requests should be done + id: checksecret_job + run: | + echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT build: + needs: [checksecret] + if: needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true' name: Build runs-on: ubuntu-latest steps: @@ -37,5 +53,4 @@ jobs: - name: Build and analyze env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: ./gradlew build sonarqube --info diff --git a/CHANGELOG.md b/CHANGELOG.md index 27061f84c..b040e5bcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Changed + +## [2.0.21] - 2023-11-08 + +### Changed + +- Changed CoreHttpProvider dependency from OkHttpClient to Call.Factory (parent interface implemented by OkHttpClient). This make usage of OpenTelemetry tracing possible. + https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/okhttp/okhttp-3.0/library/README.md + +```java + private Call.Factory createTracedClient(OpenTelemetry openTelemetry, @Nonnull final IAuthenticationProvider auth) { + return OkHttpTelemetry.builder(openTelemetry).build().newCallFactory(createClient(auth)); + } + + private OkHttpClient createClient(@Nonnull final IAuthenticationProvider auth) { + return HttpClients.createDefault(auth); + } + + // then create the GraphServiceClient + IAuthenticationProvider authenticationProvider = ...; + GraphServiceClient + .builder(Call.Factory.class, Request.class) + .httpClient(createTracedClient(openTelemetry, authenticationProvider)) + .authenticationProvider(authenticationProvider) + .buildClient(); +``` + ## [2.0.20] - 2023-10-23 ### Changed diff --git a/android/build.gradle b/android/build.gradle index cbd451570..4793db785 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -9,7 +9,7 @@ buildscript { dependencies { classpath "com.gradle:gradle-enterprise-gradle-plugin:3.15.1" - classpath "com.android.tools.build:gradle:8.1.2" + classpath "com.android.tools.build:gradle:8.1.3" classpath "com.github.ben-manes:gradle-versions-plugin:0.49.0" } } diff --git a/build.gradle b/build.gradle index 608fda594..de29f9202 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { id 'maven-publish' id 'signing' id 'jacoco' - id 'com.github.spotbugs' version '5.2.1' + id 'com.github.spotbugs' version '5.2.3' id "org.sonarqube" version "4.4.1.3373" } diff --git a/gradle.properties b/gradle.properties index c270067b9..11030eaf9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,7 +25,7 @@ mavenGroupId = com.microsoft.graph mavenArtifactId = microsoft-graph-core mavenMajorVersion = 2 mavenMinorVersion = 0 -mavenPatchVersion = 20 +mavenPatchVersion = 21 mavenArtifactSuffix = #These values are used to run functional tests diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index e30e65e23..ed256e9e5 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -1,8 +1,8 @@ dependencies { // Use JUnit test framework - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.1' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.1' testImplementation 'org.mockito:mockito-inline:5.2.0' api 'com.squareup.okhttp3:okhttp:4.12.0' @@ -10,7 +10,7 @@ dependencies { implementation 'com.google.guava:guava:32.1.3-jre' implementation 'com.google.code.gson:gson:2.10.1' - api 'com.azure:azure-core:1.44.1' + api 'com.azure:azure-core:1.45.0' - api 'com.github.spotbugs:spotbugs-annotations:4.8.0' + api 'com.github.spotbugs:spotbugs-annotations:4.8.1' } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 59f07acda..1cb75d8a2 100644 --- a/pom.xml +++ b/pom.xml @@ -35,18 +35,18 @@ com.azure azure-core - 1.44.1 + 1.45.0 org.junit.jupiter junit-jupiter-api - 5.10.0 + 5.10.1 test org.junit.jupiter junit-jupiter-params - 5.10.0 + 5.10.1 test @@ -58,7 +58,7 @@ com.github.spotbugs spotbugs-annotations - 4.8.0 + 4.8.1 diff --git a/samples/deviceCodeSample/build.gradle b/samples/deviceCodeSample/build.gradle index 9271f2dbb..5d56bb63b 100644 --- a/samples/deviceCodeSample/build.gradle +++ b/samples/deviceCodeSample/build.gradle @@ -12,5 +12,5 @@ repositories { dependencies { testImplementation group: 'junit', name: 'junit', version: '4.13.2' implementation project(':coreLibrary') - implementation 'com.azure:azure-identity:1.10.4' + implementation 'com.azure:azure-identity:1.11.0' } diff --git a/samples/interactiveBrowserSample/build.gradle b/samples/interactiveBrowserSample/build.gradle index 9271f2dbb..5d56bb63b 100644 --- a/samples/interactiveBrowserSample/build.gradle +++ b/samples/interactiveBrowserSample/build.gradle @@ -12,5 +12,5 @@ repositories { dependencies { testImplementation group: 'junit', name: 'junit', version: '4.13.2' implementation project(':coreLibrary') - implementation 'com.azure:azure-identity:1.10.4' + implementation 'com.azure:azure-identity:1.11.0' } diff --git a/src/main/java/com/microsoft/graph/core/BaseClient.java b/src/main/java/com/microsoft/graph/core/BaseClient.java index cbdbac4e7..27382a382 100644 --- a/src/main/java/com/microsoft/graph/core/BaseClient.java +++ b/src/main/java/com/microsoft/graph/core/BaseClient.java @@ -41,6 +41,7 @@ import javax.annotation.Nonnull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import okhttp3.Call; import okhttp3.OkHttpClient; import okhttp3.Request; @@ -185,7 +186,7 @@ private httpClientType getHttpClient() { @SuppressWarnings("unchecked") private IHttpProvider getHttpProvider() { if(httpProvider == null) { - return (IHttpProvider)new CoreHttpProvider(getSerializer(), getLogger(), (OkHttpClient)getHttpClient()); + return (IHttpProvider)new CoreHttpProvider(getSerializer(), getLogger(), (Call.Factory) getHttpClient()); } else { return httpProvider; } diff --git a/src/main/java/com/microsoft/graph/http/CoreHttpProvider.java b/src/main/java/com/microsoft/graph/http/CoreHttpProvider.java index 7dea22c18..31f357643 100644 --- a/src/main/java/com/microsoft/graph/http/CoreHttpProvider.java +++ b/src/main/java/com/microsoft/graph/http/CoreHttpProvider.java @@ -98,9 +98,9 @@ public class CoreHttpProvider implements IHttpProvider { private final ILogger logger; /** - * The OkHttpClient that handles all requests + * The OkHttpClient(Call.Factory) that handles all requests */ - private OkHttpClient corehttpClient; + private Call.Factory corehttpClient; /** * Creates the CoreHttpProvider @@ -112,7 +112,7 @@ public class CoreHttpProvider implements IHttpProvider { @SuppressFBWarnings public CoreHttpProvider(@Nonnull final ISerializer serializer, @Nonnull final ILogger logger, - @Nonnull final OkHttpClient httpClient) { + @Nonnull final Call.Factory httpClient) { Objects.requireNonNull(logger, "parameter logger cannot be null"); Objects.requireNonNull(serializer, "parameter serializer cannot be null"); Objects.requireNonNull(httpClient, "parameter httpClient cannot be null");