Skip to content

Commit

Permalink
Merge branch 'master' into issue/release_1_2_0
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
RuslanMingaliev committed Sep 15, 2020
2 parents 7a80922 + ee7ee1e commit 8b1bf25
Show file tree
Hide file tree
Showing 2,172 changed files with 24,992 additions and 11,744 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/deploy_snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
BINTRAY_KEY: ${{ secrets.bintray_key }}
ARTIFACTORY_PASS: ${{ secrets.artifactory_password }}
run: |
mkdir -p ${HOME}/.gradle
touch ${HOME}/.gradle/gradle.properties
echo $'\n'bintrayuser=$BINTRAY_USER >> ${HOME}/.gradle/gradle.properties
echo $'\n'bintraykey=$BINTRAY_KEY >> ${HOME}/.gradle/gradle.properties
echo $'\n'artifactoryPassword=$ARTIFACTORY_PASS >> ${HOME}/.gradle/gradle.properties
mkdir -p $HOME/.gradle
touch $HOME/.gradle/gradle.properties
echo $'\n'bintrayuser=$BINTRAY_USER >> $HOME/.gradle/gradle.properties
echo $'\n'bintraykey=$BINTRAY_KEY >> $HOME/.gradle/gradle.properties
echo $'\n'artifactoryPassword=$ARTIFACTORY_PASS >> $HOME/.gradle/gradle.properties
- name: Build
run: ./gradlew assemble
run: ./gradlew assemble --full-stacktrace
- name: Deploy snapshots to artifactory
run: ./gradlew artifactoryPublish
2 changes: 2 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ Vyacheslav Rodionov <[email protected]> <br>
Andrey Beryukhov <[email protected]> <br>
Mansur Biryukov <[email protected]> <br>
Darran Kelinske <[email protected]> <br>
Nataliya Vikulina <[email protected]> <br>
Azamat Cherchesov <[email protected]> <br>
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ Kaspresso writes its own logs, detailed and readable:

### Ability to call ADB commands

Espresso and UI Automator don't allow to call ADB commands from inside a test. That's why we have written special Autotest AdbServer.
All detailed info is available on [wiki](/wiki/06_AdbServer.md).
Espresso and UI Automator don't allow to call ADB commands from inside a test. To fix this problem, we developed Autotest AdbServer (see the [wiki](./wiki/06_AdbServer.md)).

### Ability to work with Android System

Expand Down
18 changes: 7 additions & 11 deletions adb-server/adbserver-desktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.gradle.jvm.tasks.Jar

plugins {
kotlin
application
Expand All @@ -16,13 +14,11 @@ dependencies {

setProperty("mainClassName", "com.kaspersky.adbserver.desktop.MainKt")

tasks {
val jar by getting(Jar::class) {
manifest {
attributes["Main-Class"] = "com.kaspersky.adbserver.desktop.MainKt"
}
from(configurations.runtimeClasspath.get().map {
if (it.isDirectory) it else zipTree(it)
})
tasks.jar.configure {
manifest {
attributes["Main-Class"] = "com.kaspersky.adbserver.desktop.MainKt"
}
}
from(configurations.runtimeClasspath.get().map {
if (it.isDirectory) it else zipTree(it)
})
}
33 changes: 32 additions & 1 deletion adb-server/adbserver-device/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import org.gradle.jvm.tasks.Jar

plugins {
kotlin
javaLibrary
}

dependencies {
Expand All @@ -8,4 +11,32 @@ dependencies {
implementation(project(Projects.AdbServer.commandTypes))
implementation(project(Projects.AdbServer.connection))
implementation(project(Projects.AdbServer.desktopDeviceConnection))
}
}

task(name = "sourcesJar", type = Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}

task(name = "javadocJar", type = Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.javadoc.get().destinationDir)
}

tasks.jar.configure {
val included = listOf(
"adbserver-common",
"adbserver-command-types",
"adbserver-connection",
"adbserver-desktop-device-connection"
)

archiveBaseName.set(project.name)
archiveVersion.set("")

from(
configurations.runtimeClasspath.get()
.filter { included.contains(it.nameWithoutExtension) }
.map { if (it.isDirectory) it else zipTree(it) }
)
}
4 changes: 4 additions & 0 deletions adb-server/adbserver-device/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
publish.artifactGroup=com.kaspersky.android-components
publish.artifactName=adbserver-device
publish.publicationName=adbserver-device
publish.bintrayRepo=AdbServer
25 changes: 0 additions & 25 deletions adb-server/adbserver-sample/build.gradle.kts

This file was deleted.

File renamed without changes.
File renamed without changes.
Binary file modified artifacts/adbserver-desktop.jar
Binary file not shown.
25 changes: 20 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
import groovy.lang.GroovyObject
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
import publishing.setup
import publishing.shouldBePublished
import java.util.Date

buildscript {

Expand All @@ -25,16 +27,26 @@ plugins {
mavenPublish
bintray
artifactory
dokka
}

subprojects {
apply(plugin = Dependencies.Detect.plugin)
apply(plugin = Dependencies.Dokka.plugin)

dependencies {
detekt(Dependencies.Detect.cli)
detekt(Dependencies.Detect.formatting)
}

tasks.dokkaGfm.configure {
val parentDir = when {
parent != rootProject && parent != null -> "docs" + File.separator + parent?.name
else -> "docs"
}
outputDirectory.set(rootDir.resolve(parentDir))
}

detekt {
failFast = true
autoCorrect = true
Expand All @@ -60,17 +72,21 @@ subprojects {
val publicationName = findProperty("publish.publicationName").toString()

bintray {

user = findProperty("bintrayuser").toString()
key = findProperty("bintraykey").toString()
setPublications(publicationName)

pkg.apply {
repo = "Kaspresso"
repo = findProperty("publish.bintrayRepo").toString()
name = publicationName
userOrg = user
vcsUrl = "https://github.com/KasperskyLab/Kaspresso.git"
setLicenses("Apache-2.0")

version.apply {
name = findProperty("stableVersion").toString()
released = Date().toString()
}
}

version = findProperty("stableVersion").toString()
Expand Down Expand Up @@ -102,9 +118,8 @@ subprojects {
})
}

tasks.named("artifactoryPublish") {
dependsOn("assemble")
}
tasks.artifactoryPublish.dependsOn("assemble")
tasks.bintrayUpload.dependsOn("assemble")
}
}

Expand Down
11 changes: 8 additions & 3 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ object Dependencies {
const val truth = "1.0"
const val gson = "2.8.6"

const val agp = "4.0.1"
const val detekt = "1.12.0"
const val dokka = "0.10.1"
const val dokka = "1.4.0"

const val bintray = "1.8.5"
const val artifactory = "4.17.2"
Expand All @@ -37,8 +38,12 @@ object Dependencies {
const val formatting = "io.gitlab.arturbosch.detekt:detekt-formatting:${Versions.detekt}"
}

object Dokka {
const val plugin = "org.jetbrains.dokka"
}

object Classpath {
const val gradlePlugin = "com.android.tools.build:gradle:3.6.3"
const val gradlePlugin = "com.android.tools.build:gradle:${Versions.agp}"
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
const val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:${Versions.dokka}"
const val bintrayPlugin = "com.jfrog.bintray.gradle:gradle-bintray-plugin:${Versions.bintray}"
Expand All @@ -51,7 +56,7 @@ object Dependencies {
const val artifactoryPlugin = "com.jfrog.artifactory"
}

const val kotlinStdlib = "org.jetbrains.kotlin:kotlin-stdlib"
const val kotlinStdlib = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}"
const val kotlinCli = "org.jetbrains.kotlinx:kotlinx-cli:${Versions.kotlinCli}"

const val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ val PluginDependenciesSpec.detekt: PluginDependencySpec
get() = id("io.gitlab.arturbosch.detekt") version Dependencies.Versions.detekt

val PluginDependenciesSpec.dokka: PluginDependencySpec
get() = id("org.jetbrains.dokka")
get() = id("org.jetbrains.dokka") version Dependencies.Versions.dokka

val PluginDependenciesSpec.javaLibrary: PluginDependencySpec
get() = `java-library`
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Projects.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ object Projects {
}

object Kaspresso {
const val framework = ":kaspresso:kaspresso-framework"
const val framework = ":kaspresso"
}

object Kautomator {
const val framework = ":kautomator:kautomator-framework"
const val framework = ":kautomator"
}
}
}
56 changes: 38 additions & 18 deletions buildSrc/src/main/kotlin/publishing/Publishing.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package publishing

import org.gradle.api.Project
import org.gradle.api.plugins.JavaLibraryPlugin
import org.gradle.api.publish.PublicationContainer
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
Expand All @@ -11,29 +12,33 @@ private const val JAVADOC_TASK = "javadocJar"
private const val NODE_DEPENDENCIES = "dependencies"
private const val NODE_DEPENDENCY = "dependency"
private const val DEPENDENCIES_CONFIGURATION = "implementation"
private const val UNSPECIFIED_DEPENDENCY = "unspecified"
private const val UNSPECIFIED = "unspecified"

private const val DEPENDENCY_GROUP = "groupId"
private const val DEPENDENCY_ARTIFACT = "artifactId"
private const val DEPENDENCY_VERSION = "version"
private const val DEPENDENCY_KAUTOMATOR = "kautomator-framework"
private const val DEPENDENCY_KAUTOMATOR_SHORT = "kautomator"
private const val DEPENDENCY_KAUTOMATOR = "kautomator"
private const val DEPENDENCY_ADB_SERVER = "adbserver-device"

private const val PROPERTY_VERSION = "stableVersion"
private const val PROPERTY_VERSION_SNAPSHOT = "snapshotVersion"
private const val PROPERTY_GROUP_ID = "publish.artifactGroup"
private const val PROPERTY_ARTIFACT_NAME = "publish.artifactName"
private const val PROPERTY_PUBLICATION_NAME = "publish.publicationName"

val Project.shouldBePublished get() = name == "kaspresso-framework" ||
name == "kautomator-framework"
val Project.shouldBePublished
get() = listOf(
"kaspresso",
"kautomator",
"adbserver-device"
).contains(name)

fun PublishingExtension.setup(project: Project) {
publications {
createWithNameAndVersion(
project = project,
publicationName = project.findProperty(PROPERTY_PUBLICATION_NAME).toString(),
publicationVersion = project.findProject(PROPERTY_VERSION).toString()
publicationVersion = project.findProperty(PROPERTY_VERSION).toString()
)

createWithNameAndVersion(
Expand All @@ -44,10 +49,18 @@ fun PublishingExtension.setup(project: Project) {
}
}

private fun PublicationContainer.createWithNameAndVersion(project: Project, publicationName: String, publicationVersion: String): MavenPublication {
private fun PublicationContainer.createWithNameAndVersion(
project: Project,
publicationName: String,
publicationVersion: String
): MavenPublication {
return create(publicationName, MavenPublication::class.java) {
project.afterEvaluate {
artifact(file("$buildDir/outputs/aar/$name-release.aar"))
if (project.plugins.hasPlugin(JavaLibraryPlugin::class.java)) {
artifact(file("$buildDir/libs/$name.jar"))
}
if (project.plugins.hasPlugin("com.android.library"))
artifact(file("$buildDir/outputs/aar/$name-release.aar"))
artifact(tasks.getByName(SOURCES_TASK))
artifact(tasks.getByName(JAVADOC_TASK))
}
Expand All @@ -62,17 +75,24 @@ private fun PublicationContainer.createWithNameAndVersion(project: Project, publ
val dependenciesNode = root.appendNode(NODE_DEPENDENCIES)

project.configurations.getByName(DEPENDENCIES_CONFIGURATION).allDependencies.forEach {
if (it.name != UNSPECIFIED_DEPENDENCY && it.version != null) {
val dependencyNode = dependenciesNode.appendNode(NODE_DEPENDENCY)

if (it.name != DEPENDENCY_KAUTOMATOR) { // TODO: Move to project settings
dependencyNode.appendNode(DEPENDENCY_GROUP, it.group)
dependencyNode.appendNode(DEPENDENCY_VERSION, it.version)
dependencyNode.appendNode(DEPENDENCY_ARTIFACT, it.name)
} else {
dependencyNode.appendNode(DEPENDENCY_GROUP, groupId)
dependencyNode.appendNode(DEPENDENCY_VERSION, publicationVersion)
dependencyNode.appendNode(DEPENDENCY_ARTIFACT, DEPENDENCY_KAUTOMATOR_SHORT)
val dependencyNode = dependenciesNode.appendNode(NODE_DEPENDENCY)

fun appendArtifact(group: String?, version: String?, artifact: String?) {
dependencyNode.appendNode(DEPENDENCY_GROUP, group)
dependencyNode.appendNode(DEPENDENCY_ARTIFACT, artifact)
dependencyNode.appendNode(DEPENDENCY_VERSION, version)
}

when {
listOf(DEPENDENCY_KAUTOMATOR, DEPENDENCY_ADB_SERVER).contains(it.name) -> {
appendArtifact(groupId, publicationVersion, it.name)
}
it.version != UNSPECIFIED && it.version != null -> {
appendArtifact(it.group, it.version, it.name)
}
else -> {
dependenciesNode.remove(dependencyNode)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//[adbserver-command-types](../../index.md)/[com.kaspersky.adbserver.commandtypes](../index.md)/[AdbCommand](index.md)/[AdbCommand](-adb-command.md)



# AdbCommand
[jvm]
Content
fun [AdbCommand](-adb-command.md)(body: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html))



Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//[adbserver-command-types](../../index.md)/[com.kaspersky.adbserver.commandtypes](../index.md)/[AdbCommand](index.md)/[component1](component1.md)



# component1
[jvm]
Content
operator fun [component1](component1.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)



Loading

0 comments on commit 8b1bf25

Please sign in to comment.