Created
September 19, 2022 14:15
-
-
Save laithnurie/311c657eb9f7f62bb2cd304401e868f1 to your computer and use it in GitHub Desktop.
local_maven_repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'maven-publish' | |
// SDK version is passed in as a parameter when you run the script assemble_and_deploy_lib.sh or you can uncomment the below and use the version from gradle.properties | |
// version SDK_ARTIFACT_VERSION // version picked up from gradle.properties | |
String sdkVersion = System.getenv('SDK_VERSION') != null ? System.getenv('SDK_VERSION') : SDK_ARTIFACT_VERSION | |
publishing { | |
publications { | |
sdk(MavenPublication) { | |
groupId SDK_ARTIFACT_PACKAGE | |
version sdkVersion | |
artifactId SDK_ARTIFACT_NAME | |
artifact("$buildDir/outputs/aar/library-release.aar") | |
pom.withXml { | |
def dependenciesNode = asNode().appendNode('dependencies') | |
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency> node for each | |
configurations.compile.allDependencies.each { | |
if (it.group != null && (it.name != null || "unspecified" == it.name) && it.version != null) { | |
def dependencyNode = dependenciesNode.appendNode('dependency') | |
dependencyNode.appendNode('groupId', it.group) | |
dependencyNode.appendNode('artifactId', it.name) | |
dependencyNode.appendNode('version', it.version) | |
} | |
} | |
configurations.implementation.allDependencies.each { | |
if (it.group != null && (it.name != null || "unspecified" == it.name) && it.version != null) { | |
def dependencyNode = dependenciesNode.appendNode('dependency') | |
dependencyNode.appendNode('groupId', it.group) | |
dependencyNode.appendNode('artifactId', it.name) | |
dependencyNode.appendNode('version', it.version) | |
} | |
} | |
} | |
} | |
} | |
repositories { | |
maven { | |
url "../../maven-repo" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment