-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshermanfeature.py
67 lines (50 loc) · 1.96 KB
/
shermanfeature.py
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
DEFAULT_PRIORITY = 50
class Options:
def __init__(self, projectDir = None, shermanDir = None, buildDir = None, projectBuilder = None, featureOptions = None):
self.projectDir = projectDir
self.shermanDir = shermanDir
self.buildDir = buildDir
self.projectBuilder = projectBuilder
self.featureOptions = featureOptions
class ShermanFeature(object):
def __init__(self, options):
self.projectDir = options.projectDir
self.shermanDir = options.shermanDir
self.buildDir = options.buildDir
self.projectBuilder = options.projectBuilder
self.currentBuild = self.projectBuilder.currentBuild
self.options = options.featureOptions
self.additionalBootResources = []
def manifestLoaded(self, moduleName, modulePath, manifest):
if moduleName != "boot":
return
insertIndex = 0
for resource in self.additionalBootResources:
included = False
for source in manifest["sources"]:
if source["path"] == "async.js" and insertIndex == 0:
insertIndex = manifest["sources"].index(source) + 1
if source["path"].endswith(resource["path"]):
included = True
break
if not included:
manifest["sources"].insert(insertIndex, resource)
insertIndex += 1
def sourcesLoaded(self, locale, moduleName, modulePath):
pass
def isRebuildNeeded(self, locale, moduleName, modulePath):
return False
def sourcesConcatenated(self, locale, moduleName, modulePath):
pass
def modulesWritten(self):
pass
def generateBootstrapCode(self, locale, bootstrapCode):
return bootstrapCode
def buildFinished(self):
pass
@staticmethod
def priority(prio):
def setPriority(func):
func.priority = prio
return func
return setPriority