Skip to content

Commit

Permalink
Allow compiling client with hxcpp target (HaxeFoundation#643)
Browse files Browse the repository at this point in the history
* Allow compiling client with hxcpp target

* Add tests for hxcpp build of haxelib

* Put shared flags into each.hxml
  • Loading branch information
tobil4sk committed Aug 26, 2024
1 parent be2fff1 commit 8d07d4a
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 55 deletions.
20 changes: 15 additions & 5 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,19 @@ run.n:
COPY .git .git
COPY src src
COPY hx3compat hx3compat
COPY client.hxml haxelib.json .
COPY client.hxml each.hxml haxelib.json .
RUN haxe client.hxml
SAVE ARTIFACT run.n AS LOCAL run.n

haxelib-binary:
FROM +devcontainer
COPY .git .git
COPY src src
COPY hx3compat hx3compat
COPY client_cpp.hxml each.hxml haxelib.json .
RUN haxe client_cpp.hxml
SAVE ARTIFACT haxelib AS LOCAL haxelib

package-haxelib:
FROM +devcontainer-base
COPY src src
Expand Down Expand Up @@ -350,7 +359,7 @@ haxelib-server-builder:

haxelib-server-legacy:
FROM +haxelib-server-builder
COPY server_legacy.hxml server_each.hxml .
COPY server_legacy.hxml server_each.hxml each.hxml .
COPY src src
COPY hx3compat hx3compat
COPY www/legacy www/legacy
Expand All @@ -359,7 +368,7 @@ haxelib-server-legacy:

haxelib-server-website:
FROM +haxelib-server-builder
COPY server_website.hxml server_each.hxml .
COPY server_website.hxml server_each.hxml each.hxml .
COPY src src
COPY hx3compat hx3compat
RUN haxe server_website.hxml
Expand All @@ -373,15 +382,15 @@ haxelib-server-website-highlighter:

haxelib-server-tasks:
FROM +haxelib-server-builder
COPY server_tasks.hxml server_each.hxml .
COPY server_tasks.hxml server_each.hxml each.hxml .
COPY src src
COPY hx3compat hx3compat
RUN haxe server_tasks.hxml
SAVE ARTIFACT www/tasks.n

haxelib-server-api:
FROM +haxelib-server-builder
COPY server_api.hxml server_each.hxml .
COPY server_api.hxml server_each.hxml each.hxml .
COPY src src
COPY hx3compat hx3compat
RUN haxe server_api.hxml
Expand Down Expand Up @@ -518,6 +527,7 @@ ci-tests:
# for package.hxml
COPY haxelib.json README.md .
COPY +run.n/run.n .
COPY +haxelib-binary/haxelib .

COPY +ci-runner/ci.n bin/ci.n
ENV HAXELIB_SERVER=localhost
Expand Down
5 changes: 1 addition & 4 deletions client.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
-cp src
-cp hx3compat/std
-cp hx4compat/std
-cp crypto/src
each.hxml
-neko run.n
-main haxelib.client.Main
6 changes: 6 additions & 0 deletions client_cpp.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
each.hxml
--cpp bin/cpp
--main haxelib.client.Main
-D destination=../../haxelib{EXESUFFIX}
--dce full
-D analyzer-optimize
5 changes: 1 addition & 4 deletions client_legacy.hxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
-cp src
-cp hx3compat/std
-cp hx4compat/std
-cp crypto/src
each.hxml
-neko bin/legacyhaxelib.n
-main legacyhaxelib.Main
5 changes: 1 addition & 4 deletions client_tests.hxml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
-p src
each.hxml
-p test
-p hx3compat/std
-p hx4compat/std
-p crypto/src
--main HaxelibTests
--debug
--neko bin/test.n
4 changes: 4 additions & 0 deletions each.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-cp src
-cp hx3compat/std
-cp hx4compat/std
-cp crypto/src
7 changes: 2 additions & 5 deletions integration_tests.hxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
-cp src
-cp test
-lib hx3compat
-cp hx4compat/std
-cp crypto/src
each.hxml
-p test
-main IntegrationTests
-neko bin/integration_tests.n
1 change: 1 addition & 0 deletions libs.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@
-cmd curl -sSLk https://lib.haxe.org/files/3.0/ufront-2,0,0.zip -o haxelib_global/ufront.zip && neko run.n install --always --skip-dependencies haxelib_global/ufront.zip
-cmd curl -sSLk https://lib.haxe.org/files/3.0/utest-1,9,6.zip -o haxelib_global/utest.zip && neko run.n install --always --skip-dependencies haxelib_global/utest.zip
-cmd curl -sSLk https://lib.haxe.org/files/3.0/hxnodejs-12,1,0.zip -o haxelib_global/hxnodejs.zip && neko run.n install --always --skip-dependencies haxelib_global/hxnodejs.zip
-cmd curl -sSLk https://lib.haxe.org/files/3.0/hxcpp-4,3,2.zip -o haxelib_global/hxcpp.zip && neko run.n install --always --skip-dependencies haxelib_global/hxcpp.zip
-cmd neko run.n dev record-macros lib/record-macros
5 changes: 1 addition & 4 deletions package.hxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
-cp src
-cp hx3compat/std
-cp hx4compat/std
-cp crypto/src
-p src
--run Package
5 changes: 1 addition & 4 deletions server_each.hxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
-cp src
-cp hx3compat/std
-cp hx4compat/std
-cp crypto/src
each.hxml
-lib ufront
-lib ufront-mail:1.0.0-rc.4
-lib ufront-ufadmin
Expand Down
5 changes: 1 addition & 4 deletions server_gitrepo.hxml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
--class-path src
each.hxml
--class-path lib/dts2hx-generated
--class-path lib/node-sys-db
--class-path hx3compat/std
--class-path hx4compat/std
--class-path crypto/src
--library hxnodejs
--library record-macros
--js gitrepo.js
Expand Down
1 change: 0 additions & 1 deletion server_legacy.hxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
server_each.hxml
-cp src
-neko www/legacy/index.n
-main legacyhaxelib.Site
-lib hx2compat
Expand Down
1 change: 0 additions & 1 deletion src/Package.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import haxe.zip.Tools;

import sys.io.File;
import sys.FileSystem;
import haxelib.client.Main.VERSION;
import haxelib.Data.Infos;

using StringTools;
Expand Down
10 changes: 5 additions & 5 deletions src/haxelib/client/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class Main {
Version => create(version, 0),
Help => create(usage, 0),

#if neko
#if !js
Submit => create(submit, 3, true),
#end
Register => create(register, 5, true),
Expand All @@ -227,7 +227,7 @@ class Main {
DeleteRepo => create(deleteRepo, 0),
ConvertXml => create(convertXml, 0),
Run => create(run, null),
#if neko
#if !js
Proxy => create(proxy, 5, true),
#end
FixRepo => create(fixRepo, 0),
Expand Down Expand Up @@ -264,7 +264,7 @@ class Main {

try {
if (commandInfo.net) {
#if neko
#if !js
loadProxy();
#end
checkUpdate();
Expand Down Expand Up @@ -367,7 +367,7 @@ class Main {
return encodedPassword;
}

#if neko
#if !js
function getContributor(contributors:Array<String>): {name:String, password:String} {
var user:String = contributors[0];

Expand Down Expand Up @@ -780,7 +780,7 @@ class Main {
}
}

#if neko
#if !js
function proxy() {
final rep = getRepositoryPath();
final host = getArgument("Proxy host");
Expand Down
2 changes: 2 additions & 0 deletions test/IntegrationTests.hx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class IntegrationTests extends TestBase {
function haxelib(args:Array<String>, ?input:String):Process {
final p = #if system_haxelib
new Process("haxelib", ["-R", serverUrl].concat(args));
#elseif haxelib_path
new Process(haxe.macro.Compiler.getDefine("haxelib_path"), ["-R", serverUrl].concat(args));
#else
new Process("neko", [haxelibBin, "-R", serverUrl].concat(args));
#end
Expand Down
22 changes: 8 additions & 14 deletions test/RunCi.hx
Original file line number Diff line number Diff line change
Expand Up @@ -370,19 +370,6 @@ Listen 2000
}

static function integrationTests():Void {
function test():Void {
switch (Sys.getEnv("TRAVIS_HAXE_VERSION")) {
case null, "development":
runCommand("haxe", ["integration_tests.hxml"]);
case "3.1.3":
runCommand("haxe", ["integration_tests.hxml", "-D", "system_haxelib"]);
case _:
runCommand("haxe", ["integration_tests.hxml"]);
runCommand("neko", ["bin/integration_tests.n"]);
runCommand("haxe", ["integration_tests.hxml", "-D", "system_haxelib"]);
}
runCommand("neko", ["bin/integration_tests.n"]);
}
var dbConfigPath = Path.join(["www", "dbconfig.json"]);
saveContent(dbConfigPath, Json.stringify({
user: Sys.getEnv("HAXELIB_DB_USER"),
Expand All @@ -391,7 +378,14 @@ Listen 2000
port: Std.parseInt(Sys.getEnv("HAXELIB_DB_PORT")),
database: Sys.getEnv("HAXELIB_DB_NAME"),
}, "\t"));
test();
runCommand("haxe", ["integration_tests.hxml"]);
runCommand("neko", ["bin/integration_tests.n"]);
runCommand("haxe", [
"integration_tests.hxml",
"-D",
'haxelib_path=${Path.join([Sys.getCwd(), "haxelib"])}'
]);
runCommand("neko", ["bin/integration_tests.n"]);
}

static function deploy():Void {
Expand Down

0 comments on commit 8d07d4a

Please sign in to comment.