Skip to content

Commit

Permalink
[release/9.0] Use MacOS-13 in CI (#58546)
Browse files Browse the repository at this point in the history
* Use MacOS-13 in CI

* Gradle 6.9

* Update gradle-wrapper.properties

* Update gradle-wrapper.properties

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Update build.gradle

* Fixup gradle

---------

Co-authored-by: William Godbe <wigodbe@microsoft.com>
Co-authored-by: Brennan <brecon@microsoft.com>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent 6cdcff9 commit ff8e369
Show file tree
Hide file tree
Showing 10 changed files with 157 additions and 96 deletions.
12 changes: 6 additions & 6 deletions .azure/pipelines/jobs/default-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
# See https://github.com/dotnet/arcade/blob/master/Documentation/ChoosingAMachinePool.md
pool:
${{ if eq(parameters.agentOs, 'macOS') }}:
vmImage: macOS-12
vmImage: macOS-13
${{ if eq(parameters.agentOs, 'Linux') }}:
${{ if eq(parameters.useHostedUbuntu, true) }}:
vmImage: ubuntu-20.04
Expand Down Expand Up @@ -164,8 +164,8 @@ jobs:
- script: df -h
displayName: Disk size
- ${{ if eq(parameters.agentOs, 'macOS') }}:
- script: sudo xcode-select -s /Applications/Xcode_14.2.0.app/Contents/Developer
displayName: Use XCode 14.2.0
- script: sudo xcode-select -s /Applications/Xcode_15.2.0.app/Contents/Developer
displayName: Use XCode 15.2.0
- checkout: self
clean: true
- ${{ if and(eq(parameters.agentOs, 'Windows'), eq(parameters.isAzDOTestingJob, true)) }}:
Expand Down Expand Up @@ -323,7 +323,7 @@ jobs:
pool:
${{ if eq(parameters.agentOs, 'macOS') }}:
name: Azure Pipelines
image: macOS-12
image: macOS-13
os: macOS
${{ if eq(parameters.agentOs, 'Linux') }}:
name: $(DncEngInternalBuildPool)
Expand Down Expand Up @@ -391,8 +391,8 @@ jobs:
- script: df -h
displayName: Disk size
- ${{ if eq(parameters.agentOs, 'macOS') }}:
- script: sudo xcode-select -s /Applications/Xcode_14.2.0.app/Contents/Developer
displayName: Use XCode 14.2.0
- script: sudo xcode-select -s /Applications/Xcode_15.2.0.app/Contents/Developer
displayName: Use XCode 15.2.0
- checkout: self
clean: true
- ${{ if and(eq(parameters.agentOs, 'Windows'), eq(parameters.isAzDOTestingJob, true)) }}:
Expand Down
4 changes: 2 additions & 2 deletions eng/targets/Java.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

<Target Name="Pack" Condition="'$(IsPackable)' == 'true'" DependsOnTargets="$(PackDependsOn)">
<Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Pack" />
<Message Text="> gradlew $(GradleOptions) createPackage" Importance="high" />
<Exec Command="../gradlew $(GradleOptions) createPackage" />
<Message Text="> gradlew $(GradleOptions) publishToMavenLocal" Importance="high" />
<Exec Command="../gradlew $(GradleOptions) publishToMavenLocal" />
<Message Importance="high" Text="$(PackageId) -> $(PackageOutputPath)%(JavaBuildFiles.Identity)" />
<Copy SourceFiles="$(MSBuildProjectDirectory)\build\libs\%(JavaBuildFiles.Identity)" DestinationFolder="$(PackageOutputPath)" />
</Target>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"xcopy-msbuild": "17.1.0"
},
"native-tools": {
"jdk": "11"
"jdk": "11.0.24"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24516.2",
Expand Down
9 changes: 5 additions & 4 deletions src/SignalR/clients/java/signalr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ buildscript {
}
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.6.1"
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
}
}

plugins {
id 'java'
id 'maven'
id 'maven-publish'
}

allprojects {
Expand All @@ -22,7 +21,9 @@ allprojects {
// If we're run from outside MSBuild, just assign a bogus dev version.
version project.findProperty('packageVersion') ?: "99.99.99-dev"

sourceCompatibility = 1.8
java {
sourceCompatibility = 1.8
}

repositories {
mavenCentral()
Expand Down Expand Up @@ -52,4 +53,4 @@ spotless {
indentWithSpaces(4)
removeUnusedImports() // removes any unused imports
}
}
}
73 changes: 40 additions & 33 deletions src/SignalR/clients/java/signalr/core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,67 @@
plugins {
id 'java'
id 'maven'
id 'maven-publish'
}

group 'com.microsoft.signalr'

java {
withJavadocJar()
withSourcesJar()
}

dependencies {
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
api 'io.reactivex.rxjava3:rxjava:3.0.11'
implementation 'org.slf4j:slf4j-api:1.7.25'
}

archivesBaseName = 'signalr'

task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
base {
archivesName = 'signalr'
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}
publishing {
publications {
release(MavenPublication) {
from components.java

task generatePOM {
pom {
project {
artifactId 'signalr'
inceptionYear '2018'
description 'ASP.NET Core SignalR Client for Java applications'
url 'https://github.com/dotnet/aspnetcore'
name groupId + ':' + artifactId
licenses {
license {
name 'MIT License'
url 'https://opensource.org/licenses/MIT'
distribution 'repo'

pom {
packaging = 'jar'
inceptionYear = '2018'
url = 'https://github.com/dotnet/aspnetcore'
name = groupId + ':' + artifactId
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
scm {
connection 'scm:git:https://github.com/dotnet/aspnetcore.git'
developerConnection 'scm:git:https://github.com/dotnet/aspnetcore.git'
url 'https://github.com/dotnet/aspnetcore/tree/main'
}
developers {
developer {
id 'microsoft'
name 'Microsoft'
scm {
connection = 'scm:git:https://github.com/dotnet/aspnetcore.git'
developerConnection = 'scm:git:https://github.com/dotnet/aspnetcore.git'
url = 'https://github.com/dotnet/aspnetcore/tree/main'
}
developers {
developer {
id = 'microsoft'
name = 'Microsoft'
}
}
}
}
}.writeTo("${buildDir}/libs/signalr-${project.version}.pom")
}
}

task createPackage(dependsOn: [jar,sourceJar,javadocJar,generatePOM])
tasks.withType(GenerateMavenPom).all {
def matcher = name =~ /generatePomFileFor(\w+)Publication/
def publicationName = matcher[0][1]
destination = layout.buildDirectory.file("libs/signalr-${project.version}.pom").get().asFile
}

task generateVersionClass {
inputs.property "version", project.version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public Single<HttpResponse> send(HttpRequest httpRequest, ByteBuffer bodyContent
case "POST":
RequestBody body;
if (bodyContent != null) {
body = RequestBody.create(MediaType.parse("text/plain"), ByteString.of(bodyContent));
body = RequestBody.Companion.create(ByteString.of(bodyContent), MediaType.parse("text/plain"));
} else {
body = RequestBody.create(null, new byte[]{});
body = RequestBody.Companion.create(new byte[]{}, null);
}

requestBuilder.post(body);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=23e7d37e9bb4f8dabb8a3ea7fdee9dd0428b9b1a71d298aefd65b11dccea220f
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionSha256Sum=5b9c5eb3f9fc2c94abaea57d90bd78747ca117ddbbf96c859d3741181a12bf2a
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
78 changes: 43 additions & 35 deletions src/SignalR/clients/java/signalr/messagepack/build.gradle
Original file line number Diff line number Diff line change
@@ -1,56 +1,64 @@
plugins {
id 'java'
id 'maven'
id 'maven-publish'
}

group 'com.microsoft.signalr.messagepack'

java
{
withJavadocJar()
withSourcesJar()
}

dependencies {
implementation project(':core')
compile 'org.msgpack:msgpack-core:0.8.20'
compile 'org.msgpack:jackson-dataformat-msgpack:0.8.20'
implementation 'org.msgpack:msgpack-core:0.8.20'
implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.20'
}

archivesBaseName = 'signalr-messagepack'

task sourceJar(type: Jar) {
classifier "sources"
from sourceSets.main.allJava
base {
archivesName = 'signalr-messagepack'
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier "javadoc"
from javadoc.destinationDir
}
publishing {
publications {
release(MavenPublication) {
from components.java

task generatePOM {
pom {
project {
artifactId 'signalr-messagepack'
inceptionYear '2020'
description 'MessagePack protocol implementation for ASP.NET Core SignalR Client for Java applications'
url 'https://github.com/dotnet/aspnetcore'
name groupId + ':' + artifactId
licenses {
license {
name 'MIT License'
url 'https://opensource.org/licenses/MIT'
distribution 'repo'

pom {
packaging = 'jar'
inceptionYear = '2020'
url = 'https://github.com/dotnet/aspnetcore'
name = groupId + ':' + artifactId
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
scm {
connection 'scm:git:https://github.com/dotnet/aspnetcore.git'
developerConnection 'scm:git:https://github.com/dotnet/aspnetcore.git'
url 'https://github.com/dotnet/aspnetcore/tree/main'
}
developers {
developer {
id 'microsoft'
name 'Microsoft'
scm {
connection = 'scm:git:https://github.com/dotnet/aspnetcore.git'
developerConnection = 'scm:git:https://github.com/dotnet/aspnetcore.git'
url = 'https://github.com/dotnet/aspnetcore/tree/main'
}
developers {
developer {
id = 'microsoft'
name = 'Microsoft'
}
}
}
}
}.writeTo("${buildDir}/libs/signalr-messagepack-${project.version}.pom")
}
}

task createPackage(dependsOn: [jar,sourceJar,javadocJar,generatePOM])
tasks.withType(GenerateMavenPom).all {
def matcher = name =~ /generatePomFileFor(\w+)Publication/
def publicationName = matcher[0][1]
destination = layout.buildDirectory.file("libs/signalr-messagepack-${project.version}.pom").get().asFile
}
63 changes: 54 additions & 9 deletions src/SignalR/clients/java/signalr/test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,61 @@
apply plugin: 'org.junit.platform.gradle.plugin'
plugins {
id 'java'
}

configurations {
antJUnit
}

dependencies {
implementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
compile 'org.junit.jupiter:junit-jupiter-params:5.3.1'
runtime 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
implementation 'org.junit.jupiter:junit-jupiter-params:5.11.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.2'
implementation 'com.google.code.gson:gson:2.8.5'
compile 'ch.qos.logback:logback-classic:1.2.3'
implementation 'ch.qos.logback:logback-classic:1.2.3'
implementation project(':core')
implementation project(':messagepack')
compile project(':messagepack')
implementation project(':messagepack')
antJUnit 'org.apache.ant:ant-junit:1.10.15'
}

sourceSets {
test {
java {
srcDir 'src'
}
}
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}

reports {
html.required = false
junitXml.outputPerTestCase = true
junitXml.required = true
}
}

// Merge test results into a single file for Helix to detect JUnit test file
task testReport {
ext {
resultsDir = file("$buildDir/test-results")
mergedFile = "test-results/junit-results.xml"
}

doLast {
mkdir 'test-results'
ant.taskdef(name: 'junitreport',
classname: 'org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator',
classpath: configurations.antJUnit.asPath)

ant.junitreport(tofile: mergedFile) {
fileset(dir: resultsDir, includes: '**/TEST-*.xml')
}
}
}

junitPlatform {
reportsDir file('test-results')
}
test.finalizedBy(testReport)