ndktest-plugin

Run ndk C++ tests on Android devices

License

License

The Apache Software License, Version 2.0
GroupId

GroupId

com.github.fsbarata
ArtifactId

ArtifactId

ndktest-plugin
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

ndktest-plugin
Run ndk C++ tests on Android devices
Project URL

Project URL

https://github.com/fsbarata/ndktest-plugin
Source Code Management

Source Code Management

https://github.com/fsbarata/ndktest-plugin

Download ndktest-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.fsbarata/ndktest-plugin/ -->
<dependency>
    <groupId>com.github.fsbarata</groupId>
    <artifactId>ndktest-plugin</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.fsbarata/ndktest-plugin/
implementation 'com.github.fsbarata:ndktest-plugin:1.0.0'
// https://jarcasting.com/artifacts/com.github.fsbarata/ndktest-plugin/
implementation ("com.github.fsbarata:ndktest-plugin:1.0.0")
'com.github.fsbarata:ndktest-plugin:jar:1.0.0'
<dependency org="com.github.fsbarata" name="ndktest-plugin" rev="1.0.0">
  <artifact name="ndktest-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.fsbarata', module='ndktest-plugin', version='1.0.0')
)
libraryDependencies += "com.github.fsbarata" % "ndktest-plugin" % "1.0.0"
[com.github.fsbarata/ndktest-plugin "1.0.0"]

Dependencies

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
com.android.tools.build : gradle-experimental jar 0.2.0

Project Modules

There are no modules declared in this project.

NDK Test Gradle Plugin

Description

Build NDK Googletest based C++ tests with gradle and run them on an Android device. Can be used in Android studio.

Requirements

It is important to have a compiling NDK configuration in place.

How to use

Simply apply the plugin and you're ready to go.

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.github.fsbarata:ndktest-gradle-plugin:1.0.0
    }
}

apply plugin: 'com.github.fsbarata.ndktest'

This will add multiple tasks to your project:

  1. compileVariantNdkTest
  2. connectedVariantNdkTest

Simply running the connectedVariantNdkTest will compile it and run on the device.

Configure

After configuring your NDK, you may configure NDK test plugin by the following:

android {
	...
	sourceSets {
		test {
			jni.srcDirs = ['src/test/jni']
		}
	}
}

ndktest {
	cFlags = "-std=c++11"
	ldLibs = ["log"]
	abiFilters = ['x86','armeabi-v7a']
}

Known issues

  1. Currently not compatible with gradle experimental plugin
  2. Does not run as a testing task
  3. Cannot debug on device using Android studio (some code is in place but I was unable to fix the gdb server)
  4. Does not support multiple devices

Suggestions

  1. Use abi filters to avoid compiling every architecture every time. Use the architecture of the device under test.
  2. Create a gradle task Android studio run configuration
  3. Disable jniDebuggable for faster builds and runs

Versions

Version
1.0.0