Skip to content

Commit

Permalink
Merge pull request #20 from Malinskiy/feature/target-jvm-8
Browse files Browse the repository at this point in the history
Prepare for release 0.2.0
  • Loading branch information
Malinskiy authored Jan 12, 2021
2 parents 08081d8 + 40ce8b1 commit 40c5b4d
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 6 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ jobs:
- uses: malinskiy/action-android/install-sdk@release/0.0.8
- name: gradle test jacocoTestReport
run: ./gradlew test jacocoTestReport
- name: archive test results
run: (cd build/reports/tests/test; zip -r -X ../../../../test-result.zip .)
- name: Save test output
uses: actions/upload-artifact@master
if: failure()
with:
name: test-result
path: build/reports/tests/test
path: test-result.zip
- name: archive test coverage
run: (cd build/reports/jacoco/test/html; zip -r -X ../../../../test-coverage.zip .)
- name: Save coverage output
uses: actions/upload-artifact@master
with:
name: test-coverage
path: build/reports/jacoco/test/html
path: test-coverage.zip
- name: codecov unit tests
run: bash <(curl -s https://codecov.io/bash) -f ./build/reports/jacoco/test/jacocoTestReport.xml -F unit
env:
Expand All @@ -49,17 +53,21 @@ jobs:
abi: x86
- name: Generate integration code coverage report
run: ./gradlew jacocoIntegrationTestReport
- name: archive integration test results
run: (cd build/reports/tests/integrationTest; zip -r -X ../../../../integration-test-result.zip .)
- name: Save integration test output
uses: actions/upload-artifact@master
if: failure()
with:
name: integration-test-result
path: build/reports/tests/integrationTest
path: integration-test-result.zip
- name: archive test coverage
run: (cd build/reports/jacoco/jacocoIntegrationTestReport/html; zip -r -X ../../../../integration-test-coverage.zip .)
- name: Save coverage output
uses: actions/upload-artifact@master
with:
name: integration-test-coverage
path: build/reports/jacoco/jacocoIntegrationTestReport/html
path: integration-test-coverage.zip
- name: Save logcat output
uses: actions/upload-artifact@master
if: failure()
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
![Maven Central](https://img.shields.io/maven-central/v/com.malinskiy/adam)
![Codecov](https://img.shields.io/codecov/c/github/Malinskiy/adam)
![Documentation](https://img.shields.io/badge/docs-documentation-green?link=https://malinskiy.github.io/adam/)

# adam
Android Debug Bridge helper written in Kotlin
Expand Down Expand Up @@ -69,6 +70,9 @@ Full E2E testing with at least Android emulator is also used to guarantee stabil

Not to mention any device shell commands.

## API compatibility
Until v1.0.0 release, there is no guarantee that the interfaces and requests will not change.

License
-------

Expand Down
12 changes: 12 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
jcenter()
Expand Down Expand Up @@ -98,6 +100,16 @@ tasks.dokkaHtml.configure {
outputDirectory.set(projectDir.resolve("docs/api"))
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.apiVersion = "1.4"
}

dependencies {
implementation(Libraries.kxml)
implementation(Libraries.annotations)
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object Versions {
val adam = System.getenv("GIT_TAG_NAME") ?: "0.1.0"
val adam = System.getenv("GIT_TAG_NAME") ?: "0.2.0"
val kotlin = "1.4.20"
val coroutines = "1.3.9"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class InstrumentationResponseTransformer : ProgressiveResponseTransformer<List<T
}

val nextLineBreak = buffer.indexOf('\n', startIndex = tokenPosition)

if (nextLineBreak == -1) {
return null
}

val atom = buffer.substring(0, nextLineBreak).lines()
buffer = buffer.delete(0, nextLineBreak + 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,29 @@ class InstrumentationResponseTransformerTest {
assertThat(events.map { it.toString() }.reduce { acc, s -> acc + "\n" + s })
.isEqualTo(javaClass.getResourceAsStream("/instrumentation/log_6.expected").reader().readText())
}

@Test
fun testBufferFraming() = runBlocking {
val transformer = InstrumentationResponseTransformer()

val lines = javaClass.getResourceAsStream("/instrumentation/log_6.input").reader().readLines()

val events = mutableListOf<TestEvent>()
for (line in lines) {
val part1 = line.substring(0, 7 * line.length / 8)
val part2 = line.substring(7 * line.length / 8, line.length)
val bytes1 = (part1).toByteArray(Const.DEFAULT_TRANSPORT_ENCODING)
val bytes2 = (part2 + '\n').toByteArray(Const.DEFAULT_TRANSPORT_ENCODING)
transformer.process(bytes1, 0, bytes1.size)?.let {
events.addAll(it)
}
transformer.process(bytes2, 0, bytes2.size)?.let {
events.addAll(it)
}
}
transformer.transform()?.let { events.addAll(it) }

assertThat(events.map { it.toString() }.reduce { acc, s -> acc + "\n" + s })
.isEqualTo(javaClass.getResourceAsStream("/instrumentation/log_6.expected").reader().readText())
}
}

0 comments on commit 40c5b4d

Please sign in to comment.