forked from minecraft-dev/MinecraftDev
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c3f5ee
commit 44c44ed
Showing
22 changed files
with
515 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[*.{kt,kts}] | ||
max_line_length=120 | ||
indent_size = 4 | ||
ij_kotlin_imports_layout=* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...nsion/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/McpModelRFGBuilderImpl.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Minecraft Development for IntelliJ | ||
* | ||
* https://mcdev.io/ | ||
* | ||
* Copyright (C) 2024 minecraft-dev | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, version 3.0 only. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.demonwav.mcdev.platform.mcp.gradle.tooling | ||
|
||
import org.gradle.api.Project | ||
import org.jetbrains.annotations.NotNull | ||
import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder | ||
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService | ||
|
||
final class McpModelRFGBuilderImpl implements ModelBuilderService { | ||
|
||
@Override | ||
boolean canBuild(String modelName) { | ||
return McpModelRFG.name == modelName | ||
} | ||
|
||
@Override | ||
Object buildAll(String modelName, Project project) { | ||
def extension = project.extensions.findByName('minecraft') | ||
if (extension == null) { | ||
return null | ||
} | ||
|
||
def mcpTasksObj = project.extensions.findByName('mcpTasks') | ||
if (mcpTasksObj == null) { | ||
return null | ||
} | ||
|
||
if (project.tasks.findByName("generateForgeSrgMappings") == null) { | ||
return null | ||
} | ||
|
||
def mappingFiles = project.tasks.generateForgeSrgMappings.outputs.files.files.collect { it.absolutePath } | ||
def atFiles = mcpTasksObj.deobfuscationATs.files.collect {it} | ||
try { | ||
def implObj = new McpModelRFGImpl(extension.mcVersion.get(), extension.mcpMappingChannel.get() + "-" + extension.mcpMappingVersion.get(), mappingFiles.toSet(), atFiles) | ||
return implObj | ||
} catch (Throwable t) { | ||
System.err.println(t.message) | ||
t.printStackTrace() | ||
throw t | ||
} | ||
} | ||
|
||
@Override | ||
ErrorMessageBuilder getErrorMessageBuilder(@NotNull Project project, @NotNull Exception e) { | ||
return ErrorMessageBuilder.create( | ||
project, e, "MinecraftDev import errors" | ||
).withDescription("Unable to build MinecraftDev MCP project configuration") | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...ng-extension/groovy/com/demonwav/mcdev/platform/mcp/gradle/tooling/McpModelRFGImpl.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Minecraft Development for IntelliJ | ||
* | ||
* https://mcdev.io/ | ||
* | ||
* Copyright (C) 2024 minecraft-dev | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, version 3.0 only. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.demonwav.mcdev.platform.mcp.gradle.tooling | ||
|
||
import groovy.transform.CompileStatic | ||
|
||
@CompileStatic | ||
final class McpModelRFGImpl implements McpModelRFG, Serializable { | ||
|
||
final String minecraftVersion | ||
final String mcpVersion | ||
final Set<String> mappingFiles | ||
final List<File> accessTransformers | ||
|
||
McpModelRFGImpl(String minecraftVersion, String mcpVersion, Set<String> mappingFiles, List<File> accessTransformers) { | ||
this.minecraftVersion = minecraftVersion | ||
this.mcpVersion = mcpVersion | ||
this.mappingFiles = mappingFiles | ||
this.accessTransformers = accessTransformers | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "McpModelRFGImpl{" + | ||
"minecraftVersion='" + minecraftVersion + '\'' + | ||
", mcpVersion='" + mcpVersion + '\'' + | ||
", mappingFiles=" + mappingFiles + | ||
", accessTransformers=" + accessTransformers + | ||
'}'; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...le-tooling-extension/java/com/demonwav/mcdev/platform/mcp/gradle/tooling/McpModelRFG.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Minecraft Development for IntelliJ | ||
* | ||
* https://mcdev.io/ | ||
* | ||
* Copyright (C) 2024 minecraft-dev | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, version 3.0 only. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.demonwav.mcdev.platform.mcp.gradle.tooling; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public interface McpModelRFG extends McpModel { | ||
String getMinecraftVersion(); | ||
Set<String> getMappingFiles(); | ||
List<File> getAccessTransformers(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.