Skip to content

Commit

Permalink
Merge branch '2023.3' into 2024.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DenWav committed Aug 4, 2024
2 parents 9a0d413 + 370a370 commit 87677a6
Show file tree
Hide file tree
Showing 106 changed files with 2,372 additions and 1,004 deletions.
8 changes: 3 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ dependencies {

implementation(libs.mixinExtras.expressions)
testLibs(libs.mixinExtras.common)
implementation("org.ow2.asm:asm-util:9.3")

// Kotlin
implementation(kotlin("stdlib-jdk8"))
Expand Down Expand Up @@ -298,10 +297,9 @@ tasks.processResources {
tasks.test {
dependsOn(tasks.jar, testLibs)
useJUnitPlatform()
doFirst {
testLibs.resolvedConfiguration.resolvedArtifacts.forEach {
systemProperty("testLibs.${it.name}", it.file.absolutePath)
}

testLibs.resolvedConfiguration.resolvedArtifacts.forEach {
systemProperty("testLibs.${it.name}", it.file.absolutePath)
}
systemProperty("NO_FS_ROOTS_ACCESS_CHECK", "true")
systemProperty("java.awt.headless", "true")
Expand Down
9 changes: 8 additions & 1 deletion buildSrc/src/main/kotlin/JFlexExec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,29 @@ import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity

@CacheableTask
abstract class JFlexExec : JavaExec() {

@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val sourceFile: RegularFileProperty

@get:InputFiles
@get:Classpath
abstract val jflex: ConfigurableFileCollection

@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val skeletonFile: RegularFileProperty

@get:OutputDirectory
Expand Down
13 changes: 8 additions & 5 deletions buildSrc/src/main/kotlin/ParserExec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,29 @@ import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity

@CacheableTask
abstract class ParserExec : JavaExec() {

@get:InputFile
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val sourceFile: RegularFileProperty

@get:InputFiles
@get:Classpath
abstract val grammarKit: ConfigurableFileCollection

@get:OutputDirectory
@get:Internal
abstract val destinationRootDirectory: DirectoryProperty

@get:OutputDirectory
abstract val destinationDirectory: DirectoryProperty

@get:OutputDirectory
abstract val psiDirectory: DirectoryProperty

Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/mcdev.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import java.net.HttpURLConnection
import java.net.URI
import java.net.URL
import java.util.Properties
import java.util.zip.ZipFile
Expand Down Expand Up @@ -94,7 +95,7 @@ tasks.register("resolveIntellijLibSources") {
val groupPath = dep.groupId.replace('.', '/')
val (_, artifact, ver) = dep
val url = "https://repo.maven.apache.org/maven2/$groupPath/$artifact/$ver/$artifact-$ver-sources.jar"
return@filter with(URL(url).openConnection() as HttpURLConnection) {
return@filter with(URI.create(url).toURL().openConnection() as HttpURLConnection) {
try {
requestMethod = "GET"
val code = responseCode
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.TaskContainer
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.RegisteringDomainObjectDelegateProviderWithTypeAndAction
import org.gradle.kotlin.dsl.getValue
import org.gradle.kotlin.dsl.provideDelegate
Expand All @@ -39,8 +40,8 @@ fun Project.lexer(flex: String, pack: String): TaskDelegate<JFlexExec> {

return tasks.registering(JFlexExec::class) {
sourceFile.set(layout.projectDirectory.file("src/main/grammars/$flex.flex"))
destinationDirectory.set(layout.buildDirectory.dir("gen/$pack"))
destinationFile.set(layout.buildDirectory.file("gen/$pack/$flex.java"))
destinationDirectory.set(layout.buildDirectory.dir("gen/$pack/lexer"))
destinationFile.set(layout.buildDirectory.file("gen/$pack/lexer/$flex.java"))
logFile.set(layout.buildDirectory.file("logs/generate$flex.log"))

val jflex by project.configurations
Expand All @@ -61,7 +62,6 @@ fun Project.parser(bnf: String, pack: String): TaskDelegate<ParserExec> {
val dest = destRoot.map { it.dir(pack) }
sourceFile.set(project.layout.projectDirectory.file("src/main/grammars/$bnf.bnf"))
destinationRootDirectory.set(destRoot)
destinationDirectory.set(dest)
psiDirectory.set(dest.map { it.dir("psi") })
parserDirectory.set(dest.map { it.dir("parser") })
logFile.set(layout.buildDirectory.file("logs/generate$bnf.log"))
Expand Down
21 changes: 21 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Minecraft Development for IntelliJ

## [Unreleased]

### Added

- Access widener completion in fabric.mod.json
- Event listener generation for Kotlin
- `JUMP` injection point support (without source navigation)
- Inspection highlighting that `JUMP` usages are discouraged
- Inspection highlighting discouraged instruction shifts
- Inspections for when @Inject local capture is unused and for when they can be replaced with @Local
- [#2306](https://github.com/minecraft-dev/MinecraftDev/issues/2306) Use mixin icon for mixin classes

### Fixed

- [#2330](https://github.com/minecraft-dev/MinecraftDev/issues/2330) Reformat created files without keeping line breaks. Fixes the Velocity main class annotation's bad formatting.
- [#2331](https://github.com/minecraft-dev/MinecraftDev/issues/2331) Support fabric.mod.json in test resources
- MixinExtras occasional cache desync ([#2335](https://github.com/minecraft-dev/MinecraftDev/pull/2335))
- [#2163](https://github.com/minecraft-dev/MinecraftDev/issues/2163) `@ModifyVariable` method signature checking with `STORE`
- [#2282](https://github.com/minecraft-dev/MinecraftDev/issues/2282) Mixin support confusion with `$` and `.` separators in class names
- Recent NeoModDev version import errors

## [1.8.0]

This release contains two major features:
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ groovy = "org.codehaus.groovy:groovy-all:2.5.18"
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
asm-tree = { module = "org.ow2.asm:asm-tree", version.ref = "asm" }
asm-analysis = { module = "org.ow2.asm:asm-analysis", version.ref = "asm" }
asm-util = { module = "org.ow2.asm:asm-util", version.ref = "asm" }

fuel = { module = "com.github.kittinunf.fuel:fuel", version.ref = "fuel" }
fuel-coroutines = { module = "com.github.kittinunf.fuel:fuel-coroutines", version.ref = "fuel" }
Expand All @@ -45,5 +46,5 @@ mixinExtras-common = "io.github.llamalad7:mixinextras-common:0.5.0-beta.1"

[bundles]
coroutines = ["coroutines-swing"]
asm = ["asm", "asm-tree", "asm-analysis"]
asm = ["asm", "asm-tree", "asm-analysis", "asm-util"]
fuel = ["fuel", "fuel-coroutines"]
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Minecraft Development for IntelliJ
</tr>
</table>

Info and Documentation [![Current Release](https://img.shields.io/badge/release-1.7.6-orange.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/8327)
Info and Documentation [![Current Release](https://img.shields.io/badge/release-1.8.0-orange.svg?style=flat-square)](https://plugins.jetbrains.com/plugin/8327)
----------------------

<a href="https://discord.gg/j6UNcfr"><img src="https://i.imgur.com/JXu9C1G.png" height="48px"></img></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package com.demonwav.mcdev.platform.mcp.gradle.tooling.neomoddev

import com.demonwav.mcdev.platform.mcp.gradle.tooling.McpModelNMD
import org.gradle.api.Project
import org.gradle.api.provider.ListProperty
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService
Expand Down Expand Up @@ -51,16 +52,26 @@ final class NeoModDevGradleModelBuilderImpl implements ModelBuilderService {
return null
}

def accessTransformers = extension.accessTransformers.get().collect { project.file(it) }
def accessTransformersRaw = extension.accessTransformers
List<File> accessTransformers
if (accessTransformersRaw instanceof ListProperty) {
accessTransformers = accessTransformersRaw.get().collect { project.file(it) }
} else {
accessTransformers = accessTransformersRaw.files.files.toList()
}

// Hacky way to guess where the mappings file is, but I could not find a proper way to find it
def neoformDir = project.buildDir.toPath().resolve("neoForm")
def mappingsFile = Files.list(neoformDir)
.map { it.resolve("config/joined.tsrg") }
.filter { Files.exists(it) }
.findFirst()
.orElse(null)
?.toFile()
File mappingsFile = null
try {
// Hacky way to guess where the mappings file is, but I could not find a proper way to find it
def neoformDir = project.buildDir.toPath().resolve("neoForm")
mappingsFile = Files.list(neoformDir)
.map { it.resolve("config/joined.tsrg") }
.filter { Files.exists(it) }
.findFirst()
.orElse(null)
?.toFile()
} catch (Exception ignore) {
}

//noinspection GroovyAssignabilityCheck
return new NeoModDevGradleModelImpl(neoforgeVersion, mappingsFile, accessTransformers)
Expand Down
2 changes: 1 addition & 1 deletion src/main/grammars/MEExpressionParser.bnf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

{
parserClass="com.demonwav.mcdev.platform.mixin.expression.gen.MEExpressionParser"
parserClass="com.demonwav.mcdev.platform.mixin.expression.gen.parser.MEExpressionParser"
extends="com.intellij.extapi.psi.ASTWrapperPsiElement"
parserImports = ["static com.demonwav.mcdev.platform.mixin.expression.psi.MEExpressionParserUtil.*"]

Expand Down
7 changes: 7 additions & 0 deletions src/main/kotlin/MinecraftConfigurable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ class MinecraftConfigurable : Configurable {
}
}

group(MCDevBundle("minecraft.settings.mixin")) {
row {
checkBox(MCDevBundle("minecraft.settings.mixin.mixin_class_icon"))
.bindSelected(settings::mixinClassIcon)
}
}

group(MCDevBundle("minecraft.settings.creator")) {
row(MCDevBundle("minecraft.settings.creator.repos")) {}

Expand Down
8 changes: 8 additions & 0 deletions src/main/kotlin/MinecraftSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class MinecraftSettings : PersistentStateComponent<MinecraftSettings.State> {
var isShowChatColorUnderlines: Boolean = false,
var underlineType: UnderlineType = UnderlineType.DOTTED,

var mixinClassIcon: Boolean = true,

var creatorTemplateRepos: List<TemplateRepo> = listOf(TemplateRepo.makeBuiltinRepo()),
)

Expand Down Expand Up @@ -106,6 +108,12 @@ class MinecraftSettings : PersistentStateComponent<MinecraftSettings.State> {
state.underlineType = underlineType
}

var mixinClassIcon: Boolean
get() = state.mixinClassIcon
set(mixinClassIcon) {
state.mixinClassIcon = mixinClassIcon
}

var creatorTemplateRepos: List<TemplateRepo>
get() = state.creatorTemplateRepos.map { it.copy() }
set(creatorTemplateRepos) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/asset/MixinAssets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ object MixinAssets : Assets() {

val MIXIN_CLASS_ICON = loadIcon("/assets/icons/mixin/mixin_class_gutter.png")
val MIXIN_CLASS_ICON_DARK = loadIcon("/assets/icons/mixin/mixin_class_gutter_dark.png")

val MIXIN_MARK = loadIcon("/assets/icons/mixin/mixin_mark.svg")
}
9 changes: 7 additions & 2 deletions src/main/kotlin/creator/creator-utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.observable.properties.ObservableMutableProperty
import com.intellij.openapi.observable.properties.ObservableProperty
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Key
import com.intellij.openapi.util.RecursionManager
import java.time.ZonedDateTime
import javax.swing.JComponent

val NewProjectWizardStep.gitEnabled
get() = data.getUserData(GitNewProjectWizardData.KEY)!!.git
Expand Down Expand Up @@ -165,10 +167,13 @@ fun notifyCreatedProjectNotOpened() {
).notify(null)
}

val WizardContext.contentPanel: JComponent?
get() = this.getUserData(AbstractWizard.KEY)?.contentPanel

val WizardContext.modalityState: ModalityState
get() {
val contentPanel = this.getUserData(AbstractWizard.KEY)?.contentPanel

ProgressManager.checkCanceled()
val contentPanel = contentPanel
if (contentPanel == null) {
thisLogger().error("Wizard content panel is null, using default modality state")
return ModalityState.defaultModalityState()
Expand Down
Loading

0 comments on commit 87677a6

Please sign in to comment.