forked from jevalenciap/training
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSConstruct
More file actions
79 lines (66 loc) · 2.51 KB
/
SConstruct
File metadata and controls
79 lines (66 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
import os
import file_search
import itertools
import others_builder
import gherkin_builder
import folders_builder
# Guarantee scons version
EnsureSConsVersion(2, 3)
# Build default construction environment
env = Environment()
# Set external variables
env['ENV']['PATH'] = os.environ['PATH']
env['ENV']['HOME'] = os.environ['HOME']
# Set signature
env.Decider('MD5-timestamp')
# Dissable python warnings
env['ENV']['PYTHONWARNINGS'] = 'ignore'
# File change cache location
env.SConsignFile('build/decider')
env.CacheDir('build/build_cache')
# Find all required sources
#cpp_sources = fileSearch.find_sources('cpp', 0)
#cs_sources = fileSearch.find_sources('cs', 0)
#java_sources = fileSearch.find_sources('java', 0)
#js_sources = fileSearch.find_sources('js', 0)
#py_sources = fileSearch.find_sources('py', 0)
#rb_sources = fileSearch.find_sources('rb', 0)
#sh_sources = fileSearch.find_sources('sh', 0)
gherkin_sources = file_search.find_sources('feature', 0)
others_sources = file_search.find_sources('txt', 1)
folder_sources = file_search.find_folders()
# Prep OTHERS targets
others_targets = others_sources
others_targets = [ot.replace('challenges', 'build') for ot in others_targets]
# Prep Gherkin targets
gherkin_targets = gherkin_sources
gherkin_targets = [gt.replace('challenges', 'build') for gt in gherkin_targets]
# Prep Folder targets
folder_tmps = folder_sources
folder_targets = []
for ft in folder_tmps:
dir_path = os.path.dirname(os.path.realpath(ft[0]))
dir_path = dir_path.replace('challenges', 'build')
dir_path += "/folder.txt"
folder_targets.append(dir_path)
# Builder - OTHERS
bothers_builder = Builder(action = others_builder.build_others)
env.Append(BUILDERS = {'Bothers' : bothers_builder})
for sr, tg in itertools.izip(others_sources, others_targets):
bothers_run = env.Bothers(target = tg, source = sr)
env.Alias('others', others_targets)
# Builder - Gherkin
bgherkin_builder = Builder(action = gherkin_builder.build_gherkin)
env.Append(BUILDERS = {'Bgherkin' : bgherkin_builder})
for sr, tg in itertools.izip(gherkin_sources, gherkin_targets):
gherkin_run = env.Bgherkin(target = tg, source = sr)
env.Alias('gherkin', gherkin_targets)
# Builder - Folders
bfolders_builder = Builder(action = folders_builder.build_folders)
env.Append(BUILDERS = {'Bfolders' : bfolders_builder})
for sr, tg in itertools.izip(folder_sources, folder_targets):
bfolders_run = env.Bfolders(target = tg, source = sr)
env.Alias('folders', folder_targets)
# Enable explicit builds only
Default(None)