Skip to content

Commit

Permalink
cmake error check + verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikai B committed Feb 27, 2025
1 parent a28d556 commit b55db31
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ALCL.iml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<sourceFolder url="file://$MODULE_DIR$/Source" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="Haxe toolkit" jdkType="Haxe toolkit" />
<orderEntry type="jdk" jdkName="Haxe 4.3.6" jdkType="Haxe toolkit" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Binary file modified Binary/Hashlink/out.hl
Binary file not shown.
2 changes: 1 addition & 1 deletion Scripts/git_test_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ do
echo "- $file"
done

./ALCL -cwd ./Tests -compile cmake -std ../Stdlib -output ../Env/Out/Tests $TEST_FILES
./ALCL -verbose yes -cwd ./Tests -compile cmake -std ../Stdlib -output ../Env/Out/Tests $TEST_FILES
echo "Tests generated!"
2 changes: 1 addition & 1 deletion Scripts/git_test_windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cd /d ..
echo Test files:
for %%F in (!TEST_FILES!) do echo - %%F

ALCL -cwd ./Tests -compile cmake -std ../Stdlib -output ../Env/Out/Tests !TEST_FILES!
ALCL -verbose yes -cwd ./Tests -compile cmake -std ../Stdlib -output ../Env/Out/Tests !TEST_FILES!
echo Tests generated!

endlocal
1 change: 1 addition & 0 deletions Source/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Main {
public static function main() {
cli_main();
}

public static function cli_main() {
var project = new ProjectData();

Expand Down
25 changes: 20 additions & 5 deletions Source/cbuild/CMakeInterface.hx
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,29 @@ class CMakeInterface extends CBuild {

var problems: Bool = false;
for (cmd in cmds) {
if (_project.getVerbose()) {
Logging.print("running: " + cmd);
Sys.command(cmd);
continue;
}

if (problems) {
continue;
}

var cmdArgs = cmd.split(" ");
var cmdName = cmdArgs.shift();
var process = new Process(cmdName, cmdArgs);
var err = process.stderr.readAll().toString();
try {
var process = new Process(cmdName, cmdArgs);
var err = process.stderr.readAll().toString();

if (process.exitCode(true) != 0) {
Logging.print(process.stdout.readAll().toString());
Logging.error(err);
if (process.exitCode(true) != 0) {
Logging.print(process.stdout.readAll().toString());
Logging.error(err);
problems = true;
}
} catch (e: Dynamic) {
Logging.error("Failed to run CMake command!");
problems = true;
}
}
Expand Down
23 changes: 21 additions & 2 deletions Source/data/ProjectData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -261,26 +261,34 @@ class ProjectData {
var start = Sys.time();

for (dependency in _dependencies) {
Logging.debug('Building dependency: ${dependency.getProjectName()}');
dependency.setOutputDirectory(_outputDirectory);
dependency.setImportMap(_importMap);
dependency.setAstMap(_astMap);
dependency.setDumpAst(_dumpAst);
dependency.setParserMap(_parserMap);
dependency.setBuiltFileMap(_builtFileMap);
dependency.setVerbose(_verbose);
dependency.build(true);
}

// Logging.info('Start building: ${_projectName}');
if (getVerbose()) Logging.info('Start building: ${_projectName}');
var errors = new ErrorContainer();

// import map prepass
for (file in _files) {
var baseLoc = baseLocOf(file);
addImport(baseLoc, file);

Logging.debug('Import map: ${baseLoc} -> ${file}');
}

// tokenize + gen ASTs
for (file in _files) {
if (getVerbose()) {
Logging.info('- ${file} [parse]');
}

if (!FileSystem.exists(file)) {
errors.addError({ type: ErrorType.FileNotFound, message: file });
continue;
Expand All @@ -306,6 +314,10 @@ class ProjectData {

// typer + verifier
for (file in _files) {
if (getVerbose()) {
Logging.info('- ${file} [verify]');
}

var parser = _parserMap[file];
if (parser == null) {
Logging.warn('Missing parser for file "$file"');
Expand All @@ -327,6 +339,10 @@ class ProjectData {

// print ASTs
for (file in _files) {
if (getVerbose()) {
Logging.info('- ${file} [write]');
}

var parser = _parserMap[file];
if (parser == null) {
Logging.warn('Missing parser for file "$file"');
Expand Down Expand Up @@ -361,7 +377,10 @@ class ProjectData {

Logging.info('Dumped AST to ${outputFilename}');
}
// Logging.success('Done! Took ${Sys.time() - start} seconds.');

if (_verbose) {
Logging.success('Generation Done! Took ${Sys.time() - start} seconds.');
}
}
}

Expand Down

0 comments on commit b55db31

Please sign in to comment.