Added dagger dependencies and moved code to package to avoid kapt warnings

This commit is contained in:
Abdelilah El Aissaoui 2021-10-06 19:05:07 +02:00
parent e34ded9e29
commit 642cfd5f1e
42 changed files with 111 additions and 104 deletions

View file

@ -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"

View file

@ -1 +1,3 @@
kotlin.code.style=official
# Workaround for sometimes happening this issue https://youtrack.jetbrains.com/issue/KT-40750
kapt.use.worker.api=false

Binary file not shown.

2
gradlew vendored Normal file → Executable file
View 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
View file

View file

@ -1,3 +1,5 @@
package app
import java.util.prefs.Preferences
private const val PREFERENCES_NAME = "GitnuroConfig"

View file

@ -1,4 +1,4 @@
package credentials
package app.credentials
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

View file

@ -1,4 +1,4 @@
package credentials
package app.credentials
import org.apache.sshd.client.channel.ChannelExec
import org.apache.sshd.client.session.ClientSession

View file

@ -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

View file

@ -1,4 +1,4 @@
package credentials
package app.credentials
import org.eclipse.jgit.transport.CredentialsProvider
import org.eclipse.jgit.transport.RemoteSession

View file

@ -1,4 +1,4 @@
package credentials
package app.credentials
import org.eclipse.jgit.transport.CredentialItem
import org.eclipse.jgit.transport.CredentialsProvider

View file

@ -0,0 +1,7 @@
package app.di
import dagger.Component
@Component
interface AppComponent {
}

View file

@ -1,4 +1,4 @@
package extensions
package app.extensions
import java.text.DateFormat
import java.time.LocalDate

View file

@ -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() {

View file

@ -1,4 +1,4 @@
package extensions
package app.extensions
import java.io.ByteArrayOutputStream
import java.io.InputStream

View file

@ -1,4 +1,4 @@
package extensions
package app.extensions
import org.eclipse.jgit.lib.Ref

View file

@ -1,4 +1,4 @@
package extensions
package app.extensions
import org.eclipse.jgit.api.Status

View file

@ -1,4 +1,4 @@
package extensions
package app.extensions
import java.math.BigInteger
import java.security.MessageDigest

View file

@ -1,4 +1,4 @@
package git
package app.git
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow

View file

@ -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

View file

@ -1,4 +1,4 @@
package git
package app.git
import org.eclipse.jgit.diff.DiffEntry

View file

@ -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")
}
}

View file

@ -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

View file

@ -1,4 +1,4 @@
package git
package app.git
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ensureActive

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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 {

View file

@ -1,4 +1,4 @@
package theme
package app.theme
import androidx.compose.ui.graphics.Color

View file

@ -1,4 +1,4 @@
package theme
package app.theme
import androidx.compose.material.*
import androidx.compose.runtime.Composable

View file

@ -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) {

View file

@ -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(

View file

@ -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) {

View file

@ -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(

View file

@ -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(

View file

@ -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,

View file

@ -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) {

View file

@ -1,4 +1,4 @@
import git.GitManager
import app.git.GitManager
import javax.swing.JFileChooser
fun openRepositoryDialog(gitManager: GitManager) {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,4 @@
package ui.components
package app.ui.components
import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.foundation.layout.Box