This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
forked from akamai/boomerang
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
95 lines (76 loc) · 7.78 KB
/
Makefile
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Copyright (c) 2011, Yahoo! Inc. All rights reserved.
# Copyright (c) 2014, Salesforce.com All rights reserved.
# Copyrights licensed under the BSD License. See the accompanying LICENSE.txt file for terms.
#Update each time the code changes.
BUILD_NUMBER := $(shell echo $$(( $(shell cat build-version.txt) + 1 )))
MINOR_VERSION := 0
MAJOR_VERSION := 1
VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(BUILD_NUMBER)
DATE := $(shell date +%s)
PROD_DIRECTORY := prod-$(VERSION)-$(DATE)
PLUGINS := src/plugins/rt.js src/plugins/memory.js src/plugins/mobile.js src/plugins/rtrestiming.js src/plugins/kylie.js
SHIM := src/shim/perfEnums.js src/shim/perfShimClousreCompilerTypes.js src/shim/perfShim.js
STUB := src/shim/perfEnums.js src/shim/perfShimClousreCompilerTypes.js src/shim/perfStubs.js
BEACON_URL := ""
ROOT_NAMESPACE := "Perf"
IMPLEMENTATION_FILE_NAME := perf
STUB_FILE_NAME := perfStub
MAP_FILE_NAME := "$(IMPLEMENTATION_FILE_NAME).js.map"
MINIFIER := java -jar ClosureCompiler/compiler.jar --define="VERSION='$(VERSION)'" --define="BEACON_URL='$(BEACON_URL)'" --define="ROOT_NAMESPACE='$(ROOT_NAMESPACE)'" --summary_detail_level 3 --warning_level VERBOSE --compilation_level ADVANCED_OPTIMIZATIONS --language_in ECMASCRIPT5_STRICT --output_wrapper 'this[$(ROOT_NAMESPACE)]&&void 0!==this[$(ROOT_NAMESPACE)].enabled||(function(window){%output%})(this);' --create_source_map ./$(PROD_DIRECTORY)/$(MAP_FILE_NAME) --source_map_format=V3 --jscomp_error accessControls --jscomp_error ambiguousFunctionDecl --jscomp_error checkEventfulObjectDisposal --jscomp_error checkRegExp --jscomp_error checkStructDictInheritance --jscomp_error checkTypes --jscomp_error checkVars --jscomp_error const --jscomp_error constantProperty --jscomp_error deprecated --jscomp_error duplicateMessage --jscomp_error es3 --jscomp_error es5Strict --jscomp_error externsValidation --jscomp_error fileoverviewTags --jscomp_error globalThis --jscomp_error internetExplorerChecks --jscomp_error invalidCasts --jscomp_error misplacedTypeAnnotation --jscomp_error missingProperties --jscomp_error missingProvide --jscomp_error missingRequire --jscomp_error missingReturn --jscomp_error nonStandardJsDocs --jscomp_error suspiciousCode --jscomp_error strictModuleDepCheck --jscomp_error typeInvalidation --jscomp_error undefinedNames --jscomp_error undefinedVars --jscomp_error unknownDefines --jscomp_error uselessCode --jscomp_error visibility --js=
MINIFIER_STUBS := java -jar ClosureCompiler/compiler.jar --define="ROOT_NAMESPACE='$(ROOT_NAMESPACE)'" --summary_detail_level 3 --warning_level VERBOSE --compilation_level ADVANCED_OPTIMIZATIONS --language_in ECMASCRIPT5_STRICT --output_wrapper 'this[$(ROOT_NAMESPACE)]&&void 0!==this[$(ROOT_NAMESPACE)].enabled||(function(window){%output%})(this);' --jscomp_error accessControls --jscomp_error ambiguousFunctionDecl --jscomp_error checkEventfulObjectDisposal --jscomp_error checkRegExp --jscomp_error checkStructDictInheritance --jscomp_error checkTypes --jscomp_error checkVars --jscomp_error const --jscomp_error constantProperty --jscomp_error deprecated --jscomp_error duplicateMessage --jscomp_error es3 --jscomp_error es5Strict --jscomp_error externsValidation --jscomp_error fileoverviewTags --jscomp_error globalThis --jscomp_error internetExplorerChecks --jscomp_error invalidCasts --jscomp_error misplacedTypeAnnotation --jscomp_error missingProperties --jscomp_error missingProvide --jscomp_error missingRequire --jscomp_error missingReturn --jscomp_error nonStandardJsDocs --jscomp_error suspiciousCode --jscomp_error strictModuleDepCheck --jscomp_error typeInvalidation --jscomp_error undefinedNames --jscomp_error undefinedVars --jscomp_error unknownDefines --jscomp_error uselessCode --jscomp_error visibility --js=
MINIFIER_DEBUG := java -jar ClosureCompiler/compiler.jar --define="VERSION='$(VERSION)'" --define="BEACON_URL='$(BEACON_URL)'" --define="ROOT_NAMESPACE='$(ROOT_NAMESPACE)'" --summary_detail_level 3 --warning_level VERBOSE --compilation_level WHITESPACE_ONLY --formatting PRETTY_PRINT --language_in ECMASCRIPT5_STRICT --output_wrapper "this.$(ROOT_NAMESPACE)&&void 0!==this.$(ROOT_NAMESPACE).enabled||(function(window){%output%})(this);" --jscomp_error accessControls --jscomp_error ambiguousFunctionDecl --jscomp_error checkEventfulObjectDisposal --jscomp_error checkRegExp --jscomp_error checkStructDictInheritance --jscomp_error checkTypes --jscomp_error checkVars --jscomp_error const --jscomp_error constantProperty --jscomp_error deprecated --jscomp_error duplicateMessage --jscomp_error es3 --jscomp_error es5Strict --jscomp_error externsValidation --jscomp_error fileoverviewTags --jscomp_error globalThis --jscomp_error internetExplorerChecks --jscomp_error invalidCasts --jscomp_error misplacedTypeAnnotation --jscomp_error missingProperties --jscomp_error missingProvide --jscomp_error missingRequire --jscomp_error missingReturn --jscomp_error nonStandardJsDocs --jscomp_error suspiciousCode --jscomp_error strictModuleDepCheck --jscomp_error typeInvalidation --jscomp_error undefinedNames --jscomp_error undefinedVars --jscomp_error unknownDefines --jscomp_error uselessCode --jscomp_error visibility --js=
all: $(PROD_DIRECTORY)/$(IMPLEMENTATION_FILE_NAME).js
usage:
echo "Create a release version of Kylie:"
echo " make"
echo
echo "Create a release version of Kylie with the rt, bw, dns, & kylie plugins:"
echo " make PLUGINS=\"plugins/rt.js plugins/bw.js plugins/dns.js plugins/kylie.js\""
echo
echo "Create a release version of Kylie with a custom beacon URL and root namespace:"
echo " make BEACON_URL=\"/location/to/beacon/data/to\" ROOT_NAMESPACE=\"Ninja\""
echo
echo "All of the major make arguments (all of which are optional)"
echo " BEACON_URL : The url where the collected data will be sent. By default it will use \"\"."
echo " ROOT_NAMESPACE : The name of the JavaScript object to which Kylie will be accessible from in the browser. Can be used to prevent name collisions. By default it will use \"Perf\"."
echo " IMPLEMENTATION_FILE_NAME : When building code this is the name of the resulting JS file, excluding the extension. By default it will use \"perf\"."
echo " STUB_FILE_NAME : The name of the no-op stub file, excluding the extension. By default it will use \"perfStub\"."
echo
$(PROD_DIRECTORY)/$(IMPLEMENTATION_FILE_NAME).js: $(PROD_DIRECTORY)/$(IMPLEMENTATION_FILE_NAME)-debug.js
echo "Making $@ ..."
echo "using plugins: $(PLUGINS)..."
echo "using shim: $(SHIM)..."
$(MINIFIER)src/boomerangClousreCompilerTypes.js src/plugins/pluginClousreCompilerTypes.js src/boomerang.js $(PLUGINS) $(SHIM) --js_output_file=$@
#Steps to connect the js file to the map file and handle some security
echo "//# sourceMappingURL=$(MAP_FILE_NAME)" >> $@
echo ")]}" | cat - $(PROD_DIRECTORY)/$(MAP_FILE_NAME) > /tmp/$(MAP_FILE_NAME).tmp && mv /tmp/$(MAP_FILE_NAME).tmp $(PROD_DIRECTORY)/$(MAP_FILE_NAME)
sed -i "" "s|$(PROD_DIRECTORY)/$(IMPLEMENTATION_FILE_NAME)|$(IMPLEMENTATION_FILE_NAME)|g" $(PROD_DIRECTORY)/$(MAP_FILE_NAME)
echo "done"
echo
$(PROD_DIRECTORY)/$(IMPLEMENTATION_FILE_NAME)-debug.js: $(PROD_DIRECTORY)/$(STUB_FILE_NAME).js
echo "Making $@ ..."
echo "using plugins: $(PLUGINS)..."
echo "using shim: $(SHIM)..."
$(MINIFIER_DEBUG)src/boomerangClousreCompilerTypes.js src/plugins/pluginClousreCompilerTypes.js src/boomerang.js $(PLUGINS) $(SHIM) --js_output_file=$@
echo "done"
echo
$(PROD_DIRECTORY)/$(STUB_FILE_NAME).js: updateVersion
echo
echo "Making $@ ..."
echo "using stub: $(STUB)..."
$(MINIFIER_STUBS)$(STUB) > $@
echo "done"
echo
updateVersion: makeProdDir
echo $(shell cat build-version.txt)
echo $(BUILD_NUMBER) > $(PROD_DIRECTORY)/build-version.txt
cp bower.json $(PROD_DIRECTORY)/bower.json
sed -i "" 's|"version": "[[:digit:].]*",|"version": "$(VERSION)",|' $(PROD_DIRECTORY)/bower.json
makeProdDir:
echo
echo "Making $(PROD_DIRECTORY) ..."
mkdir $(PROD_DIRECTORY)
echo "done"
echo
.PHONY: all
.SILENT: