From c40626122a9a1b442c22d4731339e32406513fa5 Mon Sep 17 00:00:00 2001 From: AltronMaxX Date: Tue, 29 Oct 2024 19:47:57 +0400 Subject: [PATCH] works on windows now --- .github/workflows/main.yml | 78 ++++++++++++++++++++++++++++++++++++++ build.hxml | 3 +- src/FnFork.hx | 24 ++++++------ 3 files changed, 92 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6678e22 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,78 @@ +name: Build Artifacts + +on: + push: + workflow_dispatch: + +jobs: + buildWindows: + runs-on: windows-latest + + permissions: + contents: write + actions: write + + steps: + - uses: actions/checkout@main + + - name: Setting up Haxe + uses: krdlab/setup-haxe@master + with: + haxe-version: 4.3.6 + + - name: Setup everything + run: | + haxelib setup C:/haxelib + haxelib install hxcpp > /dev/null --quiet + shell: cmd + + - name: Setup HXCPP dev commit + run: | + cd .haxelib/hxcpp/git/tools/hxcpp + haxe compile.hxml + cd ../../../../.. + + - name: Compile FnFork + run: haxe build.hxml + + - name: Uploading artifact + uses: actions/upload-artifact@v4 + with: + name: FnFork-Windows + path: bin/cpp/FnFork.exe + + buildLinux: + runs-on: ubuntu-latest + + permissions: + contents: write + actions: write + + steps: + - uses: actions/checkout@main + + - name: Setting up Haxe + uses: krdlab/setup-haxe@master + with: + haxe-version: 4.3.6 + + - name: Setup everything + run: | + haxelib setup C:/haxelib + haxelib install hxcpp > /dev/null --quiet + shell: cmd + + - name: Setup HXCPP dev commit + run: | + cd .haxelib/hxcpp/git/tools/hxcpp + haxe compile.hxml + cd ../../../../.. + + - name: Compile FnFork + run: haxe build.hxml + + - name: Uploading artifact + uses: actions/upload-artifact@v4 + with: + name: FnFork-Linux + path: bin/cpp/FnFork \ No newline at end of file diff --git a/build.hxml b/build.hxml index f6533a5..c597e56 100644 --- a/build.hxml +++ b/build.hxml @@ -1,3 +1,4 @@ --class-path src --main FnFork ---cpp bin/cpp \ No newline at end of file +--cpp bin/cpp +-D HXCPP_GC_BIG_BLOCKS \ No newline at end of file diff --git a/src/FnFork.hx b/src/FnFork.hx index 61b99c8..8e44218 100644 --- a/src/FnFork.hx +++ b/src/FnFork.hx @@ -1,6 +1,5 @@ package; -import sys.FileStat; import settings.Settings; import haxe.io.Path; import sys.FileSystem; @@ -43,10 +42,10 @@ class FnFork { //clonning code repo var gitClone = new Process('git clone ${settings.codeRepoURL} ./.caches/fnf'); - while (gitClone.exitCode(false) == null) { - Sys.stdout().write(gitClone.stdout.readAll()); - Sys.stderr().write(gitClone.stderr.readAll()); - } + trace(gitClone.stdout.readAll().toString()); + trace(gitClone.stderr.readAll().toString()); + while (gitClone.exitCode(false) == null) {} + gitClone.close(); final cwd = Sys.getCwd(); Sys.setCwd('./.caches/fnf'); @@ -67,8 +66,10 @@ class FnFork { }); for (patch in patches) { var gitApply = new Process('git apply --reject "./patches/$patch"'); - gitApply.stdout.readAll(); - gitApply.stderr.readAll(); // Needed to apply patches, lol + while (gitApply.exitCode(false) == null) { + trace(gitApply.stdout.readAll()); + trace(gitApply.stderr.readAll()); + } gitApply.close(); } } @@ -84,7 +85,6 @@ class FnFork { var commitsStr = readCommitsFromFileString(fileContent); var commits:Array = []; for (commit in commitsStr) { - //trace(commit); commits.push(new Commit(commit)); } @@ -118,7 +118,7 @@ class FnFork { if (line.startsWith("commit")) { // Reading new commit if (commitStr != "") ret.push(commitStr); - if (line.contains(File.getContent('./.caches/lastFnfCommitHash.txt'))) + if (line.contains(File.getContent('./.caches/lastFnfCommitHash.txt'))) // No need to create patch files for base repo commits break; commitStr = ""; } @@ -137,13 +137,13 @@ class FnFork { FileSystem.createDirectory(dest); for (file in FileSystem.readDirectory(src)) { - var srcPath = '$src/$file'; - var destPath = '$dest/$file'; + final srcPath = '$src/$file'; + final destPath = '$dest/$file'; if (FileSystem.isDirectory(srcPath)) { copyDirectory(srcPath, destPath); } else { - File.saveContent(destPath, File.getContent(srcPath)); + File.saveBytes(destPath, File.getBytes(srcPath)); } } }