Skip to content

Commit

Permalink
works on windows now
Browse files Browse the repository at this point in the history
  • Loading branch information
AltronMaxX committed Oct 29, 2024
1 parent 9a58cf3 commit c406261
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 13 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion build.hxml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--class-path src
--main FnFork
--cpp bin/cpp
--cpp bin/cpp
-D HXCPP_GC_BIG_BLOCKS
24 changes: 12 additions & 12 deletions src/FnFork.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package;

import sys.FileStat;
import settings.Settings;
import haxe.io.Path;
import sys.FileSystem;
Expand Down Expand Up @@ -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');
Expand All @@ -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();
}
}
Expand All @@ -84,7 +85,6 @@ class FnFork {
var commitsStr = readCommitsFromFileString(fileContent);
var commits:Array<Commit> = [];
for (commit in commitsStr) {
//trace(commit);
commits.push(new Commit(commit));
}

Expand Down Expand Up @@ -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 = "";
}
Expand All @@ -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));
}
}
}
Expand Down

0 comments on commit c406261

Please sign in to comment.