computer-vision maven publishing support

This commit is contained in:
Mautisim Munir 2022-11-15 00:54:25 +05:00
parent 111683ccb9
commit 1de0e850e1
4 changed files with 133 additions and 2 deletions

View File

@ -2,6 +2,7 @@ plugins {
id 'com.android.application'
}
android {
namespace 'com.google.mediapipe'
compileSdk 32
@ -26,11 +27,24 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions 'source'
productFlavors {
local {
dimension 'source'
applicationIdSuffix '.local'
}
maven {
dimension 'source'
applicationIdSuffix '.maven'
}
}
}
dependencies {
implementation project(':copperlabs-computer-vision')
mavenImplementation 'ca.copperlabs.cv:copperlabs-computer-vision:0.0.1-alpha'
localImplementation project(':copperlabs-computer-vision')
implementation project(':copperlabs-pose-api')
implementation project(':copperlabs-pose-detection')
implementation project(':copperlabs-pose-landmark')

View File

@ -2,4 +2,11 @@
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
def githubProperties = new Properties()
githubProperties.load(new FileInputStream(rootProject.file("github.properties")))

View File

@ -1,7 +1,82 @@
plugins {
id 'com.android.library'
id("maven-publish")
}
def githubProperties = new Properties()
githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) //Set env variable GPR_USER & GPR_API_KEY if not adding a properties file
def getVersionName = { ->
return "0.0.1-alpha" // Replace with version Name
}
def getArtificatId = { ->
return "copperlabs-computer-vision" // Replace with library name ID
}
def getGroupId = {-> return 'ca.copperlabs.cv'}
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 = githubProperties['gpr.usr'] ?: System.getenv("GPR_USER")
password = githubProperties['gpr.key'] ?: System.getenv("GPR_API_KEY")
}
}
}
}
android {
namespace 'ca.copperlabs.cv'
compileSdk 32

View File

@ -1,15 +1,50 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven {
name = "GitHubPackages"
/* Configure path to the library hosted on GitHub Packages Registry
* Replace UserID with package owner userID and REPOSITORY with the repository name
* e.g. "https://maven.pkg.github.com/enefce/AndroidLibraryForGitHubPackagesDemo"*/
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
** Or set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
name = "GitHubPackages"
/* Configure path to the library hosted on GitHub Packages Registry
* Replace UserID with package owner userID and REPOSITORY with the repository name
* e.g. "https://maven.pkg.github.com/enefce/AndroidLibraryForGitHubPackagesDemo"*/
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
** Or set env variable GPR_USER & GPR_API_KEY if not adding a properties file**/
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
}
rootProject.name = "posetracking"