Skip to content

Commit afa43fb

Browse files
authored
Updated Pom task (#2111)
### Summary Updating the Pom syntax, which will also denote the scope of each dependency appropriately. Note the names of the artifacts and that most of the dependencies are listed under Runtime now instead of Compile. This means that our external dependencies which we declare with implementation configuration are no longer leaking to our consumers. The configurations are now working as described [here](https://developer.android.com/build/dependencies#dependency_configurations).
1 parent 88dbb46 commit afa43fb

File tree

2 files changed

+41
-87
lines changed

2 files changed

+41
-87
lines changed

changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ vNext
44
----------
55
- [MINOR] Support for multiple access tokens in NativeAuth (#2082)
66
- [MINOR] YubiKit 2.5.0 and CredMan 1.2.2 (#2109)
7+
- [MINOR] Updated Pom Task (#2111)
78

89
Version 5.3.1
910
---------

msal/build.gradle

Lines changed: 40 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -306,99 +306,52 @@ task pmd(type: Pmd) {
306306
}
307307

308308
afterEvaluate {
309-
// Gradle 6.1.1 and Android Gradle Plugin 4.0.1 doesn't rename the file (see 'outputFileName' above)
310-
// Adding this work around to have the file properly renamed.
311-
tasks.named("assembleDistRelease").configure {
312-
def buildFile = file("$buildDir/outputs/aar/${archivesBaseName}-dist-release.aar")
313-
print "Build file $buildFile"
314-
doLast {
315-
println "Renaming build file $buildFile to '$buildDir${File.separator}outputs${File.separator}aar${File.separator}${archivesBaseName}-${version}.aar'"
316-
if (!buildFile.renameTo("$buildDir${File.separator}outputs${File.separator}aar${File.separator}${archivesBaseName}-${version}.aar")) {
317-
println "Rename failed!"
318-
}
319-
}
320-
}
321-
}
322-
323-
publishing {
324-
publications {
325-
msal(MavenPublication) {
326-
groupId 'com.microsoft.identity.client'
327-
artifactId 'msal'
328-
//Edit the 'version' here for VSTS RC build
329-
version = project.version
330-
331-
pom.withXml {
332-
// Custom values
333-
334-
// Name
335-
asNode().appendNode('name', 'msal')
336-
337-
// Description
338-
asNode().appendNode(
339-
'description',
340-
'Microsoft Identity library for Android gives you the ability to add authentication to your application with just a few lines of additional code. Using our MSAL SDKs you can quickly and easily extend your existing application to all the employees that use MSA, B2C, Azure AD and Active Directory on-premises using Active Directory Federation Services, including Office365 customers.'
341-
)
342-
343-
// URL
344-
asNode().appendNode('url', 'https://github.com/AzureAD/microsoft-authentication-library-for-android')
345-
346-
// Inception Year
347-
asNode().appendNode('inceptionYear', '2016')
348-
349-
// Licenses
350-
asNode().appendNode('licenses').appendNode('license').appendNode('name', 'MIT License')
351-
352-
// Developers
353-
def developerNode = asNode().appendNode('developers').appendNode('developer')
354-
developerNode.appendNode('id', 'microsoft')
355-
developerNode.appendNode('name', 'Microsoft')
356-
357-
// SCM
358-
asNode().appendNode('scm').appendNode('url', 'https://github.com/AzureAD/microsoft-authentication-library-for-android/tree/master')
359-
360-
// Properties
361-
def propertiesNode = asNode().appendNode('properties')
362-
propertiesNode.appendNode('branch', 'master')
363-
propertiesNode.appendNode('version', project.version)
364-
365-
def dependenciesNode = asNode().appendNode('dependencies')
366-
367-
368-
def deps = configurations.implementation.allDependencies.asList()
369-
if (project.version.toString().endsWith("SNAPSHOT")) {
370-
deps.addAll(configurations.snapshotApi.allDependencies.asList())
371-
} else {
372-
deps.addAll(configurations.distApi.allDependencies.asList())
373-
}
374-
375-
//Iterate over the implementation dependencies (we don't want the test ones), adding a <dependency> node for each
376-
deps.each {
377-
if (it.group != null && it.name != null) {
378-
def dependencyNode = dependenciesNode.appendNode('dependency')
379-
dependencyNode.appendNode('groupId', it.group)
380-
dependencyNode.appendNode('artifactId', it.name)
381-
dependencyNode.appendNode('version', it.version)
309+
publishing {
310+
publications {
311+
msal(MavenPublication) {
312+
from components.distRelease
313+
groupId 'com.microsoft.identity.client'
314+
artifactId 'msal'
315+
//Edit the 'version' here for VSTS RC build
316+
version = project.version
317+
318+
pom {
319+
name = 'msal'
320+
description = 'Microsoft Identity library for Android gives you the ability to add authentication to your application with just a few lines of additional code. Using our MSAL SDKs you can quickly and easily extend your existing application to all the employees that use MSA, B2C, Azure AD and Active Directory on-premises using Active Directory Federation Services, including Office365 customers.'
321+
url = 'https://github.com/AzureAD/microsoft-authentication-library-for-android'
322+
developers {
323+
developer {
324+
id = 'microsoft'
325+
name = 'Microsoft'
326+
}
327+
}
328+
licenses {
329+
license {
330+
name = 'MIT License'
331+
}
382332
}
333+
inceptionYear = '2016'
334+
scm {
335+
url = 'https://github.com/AzureAD/microsoft-authentication-library-for-android/tree/master'
336+
}
337+
properties = [
338+
branch : 'dev',
339+
version: project.version
340+
]
383341
}
384-
385342
}
386343

387-
artifact(sourcesJar)
388-
artifact(javadocJar)
389-
artifact("$buildDir/outputs/aar/msal-${project.version}.aar")
390344
}
391345

392-
}
393-
394-
// Repositories to which Gradle can publish artifacts
395-
repositories {
396-
maven {
397-
name "vsts-maven-adal-android"
398-
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
399-
credentials {
400-
username System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") : project.findProperty("vstsUsername")
401-
password System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
346+
// Repositories to which Gradle can publish artifacts
347+
repositories {
348+
maven {
349+
name "vsts-maven-adal-android"
350+
url "https://identitydivision.pkgs.visualstudio.com/_packaging/AndroidADAL/maven/v1"
351+
credentials {
352+
username System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_USERNAME") : project.findProperty("vstsUsername")
353+
password System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") != null ? System.getenv("ENV_VSTS_MVN_ANDROID_MSAL_ACCESSTOKEN") : project.findProperty("vstsMavenAccessToken")
354+
}
402355
}
403356
}
404357
}

0 commit comments

Comments
 (0)