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 93afad37f..055c3a8aa 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/build.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/app/build.gradle @@ -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') diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/build.gradle b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/build.gradle index 71b99f4ca..9ae2f7763 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/build.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/build.gradle @@ -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 -} \ No newline at end of file + +} +def githubProperties = new Properties() +githubProperties.load(new FileInputStream(rootProject.file("github.properties"))) + + + + 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 7cf03a6e1..d67a2d1ca 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 @@ -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 diff --git a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/settings.gradle b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/settings.gradle index c9d904ee6..719573ddd 100644 --- a/mediapipe/java/com/google/mediapipe/solutions/copperlabs/settings.gradle +++ b/mediapipe/java/com/google/mediapipe/solutions/copperlabs/settings.gradle @@ -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"