Skip to content

Commit b016c59

Browse files
Add interpreted languages to SCons (#950)
1 parent 6b30491 commit b016c59

11 files changed

+80
-5
lines changed

SConstruct

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,16 @@ rust_rustc_builder = Builder(action='rustc $SOURCE -o $TARGET$PROGSUFFIX')
1919

2020
go_builder = Builder(action='go build -o $TARGET$PROGSUFFIX $SOURCE')
2121

22+
# For interpreted languages to copy to build directory
23+
copy_builder = Builder(action=Copy('$TARGET', '$SOURCE'))
24+
2225
coconut_builder = Builder(action='coconut $COCONUTFLAGS $SOURCE $TARGET', src_suffix='.coco', target_suffix='.py')
2326

2427
env = Environment(ENV=os.environ,
2528
BUILDERS={'rustc': rust_rustc_builder,
2629
'cargo': rust_cargo_builder,
2730
'Go': go_builder,
31+
'Copier': copy_builder,
2832
'Coconut': coconut_builder},
2933
tools=['gcc', 'gnulink', 'g++', 'gas', 'gfortran'])
3034

@@ -37,14 +41,25 @@ env['COCONUTFLAGS'] = '--target 3.8'
3741

3842
# Add other languages here when you want to add language targets
3943
# Put 'name_of_language_directory' : 'file_extension'
44+
4045
languages = {
41-
'c': 'c',
42-
'cpp': 'cpp',
4346
'asm-x64': 's',
44-
'rust': 'rs',
45-
'go': 'go',
46-
'fortran': 'f90',
47+
'bash': 'bash',
48+
'c': 'c',
4749
'coconut': 'coco',
50+
'cpp': 'cpp',
51+
'fortran': 'f90',
52+
'go': 'go',
53+
'javascript': 'js',
54+
'julia': 'jl',
55+
'lolcode': 'lol',
56+
'lua': 'lua',
57+
'php': 'php',
58+
'powershell': 'ps1',
59+
'python': 'py',
60+
'ruby': 'rb',
61+
'rust': 'rs',
62+
'viml': 'vim',
4863
}
4964

5065
# Do not add new Builders here, add them to the BUILDERS argument in the call to Environment above

sconscripts/bash_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.bash'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/javascript_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.js'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/julia_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.jl'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/lolcode_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.lol'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/lua_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.lua'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/php_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.php'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/powershell_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.ps1'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/python_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.py'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/ruby_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.rb'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

sconscripts/viml_SConscript

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Import('files_to_compile env')
2+
3+
for file_info in files_to_compile:
4+
build_target = f'#/build/{file_info.language}/{file_info.chapter}/{file_info.path.stem}.vim'
5+
build_result = env.Copier(build_target, str(file_info.path))
6+
env.Alias(str(file_info.chapter), build_result)

0 commit comments

Comments
 (0)