gradle publish working for models aars

This commit is contained in:
Mautisim Munir 2022-11-15 02:18:52 +05:00
parent cdaf7405a8
commit a9c006ce7f
5 changed files with 232 additions and 10 deletions

View File

@ -42,15 +42,21 @@ android {
dependencies {
mavenImplementation 'ca.copperlabs.cv:copperlabs-computer-vision:0.0.1-alpha'
mavenImplementation 'ca.copperlabs.cv:copperlabs-computer-vision:latest.release'
localImplementation project(':copperlabs-computer-vision')
mavenImplementation "ca.copperlabs.mediapipe.posetracking:copperlabs-pose-api:0.0.1-alpha"
mavenImplementation "ca.copperlabs.mediapipe.posetracking:copperlabs-pose-api:latest.release"
localImplementation project(':copperlabs-pose-api')
implementation project(':copperlabs-pose-detection')
implementation project(':copperlabs-pose-landmark')
implementation project(':copperlabs-pose-graph')
mavenImplementation "ca.copperlabs.mediapipe.pose_detection:copperlabs-pose-detection:latest.release"
localImplementation project(':copperlabs-pose-detection')
mavenImplementation "ca.copperlabs.mediapipe.pose_landmark:copperlabs-pose-landmark:latest.release"
localImplementation project(':copperlabs-pose-landmark')
mavenImplementation "ca.copperlabs.mediapipe.pose_graph:copperlabs-pose-graph:latest.release"
localImplementation project(':copperlabs-pose-graph')
implementation fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])

View File

@ -22,7 +22,7 @@ publishing {
groupId getGroupId()
artifactId getArtificatId()
version getVersionName()
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar")
artifact("$buildDir/outputs/aar/${getArtificatId()}-local-release.aar")
//generate .pom file with transitive dependencies
pom.withXml {
final dependenciesNode = asNode().appendNode('dependencies')
@ -119,7 +119,7 @@ dependencies {
compileOnly fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])
localImplementation project(':copperlabs-pose-api')
mavenImplementation "ca.copperlabs.mediapipe.posetracking:copperlabs-pose-api:0.0.1-alpha"
mavenImplementation "ca.copperlabs.mediapipe.posetracking:copperlabs-pose-api:latest.release"
// Mediapipe dependencies
implementation 'com.google.protobuf:protobuf-javalite:3.19.1'

View File

@ -1,9 +1,80 @@
plugins {
id 'com.android.library'
id("maven-publish")
}
def getVersionName = { ->
return "0.0.1" // Replace with version Name
}
def getArtificatId = { ->
return "copperlabs-pose-detection" // Replace with library name ID
}
def getGroupId = {-> return 'ca.copperlabs.mediapipe.pose_detection'}
publishing {
publications {
bar(MavenPublication) {
groupId getGroupId()
artifactId getArtificatId()
version getVersionName()
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar")
//generate .pom file with transitive dependencies
pom.withXml {
final dependenciesNode = asNode().appendNode('dependencies')
ext.addDependency = { Dependency dep, String scope ->
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
return
final dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dep.group)
dependencyNode.appendNode('artifactId', dep.name)
dependencyNode.appendNode('version', dep.version)
dependencyNode.appendNode('scope', scope)
if (!dep.transitive) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
exclusionNode.appendNode('groupId', '*')
exclusionNode.appendNode('artifactId', '*')
} else if (!dep.properties.excludeRules.empty) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
dep.properties.excludeRules.each { ExcludeRule rule ->
exclusionNode.appendNode('groupId', rule.group ?: '*')
exclusionNode.appendNode('artifactId', rule.module ?: '*')
}
}
}
configurations.compileOnly.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.api.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
}
}
}
repositories {
maven {
name = "GitHubPackages"
/** Configure path of your package repository on Github
** Replace GITHUB_USERID with your/organisation Github userID
** and REPOSITORY with the repository name on GitHub
*/
url = uri("https://maven.pkg.github.com/udamaster/mediapipe")
credentials {
/** Create github.properties in root project folder file with
** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN
** Set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
}
android {
namespace 'ca.copperlabs.mediapipe.pose_detection'
namespace getGroupId()
compileSdk 32
defaultConfig {

View File

@ -1,9 +1,81 @@
plugins {
id 'com.android.library'
id("maven-publish")
}
def getVersionName = { ->
return "0.0.1" // Replace with version Name
}
def getArtificatId = { ->
return "copperlabs-pose-graph" // Replace with library name ID
}
def getGroupId = {-> return 'ca.copperlabs.mediapipe.pose_graph'}
publishing {
publications {
bar(MavenPublication) {
groupId getGroupId()
artifactId getArtificatId()
version getVersionName()
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar")
//generate .pom file with transitive dependencies
pom.withXml {
final dependenciesNode = asNode().appendNode('dependencies')
ext.addDependency = { Dependency dep, String scope ->
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
return
final dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dep.group)
dependencyNode.appendNode('artifactId', dep.name)
dependencyNode.appendNode('version', dep.version)
dependencyNode.appendNode('scope', scope)
if (!dep.transitive) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
exclusionNode.appendNode('groupId', '*')
exclusionNode.appendNode('artifactId', '*')
} else if (!dep.properties.excludeRules.empty) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
dep.properties.excludeRules.each { ExcludeRule rule ->
exclusionNode.appendNode('groupId', rule.group ?: '*')
exclusionNode.appendNode('artifactId', rule.module ?: '*')
}
}
}
configurations.compileOnly.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.api.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
}
}
}
repositories {
maven {
name = "GitHubPackages"
/** Configure path of your package repository on Github
** Replace GITHUB_USERID with your/organisation Github userID
** and REPOSITORY with the repository name on GitHub
*/
url = uri("https://maven.pkg.github.com/udamaster/mediapipe")
credentials {
/** Create github.properties in root project folder file with
** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN
** Set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
}
android {
namespace 'ca.copperlabs.mediapipe.pose_graph'
namespace getGroupId()
compileSdk 32
defaultConfig {

View File

@ -1,9 +1,82 @@
plugins {
id 'com.android.library'
id("maven-publish")
}
def getVersionName = { ->
return "0.0.1" // Replace with version Name
}
def getArtificatId = { ->
return "copperlabs-pose-landmark" // Replace with library name ID
}
def getGroupId = {-> return 'ca.copperlabs.mediapipe.pose_landmark'}
publishing {
publications {
bar(MavenPublication) {
groupId getGroupId()
artifactId getArtificatId()
version getVersionName()
artifact("$buildDir/outputs/aar/${getArtificatId()}-release.aar")
//generate .pom file with transitive dependencies
pom.withXml {
final dependenciesNode = asNode().appendNode('dependencies')
ext.addDependency = { Dependency dep, String scope ->
if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
return
final dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dep.group)
dependencyNode.appendNode('artifactId', dep.name)
dependencyNode.appendNode('version', dep.version)
dependencyNode.appendNode('scope', scope)
if (!dep.transitive) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
exclusionNode.appendNode('groupId', '*')
exclusionNode.appendNode('artifactId', '*')
} else if (!dep.properties.excludeRules.empty) {
final exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
dep.properties.excludeRules.each { ExcludeRule rule ->
exclusionNode.appendNode('groupId', rule.group ?: '*')
exclusionNode.appendNode('artifactId', rule.module ?: '*')
}
}
}
configurations.compileOnly.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.api.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
}
}
}
repositories {
maven {
name = "GitHubPackages"
/** Configure path of your package repository on Github
** Replace GITHUB_USERID with your/organisation Github userID
** and REPOSITORY with the repository name on GitHub
*/
url = uri("https://maven.pkg.github.com/udamaster/mediapipe")
credentials {
/** Create github.properties in root project folder file with
** gpr.usr=GITHUB_USER_ID & gpr.key=PERSONAL_ACCESS_TOKEN
** Set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
}
android {
namespace 'ca.copperlabs.mediapipe.pose_landmark'
namespace getGroupId()
compileSdk 32
defaultConfig {