forked from algorithm-archivists/algorithm-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Racket to the build system (algorithm-archivists#1010)
- Loading branch information
Showing
4 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -531,3 +531,7 @@ target/ | |
|
||
*.out | ||
*.class | ||
|
||
# OCaml compilation files | ||
*.cmi | ||
*.cmx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from SCons.Builder import Builder | ||
import SCons.Util | ||
|
||
class ToolRacketWarning(SCons.Warnings.SConsWarning): | ||
pass | ||
|
||
class RacketNotFound(ToolRacketWarning): | ||
pass | ||
|
||
SCons.Warnings.enableWarningClass(ToolRacketWarning) | ||
|
||
def _detect(env): | ||
try: | ||
return env['raco'] | ||
except KeyError: | ||
pass | ||
|
||
go = env.WhereIs('raco') | ||
if go: | ||
return go | ||
|
||
SCons.Warnings.warn(RacketNotFound, 'Could not find raco executable') | ||
|
||
def exists(env): | ||
env.Detect('raco') | ||
|
||
def generate(env): | ||
env['RACO'] = _detect(env) | ||
env['RACOFLAGS'] = [] | ||
|
||
racket_builder = Builder( | ||
action='"$RACO" exe -o $TARGET $RACOFLAGS $SOURCE', | ||
src_suffix='.rkt', | ||
suffix='$PROGSUFFIX', | ||
) | ||
|
||
env.Append(BUILDERS={'Racket': racket_builder}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Import('files_to_compile env') | ||
|
||
for file_info in files_to_compile: | ||
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}' | ||
build_result = env.Racket(build_target, str(file_info.path)) | ||
env.Alias(str(file_info.chapter), build_result) |