Added dagger dependencies and moved code to package to avoid kapt warnings
This commit is contained in:
parent
e34ded9e29
commit
642cfd5f1e
42 changed files with 111 additions and 104 deletions
|
@ -5,6 +5,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|||
plugins {
|
||||
// __KOTLIN_COMPOSE_VERSION__
|
||||
kotlin("jvm") version "1.5.21"
|
||||
kotlin("kapt") version "1.5.21"
|
||||
// __LATEST_COMPOSE_RELEASE_VERSION__
|
||||
id("org.jetbrains.compose") version "1.0.0-alpha3"
|
||||
}
|
||||
|
@ -18,10 +19,14 @@ repositories {
|
|||
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
|
||||
}
|
||||
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation(compose.desktop.currentOs)
|
||||
implementation("org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r")
|
||||
implementation("org.apache.sshd:sshd-core:2.7.0")
|
||||
implementation("com.google.dagger:dagger:2.38.1")
|
||||
kapt("com.google.dagger:dagger-compiler:2.38.1")
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>() {
|
||||
|
@ -30,6 +35,7 @@ tasks.withType<KotlinCompile>() {
|
|||
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
|
||||
}
|
||||
|
||||
|
||||
compose.desktop {
|
||||
application {
|
||||
mainClass = "MainKt"
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
kotlin.code.style=official
|
||||
kotlin.code.style=official
|
||||
# Workaround for sometimes happening this issue https://youtrack.jetbrains.com/issue/KT-40750
|
||||
kapt.use.worker.api=false
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradlew
vendored
Normal file → Executable file
2
gradlew
vendored
Normal file → Executable file
|
@ -72,7 +72,7 @@ case "`uname`" in
|
|||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MSYS* | MINGW* )
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
|
|
0
gradlew.bat
vendored
Executable file → Normal file
0
gradlew.bat
vendored
Executable file → Normal file
|
@ -1,3 +1,5 @@
|
|||
package app
|
||||
|
||||
import java.util.prefs.Preferences
|
||||
|
||||
private const val PREFERENCES_NAME = "GitnuroConfig"
|
|
@ -1,4 +1,4 @@
|
|||
package credentials
|
||||
package app.credentials
|
||||
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
|
@ -1,4 +1,4 @@
|
|||
package credentials
|
||||
package app.credentials
|
||||
|
||||
import org.apache.sshd.client.channel.ChannelExec
|
||||
import org.apache.sshd.client.session.ClientSession
|
|
@ -1,11 +1,9 @@
|
|||
package credentials
|
||||
package app.credentials
|
||||
|
||||
import org.apache.sshd.client.SshClient
|
||||
import org.apache.sshd.client.future.ConnectFuture
|
||||
import org.eclipse.jgit.transport.RemoteSession
|
||||
import org.eclipse.jgit.transport.URIish
|
||||
import java.io.PipedInputStream
|
||||
import java.io.PipedOutputStream
|
||||
|
||||
private const val DEFAULT_SSH_PORT = 22
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package credentials
|
||||
package app.credentials
|
||||
|
||||
import org.eclipse.jgit.transport.CredentialsProvider
|
||||
import org.eclipse.jgit.transport.RemoteSession
|
|
@ -1,4 +1,4 @@
|
|||
package credentials
|
||||
package app.credentials
|
||||
|
||||
import org.eclipse.jgit.transport.CredentialItem
|
||||
import org.eclipse.jgit.transport.CredentialsProvider
|
7
src/main/kotlin/app/di/AppComponent.kt
Normal file
7
src/main/kotlin/app/di/AppComponent.kt
Normal file
|
@ -0,0 +1,7 @@
|
|||
package app.di
|
||||
|
||||
import dagger.Component
|
||||
|
||||
@Component
|
||||
interface AppComponent {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package extensions
|
||||
package app.extensions
|
||||
|
||||
import java.text.DateFormat
|
||||
import java.time.LocalDate
|
|
@ -1,4 +1,4 @@
|
|||
package extensions
|
||||
package app.extensions
|
||||
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.icons.Icons
|
||||
|
@ -10,8 +10,8 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
import theme.addFile
|
||||
import theme.modifyFile
|
||||
import app.theme.addFile
|
||||
import app.theme.modifyFile
|
||||
|
||||
val DiffEntry.filePath: String
|
||||
get() {
|
|
@ -1,4 +1,4 @@
|
|||
package extensions
|
||||
package app.extensions
|
||||
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.InputStream
|
|
@ -1,4 +1,4 @@
|
|||
package extensions
|
||||
package app.extensions
|
||||
|
||||
import org.eclipse.jgit.lib.Ref
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package extensions
|
||||
package app.extensions
|
||||
|
||||
import org.eclipse.jgit.api.Status
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package extensions
|
||||
package app.extensions
|
||||
|
||||
import java.math.BigInteger
|
||||
import java.security.MessageDigest
|
|
@ -1,4 +1,4 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
@ -1,10 +1,8 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import credentials.GRemoteSession
|
||||
import credentials.GSessionManager
|
||||
import app.credentials.GSessionManager
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.transport.*
|
||||
import org.eclipse.jgit.util.FS
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
@ -39,7 +39,7 @@ class DiffManager {
|
|||
// TODO This is just a workaround, try to find properly which lines have to be displayed by using a custom diff
|
||||
|
||||
return@withContext diff.split("\n", "\r\n").filterNot {
|
||||
it.startsWith("diff --git")
|
||||
it.startsWith("diff --app.git")
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import credentials.CredentialsState
|
||||
import credentials.CredentialsStateManager
|
||||
import app.credentials.CredentialsState
|
||||
import app.credentials.CredentialsStateManager
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
@ -83,10 +83,10 @@ class GitManager {
|
|||
}
|
||||
|
||||
fun openRepository(directory: File) {
|
||||
val gitDirectory = if (directory.name == ".git") {
|
||||
val gitDirectory = if (directory.name == ".app.git") {
|
||||
directory
|
||||
} else {
|
||||
val gitDir = File(directory, ".git")
|
||||
val gitDir = File(directory, ".app.git")
|
||||
if (gitDir.exists() && gitDir.isDirectory) {
|
||||
gitDir
|
||||
} else
|
|
@ -1,4 +1,4 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ensureActive
|
|
@ -1,6 +1,6 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import credentials.*
|
||||
import app.credentials.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.eclipse.jgit.api.Git
|
|
@ -1,4 +1,4 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
@ -6,8 +6,6 @@ import kotlinx.coroutines.flow.StateFlow
|
|||
import kotlinx.coroutines.withContext
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import java.text.DateFormat
|
||||
import java.util.*
|
||||
|
||||
class StashManager {
|
||||
private val _stashStatus = MutableStateFlow<StashStatus>(StashStatus.Loaded(listOf()))
|
||||
|
@ -24,14 +22,14 @@ class StashManager {
|
|||
}
|
||||
|
||||
suspend fun popStash(git: Git) = withContext(Dispatchers.IO) {
|
||||
// val firstStash = git.stashList().call().firstOrNull() ?: return@withContext
|
||||
// val firstStash = app.git.stashList().call().firstOrNull() ?: return@withContext
|
||||
|
||||
git
|
||||
.stashApply()
|
||||
// .setStashRef(firstStash.)
|
||||
.call()
|
||||
|
||||
// git.stashDrop()
|
||||
// app.git.stashDrop()
|
||||
// .setStashRef(firstStash.)
|
||||
|
||||
loadStashList(git)
|
|
@ -1,7 +1,7 @@
|
|||
package git
|
||||
package app.git
|
||||
|
||||
import extensions.filePath
|
||||
import extensions.hasUntrackedChanges
|
||||
import app.extensions.filePath
|
||||
import app.extensions.hasUntrackedChanges
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ensureActive
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
@ -11,13 +11,13 @@ import androidx.compose.ui.draw.alpha
|
|||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.*
|
||||
import androidx.compose.ui.zIndex
|
||||
import git.GitManager
|
||||
import git.RepositorySelectionStatus
|
||||
import theme.*
|
||||
import ui.RepositoryOpenPage
|
||||
import ui.WelcomePage
|
||||
import ui.components.RepositoriesTabPanel
|
||||
import ui.components.TabInformation
|
||||
import app.git.GitManager
|
||||
import app.git.RepositorySelectionStatus
|
||||
import app.theme.*
|
||||
import app.ui.RepositoryOpenPage
|
||||
import app.ui.WelcomePage
|
||||
import app.ui.components.RepositoriesTabPanel
|
||||
import app.ui.components.TabInformation
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
fun main() = application {
|
|
@ -1,4 +1,4 @@
|
|||
package theme
|
||||
package app.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package theme
|
||||
package app.theme
|
||||
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.Composable
|
|
@ -1,4 +1,4 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
@ -18,11 +18,11 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import extensions.simpleName
|
||||
import git.GitManager
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.extensions.simpleName
|
||||
import app.git.GitManager
|
||||
import org.eclipse.jgit.lib.Ref
|
||||
import theme.headerBackground
|
||||
import app.theme.headerBackground
|
||||
|
||||
@Composable
|
||||
fun Branches(gitManager: GitManager) {
|
|
@ -1,4 +1,4 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
|
@ -17,20 +17,20 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import extensions.*
|
||||
import app.extensions.*
|
||||
import kotlinx.coroutines.*
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import org.jetbrains.skija.Image.makeFromEncoded
|
||||
import theme.headerBackground
|
||||
import theme.primaryTextColor
|
||||
import theme.secondaryTextColor
|
||||
import app.theme.headerBackground
|
||||
import app.theme.primaryTextColor
|
||||
import app.theme.secondaryTextColor
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.setValue
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import git.GitManager
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.git.GitManager
|
||||
|
||||
@Composable
|
||||
fun CommitChanges(
|
|
@ -1,4 +1,4 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
@ -20,10 +20,10 @@ import androidx.compose.ui.graphics.Color
|
|||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import git.DiffEntryType
|
||||
import git.GitManager
|
||||
import theme.primaryTextColor
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.git.DiffEntryType
|
||||
import app.git.GitManager
|
||||
import app.theme.primaryTextColor
|
||||
|
||||
@Composable
|
||||
fun Diff(gitManager: GitManager, diffEntryType: DiffEntryType, onCloseDiffView: () -> Unit) {
|
|
@ -1,4 +1,4 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
|
@ -19,7 +19,7 @@ import androidx.compose.ui.input.pointer.pointerMoveFilter
|
|||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import theme.primaryTextColor
|
||||
import app.theme.primaryTextColor
|
||||
|
||||
@Composable
|
||||
fun GMenu(
|
|
@ -1,4 +1,4 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
@ -15,13 +15,13 @@ import androidx.compose.ui.text.font.FontStyle
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import extensions.toSmartSystemString
|
||||
import git.GitManager
|
||||
import git.LogStatus
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.extensions.toSmartSystemString
|
||||
import app.git.GitManager
|
||||
import app.git.LogStatus
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import theme.primaryTextColor
|
||||
import theme.secondaryTextColor
|
||||
import app.theme.primaryTextColor
|
||||
import app.theme.secondaryTextColor
|
||||
|
||||
@Composable
|
||||
fun Log(
|
|
@ -1,4 +1,4 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.animation.Crossfade
|
||||
import androidx.compose.foundation.layout.*
|
||||
|
@ -11,10 +11,9 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import credentials.CredentialsState
|
||||
import git.DiffEntryType
|
||||
import git.GitManager
|
||||
import git.RepositorySelectionStatus
|
||||
import app.credentials.CredentialsState
|
||||
import app.git.DiffEntryType
|
||||
import app.git.GitManager
|
||||
import openRepositoryDialog
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
|
||||
|
@ -52,7 +51,7 @@ fun RepositoryOpenPage(gitManager: GitManager) {
|
|||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Text("Introduce your remote server credentials")
|
||||
Text("Introduce your remote server app.credentials")
|
||||
|
||||
OutlinedTextField(
|
||||
value = userField,
|
|
@ -1,4 +1,4 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
@ -15,11 +15,11 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import git.GitManager
|
||||
import git.StashStatus
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.git.GitManager
|
||||
import app.git.StashStatus
|
||||
import org.eclipse.jgit.revwalk.RevCommit
|
||||
import theme.headerBackground
|
||||
import app.theme.headerBackground
|
||||
|
||||
@Composable
|
||||
fun Stashes(gitManager: GitManager) {
|
|
@ -1,4 +1,4 @@
|
|||
import git.GitManager
|
||||
import app.git.GitManager
|
||||
import javax.swing.JFileChooser
|
||||
|
||||
fun openRepositoryDialog(gitManager: GitManager) {
|
|
@ -1,6 +1,6 @@
|
|||
@file:Suppress("UNUSED_PARAMETER")
|
||||
|
||||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
|
@ -24,14 +24,14 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import ui.components.ScrollableLazyColumn
|
||||
import extensions.filePath
|
||||
import extensions.icon
|
||||
import extensions.iconColor
|
||||
import git.GitManager
|
||||
import git.StageStatus
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.extensions.filePath
|
||||
import app.extensions.icon
|
||||
import app.extensions.iconColor
|
||||
import app.git.GitManager
|
||||
import app.git.StageStatus
|
||||
import org.eclipse.jgit.diff.DiffEntry
|
||||
import theme.headerBackground
|
||||
import app.theme.headerBackground
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
@Composable
|
|
@ -1,18 +1,15 @@
|
|||
package ui
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import git.GitManager
|
||||
import app.git.GitManager
|
||||
import openRepositoryDialog
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ui.components
|
||||
package app.ui.components
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
|
@ -14,7 +14,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import theme.primaryLight
|
||||
import app.theme.primaryLight
|
||||
|
||||
|
||||
@Composable
|
|
@ -1,4 +1,4 @@
|
|||
package ui.components
|
||||
package app.ui.components
|
||||
|
||||
import androidx.compose.foundation.VerticalScrollbar
|
||||
import androidx.compose.foundation.layout.Box
|
Loading…
Reference in a new issue