From a9c006ce7f8b68758bd184a8d55d41a448433632 Mon Sep 17 00:00:00 2001 From: Mautisim Munir Date: Tue, 15 Nov 2022 02:18:52 +0500 Subject: [PATCH] gradle publish working for models aars --- .../solutions/copperlabs/app/build.gradle | 16 ++-- .../copperlabs-computer-vision/build.gradle | 4 +- .../copperlabs-pose-detection/build.gradle | 73 +++++++++++++++++- .../copperlabs-pose-graph/build.gradle | 74 +++++++++++++++++- .../copperlabs-pose-landmark/build.gradle | 75 ++++++++++++++++++- 5 files changed, 232 insertions(+), 10 deletions(-) diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/build.gradle b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/build.gradle index 3b6cdbbeb..a5c4a6afd 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/build.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/build.gradle @@ -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']) diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-computer-vision/build.gradle b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-computer-vision/build.gradle index f15068a24..cf8f6520e 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-computer-vision/build.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-computer-vision/build.gradle @@ -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' diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-detection/build.gradle b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-detection/build.gradle index a239a44c6..08f38e669 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-detection/build.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-detection/build.gradle @@ -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 { diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-graph/build.gradle b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-graph/build.gradle index 4d361d21b..183eaa0ff 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-graph/build.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-graph/build.gradle @@ -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 { diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-landmark/build.gradle b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-landmark/build.gradle index f9c2dbbc7..b15611767 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-landmark/build.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/copperlabs-pose-landmark/build.gradle @@ -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 {