diff --git a/gradle/versions.gradle b/gradle/versions.gradle index cbd78be9..1d4846b7 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -10,7 +10,7 @@ ext { // Plugins gradleVersion = '8.10.0' kotlinVersion = '1.8.0' - spotBugsGradlePluginVersion = '4.7.1' + spotBugsGradlePluginVersion = '6.5.8' jupiterApiVersion = '5.6.0' //Java Language Support diff --git a/plugins/buildsystem/build.gradle b/plugins/buildsystem/build.gradle index 8ed9d8ab..1bd8ab7d 100644 --- a/plugins/buildsystem/build.gradle +++ b/plugins/buildsystem/build.gradle @@ -10,7 +10,7 @@ plugins { } group 'com.microsoft.identity' -version '0.2.5' +version '0.2.6' tasks.withType(JavaCompile) { sourceCompatibility = '11' @@ -51,11 +51,29 @@ repositories { } } +// Publish target for the internal NewAndroid Azure Artifacts feed. +// The java-gradle-plugin + maven-publish plugins auto-create the plugin's +// publications (the plugin jar/pom and the plugin-marker artifact); this block +// only tells Gradle WHERE to push them. Consuming repos resolve the plugin from +// this same feed via their settings.gradle pluginManagement block. +publishing { + repositories { + maven { + name "NewAndroid" + url "https://pkgs.dev.azure.com/IdentityDivision/_packaging/NewAndroid/maven/v1" + credentials { + username System.getenv("ENV_VSTS_MVN_CRED_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_CRED_USERNAME") : project.findProperty("vstsUsername") + password System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_CRED_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken") + } + } + } +} + dependencies { testImplementation "org.junit.jupiter:junit-jupiter-api:${rootProject.ext.jupiterApiVersion}" testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' implementation "com.android.tools.build:gradle:${rootProject.ext.gradleVersion}" - implementation "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:${rootProject.ext.spotBugsGradlePluginVersion}" + implementation "com.github.spotbugs.snom:spotbugs-gradle-plugin:${rootProject.ext.spotBugsGradlePluginVersion}" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${rootProject.ext.kotlinVersion}" testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${rootProject.ext.kotlinVersion}" diff --git a/plugins/buildsystem/changelog b/plugins/buildsystem/changelog index d1406ed0..ba4776c3 100644 --- a/plugins/buildsystem/changelog +++ b/plugins/buildsystem/changelog @@ -1,5 +1,10 @@ Plugin Overview: https://github.com/AzureAD/android-complete/blob/master/plugins/buildsystem/docs/Overview.md +Version 0.2.6 +---------------------------- +[MINOR] Remove use of deleted gradle APIs +[MINOR] Bump SpotBugs Gradle plugin 4.7.1 -> 6.5.8 (4.x used the removed JavaPluginConvention); groupId changed to com.github.spotbugs.snom + Version 0.2.3 ---------------------------- [PATCH] Allow ability to enable/disable code coverage - disabled by default diff --git a/plugins/buildsystem/docs/Overview.md b/plugins/buildsystem/docs/Overview.md index c108d9da..653c7f16 100644 --- a/plugins/buildsystem/docs/Overview.md +++ b/plugins/buildsystem/docs/Overview.md @@ -134,4 +134,47 @@ pluginManagement { ## Plugins/Settings applied by BuildPlugin -- [SpotBugs](Spotbugs.md) \ No newline at end of file +- [SpotBugs](Spotbugs.md) + +## Publishing (manual) + +> This plugin is **published manually** — it is intentionally **not** wired into any CI/CD +> pipeline (daily, weekly, or release). Publish a new version by hand using the steps below. + +The `build.gradle` already declares the `NewAndroid` Azure Artifacts feed as a `publishing` +target, so no build changes are needed to publish. + +**Steps:** + +1. **Bump the version** in [`build.gradle`](../build.gradle) (the `version '...'` line) and add a + matching entry to the [`changelog`](../changelog). Feed versions are **immutable** — you cannot + overwrite an already-published version. + +2. **Generate a PAT** with **Packaging → Read & write** scope at + . + +3. **Provide credentials.** The username is arbitrary for Azure Artifacts (use `VSTS`); the PAT is + what authenticates. Either set env vars: + + ```powershell + $env:ENV_VSTS_MVN_CRED_USERNAME = "VSTS" + $env:ENV_VSTS_MVN_CRED_ACCESSTOKEN = "" + ``` + + …or add `vstsUsername` / `vstsMavenAccessToken` to `~/.gradle/gradle.properties` + (never commit the PAT). + +4. **Publish from the android-complete root** (the plugin only builds in the root context — the root + `settings.gradle` `pluginManagement` supplies the Kotlin plugin version): + + ```powershell + .\gradlew.bat :AcaPlugin:publish + ``` + + This uploads both artifacts to the feed: + - `com.microsoft.identity:AcaPlugin:` — the plugin jar + - `com.microsoft.identity.buildsystem:com.microsoft.identity.buildsystem.gradle.plugin:` — the plugin marker consumers resolve + +5. **Verify** the new version at + , then bump + consumers' `id 'com.microsoft.identity.buildsystem' version ''` declarations. \ No newline at end of file diff --git a/plugins/buildsystem/gradle/versions.gradle b/plugins/buildsystem/gradle/versions.gradle index e04747c8..b893e00d 100644 --- a/plugins/buildsystem/gradle/versions.gradle +++ b/plugins/buildsystem/gradle/versions.gradle @@ -1,7 +1,7 @@ // Variables for plugins project ext { kotlinVersion = '1.8.0' - spotBugsGradlePluginVersion = '4.7.1' + spotBugsGradlePluginVersion = '6.5.8' jupiterApiVersion = '5.6.0' gradleVersion = '8.10.0' } diff --git a/plugins/buildsystem/src/main/java/com/microsoft/identity/buildsystem/BuildPlugin.java b/plugins/buildsystem/src/main/java/com/microsoft/identity/buildsystem/BuildPlugin.java index 32216c28..f1a0838f 100644 --- a/plugins/buildsystem/src/main/java/com/microsoft/identity/buildsystem/BuildPlugin.java +++ b/plugins/buildsystem/src/main/java/com/microsoft/identity/buildsystem/BuildPlugin.java @@ -27,15 +27,13 @@ import org.gradle.api.JavaVersion; import org.gradle.api.Plugin; import org.gradle.api.Project; +import org.gradle.api.plugins.JavaPluginExtension; public class BuildPlugin implements Plugin { private final static String ANDROID_LIBRARY_PLUGIN_ID = "com.android.library"; private final static String JAVA_LIBRARY_PLUGIN_ID = "java-library"; - private final static String JAVA_SOURCE_COMPATIBILITY_PROPERTY = "sourceCompatibility"; - private final static String JAVA_TARGET_COMPATIBILITY_PROPERTY = "targetCompatibility"; - @Override public void apply(final Project project) { @@ -70,8 +68,10 @@ private void applyDesugaringToAndroidProject(final Project project){ private void applyJava8ToJavaProject(final Project project) { project.getPluginManager().withPlugin(JAVA_LIBRARY_PLUGIN_ID, appliedPlugin -> { - project.setProperty(JAVA_SOURCE_COMPATIBILITY_PROPERTY, JavaVersion.VERSION_1_8); - project.setProperty(JAVA_TARGET_COMPATIBILITY_PROPERTY, JavaVersion.VERSION_1_8); + final JavaPluginExtension javaPluginExtension = project.getExtensions() + .getByType(JavaPluginExtension.class); + javaPluginExtension.setSourceCompatibility(JavaVersion.VERSION_1_8); + javaPluginExtension.setTargetCompatibility(JavaVersion.VERSION_1_8); }); } }