From 8d177d1010f29609304458de8172aa7184758f7e Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Wed, 22 Jul 2026 21:54:49 -0700 Subject: [PATCH 01/10] Upgrade to Gradle 9.3.1 / AGP 9.1.1 / Kotlin 2.2.21 / API 37 (JDK 21) - Gradle wrapper 8.11.1->9.3.1, AGP 8.10.0->9.1.1, Kotlin 1.8.0->2.2.21 - compileSdk 36->37, targetSdk 35->36, buildTools 37.0.0 (minSdk unchanged) - coroutines 1.6.4->1.9.0 (K2 runTest skew), Robolectric 4.14->4.16.1 (SDK 36 needs JDK 21) - buildsystem 0.2.5->0.2.6; android.newDsl=false (AGP9 stopgap) - AGP9 built-in Kotlin (remove kotlin-android, kotlinOptions->kotlin{}), resValues, proguard-optimize - testapp: fix K2 getChars (cast to GetChars) + pin androidx.core 1.5.0; remove stray import - common submodule -> ridamarora/sdkupgrade (upgraded common) - CI: PR-branch jobs (build_test, lint, msalautomationapp) -> JDK 21; dev baseline stays 17 --- .../pull-request-validation/pr-msal.yml | 10 ++++---- .../pr-msalautomationapp.yml | 6 ++--- common | 2 +- gradle.properties | 7 ++++++ gradle/versions.gradle | 18 +++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- msal/build.gradle | 25 +++++++++++-------- .../nativeauth/SignInEmailPasswordTest.kt | 1 - msalautomationapp/build.gradle | 16 +++++++++--- settings.gradle | 7 ++++-- testapps/testapp/build.gradle | 22 +++++++++++----- .../EmailAttributeSignUpFragment.kt | 2 +- .../EmailPasswordSignInSignUpFragment.kt | 4 +-- .../PasswordResetNewPasswordFragment.kt | 2 +- .../nativeauth/SignUpPasswordFragment.kt | 2 +- 15 files changed, 81 insertions(+), 45 deletions(-) diff --git a/azure-pipelines/pull-request-validation/pr-msal.yml b/azure-pipelines/pull-request-validation/pr-msal.yml index 4218ab2f69..ed0f6f2195 100644 --- a/azure-pipelines/pull-request-validation/pr-msal.yml +++ b/azure-pipelines/pull-request-validation/pr-msal.yml @@ -52,9 +52,9 @@ stages: displayName: 'Set VSTS Fields in Environment' - template: azure-pipelines/templates/steps/automation-cert.yml@common - task: JavaToolInstaller@0 - displayName: Use Java 17 + displayName: Use Java 21 inputs: - versionSpec: '17' + versionSpec: '21' jdkArchitectureOption: x64 jdkSourceOption: PreInstalled - task: CodeQL3000Init@0 @@ -65,7 +65,7 @@ stages: tasks: clean msal:assembleLocal publishJUnitResults: false testResultsFiles: '**/build/test-results/TEST-*.xml' - jdkVersion: $(BuildParameters.jdkVersion) + jdkVersion: 1.21 jdkArchitecture: $(BuildParameters.jdkArchitecture) sqGradlePluginVersion: 2.0.1 - task: CodeQL3000Finalize@0 @@ -74,7 +74,7 @@ stages: inputs: tasks: msal:jacocoTestReport -PcodeCoverageEnabled=true -ProbolectricSdkVersion=${{variables.robolectricSdkVersion}} -PmockApiUrl=$(MOCK_API_URL) -PnativeAuthConfigString=$(NATIVE_AUTH_CONFIG_STRING) javaHomeSelection: $(BuildParameters.javaHomeSelection) - jdkVersion: 1.17 + jdkVersion: 1.21 - publish: $(Build.SourcesDirectory)/msal/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml artifact: jacocoReport displayName: 'Publish JaCoCo Report Artifact (PR Branch)' @@ -163,7 +163,7 @@ stages: inputs: tasks: clean msal:lintLocalDebug publishJUnitResults: false - jdkVersion: 1.17 + jdkVersion: 1.21 - template: azure-pipelines/code-coverage/compare-code-coverage.yml@common parameters: commonRepoAlias: common diff --git a/azure-pipelines/pull-request-validation/pr-msalautomationapp.yml b/azure-pipelines/pull-request-validation/pr-msalautomationapp.yml index f446c14c44..5ca6763776 100644 --- a/azure-pipelines/pull-request-validation/pr-msalautomationapp.yml +++ b/azure-pipelines/pull-request-validation/pr-msalautomationapp.yml @@ -8,7 +8,7 @@ name: $(date:yyyyMMdd)$(rev:.r) trigger: none variables: - name: BuildParameters.jdkVersion - value: 1.17 + value: 1.21 - name: BuildParameters.jdkArchitecture value: x64 @@ -40,9 +40,9 @@ stages: displayName: 'Set VSTS Fields in Environment' - template: azure-pipelines/templates/steps/automation-cert.yml@common - task: JavaToolInstaller@0 - displayName: Use Java 17 + displayName: Use Java 21 inputs: - versionSpec: '17' + versionSpec: '21' jdkArchitectureOption: x64 jdkSourceOption: PreInstalled - task: Gradle@2 diff --git a/common b/common index 0b219baca3..77f927a0d4 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 0b219baca3bdc00a610de9a9d5d70aad40e0bcfb +Subproject commit 77f927a0d402f48ca8566285eab0e9bf0f3a5a9e diff --git a/gradle.properties b/gradle.properties index 9da7fae4d1..7e4732d32f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,6 +4,13 @@ ariaTenantTokenTest="1e8435186fa849b28b1a402fb5074ff1-0b91a9ec-efad-440c-b92c-ac android.useAndroidX=true android.enableJetifier=true +# AGP 9 opt-out (STOPGAP, removed in AGP 10): restores the legacy DSL + Variant API +# (libraryVariants/applicationVariants) still used by common/build.gradle (output naming +# + per-variant Javadoc). Root gradle.properties governs the whole multi-project build, +# so this must live here (the copy in common/gradle.properties is not read as a subproject). +# Track migration to the androidComponents API before AGP 10. +android.newDsl=false + # https://office.visualstudio.com/Outlook%20Mobile/_wiki/wikis/Outlook-Mobile.wiki/3780/Android-Studio-Gradle-Performance-tips-and-tricks org.gradle.parallel=true org.gradle.daemon=true diff --git a/gradle/versions.gradle b/gradle/versions.gradle index e0c3f84eb8..ffba8c39b0 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -3,13 +3,17 @@ ext { // SDK minSdkVersion = 24 - targetSdkVersion = 35 - compileSdkVersion = 36 - buildToolsVersion = "36.0.0" + targetSdkVersion = 36 + compileSdkVersion = 37 + buildToolsVersion = "37.0.0" // Plugins - gradleVersion = '8.10.0' - kotlinVersion = '1.8.0' + // NOTE: 'gradleVersion' is the AGP (Android Gradle Plugin) version, NOT the Gradle + // wrapper version (that lives in gradle/wrapper/gradle-wrapper.properties = 9.3.1). + gradleVersion = '9.1.1' + // Kotlin 1.8.x has no Gradle 9 support (removed SelfResolvingDependency); AGP 9 + // built-in Kotlin also needs KGP >= 2.2.10. Matches the upgraded common submodule. + kotlinVersion = '2.2.21' spotBugsGradlePluginVersion = '4.7.1' jupiterApiVersion = '5.6.0' @@ -42,7 +46,7 @@ ext { powerMockVersion = "2.0.9" runnerVersion = "1.2.0" rulesVersion = "1.2.0" - robolectricVersion = "4.14" + robolectricVersion = "4.16.1" uiAutomatorVersion = "2.2.0" daggerVersion = "2.31.2" daggerCompilerVersion = "2.31.2" @@ -67,7 +71,7 @@ ext { yubikitAndroidVersion = "2.5.0" yubikitPivVersion = "2.5.0" powerliftAndroidVersion="1.0.3" - kotlinXCoroutinesVersion = "1.6.4" + kotlinXCoroutinesVersion = "1.9.0" mockkVersion = "1.11.0" mockitoKotlinVersion = "4.1.0" androidxAnnotationVersion = "1.4.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7046bb0561..6cda1d726c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip diff --git a/msal/build.gradle b/msal/build.gradle index 8efffa5079..077246ade4 100644 --- a/msal/build.gradle +++ b/msal/build.gradle @@ -1,10 +1,11 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + plugins { - id 'com.microsoft.identity.buildsystem' version '0.2.5' + id 'com.microsoft.identity.buildsystem' version '0.2.6' id 'com.android.library' id 'pmd' id 'checkstyle' id 'maven-publish' - id 'kotlin-android' id 'jacoco' // Test retries @@ -15,6 +16,14 @@ apply from: 'versioning/version_tasks.gradle' group = 'com.microsoft.identity.client' +// Built-in Kotlin (AGP 9): replaces the android { kotlinOptions { } } block that the +// removed 'kotlin-android' plugin previously provided. +kotlin { + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 + } +} + buildSystem { desugar = false } @@ -106,7 +115,7 @@ android { targetSdkVersion rootProject.ext.targetSdkVersion versionCode getAppVersionCode() versionName getAppVersionName() - project.archivesBaseName = "msal" + project.base.archivesName = "msal" project.version = android.defaultConfig.versionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -114,10 +123,6 @@ android { buildConfig = true } - kotlinOptions { - jvmTarget = "1.8" - } - buildTypes { // testCoverageEnabled flag is set to true to get coverage reports for Android Tests debug { @@ -183,7 +188,7 @@ android { libraryVariants.all { variant -> variant.outputs.all { - def fileName = "${archivesBaseName}-${version}.aar" + def fileName = "${project.base.archivesName.get()}-${version}.aar" outputFileName = fileName } } @@ -365,10 +370,10 @@ afterEvaluate { // to include the version number. tasks.named("assembleDistRelease").configure { if (project.findProperty("renameOutput")?.toString()?.toBoolean() == true) { - def buildFile = file("$buildDir/outputs/aar/${archivesBaseName}-dist-release.aar") + def buildFile = file("$buildDir/outputs/aar/${project.base.archivesName.get()}-dist-release.aar") println "Build file $buildFile" doLast { - def renamedFile = file("$buildDir/outputs/aar/${archivesBaseName}-${version}.aar") + def renamedFile = file("$buildDir/outputs/aar/${project.base.archivesName.get()}-${version}.aar") println "Renaming build file $buildFile to '$renamedFile'" if (!buildFile.renameTo(renamedFile)) { println "Rename failed!" diff --git a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt index 17f5191312..e4ad2d0c2b 100644 --- a/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt +++ b/msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt @@ -34,7 +34,6 @@ import com.microsoft.identity.nativeauth.statemachine.results.GetAccountResult import com.microsoft.identity.nativeauth.statemachine.results.SignInResult import com.microsoft.identity.nativeauth.statemachine.results.SignOutResult import kotlinx.coroutines.runBlocking -import org.checkerframework.checker.units.qual.s import org.junit.Assert import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue diff --git a/msalautomationapp/build.gradle b/msalautomationapp/build.gradle index 3727ae39cf..07dece9b44 100644 --- a/msalautomationapp/build.gradle +++ b/msalautomationapp/build.gradle @@ -1,5 +1,6 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' def msalVersion = "5.10.0" @@ -13,6 +14,14 @@ if (project.hasProperty("localFlights")) { copyOfLocalFlights = localFlights } +// Built-in Kotlin (AGP 9): replaces the android { kotlinOptions { } } block that the +// removed 'kotlin-android' plugin previously provided. +kotlin { + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 + } +} + android { namespace "com.microsoft.identity.client.msal.automationapp" packagingOptions { @@ -26,9 +35,8 @@ android { } buildFeatures { buildConfig = true - } - kotlinOptions { - jvmTarget = "1.8" + // AGP 9 defaults resValues to off; the local/dist flavors define resValue(...) so opt in. + resValues = true } final String BROKER_HOST = "BrokerHost" final String BROKER_MICROSOFT_AUTHENTICATOR = "BrokerMicrosoftAuthenticator" diff --git a/settings.gradle b/settings.gradle index d1d51f3fa4..d373f06e74 100644 --- a/settings.gradle +++ b/settings.gradle @@ -28,6 +28,9 @@ project(':common4j').projectDir = new File('common/common4j') project(':LabApiUtilities').projectDir = new File('common/LabApiUtilities') // test apps -include ':testapps:sample' +// Gradle 9 rejects includes whose projectDir does not exist (Gradle 8 tolerated it). +// 'sample' and 'automationapp' have no directory under testapps/ (only 'testapp' exists), +// so these dead includes are commented out to allow settings to configure. +// include ':testapps:sample' include ':testapps:testapp' -include ':testapps:automationapp' +// include ':testapps:automationapp' diff --git a/testapps/testapp/build.gradle b/testapps/testapp/build.gradle index 1dc78a8130..ff586d97d5 100644 --- a/testapps/testapp/build.gradle +++ b/testapps/testapp/build.gradle @@ -23,9 +23,9 @@ * // THE SOFTWARE. */ -apply plugin: 'com.android.application' +import org.jetbrains.kotlin.gradle.dsl.JvmTarget -apply plugin: 'kotlin-android' +apply plugin: 'com.android.application' def msalVersion = "8.3.2" @@ -39,6 +39,14 @@ if(project.hasProperty('otelAriaToken')) { otelAriaToken = project.otelAriaToken; } +// Built-in Kotlin (AGP 9): replaces the android { kotlinOptions { } } block that the +// removed 'kotlin-android' plugin previously provided. +kotlin { + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 + } +} + android { namespace "com.microsoft.identity.client.testapp" // Bumping up to Java Version 8 due to the addition of YubiKit SDK, @@ -78,15 +86,14 @@ android { release { signingConfig signingConfigs.release minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } - kotlinOptions { - jvmTarget = "1.8" - } buildFeatures { viewBinding true buildConfig true + // AGP 9 defaults resValues to off; the local/dist flavors define resValue(...) so opt in. + resValues true } lintOptions { abortOnError false @@ -115,6 +122,9 @@ dependencies { implementation "androidx.constraintlayout:constraintlayout:$rootProject.ext.constraintLayoutVersion" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.ext.kotlinXCoroutinesVersion" implementation "androidx.appcompat:appcompat:$rootProject.ext.appCompatVersion" + // Edge-to-edge inset handling in StartActivity uses WindowInsetsCompat.Type (androidx.core >= 1.5.0); + // appcompat 1.1.0 only pulls core 1.1.0 transitively, so pin core explicitly. + implementation "androidx.core:core:$rootProject.ext.androidxCoreVersion" implementation "androidx.legacy:legacy-support-v4:$rootProject.ext.legacySupportV4Version" implementation "com.google.android.material:material:$rootProject.ext.materialVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.kotlinVersion}" diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt index 951607dc9c..1bb8978917 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt @@ -114,8 +114,8 @@ class EmailAttributeSignUpFragment : Fragment() { var password: CharArray? = null if (binding.passwordText.length() > 0) { password = CharArray(binding.passwordText.length()) + (binding.passwordText.text as? android.text.GetChars)?.getChars(0, binding.passwordText.length(), password, 0) } - binding.passwordText.text?.getChars(0, binding.passwordText.length(), password, 0) val attributes = UserAttributes.Builder() diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt index f6f02492c6..60626875de 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt @@ -116,7 +116,7 @@ class EmailPasswordSignInSignUpFragment : Fragment() { try { val email = binding.emailText.text.toString() val password = CharArray(binding.passwordText.length()); - binding.passwordText.text?.getChars(0, binding.passwordText.length(), password, 0); + (binding.passwordText.text as? android.text.GetChars)?.getChars(0, binding.passwordText.length(), password, 0); val actionResult = authClient.signIn( username = email, @@ -167,7 +167,7 @@ class EmailPasswordSignInSignUpFragment : Fragment() { try { val email = binding.emailText.text.toString() val password = CharArray(binding.passwordText.length()); - binding.passwordText.text?.getChars(0, binding.passwordText.length(), password, 0); + (binding.passwordText.text as? android.text.GetChars)?.getChars(0, binding.passwordText.length(), password, 0); val actionResult = authClient.signUp( username = email, diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/PasswordResetNewPasswordFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/PasswordResetNewPasswordFragment.kt index 69a5f95700..a7c35dd198 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/PasswordResetNewPasswordFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/PasswordResetNewPasswordFragment.kt @@ -75,7 +75,7 @@ class PasswordResetNewPasswordFragment : Fragment() { CoroutineScope(Dispatchers.Main).launch { try { val password = CharArray(binding.passwordText.length()); - binding.passwordText.text?.getChars(0, binding.passwordText.length(), password, 0); + (binding.passwordText.text as? android.text.GetChars)?.getChars(0, binding.passwordText.length(), password, 0); val actionResult = currentState.submitPassword(password) diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpPasswordFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpPasswordFragment.kt index 5c87a65f63..6f37785ad9 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpPasswordFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpPasswordFragment.kt @@ -76,7 +76,7 @@ class SignUpPasswordFragment : Fragment() { CoroutineScope(Dispatchers.Main).launch { try { val password = CharArray(binding.passwordText.length()); - binding.passwordText.text?.getChars(0, binding.passwordText.length(), password, 0); + (binding.passwordText.text as? android.text.GetChars)?.getChars(0, binding.passwordText.length(), password, 0); val actionResult = currentState.submitPassword(password) From f0983373f2bd0aa73bcceaa01374295c701d3ca6 Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Mon, 27 Jul 2026 20:38:37 -0700 Subject: [PATCH 02/10] bump common to latest commit and buildsystem to 0.3.0 --- common | 2 +- msal/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common b/common index 77f927a0d4..54d28c08fd 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 77f927a0d402f48ca8566285eab0e9bf0f3a5a9e +Subproject commit 54d28c08fd277c980c85077536e8d9656415960b diff --git a/msal/build.gradle b/msal/build.gradle index 404d074eb7..146e6acf50 100644 --- a/msal/build.gradle +++ b/msal/build.gradle @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { - id 'com.microsoft.identity.buildsystem' version '0.2.6' + id 'com.microsoft.identity.buildsystem' version '0.3.0' id 'com.android.library' id 'pmd' id 'checkstyle' From d74ffb792e224baa37371266b183d034dc324d3e Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Wed, 29 Jul 2026 14:35:10 -0700 Subject: [PATCH 03/10] bump common submodule to f9caddffc (restrict pluginManagement to ADO feed) --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 54d28c08fd..f9caddffca 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 54d28c08fd277c980c85077536e8d9656415960b +Subproject commit f9caddffca1f217a7ee95070d90f862adb0c47bf From 1e6ff7f92d29bcaf7a052ebc8da73e510953f5f7 Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Wed, 29 Jul 2026 14:46:28 -0700 Subject: [PATCH 04/10] settings.gradle: restrict pluginManagement to ADO feed so buildsystem plugin resolves in 1ES --- settings.gradle | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/settings.gradle b/settings.gradle index d373f06e74..b1c4c7b88d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,13 @@ pluginManagement { - // Note: Since our plugin references the android plugin we need to include google() here. repositories { - // If you don't have access to the package feed uncomment these repositories + // Keep ONLY the ADO feed here. Declaring the public repos (gradlePluginPortal/google/ + // mavenCentral) breaks buildsystem plugin resolution in the 1ES pipelines: they can't + // reach the public repos, and the NewAndroid feed proxies google()/gradlePluginPortal() + // as upstreams anyway, so AGP still resolves. For a purely local build without feed + // access, temporarily uncomment the lines below. // mavenCentral() - google() - gradlePluginPortal() + // google() + // gradlePluginPortal() maven { name "vsts-maven-new-android" url "https://identitydivision.pkgs.visualstudio.com/_packaging/NewAndroid/maven/v1" From a26bf48f5e540703c33ff81dc50223d9267102ad Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Thu, 30 Jul 2026 12:53:38 -0700 Subject: [PATCH 05/10] bump common to e9db710c7 (remove uses-sdk for AGP 9); remove stale uses-sdk from androidTest manifest --- common | 2 +- msal/src/androidTest/AndroidManifest.xml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/common b/common index f9caddffca..e9db710c74 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit f9caddffca1f217a7ee95070d90f862adb0c47bf +Subproject commit e9db710c742f175033db5382b7909b7bc43e3129 diff --git a/msal/src/androidTest/AndroidManifest.xml b/msal/src/androidTest/AndroidManifest.xml index 578aa6b3fa..b50e52428d 100644 --- a/msal/src/androidTest/AndroidManifest.xml +++ b/msal/src/androidTest/AndroidManifest.xml @@ -4,10 +4,6 @@ android:versionCode="1" android:versionName="1.0"> - - From 7d05a3025da0939a91320901931186ca459c20e2 Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Thu, 30 Jul 2026 17:32:08 -0700 Subject: [PATCH 06/10] Guard common submodule-source projects so DIST/publish builds configure without the common checkout (Gradle 9) --- msal/build.gradle | 25 ++++++++++++++++++------- settings.gradle | 45 +++++++++++++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 17 deletions(-) diff --git a/msal/build.gradle b/msal/build.gradle index 9da36eae12..873799ecb7 100644 --- a/msal/build.gradle +++ b/msal/build.gradle @@ -286,8 +286,13 @@ dependencies { testImplementation "org.mockito:mockito-core:$rootProject.ext.mockitoCoreVersion" testImplementation ("org.robolectric:robolectric:$rootProject.ext.robolectricVersion") testImplementation "androidx.test:core:$rootProject.ext.androidxTestCoreVersion" - testLocalImplementation project(':testutils') - testLocalImplementation project(':LabApiUtilities') + // The common-source projects are only on the build when the `common` submodule is checked out + // (see settings.gradle). Guard these `local`-flavor project deps so :msal still configures for + // DIST/publish builds that consume the PUBLISHED common artifacts instead. + if (findProject(':testutils') != null) { + testLocalImplementation project(':testutils') + testLocalImplementation project(':LabApiUtilities') + } testDistImplementation("com.microsoft.identity:testutils:0.0+") { exclude module: 'common' exclude group: 'com.microsoft.identity', module: 'LabApiUtilities' @@ -313,15 +318,19 @@ dependencies { // instrumented tests; the org.gradle.test-retry plugin only covers JVM/Robolectric unit tests). // transitive = false keeps only the rule's classes and avoids dragging testutils' whole // transitive graph onto the androidTest classpath. - androidTestLocalImplementation(project(':testutils')) { - transitive = false + if (findProject(':testutils') != null) { + androidTestLocalImplementation(project(':testutils')) { + transitive = false + } } androidTestDistImplementation("com.microsoft.identity:testutils:0.0+") { transitive = false } // 'local' flavor dependencies - localApi(project(":common")) { - transitive = true + if (findProject(':common') != null) { + localApi(project(":common")) { + transitive = true + } } snapshotApi(group: 'com.microsoft.identity', name: 'common', version: commonVersion, changing: true) @@ -330,7 +339,9 @@ dependencies { transitive = true } - testLocalImplementation(testFixtures(project(":common4j"))) + if (findProject(':common4j') != null) { + testLocalImplementation(testFixtures(project(":common4j"))) + } testDistImplementation(testFixtures("com.microsoft.identity:common4j:${common4jVersion}")) implementation "io.opentelemetry:opentelemetry-api:$rootProject.ext.openTelemetryVersion" diff --git a/settings.gradle b/settings.gradle index b1c4c7b88d..39c15f14fd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -18,17 +18,42 @@ pluginManagement { } } } -include ':msal', ':common', ':keyvault', ':labapi', ':testutils', ':pop-benchmarker', - ':package-inspector', ':msalautomationapp', ':uiautomationutilities', ':common4j', - ':LabApiUtilities' +// msal's own projects that do NOT consume the common submodule source — always included +// (their directories live in this repo, and :msal only references common in its `local` flavor, +// which is guarded in msal/build.gradle). +include ':msal', ':package-inspector' -project(':common').projectDir = new File('common/common') -project(':keyvault').projectDir = new File('common/keyvault') -project(':labapi').projectDir = new File('common/labapi') -project(':testutils').projectDir = new File('common/testutils') -project(':uiautomationutilities').projectDir = new File('common/uiautomationutilities') -project(':common4j').projectDir = new File('common/common4j') -project(':LabApiUtilities').projectDir = new File('common/LabApiUtilities') +// The projects below live in the `common` git submodule (checked out at msal/common). +// They are only needed when building common FROM SOURCE (the `local` product flavor, plus +// the automation/benchmark apps). The `dist`/`snapshot` flavors — including the 1ES weekly +// DIST publish — instead consume the PUBLISHED com.microsoft.identity:common / :common4j +// artifacts (via -PdistCommonVersion), and those pipelines often run WITHOUT the submodule +// checked out. +// +// Gradle 8 silently tolerated `include`-ing a project whose directory didn't exist; Gradle 9 +// fails hard ("Configuring project ':X' without an existing directory is not allowed"). So we +// only include the common-source projects when the submodule is actually present on disk. +if (new File(settingsDir, 'common/common').exists()) { + include ':common', ':keyvault', ':labapi', ':testutils', + ':uiautomationutilities', ':common4j', ':LabApiUtilities' + // These apps consume common modules FROM SOURCE (project(':common'), project(':LabApiUtilities'), + // project(':uiautomationutilities'), project(':common4j')) unconditionally, so they can only + // configure when the submodule is present. DIST/publish builds don't build these apps. + include ':pop-benchmarker', ':msalautomationapp' + + project(':common').projectDir = new File('common/common') + project(':keyvault').projectDir = new File('common/keyvault') + project(':labapi').projectDir = new File('common/labapi') + project(':testutils').projectDir = new File('common/testutils') + project(':uiautomationutilities').projectDir = new File('common/uiautomationutilities') + project(':common4j').projectDir = new File('common/common4j') + project(':LabApiUtilities').projectDir = new File('common/LabApiUtilities') +} else { + logger.lifecycle("[settings.gradle] 'common' submodule not checked out — skipping " + + "common-source project includes. DIST/SNAPSHOT builds use the published " + + "com.microsoft.identity:common artifacts; for a source (local-flavor) build run: " + + "git submodule update --init --recursive") +} // test apps // Gradle 9 rejects includes whose projectDir does not exist (Gradle 8 tolerated it). From d699ddbf06e496f56519d498ec293aa3a8cb5bfc Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Tue, 4 Aug 2026 15:33:22 -0700 Subject: [PATCH 07/10] Fix androidTest compile under AGP 9 non-transitive R class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit msal_default_config is a MAIN resource, so under AGP 9 (non-transitive R only) it lives in the module R (com.microsoft.identity.msal.R), not the androidTest R (…msal.test.R). Fully-qualify the reference; the .test.R import stays for the test_* androidTest resources. Fixes :msal:compileLocalDebugAndroidTestJavaWithJavac 'cannot find symbol msal_default_config'. --- .../identity/client/PublicClientConfigurationTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/msal/src/androidTest/java/com/microsoft/identity/client/PublicClientConfigurationTest.java b/msal/src/androidTest/java/com/microsoft/identity/client/PublicClientConfigurationTest.java index ab4d9d333c..1d7b287dbb 100644 --- a/msal/src/androidTest/java/com/microsoft/identity/client/PublicClientConfigurationTest.java +++ b/msal/src/androidTest/java/com/microsoft/identity/client/PublicClientConfigurationTest.java @@ -66,7 +66,10 @@ public class PublicClientConfigurationTest { @Before public void setUp() { mContext = InstrumentationRegistry.getContext().getApplicationContext(); - mDefaultConfig = loadConfig(R.raw.msal_default_config); + // msal_default_config is a MAIN source-set resource, so it lives in the module R + // (com.microsoft.identity.msal.R), not the androidTest R (…msal.test.R) imported above. + // Under AGP's non-transitive R classes the test R only exposes androidTest resources. + mDefaultConfig = loadConfig(com.microsoft.identity.msal.R.raw.msal_default_config); } @After From f6c0d629899efc1842dd647e1996901aa7da1932 Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Wed, 5 Aug 2026 10:04:03 -0700 Subject: [PATCH 08/10] settings.gradle: guard testapps includes for Gradle 9 instead of commenting them out Keep ':testapps:automationapp' and ':testapps:sample' as active includes but wrap each in a directory-existence check, so they configure when the project dir is present and don't hard-fail under Gradle 9 when it isn't (a plain checkout only has 'testapp'). Addresses review feedback to not leave these commented. --- settings.gradle | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/settings.gradle b/settings.gradle index 39c15f14fd..c351ee2901 100644 --- a/settings.gradle +++ b/settings.gradle @@ -56,9 +56,15 @@ if (new File(settingsDir, 'common/common').exists()) { } // test apps -// Gradle 9 rejects includes whose projectDir does not exist (Gradle 8 tolerated it). -// 'sample' and 'automationapp' have no directory under testapps/ (only 'testapp' exists), -// so these dead includes are commented out to allow settings to configure. -// include ':testapps:sample' +// Gradle 9 rejects `include` of a project whose directory doesn't exist (Gradle 8 tolerated it). +// Rather than dropping these includes, guard each one so it configures only when its directory is +// present on disk. This keeps ':testapps:automationapp' / ':testapps:sample' in the build for any +// context that provides those project directories, while a plain checkout (which only has +// 'testapp') still configures under Gradle 9 instead of failing hard. include ':testapps:testapp' -// include ':testapps:automationapp' +if (new File(settingsDir, 'testapps/automationapp').exists()) { + include ':testapps:automationapp' +} +if (new File(settingsDir, 'testapps/sample').exists()) { + include ':testapps:sample' +} From 95d4dbae892dbf7984ed0b0876cc55f300113688 Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Tue, 17 Nov 2026 19:38:58 -0800 Subject: [PATCH 09/10] Restore MSAL SpotBugs analysis with lazy task configuration Replace eager task realization so SpotBugs discovers AGP javac tasks. Enable XML reports and baseline approved findings by class, method and detector without globally disabling checks. Align the continuation-token nullability contract and make the helper activity template static final. Validated local debug/release and DIST release SpotBugs reports: 157 classes analyzed with zero unsuppressed findings each. Clean assemblies, 65 focused tests, Android-test compilation, lint and publication metadata pass. Existing missing Android/JSON analysis-class diagnostics remain a separate limitation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- AGENTS.md | 19 +- config/spotbugs/exclude.xml | 197 ++++++++++++++++++ msal/build.gradle | 7 +- .../client/helper/BrokerHelperActivity.java | 2 +- .../internal/CommandParametersAdapter.java | 4 +- 5 files changed, 221 insertions(+), 8 deletions(-) create mode 100644 config/spotbugs/exclude.xml diff --git a/AGENTS.md b/AGENTS.md index 6b848f8065..6f83c00e9e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -96,10 +96,21 @@ These match the build/report/lint tasks and SDK used by the [PR pipeline](azure-pipelines/pull-request-validation/pr-msal.yml). SpotBugs requires assembled outputs; its task name comes from [Common's template](common/azure-pipelines/templates/steps/spotbugs.yml). -Do not count `spotbugsLocalDebug NO-SOURCE` as a pass. The bundled SpotBugs Gradle -plugin 6.5.8 (buildsystem/AcaPlugin 0.3.0) currently looks up AGP 9 compile tasks -too early and leaves its analysis inputs empty. Track the shared-plugin fix; -verify nonempty class inputs and a generated report before claiming analysis passed. +Do not count `spotbugsLocalDebug NO-SOURCE` as a pass. Keep the assembly hooks +lazy with `tasks.configureEach`: `tasks.whenTaskAdded` eagerly realizes SpotBugs +6.5.8 tasks before AGP 9 registers their javac tasks, leaving analysis inputs +empty. Verify the SpotBugs task executes with nonempty compiled-class inputs; +inspect its findings or an explicitly enabled report, not just the build status. +XML reports are enabled for each SpotBugs variant under +`msal/build/reports/spotbugs/`; confirm the report has analyzed classes. +The [SpotBugs filter](config/spotbugs/exclude.xml) baselines reviewed findings by +class, method, and detector to preserve existing API and recovery behavior. +These deferred ownership, nullability, locking, and hardening findings are not +proof of safety. Keep new exclusions equally scoped; do not disable detectors +globally or copy another repository's baseline wholesale. +The analyzer also emits missing Android/JSON class diagnostics that were present +before the upgrade. A passing findings gate does not resolve that separate +analysis-classpath completeness limitation. The coverage task depends on `testLocalDebugUnitTest` and fails if execution data is missing. Do not publish a missing-data report as successful coverage. The custom local/dist reports include AGP 9 built-in Kotlin outputs as well as diff --git a/config/spotbugs/exclude.xml b/config/spotbugs/exclude.xml new file mode 100644 index 0000000000..87545bfc7d --- /dev/null +++ b/config/spotbugs/exclude.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/msal/build.gradle b/msal/build.gradle index f0ed230537..366d8f874a 100644 --- a/msal/build.gradle +++ b/msal/build.gradle @@ -33,6 +33,10 @@ buildSystem { desugar = false } +tasks.withType(com.github.spotbugs.snom.SpotBugsTask).configureEach { + reports.maybeCreate("xml").required.set(true) +} + def enableCodeCoverage = false if (project.hasProperty("codeCoverageEnabled")) { @@ -485,7 +489,8 @@ afterEvaluate { } } -tasks.whenTaskAdded { task -> +// Eager task hooks realize SpotBugs before AGP has registered its javac tasks. +tasks.configureEach { task -> if (task.name.contains('assemble')) { task.dependsOn 'pmd' } diff --git a/msal/src/main/java/com/microsoft/identity/client/helper/BrokerHelperActivity.java b/msal/src/main/java/com/microsoft/identity/client/helper/BrokerHelperActivity.java index fe3bc9c736..baa5674b05 100644 --- a/msal/src/main/java/com/microsoft/identity/client/helper/BrokerHelperActivity.java +++ b/msal/src/main/java/com/microsoft/identity/client/helper/BrokerHelperActivity.java @@ -21,7 +21,7 @@ */ public class BrokerHelperActivity extends Activity { - private final String MANIFEST_TEMPLATE = "\n" + + private static final String MANIFEST_TEMPLATE = "\n" + " \n" + " \n" + " \n" + diff --git a/msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java b/msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java index 5b4a4ea00e..a48c4f19c6 100644 --- a/msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java +++ b/msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java @@ -608,7 +608,7 @@ public static SignInStartCommandParameters createSignInStartCommandParameters( * Creates command parameter for [{@link com.microsoft.identity.common.nativeauth.internal.commands.SignInStartCommand}] of Native Auth using continuation token * @param configuration PCA configuration * @param tokenCache token cache for storing results - * @param continuationToken continuation token + * @param continuationToken non-null continuation token * @param username email address of the user * @param correlationId correlation ID to use in the API request, taken from the previous API response in the flow * @param scopes scopes requested during sign in flow @@ -619,7 +619,7 @@ public static SignInStartCommandParameters createSignInStartCommandParameters( public static SignInWithContinuationTokenCommandParameters createSignInWithContinuationTokenCommandParameters( @NonNull final NativeAuthPublicClientApplicationConfiguration configuration, @NonNull final OAuth2TokenCache tokenCache, - @Nullable final String continuationToken, + @NonNull final String continuationToken, @Nullable final String username, @NonNull final String correlationId, final List scopes, From 23803a85f008e4819416bf68920b6ee338286985 Mon Sep 17 00:00:00 2001 From: Ridam Arora Date: Fri, 20 Nov 2026 13:24:41 -0800 Subject: [PATCH 10/10] Update Common submodule to reconciled revision 46711a62c Consume latest Common dev reconciliation. Validated local debug/release assembly, Android-test compilation, 868 JVM tests with zero failures, coverage, lint and actual SpotBugs analysis. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index 7f886b336b..46711a62c7 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 7f886b336bae320cb8bd6ed7a6da49ab01898c94 +Subproject commit 46711a62c7a9fda14cbae91d60f37c0dc5e6edbf