Skip to content

Commit

Permalink
Dev (#10)
Browse files Browse the repository at this point in the history
* added base webrtc functions and classes

* WIP webrtc handling offer/answer protocols

* WebRTC functions implemented

* Added base testing code

* reformat code

* removed license conflicts

* beautify code

* reformat code
  • Loading branch information
vkkhare authored Jan 22, 2020
1 parent 3f34b05 commit 63e4bfa
Show file tree
Hide file tree
Showing 14 changed files with 434 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.kt linguist-language=Kotlin
17 changes: 0 additions & 17 deletions .github/workflows/android.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: android
sudo: required
jdk: oraclejdk8

before_cache:
-rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
-rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

env:
global:
- ANDROID_API=29
- EMULATOR_API=29
- ANDROID_BUILD_TOOLS=29.0.2
- ADB_INSTALL_TIMEOUT=5 # minutes

android:
components:
- tools
- platform-tools
- build-tools-$ANDROID_BUILD_TOOLS
- android-$ANDROID_API
- android-$EMULATOR_API_LEVEL
- extra-google-m2repository
- extra-android-m2repository # for design library
- addon-google_apis-google-19 # google play services
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL
- sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL
licenses:
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+
script:
- ./gradlew build
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Contributing Guidelines

We would be happy ot have more volunterers for the android worker. This library constitutes and important component of on-device machine learning and you will be a part of this huge community
You can always join us on slack if you find an issue in which you are intertested.
We would be happy to have more volunterers for the android worker. This library constitutes and important component of on-device machine learning and you will be a part of this huge community
You can always join us on slack if you find an issue in which you are interested.

Here are some important resources:

* [Openmined.org](https://www.openmined.org/) describes the role and long term aim of the organisation,
* [Pysyft](https://github.com/OpenMined/PySyft) repository is the hub of all encrypted algorithms and training protocols. The android worker acts as a client for it!
* [Syft.js](https://github.com/OpenMined/syft.js) is web interface fro Pysyft
* [Syft.js](https://github.com/OpenMined/syft.js) is the web interface for Pysyft

## Testing

Expand Down
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# KotlinSyft
# <img src="logo/pysyft_android.png" height="54"> KotlinSyft

![License](https://img.shields.io/github/license/openmined/KotlinSyft)
![Language](https://img.shields.io/github/languages/top/openmined/KotlinSyft)
![Size](https://img.shields.io/github/repo-size/openmined/KotlinSyft)


## Introduction
This is the android worker Library for [PySyft](https://github.com/OpenMined/PySyft)
## License

KotlinSyft is available under the Apache 2 license. See the LICENSE file for more info.
Of course, [PySyft](https://github.com/openmined/pysyft) has the ability to run in its own environment but the final training procedure needs to deployed on the mobile workers using Torchscript.

**KotlinSyft employs P2P connectivity for realization of distributed pysyft protocols.**

### Local Development

1. Fork and clone
2. Open Android Studio and import project
4. Do your work.
5. Push to your fork
6. Submit a PR to openmined/KotlinSyft

### Contributing

Read [CONTRIBUTING.md](https://github.com/OpenMined/KotlinSyft/blob/master/CONTRIBUTING.md)

12 changes: 10 additions & 2 deletions demo-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,31 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/LICENSE-notice.md'

}
}

dependencies {
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'

// TODO During the first stages of the project, include the library here. Later on we should use the library from the repository
implementation project(path: ':syftlib')

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Binary file added logo/pysyft_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include ':demo-app'
include ':syftlib'

rootProject.name='KotlinSyft'
rootProject.name = 'KotlinSyft'
19 changes: 18 additions & 1 deletion syftlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,32 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

lintOptions {
lintConfig file("lint.xml")
}

packagingOptions {
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/LICENSE-notice.md'
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'org.webrtc:google-webrtc:1.0.30039'

testImplementation 'junit:junit:4.12'
implementation 'com.google.code.gson:gson:2.8.5'

debugImplementation "org.mockito:mockito-junit-jupiter:3.2.4"
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
testImplementation "org.mockito:mockito-core:3.2.4"
}
6 changes: 6 additions & 0 deletions syftlib/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="InvalidPackage" severity="ignore" />
<issue id="VisibleForTests" severity="error" />
<issue id="ContentDescription" severity="error" />
</lint>
3 changes: 1 addition & 2 deletions syftlib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.openmined.syft" />
<manifest package="org.openmined.syft" />
18 changes: 18 additions & 0 deletions syftlib/src/main/java/org/openmined/syft/Socket.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.openmined.syft

import java.net.Socket


class Socket(private val url: String, private val workerId: String, keepAliveTimeout: Int = 20000) {

val socket = Socket(url, 888)
val timerId: String? = null

fun send(type: String, data: String) {
//TODO decide okhttp vs scarlet for websocket connections
}

fun stop() {
socket.close()
}
}
Loading

0 comments on commit 63e4bfa

Please sign in to comment.