Skip to content

Commit

Permalink
Include all plugins inside the commons code
Browse files Browse the repository at this point in the history
  • Loading branch information
blootsvoets committed Mar 26, 2019
1 parent 950e43a commit 8b2b9c0
Show file tree
Hide file tree
Showing 511 changed files with 110,882 additions and 594 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,5 @@ fabric.properties

## Pebble 2
.lock*
.skip
gradle.skip
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Base module for the RADAR passive remote monitoring app. Plugins for that app should implement the API from this base library. Also user interfaces should use this as a base. Currently, the main user interface is [RADAR-AndroidApplication](https://github.com/RADAR-base/radar-prmt-android.git).

Plugins that are implemented as part of RADAR-base are included in the `plugins` directory. Please refer to the README in the respective plugin for information on how to use the plugin.

## Configuration

This library takes the following firebase parameters:
Expand Down Expand Up @@ -32,12 +34,22 @@ This library takes the following firebase parameters:
## Usage

Include this repository by adding the following snippet to your Android `build.gradle` file:

```gradle
repositories {
jcenter()
maven { url 'http://dl.bintray.com/radar-base/org.radarbase' }
}
dependencies {
api 'org.radarbase:radar-commons-android:0.9.2'
api 'org.radarbase:radar-commons-android:1.0.0'
}
```

Include additional plugins by adding:

```gradle
dependencies {
runtimeOnly 'org.radarbase:<plugin name>:1.0.0'
}
```

Expand All @@ -47,7 +59,7 @@ To add device types to the passive remote monitoring Android app, create a plugi

First, create an Android Library project. Include RADAR Commons Android as a module in `build.gradle`.

1. Add the schemas of the data you intend to send to the [RADAR-CNS Schemas repository](https://github.com/RADAR-base/RADAR-Schemas). Your record keys should be `org.radarcns.kafka.ObservationKey`. Be sure to set the `namespace` property to `org.radarcns.mydevicetype` so that generated classes will be put in the right package. All values should have `time` and `timeReceived` fields, with type `double`. These represent the time in seconds since the Unix Epoch (1 January 1970, 00:00:00 UTC). Subsecond precision is possible by using floating point decimals. Until those schemas are published, generate them using Avro tools. Find `avro-tools-1.8.2.jar` by going to <http://www.apache.org/dyn/closer.cgi/avro/>, choosing a mirror, and then downloading `avro-1.8.2/java/avro-tools-1.8.2.jar`. You can now generate source code for a schema `myschema.avsc` with the following command:
1. Add the schemas of the data you intend to send to the [RADAR-base Schemas repository](https://github.com/RADAR-base/RADAR-Schemas). Your record keys should be `org.radarcns.kafka.ObservationKey`. Be sure to set the `namespace` property to `org.radarcns.mydevicetype` so that generated classes will be put in the right package. All values should have `time` and `timeReceived` fields, with type `double`. These represent the time in seconds since the Unix Epoch (1 January 1970, 00:00:00 UTC). Subsecond precision is possible by using floating point decimals. Until those schemas are published, generate them using Avro tools. Find `avro-tools-1.8.2.jar` by going to <http://www.apache.org/dyn/closer.cgi/avro/>, choosing a mirror, and then downloading `avro-1.8.2/java/avro-tools-1.8.2.jar`. You can now generate source code for a schema `myschema.avsc` with the following command:
```shell
java -jar avro-tools-1.8.2.jar compile -string schema path/to/myschema.avsc path/to/plugin/src/main/java
```
Expand Down Expand Up @@ -79,5 +91,10 @@ To create an Android App, follow the following steps:
## Contributing

For latest code use `dev` branch. Code should be formatted using the [Google Java Code Style Guide](https://google.github.io/styleguide/javaguide.html), except using 4 spaces as indentation.
To only build plugins that are of interest to you, add a `gradle.skip` file in all plugin directories that should not be built.

If you want to contribute a feature or fix browse our [issues](https://github.com/RADAR-base/radar-commons-android/issues), and please make a pull request.

## Licensing

Code made in the RADAR-base platform is licensed under the Apache License 2.0, as listed in see the LICENSE file in this directory. Plugins that have additional licensing requirements list them in their README.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ buildscript {
classpath 'de.mobilej.unmock:UnMockPlugin:0.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'digital.wup:android-maven-publish:3.6.2'
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.17"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18"
}
}

subprojects {
apply plugin: 'com.android.library'
apply plugin: 'idea'
apply plugin: 'kotlin-android'
apply plugin: 'idea'

//---------------------------------------------------------------------------//
// Configuration //
//---------------------------------------------------------------------------//

version = '0.10.0-SNAPSHOT'
version = '1.0.0-SNAPSHOT'
ext.versionCode = 29
group = 'org.radarbase'
ext.githubRepoName = 'RADAR-base/radar-commons-android'
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
android.enableJetifier=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand Down
19 changes: 4 additions & 15 deletions radar-android-login-oauth2/build.gradle → gradle/android.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ android {
targetSdkVersion 28
versionCode versionCode
versionName version
manifestPlaceholders = ['appAuthRedirectScheme': 'org.radarbase.android']
}
lintOptions {
abortOnError false
disable 'TrustAllX509TrustManager', 'UnusedResources', 'ProtectedPermissions'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
libraryVariants.all { variant ->
Expand All @@ -32,17 +31,7 @@ android {
exclude 'META-INF/LICENSE'
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}

}

description = 'RADAR Android OAuth2 LoginManager.'

dependencies {
api project(':radar-commons-android')
api 'net.openid:appauth:0.7.1'
}

apply from: '../gradle/publishing.gradle'
21 changes: 21 additions & 0 deletions gradle/artifactory.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apply plugin: 'com.jfrog.artifactory'

artifactory {
contextUrl = 'https://oss.jfrog.org/artifactory'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
maven = true
}
defaults {
publications ('mavenAar')
publishArtifacts = true
publishPom = true
properties = ['qa.level': 'basic', 'q.os': 'android']
}
}
}

artifactoryPublish.dependsOn 'assembleRelease'
31 changes: 31 additions & 0 deletions gradle/bintray.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apply plugin: 'com.jfrog.bintray'

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
override = false
publications 'mavenAar'
pkg {
repo = project.group
name = project.name
userOrg = 'radar-cns'
desc = project.description
licenses = ['Apache-2.0']
websiteUrl = website
issueTrackerUrl = issueUrl
vcsUrl = githubUrl
githubRepo = githubRepoName
githubReleaseNotesFile = 'README.md'
version {
name = project.version
desc = project.description
vcsTag = System.getenv('TRAVIS_TAG')
released = new Date()
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
}
}
}
}

bintrayUpload.dependsOn 'assembleRelease'
65 changes: 7 additions & 58 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'digital.wup.android-maven-publish'
apply plugin: 'org.jetbrains.dokka-android'
//apply plugin: 'org.jetbrains.dokka-android'

ext.sharedManifest = manifest {
attributes("Implementation-Title": name,
Expand All @@ -28,12 +26,13 @@ task javadoc(type: Javadoc) {
exclude '**/*.kt'
}

dokka {
outputFormat = 'html'
outputDirectory = javadoc.destinationDir
}
//dokka {
// outputFormat = 'html'
// outputDirectory = javadoc.destinationDir
//}

task javadocJar(type: Jar, dependsOn: [dokka, javadoc]) {
//task javadocJar(type: Jar, dependsOn: [dokka, javadoc]) {
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
manifest.from sharedManifest
Expand Down Expand Up @@ -79,53 +78,3 @@ publishing {
}
}
}

bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
override = false
publications 'mavenAar'
pkg {
repo = project.group
name = project.name
userOrg = 'radar-cns'
desc = project.description
licenses = ['Apache-2.0']
websiteUrl = website
issueTrackerUrl = issueUrl
vcsUrl = githubUrl
githubRepo = githubRepoName
githubReleaseNotesFile = 'README.md'
version {
name = project.version
desc = project.description
vcsTag = System.getenv('TRAVIS_TAG')
released = new Date()
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
}
}
}
}

bintrayUpload.dependsOn 'assembleRelease'

artifactory {
contextUrl = 'https://oss.jfrog.org/artifactory'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
maven = true
}
defaults {
publications ('mavenAar')
publishArtifacts = true
publishPom = true
properties = ['qa.level': 'basic', 'q.os': 'android']
}
}
}

artifactoryPublish.dependsOn 'assembleRelease'
4 changes: 0 additions & 4 deletions lint.xml

This file was deleted.

39 changes: 39 additions & 0 deletions plugins/radar-android-application-status/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Application status plugin for RADAR-pRMT

[![Build Status](https://travis-ci.org/RADAR-base/radar-android-application-status.svg?branch=master)](https://travis-ci.org/RADAR-base/radar-android-application-status)

Plugin that sends application statuses about the RADAR pRMT app.

## Installation

To add the plugin code to your app, add the following snippet to your app's `build.gradle` file.

```gradle
dependencies {
runtimeOnly "org.radarbase:radar-android-application-status:$radarCommonsAndroidVersion"
}
```

## Configuration

To activate this plugin, add the provider `.monitor.application.ApplicationServiceProvider` to the Firebase Remote Config `device_services_to_connect` variable.

This plugin takes the following Firebase configuration parameters:

| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `ntp_server` | string | `<empty>` | NTP server to synchronize time with. If empty, time is not synchronized and the `application_external_time` topic will not receive data. |
| `application_status_update_rate` | int (seconds) | `300` = 5 minutes | Rate at which to send data for all application topics. |
| `application_send_ip` | boolean | `false` | Whether to send the device IP address with the server status. |
| `application_time_zone_update_rate` | int (seconds) | `86400` = 1 day | How often to send the current time zone. Set to `0` to disable. |

This plugin produces data for the following topics: (types starts with `org.radarcns.monitor.application` prefix)

| Topic | Type | Description |
| ----- | ---- | ----------- |
| `application_external_time` | `ApplicationExternalTime` | External NTP time. Requires `ntp_server` parameter to be set. |
| `application_record_counts` | `ApplicationRecordCounts` | Number of records sent and in queue. |
| `application_uptime` | `ApplicationUptime` | Time since the device booted. |
| `application_server_status` | `ApplicationServerStatus` | Server connection status. |
| `application_time_zone` | `ApplicationTimeZone` | Application time zone. Data is only sent on updates. |
| `application_device_info` | `ApplicationDeviceInfo` | Device information. Data is only sent on updates. |
18 changes: 18 additions & 0 deletions plugins/radar-android-application-status/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apply from: "$rootDir/gradle/android.gradle"

//---------------------------------------------------------------------------//
// Configuration //
//---------------------------------------------------------------------------//

description = 'Application statistics plugin for RADAR passive remote monitoring app'

//---------------------------------------------------------------------------//
// Sources and classpath configurations //
//---------------------------------------------------------------------------//

dependencies {
api project(':radar-commons-android')
}

apply from: "$rootDir/gradle/publishing.gradle"
apply from: "$rootDir/gradle/bintray.gradle"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.radarbase.monitor.application" >

<application>
<service android:name=".ApplicationStatusService"/>
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2017 The Hyve
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.radarbase.monitor.application

import org.radarbase.android.device.DeviceServiceProvider

open class ApplicationServiceProvider : DeviceServiceProvider<ApplicationState>() {
override val description: String?
get() = radarService.getString(R.string.application_status_description)

override val serviceClass: Class<ApplicationStatusService> = ApplicationStatusService::class.java

override val isDisplayable: Boolean = false

override val permissionsNeeded: List<String> = emptyList()

override val displayName: String
get() = radarService.getString(R.string.applicationServiceDisplayName)

override val sourceProducer: String = "RADAR"

override val sourceModel: String = "pRMT"

override val version: String = BuildConfig.VERSION_NAME
}
Loading

0 comments on commit 8b2b9c0

Please sign in to comment.