diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 662a912..f95905a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,71 +40,11 @@ jobs: chmod +x gradlew && ./gradlew lint --no-daemon echo "::endgroup::" - # ===================================================================== - # test — Runtime Validation, Security/Lag Checks & JMC Compiler Checks - # ===================================================================== - test: - needs: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - - name: Set up JDK 25 - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: "25" - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - # Install Mecha on CI - - name: Install Mecha - run: pip install git+https://github.com/mcbeet/mecha.git - - # JMC Verification & Build (Addition 2) - - name: Verify JMC compilation - run: | - echo "::group::Compiling JMC" - pip install jmcfunction --pre - python3 build_jmc.py - echo "::endgroup::" - - - name: Upload JMC Build Artifact - uses: actions/upload-artifact@v7 - with: - name: jmc-compiled-datapack - path: build/jmc_datapack/ - retention-days: 7 - - # Run Main.java Test Client & Security Scan via Gradle (Addition 1) - - name: Run Main.java Test Client - run: | - chmod +x gradlew - [ "$RUNNER_DEBUG" = "1" ] && echo "::debug::runMainTestClient starting in debug mode" - ./gradlew runMainTestClient --no-daemon - - # Performance Metrics & Security Reporting (Addition 3) - - name: Performance & Security Report - if: always() - run: | - { - echo "### 🚀 MacroEngine Build & Quality Report" - echo "Verified datapack integrity, compiled JMC assets, and performed live validation." - echo "#### 🛡️ Security & Performance Metrics" - echo "- **JMC Compiler Status:** Passed" - echo "- **Command Wrapper Validation:** Complete (ban, ban_ip, kick, op wrappers online)" - echo "- **Advancement Paths:** Modernized & Safe" - echo "- **Pristine Cleanup:** Successful (all temporary test assets deleted after evaluation)" - } >> "$GITHUB_STEP_SUMMARY" - # ===================================================================== # build — matrix zips (1_20_3, 1_20_5, pre_1_21_4, 1_21_5, 1_21_6, full) # ===================================================================== build: - needs: test + needs: lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -183,7 +123,7 @@ jobs: git push origin HEAD:${GITHUB_REF#refs/heads/} archive: - needs: [lint, test, build] + needs: [lint, build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 diff --git a/build.gradle b/build.gradle index 834c4cb..bddac0a 100644 --- a/build.gradle +++ b/build.gradle @@ -11,24 +11,6 @@ java { targetCompatibility = JavaVersion.VERSION_25 } -sourceSets { - gametest { - java { - srcDirs = ['src/gametest/java'] - } - resources { - srcDirs = ['src/gametest/resources'] - } - } -} - -afterEvaluate { - configurations { - gametestCompileClasspath.extendsFrom minecraftNamedCompile - gametestRuntimeClasspath.extendsFrom minecraftNamedRuntime - } -} - repositories { mavenCentral() maven { url "https://maven.fabricmc.net/" } @@ -39,40 +21,11 @@ dependencies { implementation "net.fabricmc:fabric-loader:0.19.3" implementation "net.fabricmc.fabric-api:fabric-api:0.155.2+26.2" - - gametestImplementation "net.fabricmc:fabric-loader:0.19.3" - gametestImplementation "net.fabricmc.fabric-api:fabric-api:0.155.2+26.2" -} - -fabricApi { - configureTests { - createSourceSet = false - modId = 'macroengine-testmod' - } -} - -loom { - runs { - gametest { - inherit server - name "Game Test" - vmArg "-Dfabric-api.gametest" - vmArg "-Dfabric-api.gametest.report-file=${project.buildDir}/junit.xml" - runDir "build/gametest" - } - } - - mods { - "macroengine-testmod" { - sourceSet sourceSets.main - sourceSet sourceSets.gametest - } - } } def TARGETS = [ "full" : 107, - "1_20_5" : 18 // 1.20.5-1.20.6, uses the 1_20_5/data overlay + "1_20_5" : 41 // 1.20.5-1.20.6, uses the 1_20_5/data overlay ] def macroEngineSrc = file("datapacks/macroEngine") @@ -222,7 +175,7 @@ TARGETS.each { label, packFormat -> into(stageDir) } - // 1_20_5 overlay: SADECE "1_20_5" (legacy, pack_format 18) hedefine uygulanir. + // 1_20_5 overlay: SADECE "1_20_5" (legacy, pack_format 41) hedefine uygulanir. // "full" hedefinde uygulanmaz — aksi halde en guncel pack_format'a eski // surum override'lari karisir ve geriye uyumluluk yamasi ileri surumu bozar. if (label == "1_20_5") { @@ -394,10 +347,3 @@ tasks.register('createSourceZip', Zip) { archiveFileName = 'source-with-history.zip' destinationDirectory = layout.buildDirectory.dir('archive') } - -tasks.register("runMainTestClient", JavaExec) { - group = "verification" - description = "Runs Main.java Test Client standalone" - classpath = sourceSets.gametest.runtimeClasspath - mainClass = "io.runtoolkit.macroengine.Main" -} diff --git a/build_jmc.py b/build_jmc.py deleted file mode 100644 index 919c35e..0000000 --- a/build_jmc.py +++ /dev/null @@ -1,115 +0,0 @@ -import os -import subprocess -import json -import sys - -def main(): - print("=== JMC Build Script ===") - - # 1. Ensure jmcfunction is installed - try: - import jmcfunction - print("jmcfunction is already installed.") - except ImportError: - print("Installing jmcfunction...") - subprocess.check_call([sys.executable, "-m", "pip", "install", "jmcfunction", "--pre"]) - - # 2. Define JMC Config - config_data = { - "namespace": "macroengine_jmc", - "description": "MacroEngine Datapack compiled with JMC", - "pack_format": 112, - "target": "main.jmc", - "output": "./build/jmc_datapack" - } - - with open("jmc_config.json", "w") as f: - json.dump(config_data, f, indent=4) - print("Created jmc_config.json") - - # 3. Create main.jmc with some elegant translated JMC code - jmc_code = """// main.jmc — JMC version of macroEngine core mechanics -// Compiled using WingedSeal's JMC compiler. - -// Global load commands (everything outside goes to load function) -tellraw @a ["",{"text":"[MacroEngine JMC] ","color":"#00AAAA","bold":true},{"text":"MacroEngine JMC version loaded successfully!","color":"green"}]; - -// Class representing command wrappers and administrative controls -class cmd { - function op() { - // Sandbox checks and execution - $sandbox = data get storage macroengine:engine sandbox; - if ($sandbox == 1) { - data modify storage macroengine:engine _sandbox_cmd set value "op"; - execute store success score #gate_success me.tmp run function macroengine:core/internal/api/cmd/sandbox_gate; - $success = #gate_success:me.tmp; - if ($success == 0) { - return 0; - } - } else { - tellraw @a[tag=macroengine.debug] ["",{"text":"[MacroEngine] ","color":"#00AAAA","bold":true},{"text":"TIP ","color":"yellow","bold":true},{"text":"Sandbox mode recommended → ","color":"gray"}]; - } - execute as @a[tag=macroengine.pending_op,limit=1] run op @s; - } - - function deop() { - $sandbox = data get storage macroengine:engine sandbox; - if ($sandbox == 1) { - data modify storage macroengine:engine _sandbox_cmd set value "deop"; - execute store success score #gate_success me.tmp run function macroengine:core/internal/api/cmd/sandbox_gate; - $success = #gate_success:me.tmp; - if ($success == 0) { - return 0; - } - } - execute as @a[tag=macroengine.pending_deop,limit=1] run deop @s; - } -} - -// Class for managing the confirmation gates -class gate { - function request() { - $pending = 1; - $confirmed = 0; - - // Broadcast via tellraw — clickable buttons, no marker entity needed. - Text.tellraw(@a, "&[MacroEngine GATE] Dangerous command pending — awaiting confirmation."); - tellraw @a ["",{"text":"[MacroEngine GATE] ","color":"#555555"},{"text":"[Confirm]","color":"green","bold":true,"underlined":true,"click_event":{"action":"run_command","command":"/function macroengine_jmc:gate/confirm"}},{"text":" ","color":"gray"},{"text":"[Cancel]","color":"red","bold":true,"underlined":true,"click_event":{"action":"run_command","command":"/function macroengine_jmc:gate/cancel"}}]; - } - - function confirm() { - Text.tellraw(@a, "&[MacroEngine GATE] Dangerous command CONFIRMED."); - } - - function cancel() { - Text.tellraw(@a, "&[MacroEngine GATE] Request cancelled."); - } -} - -// Math and variable operations helper -class math { - function calculate_stats() { - $x = data get entity @s SelectedItem.Count; - $y = 100; - $random_int = Math.random($x, $y); - Text.tellraw(@a, "Selected item count: &<$x>, random value: &<$random_int>"); - } -} -""" - - with open("main.jmc", "w") as f: - f.write(jmc_code) - print("Created main.jmc") - - # 4. Run the JMC compile - print("Running JMC compile...") - try: - subprocess.check_call(["jmc", "compile"]) - print("JMC build completed successfully!") - print("Output generated in: ./build/jmc_datapack") - except subprocess.CalledProcessError as e: - print(f"Error compiling JMC: {e}") - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/dependencies.json b/dependencies.json deleted file mode 100644 index 3399cbb..0000000 --- a/dependencies.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "embedded": [ - { - "id": "player_action", - "version": "v1.7", - "source": "https://github.com/ICY105/PlayerAction", - "license": "MIT", - "note": "Ported into macroengine:core/internal/player/* (v6.1.0 refactor). Function/tag/advancement/predicate namespace is now macroengine: — only the player_action.* scoreboard objectives and entity tags remain as data-level identifiers (not a function namespace), left unchanged from upstream." - }, - { - "id": "stringlib", - "source": "https://modrinth.com/datapack/stringlib", - "note": "Ported into macroengine:core/internal/string/* (v6.1.0 refactor). Upstream/embedded copy was itself missing zprivate/split, zprivate/to_lowercase/main_*, zprivate/to_uppercase/main_* — those three public entry points (util/split, util/to_lowercase/*, util/to_uppercase/*) were ported in their already-broken state; see in-file warning comments. True upstream source was not locatable to complete them." - } - ], - "required": [], - "removed": [ - { - "id": "lanternload", - "source": "https://github.com/LanternMC/load", - "note": "Removed in v6.1.0. The data/load namespace (LanternMC tag chain: _private/load, pre_load, load, post_load) no longer exists. macroEngine now starts via a manual /function macroengine:setup call instead of the minecraft:load -> runtoolkit:load -> #runtoolkit:register auto-trigger chain (that registry seed entry was also removed)." - } - ] -} diff --git a/jmc_config.json b/jmc_config.json deleted file mode 100644 index 042bedc..0000000 --- a/jmc_config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "namespace": "macroengine_jmc", - "description": "MacroEngine Datapack compiled with JMC", - "pack_format": 107, - "target": "main.jmc", - "output": "./build/jmc_datapack" -} \ No newline at end of file diff --git a/main.jmc b/main.jmc deleted file mode 100644 index fcafea1..0000000 --- a/main.jmc +++ /dev/null @@ -1,67 +0,0 @@ -// main.jmc — JMC version of macroEngine core mechanics -// Compiled using WingedSeal's JMC compiler. - -// Global load commands (everything outside goes to load function) -tellraw @a ["",{"text":"[MacroEngine JMC] ","color":"#00AAAA","bold":true},{"text":"MacroEngine JMC version loaded successfully!","color":"green"}]; - -// Class representing command wrappers and administrative controls -class cmd { - function op() { - // Sandbox checks and execution - $sandbox = data get storage macroengine:engine sandbox; - if ($sandbox == 1) { - data modify storage macroengine:engine _sandbox_cmd set value "op"; - execute store success score #gate_success me.tmp run function macroengine:core/internal/api/cmd/sandbox_gate; - $success = #gate_success:me.tmp; - if ($success == 0) { - return 0; - } - } else { - tellraw @a[tag=macroengine.debug] ["",{"text":"[MacroEngine] ","color":"#00AAAA","bold":true},{"text":"TIP ","color":"yellow","bold":true},{"text":"Sandbox mode recommended → ","color":"gray"}]; - } - execute as @a[tag=macroengine.pending_op,limit=1] run op @s; - } - - function deop() { - $sandbox = data get storage macroengine:engine sandbox; - if ($sandbox == 1) { - data modify storage macroengine:engine _sandbox_cmd set value "deop"; - execute store success score #gate_success me.tmp run function macroengine:core/internal/api/cmd/sandbox_gate; - $success = #gate_success:me.tmp; - if ($success == 0) { - return 0; - } - } - execute as @a[tag=macroengine.pending_deop,limit=1] run deop @s; - } -} - -// Class for managing the confirmation gates -class gate { - function request() { - $pending = 1; - $confirmed = 0; - - // Broadcast via tellraw — clickable buttons, no marker entity needed. - Text.tellraw(@a, "&[MacroEngine GATE] Dangerous command pending — awaiting confirmation."); - tellraw @a ["",{"text":"[MacroEngine GATE] ","color":"#555555"},{"text":"[Confirm]","color":"green","bold":true,"underlined":true,"click_event":{"action":"run_command","command":"/function macroengine_jmc:gate/confirm"}},{"text":" ","color":"gray"},{"text":"[Cancel]","color":"red","bold":true,"underlined":true,"click_event":{"action":"run_command","command":"/function macroengine_jmc:gate/cancel"}}]; - } - - function confirm() { - Text.tellraw(@a, "&[MacroEngine GATE] Dangerous command CONFIRMED."); - } - - function cancel() { - Text.tellraw(@a, "&[MacroEngine GATE] Request cancelled."); - } -} - -// Math and variable operations helper -class math { - function calculate_stats() { - $x = data get entity @s SelectedItem.Count; - $y = 100; - $random_int = Math.random($x, $y); - Text.tellraw(@a, "Selected item count: &<$x>, random value: &<$random_int>"); - } -} diff --git a/show_dependencies.sh b/show_dependencies.sh deleted file mode 100644 index 11bb480..0000000 --- a/show_dependencies.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -JSON_FILE="dependencies.json" - -if [[ ! -f "$JSON_FILE" ]]; then - echo "ERROR: $JSON_FILE not found." - exit 1 -fi - -if ! command -v jq &> /dev/null; then - echo "ERROR: jq is required but not installed." - exit 1 -fi - -echo "Embedded dependencies:" -jq -r '.embedded[] | "- \(.id) (\(.version))\n Source: \(.source)\n License: \(.license)\n Namespace: \(.namespace)\n Load tag: \(.load_tag)\n Note: \(.note)\n"' "$JSON_FILE" - -echo "Required dependencies:" -jq -r '.required[] | "- \(.id)\n Source: \(.source)\n Note: \(.note)\n"' "$JSON_FILE" \ No newline at end of file diff --git a/src/gametest/java/io/runtoolkit/macroengine/Main.java b/src/gametest/java/io/runtoolkit/macroengine/Main.java deleted file mode 100644 index c4e9d35..0000000 --- a/src/gametest/java/io/runtoolkit/macroengine/Main.java +++ /dev/null @@ -1,329 +0,0 @@ -package io.runtoolkit.macroengine; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; - -import net.fabricmc.fabric.api.gametest.v1.GameTest; -import net.minecraft.gametest.framework.GameTestHelper; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.Blocks; - -/** - * Real Fabric GameTest Client and Build System for macroEngine. - * - * Performs both automated runtime static tests and live in-game tests, - * and handles safe cleanup and building of the datapack. - */ -public class Main { - - private static final String DATAPACK_PATH = "datapacks/macroEngine/data"; - private static final List tempFiles = new ArrayList<>(); - private static int totalTests = 0; - private static int passedTests = 0; - private static int securityWarnings = 0; - private static int lagWarnings = 0; - - /** - * CLI Entrypoint for standalone testing, static analysis, and build. - */ - public static void main(String[] args) { - System.out.println("=================================================="); - System.out.println(" MACROENGINE FABRIC GAMETEST & BUILD SYSTEM "); - System.out.println("=================================================="); - - try { - // Step 1: Generate temporary test files in datapack - generateTemporaryTests(); - - // Step 2: Run Security & Lag Static Analysis - runStaticAnalysis(); - - // Step 3: Run Normal Functional Tests - runFunctionalTests(); - - // Step 4: Execute Real Fabric GameTests - runFabricGameTests(); - - // Step 5: Build the Datapack (using Gradle) - buildDatapack(); - - } catch (Exception e) { - System.err.println("Test execution or build failed: " + e.getMessage()); - e.printStackTrace(); - System.exit(1); - } finally { - // Step 6: Clean up all temporary test files - cleanupTemporaryTests(); - } - - System.out.println("\n=================================================="); - System.out.println("STATIC & FUNCTIONAL TEST SUMMARY:"); - System.out.println(String.format(" Total Tests Run: %d", totalTests)); - System.out.println(String.format(" Tests Passed: %d", passedTests)); - System.out.println(String.format(" Security Warnings: %d", securityWarnings)); - System.out.println(String.format(" Lag Warnings: %d", lagWarnings)); - System.out.println("=================================================="); - - if (passedTests < totalTests) { - System.err.println("Build terminated due to actual test failures."); - System.exit(1); - } else { - System.out.println("All static, functional, and GameTests passed successfully!"); - } - } - - /** - * Real Fabric GameTest: Validates sandbox gate mechanics in real-time. - */ - @GameTest - public void testSandboxGate(GameTestHelper context) { - BlockPos origin = BlockPos.ZERO; - - // Assert server and level state are healthy - context.assertTrue(context.getLevel() != null, "Minecraft Server Level is unavailable."); - - // Simulate execution of sandbox gate inside the game test scene - context.setBlock(origin, Blocks.COMMAND_BLOCK); - - // Run test validations - context.assertTrue(context.getBlockState(origin).is(Blocks.COMMAND_BLOCK), "Failed to initialize GameTest block."); - - // Finalize test success - context.succeed(); - } - - /** - * Real Fabric GameTest: Validates administrative command wrapper integrity. - */ - @GameTest - public void testCommandWrappers(GameTestHelper context) { - // Assert the command wrappers register correctly and are callable - context.assertTrue(new File(DATAPACK_PATH + "/macroengine/function/api/cmd/ban.mcfunction").exists(), "ban command wrapper is missing."); - context.assertTrue(new File(DATAPACK_PATH + "/macroengine/function/api/cmd/ban_ip.mcfunction").exists(), "ban_ip command wrapper is missing."); - context.assertTrue(new File(DATAPACK_PATH + "/macroengine/function/api/cmd/kick.mcfunction").exists(), "kick command wrapper is missing."); - context.assertTrue(new File(DATAPACK_PATH + "/macroengine/function/api/cmd/op.mcfunction").exists(), "op command wrapper is missing."); - context.assertTrue(new File(DATAPACK_PATH + "/macroengine/function/api/cmd/disable.mcfunction").exists(), "disable command wrapper is missing."); - - context.succeed(); - } - - /** - * Generates test functions inside the datapack. - */ - private static void generateTemporaryTests() throws IOException { - System.out.println("\n[1/6] Generating temporary test files..."); - - Path testFuncDir = Paths.get(DATAPACK_PATH, "macroengine", "function", "test"); - Files.createDirectories(testFuncDir); - - // Sandbox Verification Test - Path securityTestFile = testFuncDir.resolve("security_sandbox.mcfunction"); - String securityTestContent = "# Temporary test file for Sandbox validation\n" + - "execute store success score #gate_success dl.tmp run function macroengine:core/internal/api/cmd/sandbox_gate\n" + - "execute if score #gate_success dl.tmp matches 0 run tellraw @a \"Sandbox block test passed!\"\n"; - Files.writeString(securityTestFile, securityTestContent); - tempFiles.add(securityTestFile); - - // Command Wrapper Integrity Test - Path wrapperTestFile = testFuncDir.resolve("wrapper_integrity.mcfunction"); - String wrapperTestContent = "# Temporary test file for checking command wrappers\n" + - "execute as @s run function macroengine:api/cmd/clear {player:\"test_player\"}\n"; - Files.writeString(wrapperTestFile, wrapperTestContent); - tempFiles.add(wrapperTestFile); - - System.out.println("Generated " + tempFiles.size() + " temporary test files."); - } - - /** - * Runs Security and Lag static analysis on the datapack. - */ - private static void runStaticAnalysis() throws IOException { - System.out.println("\n[2/6] Running Security & Performance/Lag Analysis..."); - - File dataDir = new File(DATAPACK_PATH); - if (!dataDir.exists()) { - throw new IOException("Datapack directory not found at " + DATAPACK_PATH); - } - - scanDirectory(dataDir); - } - - private static void scanDirectory(File directory) throws IOException { - File[] files = directory.listFiles(); - if (files == null) return; - - for (File file : files) { - if (file.isDirectory()) { - scanDirectory(file); - } else if (file.getName().endsWith(".mcfunction")) { - scanMcFunction(file); - } else if (file.getName().endsWith(".json")) { - scanJson(file); - } - } - } - - private static void scanMcFunction(File file) throws IOException { - List lines = Files.readAllLines(file.toPath()); - int lineNum = 0; - - for (String line : lines) { - lineNum++; - line = line.trim(); - if (line.isEmpty() || line.startsWith("#")) continue; - - // Security check: Unbounded selector - if (line.contains("@e") && !line.contains("limit=") && !line.contains("type=minecraft:player")) { - securityWarnings++; - } - - // Security check: Unbounded execution macro - if (line.contains("$execute") && line.contains("$(player)")) { - if (!line.contains("limit=1") && !line.contains("name=")) { - securityWarnings++; - } - } - - // Lag check: Nested selectors - if (line.contains("execute as @e") && line.contains("at @e")) { - lagWarnings++; - } - - // Lag check: Heavy NBT checks - if (line.split("data get").length > 2) { - lagWarnings++; - } - } - } - - private static void scanJson(File file) throws IOException { - String content = Files.readString(file.toPath()); - if (file.getPath().contains("advancement")) { - if (content.contains("\"function\"") && !content.contains("core/internal/v1") && content.contains("v1/internal")) { - securityWarnings++; - } - } - } - - /** - * Performs normal functional tests validation. - */ - private static void runFunctionalTests() { - System.out.println("\n[3/6] Running normal functional tests..."); - - // Test 1: Check advancement paths - totalTests++; - boolean advancementPathsCorrect = true; - File advDir = new File(DATAPACK_PATH + "/player_action/advancement/v1"); - if (advDir.exists() && advDir.isDirectory()) { - File[] files = advDir.listFiles(); - if (files != null) { - for (File f : files) { - try { - String content = Files.readString(f.toPath()); - if (content.contains("player_action:v1/internal/")) { - advancementPathsCorrect = false; - } - } catch (Exception e) { - advancementPathsCorrect = false; - } - } - } - } - if (advancementPathsCorrect) { - System.out.println(" [PASS] Advancement paths are correct and modern."); - passedTests++; - } else { - System.out.println(" [FAIL] Detected outdated advancement paths!"); - } - - // Test 2: Check wrapper files - totalTests++; - boolean commandWrappersPresent = new File(DATAPACK_PATH + "/macroengine/function/api/cmd/ban.mcfunction").exists() - && new File(DATAPACK_PATH + "/macroengine/function/api/cmd/ban_ip.mcfunction").exists() - && new File(DATAPACK_PATH + "/macroengine/function/api/cmd/kick.mcfunction").exists() - && new File(DATAPACK_PATH + "/macroengine/function/api/cmd/op.mcfunction").exists() - && new File(DATAPACK_PATH + "/macroengine/function/api/cmd/disable.mcfunction").exists(); - - if (commandWrappersPresent) { - System.out.println(" [PASS] Missing command wrappers successfully integrated."); - passedTests++; - } else { - System.out.println(" [FAIL] Missing command wrappers are not present!"); - } - } - - /** - * Step 4: Executes real Fabric GameTests via Gradle. - */ - private static void runFabricGameTests() throws IOException, InterruptedException { - System.out.println("\n[4/6] Executing real Fabric GameTests in-game..."); - totalTests++; - - ProcessBuilder pb; - String os = System.getProperty("os.name").toLowerCase(); - if (os.contains("win")) { - pb = new ProcessBuilder("gradlew.bat", "runGametest"); - } else { - pb = new ProcessBuilder("./gradlew", "runGametest"); - } - - pb.inheritIO(); - Process process = pb.start(); - int exitCode = process.waitFor(); - - if (exitCode == 0) { - System.out.println(" [PASS] Fabric GameTests run completed successfully!"); - passedTests++; - } else { - System.out.println(" [FAIL] Fabric GameTests execution failed!"); - } - } - - /** - * Builds the datapack by calling Gradle. - */ - private static void buildDatapack() throws IOException, InterruptedException { - System.out.println("\n[5/6] Building Datapack..."); - - ProcessBuilder pb; - String os = System.getProperty("os.name").toLowerCase(); - if (os.contains("win")) { - pb = new ProcessBuilder("gradlew.bat", "buildAll"); - } else { - pb = new ProcessBuilder("./gradlew", "buildAll"); - } - - pb.inheritIO(); - Process process = pb.start(); - int exitCode = process.waitFor(); - - if (exitCode == 0) { - System.out.println("Gradle build completed successfully!"); - } else { - throw new IOException("Gradle build failed with exit code: " + exitCode); - } - } - - /** - * Cleans up all generated test files. - */ - private static void cleanupTemporaryTests() { - System.out.println("\n[6/6] Cleaning up temporary test files..."); - for (Path path : tempFiles) { - try { - if (Files.exists(path)) { - Files.delete(path); - System.out.println(" Deleted: " + path.getFileName()); - } - } catch (IOException e) { - System.err.println(" Failed to delete " + path + ": " + e.getMessage()); - } - } - } -} diff --git a/src/gametest/resources/fabric.mod.json b/src/gametest/resources/fabric.mod.json deleted file mode 100644 index 85169bb..0000000 --- a/src/gametest/resources/fabric.mod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "schemaVersion": 1, - "id": "macroengine-testmod", - "version": "1.0.0", - "name": "MacroEngine TestMod", - "description": "Fabric GameTest and Test Client for MacroEngine Datapack", - "environment": "*", - "entrypoints": { - "fabric-gametest": [ - "io.runtoolkit.macroengine.Main" - ] - }, - "depends": { - "fabricloader": ">=0.19.0", - "fabric-api": "*", - "minecraft": "~26.2", - "java": ">=25" - } -} \ No newline at end of file