Skip to content
Open
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
56 changes: 44 additions & 12 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,61 @@ extends:
Copy-Item $(downloadLocalProperties.secureFilePath) local.properties -Verbose
displayName: Copy secring and 'local.properties'

- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
- pwsh: |
$props = Get-Content local.properties -Raw
$keyId = ($props | Select-String -Pattern 'signing\.keyId=(.+)').Matches.Groups[1].Value
$keyRingFile = ($props | Select-String -Pattern 'signing\.secretKeyRingFile=(.+)').Matches.Groups[1].Value
$keyPassword = ($props | Select-String -Pattern 'signing\.password=(.+)').Matches.Groups[1].Value
Comment on lines +64 to +67

$settingsXml = @"
<settings>
<servers>
<server>
<id>GraphDeveloperExperiencesPublic</id>
<username>microsoftgraph</username>
<password>${{ variables.ARTIFACTS_PAT }}</password>
</server>
</servers>
<profiles>
<profile>
<id>signing</id>
<properties>
<gpg.keyname>$keyId</gpg.keyname>
<gpg.passphrase>$keyPassword</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
"@
$settingsDir = Join-Path $HOME ".m2"
New-Item -ItemType Directory -Path $settingsDir -Force | Out-Null
$settingsXml | Set-Content (Join-Path $settingsDir "settings.xml") -Encoding UTF8
displayName: Configure Maven settings

- script: ./mvnw install -Psigning --no-transfer-progress -DmavenCentralSnapshotSuffix=""
displayName: Publish to local Maven for verification
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')

- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
- script: ./mvnw install -Psigning --no-transfer-progress
displayName: Publish to local Maven for verification
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))

- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
displayName: Publish to local Maven ADO for ESRP
- script: ./mvnw deploy -Psigning --no-transfer-progress -DmavenCentralSnapshotSuffix="" -DaltDeploymentRepository=ADO::default::file://$(Build.SourcesDirectory)/target/staging-deploy
displayName: Stage artifacts for ESRP
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')

- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
displayName: Publish to local Maven ADO for ESRP
- script: ./mvnw deploy -Psigning --no-transfer-progress -DaltDeploymentRepository=ADO::default::file://$(Build.SourcesDirectory)/target/staging-deploy
displayName: Stage artifacts for ESRP
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))

- pwsh: |
$contents = Get-Content gradle.properties -Raw
$major = $contents | Select-String -Pattern 'mavenMajorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$minor = $contents | Select-String -Pattern 'mavenMinorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$patch = $contents | Select-String -Pattern 'mavenPatchVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$pomXml = [xml](Get-Content pom.xml)
$version = $pomXml.project.version
$snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
$version = "$major.$minor.$patch$snapshot_suffix"
# If version already contains -SNAPSHOT and we're on a tag, strip it
if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) {
$version = $version -replace '-SNAPSHOT$', ''
}
echo "Current version is $version"
echo "##vso[task.setvariable variable=PACKAGE_VERSION;]$version"
displayName: Get current version
Expand All @@ -95,7 +127,7 @@ extends:
displayName: Inspect contents of local Maven cache

- pwsh: |
$packageFullPath = Join-Path -Path "./" -ChildPath "build/publishing-repository/com/microsoft/graph/microsoft-graph" -AdditionalChildPath "$(PACKAGE_VERSION)"
$packageFullPath = Join-Path -Path "./target/staging-deploy" -ChildPath "com/microsoft/graph/microsoft-graph" -AdditionalChildPath "$(PACKAGE_VERSION)"
echo "Package full path: $packageFullPath"
echo "##vso[task.setvariable variable=PACKAGE_PATH;]$packageFullPath"
displayName: Get the package full path
Expand Down
45 changes: 34 additions & 11 deletions .azure-pipelines/daily-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,44 @@ extends:
- checkout: self
submodules: recursive

- script: |
sed -i "/mavenCentral()/d" build.gradle
sed -i "/gradlePluginPortal()/d" settings.gradle
sed -i "/mavenCentral()/d" settings.gradle
displayName: Strip plugins and public repos for network-isolated build
- task: JavaToolInstaller@1
inputs:
versionSpec: '17'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

- pwsh: |
$settingsXml = @"
<settings>
<servers>
<server>
<id>GraphDeveloperExperiencesPublic</id>
<username>microsoftgraph</username>
<password>$(ARTIFACTS_PAT)</password>
</server>
</servers>
<mirrors>
<mirror>
<id>GraphDeveloperExperiencesPublic</id>
<mirrorOf>central</mirrorOf>
<url>https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/GraphDeveloperExperiences_Public/maven/v1</url>
</mirror>
</mirrors>
</settings>
"@
$settingsDir = Join-Path $HOME ".m2"
New-Item -ItemType Directory -Path $settingsDir -Force | Out-Null
$settingsXml | Set-Content (Join-Path $settingsDir "settings.xml") -Encoding UTF8
displayName: Configure Maven settings for network-isolated build

- task: Gradle@4
- task: Maven@4
displayName: Build and Test SDK
inputs:
gradleWrapperFile: 'gradlew'
workingDirectory: '$(Build.SourcesDirectory)'
tasks: 'assemble test'
options: '--no-daemon -PGraphDeveloperExperiencesPublicPassword=$(ARTIFACTS_PAT)'
mavenPomFile: 'pom.xml'
goals: 'verify'
options: '--no-transfer-progress'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.17'
jdkArchitectureOption: 'x64'
21 changes: 10 additions & 11 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
version: 2
updates:
- package-ecosystem: gradle
directories:
- "/"
- "/java-8"
- "/android"
- package-ecosystem: maven
directory: "/"
schedule:
interval: daily
time: "09:00" # 9am UTC
Expand All @@ -16,12 +13,14 @@ updates:
microsoft-graph:
patterns:
- "*microsoft-graph*"
junit-dependencies:
patterns:
- "*junit*"
open-telemetry:
patterns:
- "*opentelemetry*"
- package-ecosystem: gradle
directories:
- "/android"
schedule:
interval: daily
time: "09:00" # 9am UTC
open-pull-requests-limit: 10
groups:
android-build-tools:
patterns:
- "*android*"
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
with:
java-version: 21
distribution: 'temurin'
cache: gradle
cache: maven

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand All @@ -75,10 +75,8 @@ jobs:
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew --no-build-cache build
- name: Build with Maven
run: ./mvnw compile --no-transfer-progress -DskipTests

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Gradle Build and Compare Package
name: Maven Build

on:
push:
Expand All @@ -17,36 +17,29 @@ jobs:
with:
java-version: 21
distribution: 'temurin'
cache: gradle
cache: maven
- name: Move generated sources to correct package
run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\generated'
shell: pwsh
- name: Grant Execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Build with Maven
run: ./mvnw verify --no-transfer-progress
- name: Upload Unit Test Results
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: UnitTests
path: |
build/reports/tests/test/**
build/test-results/**
target/surefire-reports/**
- name: Upload a Build Artifact
uses: actions/upload-artifact@v7
with:
name: drop
path: |
**/libs/*
build/generated-pom.xml
build/generated-pom.xml.asc
build.gradle
gradlew
gradlew.bat
settings.gradle
gradle.properties
**/gradle/**
target/*.jar
pom.xml
mvnw
mvnw.cmd
.mvn/**
scripts/**

build-java-8:
Expand All @@ -58,15 +51,12 @@ jobs:
with:
java-version: 8
distribution: 'temurin'
cache: gradle
cache: maven
- name: Move generated sources to correct package
run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\generated'
shell: pwsh
- name: Grant Execute permission for gradlew
run: chmod +x gradlew
- name: Build with Java 8
working-directory: ./java-8
run: .././gradlew build
run: ./mvnw compile --no-transfer-progress

build:
needs: [build-java-latest, build-java-8]
Expand All @@ -81,19 +71,3 @@ jobs:
exit 1
fi

dependency-submission:
runs-on: ubuntu-latest
if: github.event_name == 'push'
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v6

11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@

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

# Maven
/target/

# Maven wrapper
!.mvn/wrapper/maven-wrapper.jar

#Eclipse
.project
.classpath
.settings

# Maven
/target/
local.properties
.idea
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar
15 changes: 14 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,17 @@ android {
}
}

apply from: "../gradle/dependencies.gradle"

dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'jakarta.annotation:jakarta.annotation-api:2.1.1'

api 'com.microsoft.graph:microsoft-graph-core:3.6.6'

implementation 'com.microsoft.kiota:microsoft-kiota-authentication-azure:1.9.2'
implementation 'com.microsoft.kiota:microsoft-kiota-http-okHttp:1.9.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-json:1.9.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-text:1.9.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-form:1.9.2'
implementation 'com.microsoft.kiota:microsoft-kiota-serialization-multipart:1.9.2'
}
Loading
Loading