Skip to content

Commit

Permalink
fix: run configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeblank committed Sep 17, 2024
1 parent 914458e commit b3cbce2
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ these limitations will be resolved before version 1.0.
## Logos
Allium's logos are under the same license as the rest of the project. Feel free to use these in your own project

<img src="allium/logos/icon.png" alt="Allium Icon" height="100"/> <img src="allium/logos/logo.png" alt="Allium Logo" height="100"/>
<img src="allium/logos/banner.png" alt="Powered by Allium" height="100"/>
<img src="logos/icon.png" alt="Allium Icon" height="100"/> <img src="logos/logo.png" alt="Allium Logo" height="100"/>
<img src="logos/banner.png" alt="Powered by Allium" height="100"/>

## Contributing
Allium is broken up into 2 gradle subprojects that each build into their own jars. When making a pull request please
Expand All @@ -40,6 +40,10 @@ Found in the `allium` directory, this is the bare-minimum necessary for a Lua sc
Found in the `bouquet` directory, this features additional quality of life libraries, as well as frequently used
event hooks into the games logic.

### Dev Environment Notes
- To build both projects at the same time use the `buildMoonflower` gradle task.
- Multiple client run configurations are created. One is for running only allium, the other is for running both allium & bouquet.

## Too much Allium...
Since 2018 a project under the name Allium has existed. This is being addressed to suppress the Mandela Effect.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public PackageLib(Script script) {
this.path = "./?.lua;./?/init.lua";
this.preload = new LuaTable();
this.loaded = new LuaTable();
script.getExecutor().getGlobals()
.rawset("require", RegisteredFunction.ofV("require", this::require).create());

// When writing a loader in Java, anywhere where a module value can't be determined `nil` should be returned.
loaders = ValueFactory.listOf(
Expand All @@ -44,6 +42,12 @@ public PackageLib(Script script) {
);
}

@Override
public LuaValue add(LuaState state, LuaTable globals) {
globals.rawset("require", RegisteredFunction.ofV("require", this::require).create());
return WrappedLuaLibrary.super.add(state, globals);
}

public LuaValue preloadLoader(LuaState state, LuaValue arg) throws LuaError, UnwindThrowable {
if (preload.rawget(arg).isFunction()){
return preload.rawget(arg).checkFunction().call(state, arg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ public LuaState getState() {
return state;
}

public LuaTable getGlobals() {
return globals;
}

public Varargs initialize(@Nullable InputStream sMain, @Nullable InputStream dMain) throws Throwable {
Entrypoint entrypoints = script.getManifest().entrypoints();
LuaFunction staticFunction;
Expand Down
54 changes: 25 additions & 29 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Locale

plugins {
id("fabric-loom") version "1.7-SNAPSHOT"
id("maven-publish")
Expand Down Expand Up @@ -51,25 +53,38 @@ allprojects {
mappings("net.fabricmc", "yarn", yarnMappings, null, "v2")
modImplementation("net.fabricmc", "fabric-loader", loaderVersion)

modImplementation(include("org.squiddev", "Cobalt", cobalt))
modImplementation(include("me.basiqueevangelist","enhanced-reflection", enhancedReflections))
modImplementation("org.squiddev", "Cobalt", cobalt)
modImplementation("me.basiqueevangelist","enhanced-reflection", enhancedReflections)
modImplementation("net.fabricmc", "tiny-mappings-parser", tinyParser)
}
}

subprojects.forEach {
tasks {
processResources {
inputs.property("version", it.version)
inputs.property("version", project.version)

filesMatching("fabric.mod.json") {
expand(mutableMapOf("version" to it.version))
expand(mutableMapOf("version" to project.version))
}
}

jar {
from("LICENSE") {
val archivesName = it.base.archivesName.get()
rename { "${it}_${archivesName}" }
rename { "${it}_${project.base.archivesName.get()}" }
}
}

loom {
runs {
named("client") {
configName = "${
project.name.replaceFirstChar {
if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString()
}
} Client"
ideConfigGenerated(true)
runDir("../run")
programArgs("-username", "GradleDev")
}
}
}
}
Expand All @@ -84,30 +99,11 @@ dependencies {
evaluationDependsOnChildren()

tasks {
loom {
val loomRootDir = project.projectDir.relativeTo(project.rootDir)

loom {
runs {
named("client") {
client()
configName = "Moonflower Dev Client"
ideConfigGenerated(true)
runDir(loomRootDir.resolve("run").toString())
programArgs("-username", "GradleDev")
dependencies {
implementation(project(path = ":allium", configuration = "namedElements"))
implementation(project(path = ":bouquet", configuration = "namedElements"))
}
}
register("allium") {
client()
configName = "Allium Only"
ideConfigGenerated(true)
runDir(loomRootDir.resolve("run").toString())
programArgs("-username", "GradleDev")
dependencies {
implementation(project(path = ":allium", configuration = "namedElements"))
}
ideConfigGenerated(false)
}
}
}
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit b3cbce2

Please sign in to comment.