Skip to content

Commit

Permalink
Break-out into modules
Browse files Browse the repository at this point in the history
  • Loading branch information
garyttierney committed Apr 12, 2024
1 parent f5d4b8f commit 71eb035
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 49 deletions.
27 changes: 3 additions & 24 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,17 @@


plugins {
kotlin("jvm")
`ghidralite-conventions`
alias(libs.plugins.ksp)
alias(libs.plugins.kotlinx.serialization)
alias(libs.plugins.composeDesktop)
}

val ghidraDistribution = extra["ghidra.dir"] as String

repositories {
google()
gradlePluginPortal()
mavenCentral()

// JetBrains repositories for compose-desktop and compose-multiplatform
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven("https://packages.jetbrains.team/maven/p/kpm/public/")

// JetBrains repositories for IntelliJ components
maven("https://www.jetbrains.com/intellij-repository/releases/")
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
}

kotlin {
jvmToolchain {
vendor = JvmVendorSpec.JETBRAINS
languageVersion = JavaLanguageVersion.of(17)
}
}

dependencies {
implementation(project(":ghidra-schema-ksp"))
ksp(project(":ghidra-schema-ksp"))
implementation(project(":ghidralite-core-ksp"))
ksp(project(":ghidralite-core-ksp"))

implementation(libs.kotlin.reflect)
implementation(libs.kotlinx.serialization.json)
Expand Down
23 changes: 23 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
`kotlin-dsl`
alias(libs.plugins.kotlinx.serialization)
}

kotlin {
sourceSets {
all {
languageSettings {
optIn("kotlinx.serialization.ExperimentalSerializationApi")
}
}
}
}

dependencies {
implementation(libs.kotlin.gradlePlugin)

// Enables using type-safe accessors to reference plugins from the [plugins] block defined in
// version catalogs.
// Context: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
19 changes: 19 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@file:Suppress("UnstableApiUsage")

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

rootProject.name = "buildSrc"

dependencyResolutionManagement {
repositories {
google()
gradlePluginPortal()
mavenCentral()
}

versionCatalogs {
create("libs") {
from(files("../versions.toml"))
}
}
}
36 changes: 36 additions & 0 deletions buildSrc/src/main/kotlin/ghidralite-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@file:Suppress("UnstableApiUsage")

plugins {
kotlin("jvm")
}

group = "io.github.garyttierney.ghidralite"
version = "0.1.0"

repositories {
google()
mavenCentral()

// JetBrains repositories for compose-desktop and compose-multiplatform
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
maven("https://packages.jetbrains.team/maven/p/kpm/public/")

// JetBrains repositories for IntelliJ components
maven("https://www.jetbrains.com/intellij-repository/releases/")
maven("https://cache-redirector.jetbrains.com/intellij-dependencies")
}

dependencies {
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}

kotlin {
jvmToolchain {
vendor = JvmVendorSpec.JETBRAINS
languageVersion = JavaLanguageVersion.of(17)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.9.23"
`ghidralite-conventions`
}

group = "io.github.garyttierney"
Expand Down
22 changes: 22 additions & 0 deletions ghidralite-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
`ghidralite-conventions`
id("me.champeau.jmh") version "0.7.2"
}

group = "io.github.garyttierney"
version = "unspecified"

repositories {
mavenCentral()
}

dependencies {
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(17)
}
21 changes: 21 additions & 0 deletions ghidralite-extension/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
`ghidralite-conventions`
}

group = "io.github.garyttierney"
version = "unspecified"

repositories {
mavenCentral()
}

dependencies {
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(17)
}
21 changes: 21 additions & 0 deletions ghidralite-standalone/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
`ghidralite-conventions`
}

group = "io.github.garyttierney"
version = "unspecified"

repositories {
mavenCentral()
}

dependencies {
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(17)
}
3 changes: 3 additions & 0 deletions ghidralite-ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
`ghidralite-conventions`
}
7 changes: 6 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ dependencyResolutionManagement {
}

rootProject.name = "ghidralite"
include("ghidra-schema-ksp")

include("ghidralite-core")
include("ghidralite-core-ksp")
include("ghidralite-extension")
include("ghidralite-ui")
include("ghidralite-standalone")
3 changes: 2 additions & 1 deletion src/main/kotlin/Ghidralite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Ghidralite : GhidraLaunchable {
}

val icon = svgResource("icons/jewel-logo.svg")
val windowSize = IntSize(0, 0)

application {
val windowState = rememberWindowState()

Expand All @@ -78,6 +78,7 @@ class Ghidralite : GhidraLaunchable {
icon = icon,
) {
window.state

CompositionLocalProvider(LocalWindowPosition provides windowState.position) {
GhidraliteRoot(searchBarFocusRequester = searchBarFocusRequester)
}
Expand Down
44 changes: 24 additions & 20 deletions src/main/kotlin/ui/root/components/OnboardingComponent.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package io.github.garyttierney.ghidralite.ui.main.components

import androidx.compose.foundation.*
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.*
import androidx.compose.ui.*
import androidx.compose.ui.unit.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import ghidra.framework.model.DomainFolder
import ghidra.framework.model.Project
import ghidra.program.database.ProgramDB
import ghidra.program.model.listing.Program
import ghidra.util.task.TaskMonitor
import io.github.garyttierney.ghidralite.GhidraWorkerContext
import io.github.garyttierney.ghidralite.framework.GhidraliteProjectManager
Expand Down Expand Up @@ -46,7 +47,10 @@ fun Onboarding(onOnboardingComplete: (Workspace) -> Unit) {
}
}

Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Box(
modifier = Modifier.fillMaxSize().background(JewelTheme.globalColors.paneBackground),
contentAlignment = Alignment.Center
) {
if (project == null) {
DefaultButton(onClick = { showFilePicker = true }) {
Text("Select project (.gpr) file ")
Expand All @@ -63,26 +67,26 @@ fun Onboarding(onOnboardingComplete: (Workspace) -> Unit) {

DefaultButton(
onClick = {
projectLoadScope.launch {
val workspace = withContext(Dispatchers.IO) {
val program = file.getDomainObject(
GhidraWorkerContext,
false,
false,
TaskMonitor.DUMMY
)
projectLoadScope.launch {
val workspace = withContext(Dispatchers.IO) {
val program = file.getDomainObject(
GhidraWorkerContext,
false,
false,
TaskMonitor.DUMMY
)

Workspace.load(project!!, program as ProgramDB)
}
Workspace.load(project!!, program as ProgramDB)
}

onOnboardingComplete(workspace)
onOnboardingComplete(workspace)

}
}) {
}
}) {
Text("Open")
}
}
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/ui/search/QuickSearchResultsView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fun QuickSearch(
modifier = Modifier.fillMaxWidth()
.focusRequester(focusRequester)
.focusable(true)
,
placeholder = { Text("Type a query to begin searching") },
interactionSource = interactionSource,
)
Expand Down
4 changes: 2 additions & 2 deletions versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ intellij = "241.14494.241"
ghidra = "11.1"
jewel = "0.17.0"
jna = "5.14.0"
kotlin = "1.9.23"
kotlin = "1.9.0"
kotlinSarif = "0.5.0"
kotlinpoet = "1.15.2"
kotlinterGradlePlugin = "3.16.0"
kotlinxSerialization = "1.5.1"
kotlinxBinaryCompat = "0.14.0"
ksp = "1.9.23-1.0.20"
ksp = "1.9.20-1.0.14"
poko = "0.13.1"

[libraries]
Expand Down

0 comments on commit 71eb035

Please sign in to comment.