Skip to content

Commit e5e6153

Browse files
authored
Merge pull request #12 from DeviceFarmer/minicap-kotlin
Kotlin implemtentation of minicap
2 parents 0aa1823 + 08cbdef commit e5e6153

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1411
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.gradle
12
/*.tgz
23
/.env
34
/gdb.setup

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/.env
22
/.gitmodules
33
/.npmignore
4+
/.semaphore
45
/*.tgz
56
/build-remote.sh
67
/CONTRIBUTING.md
@@ -14,3 +15,4 @@
1415
/run.sh
1516
/temp/
1617
/yarn-error.log
18+
/experimental

.semaphore/semaphore.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ blocks:
1919
- 'export PATH=$PATH:~/android-sdk/cmdline-tools/tools/bin'
2020
- yes | sdkmanager "ndk;21.3.6528147"
2121
- 'export PATH=$PATH:~/android-sdk/ndk/21.3.6528147/'
22+
- export ANDROID_SDK_ROOT=~/android-sdk
2223
- sem-version node 12
2324
- cache restore
2425
- npm install

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,22 @@ NDKBUILT := \
1010
libs/x86_64/minicap \
1111
libs/x86_64/minicap-nopie \
1212

13+
GRADLEBUILT := \
14+
experimental/app/build/outputs/apk/debug/minicap-debug.apk
15+
1316
default: prebuilt
1417

1518
clean:
1619
ndk-build clean
1720
rm -rf prebuilt
21+
experimental/gradlew -p experimental clean
1822

1923
$(NDKBUILT):
2024
ndk-build
2125

26+
$(GRADLEBUILT):
27+
experimental/gradlew -p experimental assembleDebug
28+
2229
# It may feel a bit redundant to list everything here. However it also
2330
# acts as a safeguard to make sure that we really are including everything
2431
# that is supposed to be there.
@@ -85,6 +92,7 @@ prebuilt: \
8592
prebuilt/x86_64/lib/android-28/minicap.so \
8693
prebuilt/x86_64/lib/android-29/minicap.so \
8794
prebuilt/x86_64/lib/android-30/minicap.so \
95+
prebuilt/noarch/minicap.apk \
8896

8997
prebuilt/%/bin/minicap: libs/%/minicap
9098
mkdir -p $(@D)
@@ -109,3 +117,8 @@ prebuilt/x86/lib/%/minicap.so: jni/minicap-shared/aosp/libs/%/x86/minicap.so
109117
prebuilt/x86_64/lib/%/minicap.so: jni/minicap-shared/aosp/libs/%/x86_64/minicap.so
110118
mkdir -p $(@D)
111119
cp $^ $@
120+
121+
prebuilt/noarch/minicap.apk: experimental/app/build/outputs/apk/debug/minicap-debug.apk
122+
mkdir -p $(@D)
123+
cp $^ $@
124+

experimental/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
/.idea
11+
.DS_Store
12+
/build
13+
/captures
14+
.externalNativeBuild
15+
.cxx
16+
local.properties

experimental/app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

experimental/app/build.gradle

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (C) 2020 Orange
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
plugins {
17+
id 'com.android.application'
18+
id 'kotlin-android'
19+
id 'org.jetbrains.dokka'
20+
}
21+
22+
android {
23+
compileSdkVersion 30
24+
buildToolsVersion "30.0.2"
25+
26+
defaultConfig {
27+
applicationId "io.devicefarmer.minicap"
28+
minSdkVersion 21
29+
targetSdkVersion 30
30+
versionCode 1
31+
versionName "0.3"
32+
archivesBaseName = "minicap"
33+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
34+
}
35+
36+
buildTypes {
37+
release {
38+
minifyEnabled false
39+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
40+
}
41+
}
42+
compileOptions {
43+
sourceCompatibility JavaVersion.VERSION_1_8
44+
targetCompatibility JavaVersion.VERSION_1_8
45+
}
46+
kotlinOptions {
47+
jvmTarget = '1.8'
48+
}
49+
}
50+
51+
dependencies {
52+
53+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
54+
implementation 'androidx.core:core-ktx:1.3.2'
55+
implementation 'androidx.appcompat:appcompat:1.2.0'
56+
implementation 'com.google.android.material:material:1.3.0'
57+
implementation 'org.slf4j:slf4j-api:1.7.30'
58+
implementation 'com.github.tony19:logback-android:2.0.0'
59+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright (C) 2020 Orange
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
18+
package="io.devicefarmer.minicap">
19+
<application
20+
android:allowBackup="true"
21+
android:icon="@mipmap/ic_launcher"
22+
android:label="@string/app_name"
23+
android:roundIcon="@mipmap/ic_launcher_round"
24+
android:supportsRtl="true"
25+
android:theme="@style/Theme.Minicap" />
26+
</manifest>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
~ Copyright (C) 2020 Orange
3+
~ Licensed under the Apache License, Version 2.0 (the "License");
4+
~ you may not use this file except in compliance with the License.
5+
~ You may obtain a copy of the License at
6+
~
7+
~ http://www.apache.org/licenses/LICENSE-2.0
8+
~
9+
~ Unless required by applicable law or agreed to in writing, software
10+
~ distributed under the License is distributed on an "AS IS" BASIS,
11+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
~ See the License for the specific language governing permissions and
13+
~ limitations under the License.
14+
-->
15+
16+
<configuration>
17+
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
18+
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
19+
<target>System.err</target>
20+
<encoder>
21+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
22+
</encoder>
23+
</appender>
24+
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
25+
<file>/data/local/tmp/minicap.log</file>
26+
<append>true</append>
27+
<encoder>
28+
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
29+
</encoder>
30+
</appender>
31+
32+
<appender name="LOGCAT" class="ch.qos.logback.classic.android.LogcatAppender">
33+
<encoder>
34+
<pattern>%msg%n</pattern>
35+
</encoder>
36+
</appender>
37+
<root level="DEBUG">
38+
<!--appender-ref ref="FILE" /-->
39+
<appender-ref ref="LOGCAT" />
40+
<appender-ref ref="STDERR" />
41+
</root>
42+
</configuration>

0 commit comments

Comments
 (0)