Skip to content

Commit

Permalink
feat(apple): restructure apple to facilitate code reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
Malinskiy committed Feb 9, 2024
1 parent 64c30e3 commit 07e0b3f
Show file tree
Hide file tree
Showing 274 changed files with 448 additions and 2,814 deletions.
2 changes: 1 addition & 1 deletion cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ distributions {

dependencies {
implementation(project(":core"))
implementation(project(":vendor:vendor-ios"))
implementation(project(":vendor:vendor-apple:ios"))
implementation(project(":vendor:vendor-android"))
implementation(project(":analytics:usage"))
implementation(Libraries.kotlinStdLib)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.malinskiy.marathon.config.serialization.ConfigurationFactory
import com.malinskiy.marathon.config.vendor.VendorConfiguration
import com.malinskiy.marathon.di.marathonStartKoin
import com.malinskiy.marathon.exceptions.ExceptionsReporterFactory
import com.malinskiy.marathon.ios.AppleVendor
import com.malinskiy.marathon.apple.ios.AppleVendor
import com.malinskiy.marathon.log.MarathonLogging
import org.koin.core.context.stopKoin
import org.koin.dsl.module
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ rootProject.name = "marathon"
include("core")
include("configuration")
include("vendor:vendor-android")
include("vendor:vendor-ios")
include("vendor:vendor-apple:ios")
include("vendor:vendor-apple:base")
include("vendor:vendor-test")
include("marathon-gradle-plugin")
include("report:html-report")
Expand Down
14 changes: 14 additions & 0 deletions vendor/vendor-apple/base/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
`java-library`
jacoco
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.dokka")
}

dependencies {
api(Libraries.sshj)
}

setupDeployment()
setupKotlinCompiler()
setupTestTask()
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package net.schmizz.sshj
package com.malinskiy.marathon.apple.sshj

import net.schmizz.sshj.connection.channel.direct.PatchedExecChannel
import net.schmizz.sshj.Config
import net.schmizz.sshj.SSHClient
import sshj.connection.channel.direct.PatchedExecChannel
import net.schmizz.sshj.connection.channel.direct.Session

/**
* Subclass of SSHJ [SSHClient] that uses [PatchedSSHClient] which handles some strange features.
*/
internal class PatchedSSHClient(config: Config) : SSHClient(config) {
class PatchedSSHClient(config: Config) : SSHClient(config) {
override fun startSession(): Session {
check(isConnected) { "Not connected" }
check(isAuthenticated) { "Not authenticated" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package net.schmizz.sshj.connection.channel.direct
package sshj.connection.channel.direct

import net.schmizz.sshj.SSHClient
import net.schmizz.sshj.common.Buffer
import net.schmizz.sshj.common.DisconnectReason
import net.schmizz.sshj.common.SSHPacket
import net.schmizz.sshj.connection.ConnectionException
import net.schmizz.sshj.connection.channel.ChannelInputStream
import net.schmizz.sshj.connection.channel.direct.SessionChannel

/**
* Subclass of SSHJ [SessionChannel] that handles some strange features.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ dependencies {
implementation(Libraries.ddPlist)
implementation(Libraries.guava)
implementation(Libraries.rsync4j)
implementation(Libraries.sshj)

implementation(Libraries.gson)
implementation(Libraries.jacksonKotlin)
implementation(Libraries.jacksonYaml)
implementation(Libraries.jansi)
implementation(Libraries.kotlinProcess)
implementation(project(":core"))
implementation(project(":vendor:vendor-apple:base"))
testImplementation(TestLibraries.kluent)
testImplementation(TestLibraries.assertk)
testImplementation(TestLibraries.mockitoKotlin)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.apple.ios.extensions.testBundle
import com.malinskiy.marathon.apple.ios.model.Sdk
import com.malinskiy.marathon.apple.ios.xctestrun.TestRootFactory
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.exceptions.ConfigurationException
import com.malinskiy.marathon.config.vendor.VendorConfiguration
import com.malinskiy.marathon.config.vendor.ios.TestType
import com.malinskiy.marathon.exceptions.DeviceSetupException
import com.malinskiy.marathon.execution.withRetry
import com.malinskiy.marathon.ios.extensions.testBundle
import com.malinskiy.marathon.ios.model.Sdk
import com.malinskiy.marathon.ios.xctestrun.TestRootFactory
import com.malinskiy.marathon.log.MarathonLogging

class AppleApplicationInstaller(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.apple.ios.cmd.CommandResult
import com.malinskiy.marathon.apple.ios.test.TestEvent
import com.malinskiy.marathon.apple.ios.test.TestRequest
import com.malinskiy.marathon.device.Device
import com.malinskiy.marathon.device.screenshot.Screenshottable
import com.malinskiy.marathon.exceptions.DeviceSetupException
import com.malinskiy.marathon.ios.cmd.CommandResult
import com.malinskiy.marathon.ios.test.TestEvent
import com.malinskiy.marathon.ios.test.TestRequest
import com.malinskiy.marathon.report.logs.LogProducer
import kotlinx.coroutines.channels.ReceiveChannel
import java.io.File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.fasterxml.jackson.databind.JsonMappingException
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import com.google.gson.Gson
import com.malinskiy.marathon.analytics.internal.pub.Track
import com.malinskiy.marathon.apple.ios.configuration.AppleTarget
import com.malinskiy.marathon.apple.ios.configuration.Marathondevices
import com.malinskiy.marathon.apple.ios.configuration.Transport
import com.malinskiy.marathon.apple.ios.configuration.Worker
import com.malinskiy.marathon.apple.ios.device.AppleSimulatorProvider
import com.malinskiy.marathon.apple.ios.device.SimulatorFactory
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.vendor.VendorConfiguration
import com.malinskiy.marathon.device.Device
import com.malinskiy.marathon.device.DeviceProvider
import com.malinskiy.marathon.exceptions.NoDevicesException
import com.malinskiy.marathon.ios.configuration.AppleTarget
import com.malinskiy.marathon.ios.configuration.Marathondevices
import com.malinskiy.marathon.ios.configuration.Transport
import com.malinskiy.marathon.ios.configuration.Worker
import com.malinskiy.marathon.ios.device.AppleSimulatorProvider
import com.malinskiy.marathon.ios.device.SimulatorFactory
import com.malinskiy.marathon.log.MarathonLogging
import com.malinskiy.marathon.time.Timer
import kotlinx.coroutines.CoroutineScope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.apple.ios.extensions.testBundle
import com.malinskiy.marathon.apple.ios.listener.AppleTestRunListener
import com.malinskiy.marathon.apple.ios.test.TestEvent
import com.malinskiy.marathon.apple.ios.test.TestFailed
import com.malinskiy.marathon.apple.ios.test.TestIgnored
import com.malinskiy.marathon.apple.ios.test.TestPassed
import com.malinskiy.marathon.apple.ios.test.TestRequest
import com.malinskiy.marathon.apple.ios.test.TestRunEnded
import com.malinskiy.marathon.apple.ios.test.TestRunFailed
import com.malinskiy.marathon.apple.ios.test.TestRunStartedEvent
import com.malinskiy.marathon.apple.ios.test.TestStarted
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.vendor.VendorConfiguration
import com.malinskiy.marathon.ios.executor.listener.AppleTestRunListener
import com.malinskiy.marathon.ios.extensions.testBundle
import com.malinskiy.marathon.ios.test.TestEvent
import com.malinskiy.marathon.ios.test.TestPassed
import com.malinskiy.marathon.ios.test.TestFailed
import com.malinskiy.marathon.ios.test.TestIgnored
import com.malinskiy.marathon.ios.test.TestRequest
import com.malinskiy.marathon.ios.test.TestRunEnded
import com.malinskiy.marathon.ios.test.TestRunFailed
import com.malinskiy.marathon.ios.test.TestRunStartedEvent
import com.malinskiy.marathon.ios.test.TestStarted
import com.malinskiy.marathon.log.MarathonLogging
import com.malinskiy.marathon.test.TestBatch
import com.malinskiy.marathon.test.toTestName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import ch.qos.logback.classic.Level
import ch.qos.logback.classic.Logger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.dd.plist.PropertyListParser
import com.malinskiy.marathon.analytics.internal.pub.Track
import com.malinskiy.marathon.apple.ios.bin.AppleBinaryEnvironment
import com.malinskiy.marathon.apple.ios.bin.xcrun.simctl.service.ApplicationService
import com.malinskiy.marathon.apple.ios.cmd.CommandExecutor
import com.malinskiy.marathon.apple.ios.cmd.CommandResult
import com.malinskiy.marathon.apple.ios.cmd.FileBridge
import com.malinskiy.marathon.apple.ios.listener.AppleTestRunListener
import com.malinskiy.marathon.apple.ios.listener.CompositeTestRunListener
import com.malinskiy.marathon.apple.ios.listener.DebugTestRunListener
import com.malinskiy.marathon.apple.ios.listener.ResultBundleRunListener
import com.malinskiy.marathon.apple.ios.listener.TestResultsListener
import com.malinskiy.marathon.apple.ios.listener.TestRunListenerAdapter
import com.malinskiy.marathon.apple.ios.listener.screenshot.ScreenCapturerTestRunListener
import com.malinskiy.marathon.apple.ios.listener.video.ScreenRecordingListener
import com.malinskiy.marathon.apple.ios.logparser.XctestEventProducer
import com.malinskiy.marathon.apple.ios.logparser.parser.DebugLogPrinter
import com.malinskiy.marathon.apple.ios.logparser.parser.DeviceFailureException
import com.malinskiy.marathon.apple.ios.logparser.parser.DiagnosticLogsPathFinder
import com.malinskiy.marathon.apple.ios.logparser.parser.SessionResultsPathFinder
import com.malinskiy.marathon.apple.ios.model.Arch
import com.malinskiy.marathon.apple.ios.model.Sdk
import com.malinskiy.marathon.apple.ios.model.Simulator
import com.malinskiy.marathon.apple.ios.model.XcodeVersion
import com.malinskiy.marathon.apple.ios.test.TestEvent
import com.malinskiy.marathon.apple.ios.test.TestRequest
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.ScreenRecordingPolicy
import com.malinskiy.marathon.config.vendor.VendorConfiguration
Expand All @@ -21,30 +45,6 @@ import com.malinskiy.marathon.execution.TestBatchResults
import com.malinskiy.marathon.execution.listener.LineListener
import com.malinskiy.marathon.execution.listener.LogListener
import com.malinskiy.marathon.io.FileManager
import com.malinskiy.marathon.ios.bin.AppleBinaryEnvironment
import com.malinskiy.marathon.ios.bin.xcrun.simctl.service.ApplicationService
import com.malinskiy.marathon.ios.cmd.CommandExecutor
import com.malinskiy.marathon.ios.cmd.CommandResult
import com.malinskiy.marathon.ios.cmd.FileBridge
import com.malinskiy.marathon.ios.executor.listener.AppleTestRunListener
import com.malinskiy.marathon.ios.executor.listener.CompositeTestRunListener
import com.malinskiy.marathon.ios.executor.listener.DebugTestRunListener
import com.malinskiy.marathon.ios.executor.listener.ResultBundleRunListener
import com.malinskiy.marathon.ios.executor.listener.video.ScreenRecordingListener
import com.malinskiy.marathon.ios.executor.listener.TestResultsListener
import com.malinskiy.marathon.ios.executor.listener.TestRunListenerAdapter
import com.malinskiy.marathon.ios.executor.listener.screenshot.ScreenCapturerTestRunListener
import com.malinskiy.marathon.ios.logparser.XctestEventProducer
import com.malinskiy.marathon.ios.logparser.parser.DebugLogPrinter
import com.malinskiy.marathon.ios.logparser.parser.DeviceFailureException
import com.malinskiy.marathon.ios.logparser.parser.DiagnosticLogsPathFinder
import com.malinskiy.marathon.ios.logparser.parser.SessionResultsPathFinder
import com.malinskiy.marathon.ios.model.Arch
import com.malinskiy.marathon.ios.model.Sdk
import com.malinskiy.marathon.ios.model.Simulator
import com.malinskiy.marathon.ios.model.XcodeVersion
import com.malinskiy.marathon.ios.test.TestEvent
import com.malinskiy.marathon.ios.test.TestRequest
import com.malinskiy.marathon.log.MarathonLogging
import com.malinskiy.marathon.report.attachment.AttachmentProvider
import com.malinskiy.marathon.report.logs.LogWriter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.apple.ios.model.AppleTestBundle
import com.malinskiy.marathon.config.exceptions.ConfigurationException
import com.malinskiy.marathon.execution.bundle.TestBundleIdentifier
import com.malinskiy.marathon.ios.model.AppleTestBundle
import com.malinskiy.marathon.test.Test
import com.malinskiy.marathon.test.toTestName
import java.io.File
import java.util.concurrent.ConcurrentHashMap

class AppleTestBundleIdentifier : TestBundleIdentifier {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
import com.fasterxml.jackson.module.kotlin.KotlinFeature
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.google.gson.GsonBuilder
import com.malinskiy.marathon.apple.ios.bin.xcrun.simctl.model.SimctlDeviceList
import com.malinskiy.marathon.apple.ios.bin.xcrun.simctl.model.SimctlDeviceListDeserializer
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.vendor.VendorConfiguration
import com.malinskiy.marathon.config.vendor.ios.TestParserConfiguration
import com.malinskiy.marathon.device.DeviceProvider
import com.malinskiy.marathon.execution.TestParser
import com.malinskiy.marathon.execution.bundle.TestBundleIdentifier
import com.malinskiy.marathon.ios.bin.xcrun.simctl.model.SimctlDeviceList
import com.malinskiy.marathon.ios.bin.xcrun.simctl.model.SimctlDeviceListDeserializer
import com.malinskiy.marathon.log.MarathonLogConfigurator
import org.koin.dsl.module

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.apple.ios.extensions.testBundle
import com.malinskiy.marathon.apple.ios.model.AppleTestBundle
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.exceptions.ConfigurationException
import com.malinskiy.marathon.config.vendor.VendorConfiguration
Expand All @@ -8,8 +10,6 @@ import com.malinskiy.marathon.device.Device
import com.malinskiy.marathon.exceptions.TestParsingException
import com.malinskiy.marathon.execution.RemoteTestParser
import com.malinskiy.marathon.execution.withRetry
import com.malinskiy.marathon.ios.extensions.testBundle
import com.malinskiy.marathon.ios.model.AppleTestBundle
import com.malinskiy.marathon.log.MarathonLogging
import com.malinskiy.marathon.test.Test
import kotlinx.coroutines.CancellationException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.config.vendor.ios.RecorderType
import com.malinskiy.marathon.config.vendor.ios.ScreenRecordConfiguration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.apple.ios.RemoteFileManager.Companion.FILE_SEPARATOR
import com.malinskiy.marathon.config.vendor.ios.Type
import com.malinskiy.marathon.extension.escape
import com.malinskiy.marathon.ios.RemoteFileManager.Companion.FILE_SEPARATOR
import com.malinskiy.marathon.log.MarathonLogging
import com.malinskiy.marathon.test.Test
import com.malinskiy.marathon.test.TestBatch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.malinskiy.marathon.ios
package com.malinskiy.marathon.apple.ios

import com.malinskiy.marathon.apple.ios.extensions.testBundle
import com.malinskiy.marathon.apple.ios.model.AppleTestBundle
import com.malinskiy.marathon.apple.ios.test.TestEvent
import com.malinskiy.marathon.apple.ios.test.TestRequest
import com.malinskiy.marathon.apple.ios.test.TestStarted
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.exceptions.ConfigurationException
import com.malinskiy.marathon.config.vendor.VendorConfiguration
Expand All @@ -8,11 +13,6 @@ import com.malinskiy.marathon.exceptions.TestParsingException
import com.malinskiy.marathon.execution.RemoteTestParser
import com.malinskiy.marathon.execution.listener.LineListener
import com.malinskiy.marathon.execution.withRetry
import com.malinskiy.marathon.ios.extensions.testBundle
import com.malinskiy.marathon.ios.model.AppleTestBundle
import com.malinskiy.marathon.ios.test.TestEvent
import com.malinskiy.marathon.ios.test.TestRequest
import com.malinskiy.marathon.ios.test.TestStarted
import com.malinskiy.marathon.log.MarathonLogging
import com.malinskiy.marathon.test.Test
import kotlinx.coroutines.CancellationException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.malinskiy.marathon.ios.bin
package com.malinskiy.marathon.apple.ios.bin

import com.google.gson.Gson
import com.malinskiy.marathon.apple.ios.bin.codesign.Codesign
import com.malinskiy.marathon.apple.ios.bin.getconf.Getconf
import com.malinskiy.marathon.apple.ios.bin.lipo.Lipo
import com.malinskiy.marathon.apple.ios.bin.nm.Nm
import com.malinskiy.marathon.apple.ios.bin.plistbuddy.PlistBuddy
import com.malinskiy.marathon.apple.ios.bin.xcodeselect.Xcodeselect
import com.malinskiy.marathon.apple.ios.bin.xcrun.Xcrun
import com.malinskiy.marathon.apple.ios.cmd.CommandExecutor
import com.malinskiy.marathon.config.Configuration
import com.malinskiy.marathon.config.vendor.VendorConfiguration
import com.malinskiy.marathon.ios.bin.codesign.Codesign
import com.malinskiy.marathon.ios.bin.getconf.Getconf
import com.malinskiy.marathon.ios.bin.lipo.Lipo
import com.malinskiy.marathon.ios.bin.nm.Nm
import com.malinskiy.marathon.ios.bin.plistbuddy.PlistBuddy
import com.malinskiy.marathon.ios.bin.xcodeselect.Xcodeselect
import com.malinskiy.marathon.ios.bin.xcrun.Xcrun
import com.malinskiy.marathon.ios.cmd.CommandExecutor

class AppleBinaryEnvironment(
commandExecutor: CommandExecutor,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.malinskiy.marathon.ios.bin.codesign
package com.malinskiy.marathon.apple.ios.bin.codesign

import com.malinskiy.marathon.apple.ios.cmd.CommandExecutor
import com.malinskiy.marathon.apple.ios.cmd.CommandResult
import com.malinskiy.marathon.config.vendor.ios.TimeoutConfiguration
import com.malinskiy.marathon.exceptions.DeviceSetupException
import com.malinskiy.marathon.ios.cmd.CommandExecutor
import com.malinskiy.marathon.ios.cmd.CommandResult
import java.time.Duration

/**
Expand Down
Loading

0 comments on commit 07e0b3f

Please sign in to comment.