gradle mediapipe working

This commit is contained in:
Mautisim Munir 2022-11-15 03:05:34 +05:00
parent a9c006ce7f
commit 1d5b6ff3fb
11 changed files with 222 additions and 19 deletions

View File

@ -58,19 +58,10 @@ dependencies {
localImplementation project(':copperlabs-pose-graph')
implementation fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])
mavenImplementation "com.google.mediapipe:copperlabs-mediapipe:latest.release"
// implementation fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])
localImplementation project(':copperlabs-mediapipe')
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
// CameraX core library
def camerax_version = "1.0.0-beta10"
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@ -7,7 +7,7 @@ plugins {
def getVersionName = { ->
return "0.0.1-alpha" // Replace with version Name
return "0.0.2" // Replace with version Name
}
def getArtificatId = { ->
@ -116,7 +116,8 @@ android {
}
dependencies {
compileOnly fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])
localCompileOnly fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])
mavenImplementation "com.google.mediapipe:copperlabs-mediapipe:latest.release"
localImplementation project(':copperlabs-pose-api')
mavenImplementation "ca.copperlabs.mediapipe.posetracking:copperlabs-pose-api:latest.release"

View File

@ -0,0 +1,121 @@
plugins {
id 'com.android.library'
id("maven-publish")
}
def getVersionName = { ->
return "0.0.1" // Replace with version Name
}
def getArtificatId = { ->
return "copperlabs-mediapipe" // Replace with library name ID
}
def getGroupId = {-> return 'com.google.mediapipe'}
publishing {
publications {
bar(MavenPublication) {
groupId getGroupId()
artifactId getArtificatId()
version getVersionName()
artifact("../common_libs/copperlabs-mediapipe.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 getGroupId()
compileSdk 32
defaultConfig {
minSdk 23
targetSdk 32
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
// CameraX core library
def camerax_version = "1.0.0-beta10"
implementation "androidx.camera:camera-core:$camerax_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation(name:'copperlabs-mediapipe',ext:'aar')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}

View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -0,0 +1,26 @@
package com.google.mediapipe;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.google.mediapipe.test", appContext.getPackageName());
}
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View File

@ -0,0 +1,17 @@
package com.google.mediapipe;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -7,7 +7,7 @@ plugins {
def getVersionName = { ->
return "0.0.1" // Replace with version Name
return "0.0.2" // Replace with version Name
}
def getArtificatId = { ->
@ -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')
@ -50,6 +50,8 @@ publishing {
configurations.compileOnly.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.api.getDependencies().each { dep -> addDependency(dep, "compile") }
configurations.implementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
configurations.mavenImplementation.getDependencies().each { dep -> addDependency(dep, "runtime") }
}
}
}
@ -95,10 +97,20 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions 'source'
productFlavors {
local {
dimension 'source'
}
maven {
dimension 'source'
}
}
}
dependencies {
compileOnly fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])
localCompileOnly fileTree(dir: '../common_libs', include: ['*.jar', '*.aar'])
mavenImplementation "com.google.mediapipe:copperlabs-mediapipe:latest.release"
// Mediapipe dependencies
implementation 'com.google.protobuf:protobuf-javalite:3.19.1'

View File

@ -5,7 +5,10 @@ pluginManagement {
gradlePluginPortal()
google()
mavenCentral()
mavenLocal()
flatDir {
dirs 'common_libs'
}
// mavenLocal()
maven {
name = "GitHubPackages"
@ -24,6 +27,7 @@ pluginManagement {
}
}
}
}
@ -32,7 +36,10 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
mavenLocal()
flatDir {
dirs 'common_libs'
}
// mavenLocal()
maven {
name = "GitHubPackages"
@ -50,6 +57,7 @@ dependencyResolutionManagement {
password = System.getenv("TOKEN")
}
}
}
}
rootProject.name = "posetracking"
@ -59,3 +67,4 @@ include ':copperlabs-computer-vision'
include ':copperlabs-pose-landmark'
include ':copperlabs-pose-detection'
include ':copperlabs-pose-graph'
include ':copperlabs-mediapipe'