Skip to content

Commit af2f89d

Browse files
Version 1.3.10.5
1 parent 4b0559a commit af2f89d

File tree

340 files changed

+3277
-3921
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+3277
-3921
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
* eol=lf
2+
*.bat text eol=crlf
23
*.der binary
34
*.otf binary
45
*.ttf binary

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
- uses: actions/setup-java@v3
1616
with:
17-
distribution: temurin
17+
distribution: corretto
1818
java-version: |
1919
8
2020
16

api/api/api.api

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,20 @@ public class gg/essential/api/gui/EssentialGUI : gg/essential/elementa/WindowScr
299299
public fun <init> (Ljava/lang/String;IZ)V
300300
public synthetic fun <init> (Ljava/lang/String;IZILkotlin/jvm/internal/DefaultConstructorMarker;)V
301301
public final fun getBackButtonVisible ()Z
302+
protected fun getBackgroundColor ()Ljava/awt/Color;
303+
protected fun getButtonColor ()Ljava/awt/Color;
304+
protected fun getButtonHighlightColor ()Ljava/awt/Color;
302305
protected final fun getContainer ()Lgg/essential/elementa/components/UIContainer;
303306
public final fun getContent ()Lgg/essential/elementa/components/UIContainer;
307+
protected fun getContentEdgesColor ()Ljava/awt/Color;
304308
public final fun getDiscordActivityDescription ()Ljava/lang/String;
305309
public final fun getRightDivider ()Lgg/essential/elementa/components/UIBlock;
306310
public final fun getScissorBox ()Lgg/essential/elementa/components/UIContainer;
311+
protected fun getTextColor ()Ljava/awt/Color;
312+
protected fun getTextHighlightColor ()Ljava/awt/Color;
313+
protected fun getTitleBackgroundColor ()Ljava/awt/Color;
307314
public final fun getTitleBar ()Lgg/essential/elementa/components/UIBlock;
315+
protected fun getTitleEdgesColor ()Ljava/awt/Color;
308316
public final fun getTitleText ()Lgg/essential/elementa/components/UIWrappedText;
309317
public final fun setBackButtonVisible (Z)V
310318
public final fun setTitle (Ljava/lang/String;)V

api/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ val mcPlatform = platform.loaderStr
2525

2626
group = "gg.essential"
2727
base.archivesName.set("EssentialAPI " + project.name)
28-
tasks.compileKotlin { kotlinOptions.moduleName = "essential-api" }
28+
kotlin.compilerOptions.moduleName.set("essential-api")
2929
java.withSourcesJar()
3030
loom.noRunConfigs() // can't run just the API, only the implementation
3131
configureDokkaForEssentialApi()

api/src/main/kotlin/gg/essential/api/gui/EssentialGUI.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,16 @@ open class EssentialGUI(
8484
@get:ApiStatus.Internal
8585
protected val outlineThickness = 3f
8686

87-
88-
private val background by UIBlock(BACKGROUND).constrain {
87+
protected open fun getTitleBackgroundColor(): Color = Color(0x232323)
88+
protected open fun getTitleEdgesColor(): Color = Color(0x303030)
89+
protected open fun getBackgroundColor(): Color = Color(0x181818)
90+
protected open fun getContentEdgesColor(): Color = Color(0x232323)
91+
protected open fun getButtonColor(): Color = Color(0x323232)
92+
protected open fun getButtonHighlightColor(): Color = Color(0x474747)
93+
protected open fun getTextColor(): Color = Color(0xBFBFBF)
94+
protected open fun getTextHighlightColor(): Color = Color(0xE5E5E5)
95+
96+
private val background by UIBlock(getBackgroundColor()).constrain {
8997
width = 100.percent
9098
height = 100.percent
9199
} childOf window
@@ -104,22 +112,22 @@ open class EssentialGUI(
104112
height = 75.percent
105113
} childOf window
106114

107-
private val leftDivider by UIBlock(DARK_GRAY).constrain {
115+
private val leftDivider by UIBlock(getContentEdgesColor()).constrain {
108116
x = SiblingConstraint(alignOpposite = true)
109117
y = componentYConstraint(container)
110118
width = outlineThickness.pixels
111119
height = componentHeightConstraint(container)
112120
} childOf window
113121

114-
val rightDivider by UIBlock(DARK_GRAY).constrain {
122+
val rightDivider by UIBlock(getContentEdgesColor()).constrain {
115123
x = SiblingConstraint() boundTo container
116124
y = componentYConstraint(container)
117125
width = outlineThickness.pixels
118126
height = componentHeightConstraint(container)
119127
} childOf window
120128

121129
@get:ApiStatus.Internal
122-
val bottomDivider by UIBlock(DARK_GRAY).constrain {
130+
val bottomDivider by UIBlock(getContentEdgesColor()).constrain {
123131
x = componentXConstraint(leftDivider)
124132
y = SiblingConstraint()
125133
width =
@@ -128,15 +136,15 @@ open class EssentialGUI(
128136
} childOf window
129137

130138

131-
val titleBar by UIBlock(DARK_GRAY).constrain {
139+
val titleBar by UIBlock(getTitleBackgroundColor()).constrain {
132140
width = 100.percent
133141
height = 30.pixels
134142
} childOf container
135143

136144
val titleText by UIWrappedText(guiTitle).constrain {
137145
x = 10.pixels
138146
y = 11.pixels
139-
color = TEXT_HIGHLIGHT.toConstraint()
147+
color = getTextHighlightColor().toConstraint()
140148
} childOf titleBar
141149

142150
val content by UIContainer().constrain {
@@ -157,14 +165,14 @@ open class EssentialGUI(
157165

158166
init {
159167
// Notches in titlebar
160-
UIBlock(COMPONENT_HIGHLIGHT).constrain {
168+
UIBlock(getTitleEdgesColor()).constrain {
161169
x = 0.pixels(alignOutside = true) boundTo titleBar
162170
y = 0.pixels boundTo titleBar
163171
height = 100.percent boundTo titleBar
164172
width = outlineThickness.pixels
165173
} childOf window
166174

167-
UIBlock(COMPONENT_HIGHLIGHT).constrain {
175+
UIBlock(getTitleEdgesColor()).constrain {
168176
x = 0.pixels(alignOpposite = true, alignOutside = true) boundTo titleBar
169177
y = 0.pixels boundTo titleBar
170178
height = 100.percent boundTo titleBar
@@ -185,13 +193,4 @@ open class EssentialGUI(
185193
fun setTitle(newTitle: String) {
186194
titleText.setText(newTitle)
187195
}
188-
private companion object EssentialGuiPalette {
189-
private val BACKGROUND = Color(0x181818)
190-
private val DARK_GRAY: Color = Color(0x232323)
191-
private val BUTTON = Color(0x323232)
192-
private val BUTTON_HIGHLIGHT = Color(0x474747)
193-
private var TEXT = Color(0xBFBFBF)
194-
private var TEXT_HIGHLIGHT = Color(0xE5E5E5)
195-
private val COMPONENT_HIGHLIGHT = Color(0x303030)
196-
}
197196
}

build-logic/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626
implementation(gradleApi())
2727
implementation(localGroovy())
2828

29-
val kotlinCompilerVersion = "1.9.24"
29+
val kotlinCompilerVersion = "2.3.0"
3030

3131
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinCompilerVersion")
3232
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinCompilerVersion")
@@ -37,8 +37,8 @@ dependencies {
3737
implementation("org.ow2.asm:asm-commons:9.3")
3838
implementation ("com.google.guava:guava:30.1.1-jre")
3939

40-
implementation("gg.essential:essential-gradle-toolkit:0.6.10")
41-
implementation("gg.essential.loom:gg.essential.loom.gradle.plugin:1.7.35") // TODO remove once EGT has updated
40+
implementation("gg.essential:essential-gradle-toolkit:0.7.0-alpha.2")
41+
// FIXME remove the forced remap version in `root.gradle.kts` once EGT updates its remap
4242
}
4343

4444
gradlePlugin {

build-logic/src/main/kotlin/essential/SyncToExternalRepoTask.kt

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212
package essential
1313

1414
import org.gradle.api.DefaultTask
15-
import org.gradle.api.Project
1615
import org.gradle.api.provider.ListProperty
1716
import org.gradle.api.provider.Property
1817
import org.gradle.api.tasks.Input
1918
import org.gradle.api.tasks.TaskAction
2019
import org.gradle.kotlin.dsl.*
20+
import org.gradle.process.ExecOperations
2121
import org.gradle.process.ExecSpec
2222
import java.io.ByteArrayOutputStream
2323
import java.nio.file.Files
2424
import java.nio.file.Path
25+
import javax.inject.Inject
2526
import kotlin.io.path.pathString
2627

2728
private val sourceCommitRegex = Regex("Source-Commit: (\\w+)")
@@ -43,6 +44,9 @@ abstract class SyncToExternalRepoTask : DefaultTask() {
4344

4445
private val srcRepoPath = project.rootDir.toPath()
4546

47+
@get:Inject
48+
protected abstract val execOperations: ExecOperations
49+
4650
@TaskAction
4751
fun sync() {
4852
//make sure the target directories exist in the target repository
@@ -54,7 +58,7 @@ abstract class SyncToExternalRepoTask : DefaultTask() {
5458
}
5559
// get synced commit(s) in the target repo
5660
val targetFilters = targetDirectories.get().toTypedArray()
57-
val syncedCommitMessages = project.git(_targetRepoPath, "log", "--format=%b", "-E", "--grep=${sourceCommitRegex.pattern}", "--", *targetFilters)
61+
val syncedCommitMessages = git(_targetRepoPath, "log", "--format=%b", "-E", "--grep=${sourceCommitRegex.pattern}", "--", *targetFilters)
5862
// parse the source commit hash(es)
5963
val syncedCommits = sourceCommitRegex.findAll(syncedCommitMessages).map { it.groupValues[1] }.toSet()
6064
val latestSyncedCommit = syncedCommits.firstOrNull()
@@ -65,7 +69,7 @@ abstract class SyncToExternalRepoTask : DefaultTask() {
6569
// Here we use a format string without speficying the leading `format:` which results in linebreaks following
6670
// each line. We then split by linebreak and drop the last one as the trailing linebreak results in a single
6771
// empty string
68-
val commitsToSync = project.git(srcRepoPath, "log", "--format=%H %s", "--reverse", "--topo-order", revisionsSinceLastSyncedCommit, "--", *sourceFilters)
72+
val commitsToSync = git(srcRepoPath, "log", "--format=%H %s", "--reverse", "--topo-order", revisionsSinceLastSyncedCommit, "--", *sourceFilters)
6973
.split("\n")
7074
.dropLast(1)
7175
if (commitsToSync.isEmpty()) {
@@ -79,32 +83,32 @@ abstract class SyncToExternalRepoTask : DefaultTask() {
7983
}
8084
println("Applying $commit $subject")
8185
// get diff of current commit
82-
val diff = project.git(srcRepoPath, "show", commit, "--remerge-diff", "--", *sourceFilters)
86+
val diff = git(srcRepoPath, "show", commit, "--remerge-diff", "--", *sourceFilters)
8387
// process diff by applying replacements
8488
val processed = replacements.get().fold(diff) { processing, (replaced, replacement) ->
8589
processing.replace(replaced, replacement)
8690
}
8791
// apply commit diff using stdin
8892
try {
89-
project.git(_targetRepoPath, "apply", "--allow-empty") {
93+
git(_targetRepoPath, "apply", "--allow-empty") {
9094
standardInput = processed.byteInputStream()
9195
}
9296
} catch (e: Exception) {
93-
project.git(_targetRepoPath, "apply", "--reject", "--allow-empty") {
97+
git(_targetRepoPath, "apply", "--reject", "--allow-empty") {
9498
standardInput = processed.byteInputStream()
9599
}
96100
}
97101
// ignore commit if diff was empty (e.g. trivial merge commit)
98-
if (project.git(_targetRepoPath, "status", "--porcelain").isBlank()) {
102+
if (git(_targetRepoPath, "status", "--porcelain").isBlank()) {
99103
return@forEach
100104
}
101105
// stage changes
102-
project.git(_targetRepoPath, "add", "--", *targetFilters)
106+
git(_targetRepoPath, "add", "--", *targetFilters)
103107
// get source commit message
104-
val srcCommitMsg = project.git(srcRepoPath, "show", "--format=%B", "--no-patch", commit)
108+
val srcCommitMsg = git(srcRepoPath, "show", "--format=%B", "--no-patch", commit)
105109
val srcCommitData = configureCommitData(commit)
106110
// commit changes
107-
project.git(_targetRepoPath, "commit", "-m", "$srcCommitMsg\n" +
111+
git(_targetRepoPath, "commit", "-m", "$srcCommitMsg\n" +
108112
"Source-Commit: $commit") {
109113
environment(srcCommitData)
110114
}
@@ -113,18 +117,17 @@ abstract class SyncToExternalRepoTask : DefaultTask() {
113117

114118
private fun configureCommitData(hash: String): Map<String, String> =
115119
mapOf(
116-
"GIT_COMMITER_NAME" to project.git(srcRepoPath, "show", "--format=%cn", "--no-patch", hash),
117-
"GIT_COMMITER_EMAIL" to project.git(srcRepoPath, "show", "--format=%ce", "--no-patch", hash),
118-
"GIT_COMMITER_DATE" to project.git(srcRepoPath, "show", "--format=%ai", "--no-patch", hash),
119-
"GIT_AUTHOR_NAME" to project.git(srcRepoPath, "show", "--format=%an", "--no-patch", hash),
120-
"GIT_AUTHOR_EMAIL" to project.git(srcRepoPath, "show", "--format=%ae", "--no-patch", hash),
121-
"GIT_AUTHOR_DATE" to project.git(srcRepoPath, "show", "--format=%ai", "--no-patch", hash),
120+
"GIT_COMMITER_NAME" to git(srcRepoPath, "show", "--format=%cn", "--no-patch", hash),
121+
"GIT_COMMITER_EMAIL" to git(srcRepoPath, "show", "--format=%ce", "--no-patch", hash),
122+
"GIT_COMMITER_DATE" to git(srcRepoPath, "show", "--format=%ai", "--no-patch", hash),
123+
"GIT_AUTHOR_NAME" to git(srcRepoPath, "show", "--format=%an", "--no-patch", hash),
124+
"GIT_AUTHOR_EMAIL" to git(srcRepoPath, "show", "--format=%ae", "--no-patch", hash),
125+
"GIT_AUTHOR_DATE" to git(srcRepoPath, "show", "--format=%ai", "--no-patch", hash),
122126
)
123-
}
124127

125-
private fun Project.git(workingDirectory: Path, command: String, vararg args: String, configure: ExecSpec.() -> Unit = {}) =
126-
ByteArrayOutputStream().use { stream ->
127-
project.exec {
128+
private fun git(workingDirectory: Path, command: String, vararg args: String, configure: ExecSpec.() -> Unit = {}): String {
129+
val stream = ByteArrayOutputStream()
130+
execOperations.exec {
128131
commandLine("git")
129132
args("-C", workingDirectory.pathString)
130133
args(command)
@@ -144,5 +147,6 @@ private fun Project.git(workingDirectory: Path, command: String, vararg args: St
144147
}
145148
}
146149
}
147-
stream.toString()
148-
}
150+
return stream.toString()
151+
}
152+
}

build-logic/src/main/kotlin/essential/embedded-loader.gradle.kts

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ package essential
1414
import gg.essential.gradle.multiversion.Platform
1515
import java.nio.file.FileSystems
1616
import java.nio.file.Files
17-
import kotlin.io.path.nameWithoutExtension
17+
import java.nio.file.StandardCopyOption
1818

1919
plugins {
2020
java
@@ -23,10 +23,10 @@ plugins {
2323
val platform: Platform by extensions
2424

2525
val dependency = when {
26-
platform.isFabric -> "gg.essential:loader-fabric:1.2.1"
27-
platform.isModLauncher && platform.mcVersion >= 11700 -> "gg.essential:loader-modlauncher9:1.2.1"
28-
platform.isModLauncher -> "gg.essential:loader-modlauncher8:1.2.1"
29-
platform.isLegacyForge -> "gg.essential:loader-launchwrapper:1.2.1"
26+
platform.isFabric -> "gg.essential:loader-fabric"
27+
platform.isModLauncher && platform.mcVersion >= 11700 -> "gg.essential:loader-modlauncher9"
28+
platform.isModLauncher -> "gg.essential:loader-modlauncher8"
29+
platform.isLegacyForge -> "gg.essential:loader-launchwrapper"
3030
else -> throw UnsupportedOperationException("No known loader variant for current platform.")
3131
}
3232

@@ -61,41 +61,36 @@ tasks.jar {
6161
}
6262

6363
/**
64-
* Takes the stage1 jar from the input stage0 jar and copies it to a different location in the output jar.
64+
* Extracts the stage1 jar from the given input stage0 jar.
6565
* We do this so we don't need to do any double-unpacking at runtime when we upgrade the installed stage1 version, and
6666
* because the raw loader stored above will actually be stripped when the Essential jar is installed via stage2 (because
6767
* the regular upgrade path would break with relaunching; we instead need to use the `stage1.update.jar` path).
6868
*/
69-
abstract class Stage1JarTransform : TransformAction<TransformParameters.None> {
70-
@get:InputArtifact
71-
abstract val input: Provider<FileSystemLocation>
69+
abstract class ExtractStage1JarTask : DefaultTask() {
70+
@get:InputFile
71+
abstract val stage0: RegularFileProperty
72+
@get:OutputFile
73+
abstract val stage1: RegularFileProperty
7274

73-
override fun transform(outputs: TransformOutputs) {
74-
val input = input.get().asFile.toPath()
75-
val output = outputs.file(input.nameWithoutExtension + "-stage1-only.jar").toPath()
75+
@TaskAction
76+
fun extract() {
77+
val input = stage0.get().asFile.toPath()
78+
val output = stage1.get().asFile.toPath()
7679
FileSystems.newFileSystem(input, null as ClassLoader?).use { sourceFs ->
7780
val source = sourceFs.getPath("gg/essential/loader/stage0/stage1.jar")
78-
FileSystems.newFileSystem(output, mapOf("create" to true)).use { targetFs ->
79-
val target = targetFs.getPath("gg/essential/loader-stage1.jar")
80-
Files.createDirectories(target.parent)
81-
Files.copy(source, target)
82-
}
81+
Files.createDirectories(output.parent)
82+
Files.copy(source, output, StandardCopyOption.REPLACE_EXISTING)
8383
}
8484
}
8585
}
8686

87-
dependencies {
88-
val attr = Attribute.of("stage1Jar", Boolean::class.javaObjectType)
89-
dependencies.registerTransform(Stage1JarTransform::class.java) {
90-
from.attribute(attr, false)
91-
to.attribute(attr, true)
92-
}
93-
dependencies.artifactTypes.all {
94-
attributes.attribute(attr, false)
87+
val extractStage1Jar by tasks.registering(ExtractStage1JarTask::class) {
88+
stage0.fileProvider(loader.elements.map { it.single().asFile })
89+
stage1.set(layout.buildDirectory.file("loader-stage1.jar"))
90+
}
91+
92+
tasks.named<Jar>("bundleJar") {
93+
from(extractStage1Jar.flatMap { it.stage1 }) {
94+
into("gg/essential/")
9595
}
96-
// Note: May need to pre-bundle this if we ever want to have the real thing on the classpath too; each dependency
97-
// can only be present once per configuration.
98-
implementation("bundle"(dependency) {
99-
attributes { attribute(attr, true) }
100-
})
10196
}

0 commit comments

Comments
 (0)