Browse Source

Remove need for skip-build, don't write empty file

* No longer necessary to specify skip-build because it will be
detected automatically
* Don't count whitespace as meaningful output
macOS
Macoy Madson 1 year ago
parent
commit
a627e5a99f
  1. 2
      Bootstrap.cake
  2. 2
      Bootstrap_MSVC.cake
  3. 2
      CrossCompile_Windows.cake
  4. 1
      runtime/BuildTools.cake
  5. 2
      runtime/CHelpers.cake
  6. 2
      runtime/ComptimeHelpers.cake
  7. 1
      runtime/Config_Linux.cake
  8. 1
      runtime/Config_Mingw.cake
  9. 3
      runtime/Config_Windows.cake
  10. 1
      runtime/CppHelpers.cake
  11. 20
      src/Evaluator.cpp
  12. 32
      src/ModuleManager.cpp
  13. 1
      test/Export.cake
  14. 2
      test/RunTests.cake

2
Bootstrap.cake

@ -1,5 +1,3 @@
(skip-build)
(set-cakelisp-option executable-output "bin/cakelisp")
(add-c-search-directory-module "src")

2
Bootstrap_MSVC.cake

@ -1,5 +1,3 @@
(skip-build)
(set-cakelisp-option executable-output "bin/cakelisp.exe")
(add-c-search-directory-module "src")

2
CrossCompile_Windows.cake

@ -1,5 +1,3 @@
(skip-build)
(set-cakelisp-option executable-output "bin/cakelisp.exe")
(add-c-search-directory-module "src")

1
runtime/BuildTools.cake

@ -1,7 +1,6 @@
;; Build Tools - useful macros/functions for compile-time code
;; These rely on Cakelisp, so don't expect it to work outside comptime
(skip-build)
(import "ComptimeHelpers.cake")
;; Returns exit code (0 = success)

2
runtime/CHelpers.cake

@ -1,5 +1,3 @@
(skip-build)
(import "ComptimeHelpers.cake")
;; Unlike scope, this does not create a scope, which is useful when you don't want a scope but do

2
runtime/ComptimeHelpers.cake

@ -1,5 +1,3 @@
(skip-build)
(import &comptime-only "CppHelpers.cake")
;; Binds the variable's address to the named var

1
runtime/Config_Linux.cake

@ -1,2 +1 @@
(skip-build)
(comptime-define-symbol 'Unix)

1
runtime/Config_Mingw.cake

@ -1,4 +1,3 @@
(skip-build)
(comptime-define-symbol 'Windows)
;; TODO: Remove. These are only to ease testing via cross-compilation

3
runtime/Config_Windows.cake

@ -1,2 +1 @@
(skip-build)
(comptime-define-symbol 'Windows)
(comptime-define-symbol 'Windows)

1
runtime/CppHelpers.cake

@ -1,4 +1,3 @@
(skip-build)
(import "CHelpers.cake")
(defmacro std-str-equals (std-string-var any str any)

20
src/Evaluator.cpp

@ -2120,12 +2120,20 @@ bool StringOutputHasAnyMeaningfulOutput(const std::vector<StringOutput>* stringO
{
if (output.modifiers == StringOutMod_Splice)
{
bool spliceHadMeaningfulOutput =
(isHeader ?
StringOutputHasAnyMeaningfulOutput(&output.spliceOutput->header, isHeader) :
StringOutputHasAnyMeaningfulOutput(&output.spliceOutput->source, isHeader));
if (spliceHadMeaningfulOutput)
return true;
if (output.spliceOutput)
{
const std::vector<StringOutput>* outputToCheck =
isHeader ? &output.spliceOutput->header : &output.spliceOutput->source;
bool spliceHadMeaningfulOutput =
StringOutputHasAnyMeaningfulOutput(outputToCheck, isHeader);
if (spliceHadMeaningfulOutput)
return true;
}
}
else if (output.modifiers & (StringOutMod_NewlineAfter | StringOutMod_SpaceAfter |
StringOutMod_SpaceBefore | StringOutMod_None))
{
// Not actually meaningful output
}
else // Anything else should actually output
return true;

32
src/ModuleManager.cpp

@ -577,6 +577,15 @@ bool moduleManagerWriteGeneratedOutput(ModuleManager& manager)
WriterOutputSettings outputSettings;
outputSettings.sourceCakelispFilename = module->filename;
if (!StringOutputHasAnyMeaningfulOutput(&module->generatedOutput->source, false))
{
if (logging.buildProcess)
Logf("note: not writing module %s because it has no meaningful output\n",
module->filename);
module->skipBuild = true;
continue;
}
GeneratorOutput header;
GeneratorOutput footer;
// Something to attach the reason for generating this output
@ -906,17 +915,20 @@ static bool moduleManagerGetObjectsToBuild(ModuleManager& manager,
// We do this late so that the file can still affect the build arguments without getting
// built itself
if (!StringOutputHasAnyMeaningfulOutput(&module->generatedOutput->source, false))
{
if (logging.buildProcess)
Logf("note: not building module %s because it has no meaningful output\n",
module->sourceOutputName.c_str());
continue;
}
// Explicitly marked to not build
if (module->skipBuild)
{
continue;
// Explicitly marked to not build or automatically excluded
if (module->skipBuild)
{
continue;
}
if (!StringOutputHasAnyMeaningfulOutput(&module->generatedOutput->source, false))
{
if (logging.buildProcess)
Logf("note: not building module %s because it has no meaningful output\n",
module->sourceOutputName.c_str());
continue;
}
}
char buildObjectName[MAX_PATH_LENGTH] = {0};

1
test/Export.cake

@ -1,4 +1,3 @@
(skip-build)
(export
(add-cakelisp-search-directory "runtime")
(import "CHelpers.cake"))

2
test/RunTests.cake

@ -1,5 +1,3 @@
;; (skip-build)
(add-cakelisp-search-directory "runtime")
(import "BuildTools.cake" "ComptimeHelpers.cake" "CHelpers.cake" "Cakelisp.cake")

Loading…
Cancel
Save