-
Notifications
You must be signed in to change notification settings - Fork 30
/
project.clj
561 lines (508 loc) · 33 KB
/
project.clj
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
(def clj-logging-config-version "1.9.12")
(def slf4j-log4j12-version "1.7.30")
(def figwheel-version "0.5.20")
(def selected-clojurescript-version (or (System/getenv "CANARY_CLOJURESCRIPT_VERSION") "1.10.773"))
(def selected-clojure-version "1.10.1")
(def selenium-version "3.141.59")
(def lein-cljsbuild-version "1.1.8")
(def provided-deps
[['org.clojure/clojure selected-clojure-version :scope "provided"]
['org.clojure/clojurescript selected-clojurescript-version :scope "provided"]])
(def required-deps
[['org.clojure/core.async "1.3.610"]
['org.clojure/tools.logging "1.1.0"]
['org.clojure/tools.cli "1.0.194"]
['nrepl/nrepl "0.8.3"]
['binaryage/env-config "0.2.2"]
['http-kit "2.5.0"]
['version-clj "0.1.2"]
['clansi "1.0.0"]
['funcool/cuerdas "2020.03.26-3"]
['com.rpl/specter "1.1.3"]
['progrock "0.1.2"]
['me.raynes/conch "0.8.0"]
['clj-sub-command "0.6.0"]
['ring/ring-core "1.8.2"]
['ring/ring-defaults "0.3.2"]
['binaryage/devtools "1.0.2"]])
(def test-deps
[; we cannot use :dependencies under individual profiles because Cursive recognizes only root level
; thus we mark extra deps with :scope "test" and filter them later when producing jar library
['binaryage/oops "0.7.0" :scope "test"]
['binaryage/chromex "0.9.2" :scope "test"]
['environ "1.2.0" :scope "test"]
['cljs-http "0.1.46" :scope "test"]
['figwheel figwheel-version :scope "test"]
['reforms "0.4.3" :scope "test"]
['rum "0.12.3" :scope "test"]
['rum-reforms "0.4.3" :scope "test"]
['com.lucasbradstreet/cljs-uuid-utils "1.0.2" :scope "test"]
['org.clojure/tools.namespace "1.0.0" :scope "test"]
['org.clojure/tools.reader "1.3.3" :scope "test"]
['fipp "0.6.23" :scope "test"]
['nubank/matcher-combinators "3.1.4" :scope "test"]
['clj-logging-config clj-logging-config-version :scope "test"]
['org.slf4j/slf4j-log4j12 slf4j-log4j12-version :scope "test"]
['http.async.client "1.3.1" :scope "test"]
['ring/ring-devel "1.8.2" :scope "test"]
['clj-time "0.15.2" :scope "test"]
; guava is needed for selenium, they rely on latest guava which gets overridden by google closure compiler dep inside clojurescript
;[com.google.guava/guava "23.0" :scope "test" :upgrade false]
['org.seleniumhq.selenium/selenium-java selenium-version :scope "test"]
['org.seleniumhq.selenium/selenium-chrome-driver selenium-version :scope "test"]
['org.seleniumhq.selenium/selenium-support selenium-version :scope "test"]
['org.seleniumhq.selenium/selenium-api selenium-version :scope "test"]
['org.seleniumhq.selenium/selenium-htmlunit-driver "2.52.0" :scope "test"]])
(def lib-deps (concat provided-deps required-deps))
(def all-deps (concat lib-deps test-deps))
(defproject binaryage/dirac "1.7.2"
:description "Dirac DevTools - a Chrome DevTools fork for ClojureScript developers."
:url "https://github.com/binaryage/dirac"
:license {:name "MIT License"
:url "http://opensource.org/licenses/MIT"
:distribution :repo}
:scm {:name "git"
:url "https://github.com/binaryage/dirac"}
:dependencies ~all-deps
:plugins [[lein-shell "0.5.0"]]
; this union of all paths for Cursive, may be redefined by profiles
:source-paths ["scripts"
"src/base"
"src/agent"
"src/automation"
"src/background"
"src/devtools"
"src/figwheel"
"src/implant"
"src/nrepl-lib"
"src/nrepl"
"src/options"
"src/project"
"src/empty"
"src/runtime"
"src/settings"
"src/shared"
"src/logging"
"src/main"
"src/home"
"test/src/test_lib"
"test/src/webdriver"
"test/marion/src/background"
"test/marion/src/content_script"
"test/backend/src/backend_tests"
"test/browser/fixtures/src/scenarios01"
"test/browser/fixtures/src/scenarios02"
"test/browser/fixtures/src/scenarios03"
"test/browser/fixtures/src/tasks"
"test/browser/src/browser_tests"]
:resource-paths ["resources/dev"
"resources/templates"]
:test-paths ["test"]
; unfortunately this must be on root level because leiningen does not properly merge metadata
; see https://github.com/technomancy/leiningen/issues/1826
; ! be careful with lein clean or tasks which do cleaning implicitly, this will wipe out all generated files
:clean-targets ^{:protect false} ["target"
"resources/release/.compiled"
"resources/unpacked/.compiled"
"resources/unpacked/devtools/front_end/dirac/.compiled"
"test/browser/fixtures/resources/.compiled"
"test/marion/resources/unpacked/.compiled"]
:cljsbuild {:builds {}} ; prevent https://github.com/emezeske/lein-cljsbuild/issues/413
:profiles {:lib
^{:pom-scope :provided} ; ! to overcome default jar/pom behaviour, our :dependencies replacement would be ignored for some reason
[{:dependencies ~(with-meta lib-deps {:replace true})
:source-paths ^:replace ["src/base"
"src/project"
"src/settings"
"src/runtime"
"src/nrepl-lib"
"src/home"
"src/main"
"src/agent"
"src/nrepl"]
:resource-paths ^:replace ["resources/templates"]
:test-paths ^:replace []}]
:logging-support
^{:pom-scope :provided} ; ! to overcome default jar/pom behaviour, our :dependencies replacement would be ignored for some reason
[{:dependencies [[clj-logging-config ~clj-logging-config-version :scope nil]
[org.slf4j/slf4j-log4j12 ~slf4j-log4j12-version :scope nil]]
:source-paths ["src/logging"]}]
:lib-with-logging
[:lib :logging-support]
:debugger-5005
{:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"]}
:suspended-debugger-5005
{:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"]}
:debugger-5006
{:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5006"]}
:suspended-debugger-5006
{:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5006"]}
:debugger-5007
{:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5007"]}
:suspended-debugger-5007
{:jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5007"]}
:clojure19
{:dependencies [[org.clojure/clojure "1.9.0" :scope "provided" :upgrade false]]}
:clojure110
{:dependencies [[org.clojure/clojure ~selected-clojure-version :scope "provided" :upgrade false]]}
:cooper
{:plugins [[lein-cooper "1.2.2"]]}
:cljs
{:plugins [[lein-cljsbuild ~lein-cljsbuild-version]
[lein-figwheel ~figwheel-version]]}
:nuke-aliases
{:aliases ^:replace {}}
:test-runner
{:source-paths ^:replace ["src/base"
"src/project"
"src/settings"
"src/agent"
"src/nrepl-lib"
"src/nrepl"
"src/shared"
"src/logging"
"src/home"
"src/main"
"test/src/test_lib"
"test/src/webdriver"
"test/browser/src/browser_tests"
"test/backend/src/backend_tests"
"test/browser/fixtures/src/tasks"
"test/browser/fixtures/src/scenarios01"
"test/browser/fixtures/src/scenarios02"
"test/browser/fixtures/src/scenarios03"]}
:browser-tests
{:cljsbuild {:builds
{:tasks
{:notify-command ["scripts/cljsbuild-notify.sh" "tasks"]
:source-paths ["src/settings"
"src/project"
"src/automation"
"src/runtime"
"src/shared"
"src/logging"
"test/browser/fixtures/src/tasks"]
:compiler {:output-to "test/browser/fixtures/resources/.compiled/tasks/main.js"
:output-dir "test/browser/fixtures/resources/.compiled/tasks"
:optimizations :none ; we rely on optimizations :none in test runner
:external-config {:devtools/config {:dont-detect-custom-formatters true}}
:source-map true
:source-map-timestamp true}}
:scenarios01
{; HACK: we rely on figwheel's "rel=<timestamp>" into cljs url params, clean-urls tests depend on it
:figwheel {:server-port 7301
:server-logfile ".figwheel/scenarios01.log"
:validate-interactive :start
:repl false}
:notify-command ["scripts/cljsbuild-notify.sh" "scenarios01"]
:source-paths ["src/settings"
"src/project"
"src/automation"
"src/runtime"
"src/shared"
"src/logging"
"test/browser/fixtures/src/scenarios01"]
:compiler {:output-to "test/browser/fixtures/resources/.compiled/scenarios01/main.js"
:output-dir "test/browser/fixtures/resources/.compiled/scenarios01"
:optimizations :none
:source-map true
:source-map-timestamp true}}
:scenarios02
{:notify-command ["scripts/cljsbuild-notify.sh" "scenarios02"]
:source-paths ["src/settings"
"src/project"
"src/automation"
"src/runtime"
"src/shared"
"src/logging"
"test/browser/fixtures/src/scenarios02"]
:compiler {:output-to "test/browser/fixtures/resources/.compiled/scenarios02/main.js"
:output-dir "test/browser/fixtures/resources/.compiled/scenarios02"
:asset-path "../.compiled/scenarios02"
:optimizations :none
:main dirac.tests.scenarios.normal-via-preloads
:preloads [dirac.runtime.preload]
:external-config {:dirac.runtime/config {:external-config-setting "configured externally"}}
:source-map true
:source-map-timestamp true}}
:scenarios03
{:notify-command ["scripts/cljsbuild-notify.sh" "scenarios03"]
:source-paths ["src/settings"
"src/project"
"src/automation"
"src/runtime"
"src/shared"
"src/logging"
"test/browser/fixtures/src/scenarios03"]
:compiler {:output-to "test/browser/fixtures/resources/.compiled/scenarios03/main.js"
:output-dir "test/browser/fixtures/resources/.compiled/scenarios03"
:asset-path "../.compiled/scenarios03"
:optimizations :none
:source-map true
:source-map-timestamp true}}}}}
:marion-figwheel
{:figwheel {:server-port 7200
:server-logfile ".figwheel/marion.log"
:validate-interactive :start
:repl false}}
:marion
{:cljsbuild {:builds
{:marion-background
{:notify-command ["scripts/cljsbuild-notify.sh" "marion-background"]
:source-paths ["src/settings"
"src/devtools"
"src/shared"
"src/logging"
"test/marion/src/background"]
:compiler {:output-to "test/marion/resources/unpacked/.compiled/background/background.js"
:output-dir "test/marion/resources/unpacked/.compiled/background"
:external-config {:devtools/config {:dont-detect-custom-formatters true}}
:optimizations :none
:source-map true}}
:marion-content-script
{:notify-command ["scripts/cljsbuild-notify.sh" "marion-content-script"]
:source-paths ["src/settings"
"src/shared"
"src/logging"
"test/marion/src/content_script"]
:compiler {:output-to "test/marion/resources/unpacked/.compiled/content_script/content_script.js"
:output-dir "test/marion/resources/unpacked/.compiled/content_script"
:closure-output-charset "US-ASCII"
:external-config {:devtools/config {:silence-optimizations-warning true
:dont-detect-custom-formatters true}}
:optimizations :whitespace ; content scripts cannot do eval / load script dynamically
:pretty-print true
:source-map "test/marion/resources/unpacked/.compiled/content_script/content_script.js.map"}}}}}
:dirac-figwheel
{:figwheel {:server-port 7100
:server-logfile ".figwheel/dirac.log"
:validate-interactive :start
:repl false}}
:dirac-unpacked
{:cljsbuild {:builds
{:dirac-implant
{:notify-command ["scripts/cljsbuild-notify.sh" "dirac-implant"]
:source-paths ["src/settings"
"src/shared"
"src/logging"
"src/project"
"src/devtools"
"src/options"
"src/implant"]
:compiler {:output-to "resources/unpacked/devtools/front_end/dirac/.compiled/implant/implant.js"
:output-dir "resources/unpacked/devtools/front_end/dirac/.compiled/implant"
:external-config {:devtools/config {:dont-detect-custom-formatters true}}
:optimizations :none
:main dirac.implant
:source-map true
; this is using my fork of ClojureScript,
; until https://clojure.atlassian.net/browse/CLJS-1902 gets merged
:aot-cache false ; to get cljs.core compiled with inlined namespace
:inline-source-maps true}}
:dirac-background
{:notify-command ["scripts/cljsbuild-notify.sh" "dirac-background"]
:source-paths ["src/settings"
"src/figwheel"
"src/shared"
"src/logging"
"src/project"
"src/devtools"
"src/options"
"src/background"]
:compiler {:output-to "resources/unpacked/.compiled/background/dirac.js"
:output-dir "resources/unpacked/.compiled/background"
:external-config {:devtools/config {:dont-detect-custom-formatters true}}
:optimizations :none
:source-map true}}
:dirac-options
{:notify-command ["scripts/cljsbuild-notify.sh" "dirac-options"]
:source-paths ["src/settings"
"src/figwheel"
"src/shared"
"src/logging"
"src/project"
"src/devtools"
"src/options"]
:compiler {:output-to "resources/unpacked/.compiled/options/dirac.js"
:output-dir "resources/unpacked/.compiled/options"
:external-config {:devtools/config {:dont-detect-custom-formatters true}}
:optimizations :none
:source-map true}}}}}
:dirac-packed
; note: we want to compile under target folder to prevent unnecessary recompilations after running ./scripts/release.sh
; the script will copy most recent build over
{; TODO: figure out how to pass env to chromex without lein-environ
; :env {:chromex-elide-verbose-logging "true"}
:cljsbuild {:builds
{:dirac-implant
{:source-paths ["src/settings"
"src/shared"
"src/logging"
"src/project"
"src/implant"]
:compiler {:output-to "target/resources/release/devtools/front_end/dirac/.compiled/implant/implant.js"
:output-dir "target/resources/release/devtools/front_end/dirac/.compiled/implant"
:main dirac.implant
:optimizations :advanced
:output-wrapper "(function(){%s}).call(window);"
:elide-asserts true}}
:dirac-background
{:source-paths ["src/settings"
"src/shared"
"src/logging"
"src/project"
"src/background"]
:compiler {:output-to "target/resources/release/.compiled/background.js"
:output-dir "target/resources/release/.compiled/background"
:optimizations :advanced
:main dirac.background
:elide-asserts true}}
:dirac-options
{:source-paths ["src/settings"
"src/shared"
"src/logging"
"src/project"
"src/options"]
:compiler {:output-to "target/resources/release/.compiled/options.js"
:output-dir "target/resources/release/.compiled/options"
:optimizations :advanced
:main dirac.options
:elide-asserts true}}}}}
; want to use technique of overlaying related compiler options on top of our default configuration to all builds
; the problem is cljsbuild's logic for adding default/missing options to :cljsbuild config maps
; sure, we can overlay :builds with profiles, but build-ids which end up not having :source-paths will
; get assigned "src-cljs" for some silly reason which goes beyond my imagination
; we fight it by assigning an empty existing :source-paths to all our possible build-ids
; to prevent cljsbuild to assign their defaults
:prevent-cljsbuild-defaults
{:cljsbuild {:builds
{:dirac-implant
{:source-paths ["src/empty"]}
:dirac-background
{:source-paths ["src/empty"]}
:dirac-options
{:source-paths ["src/empty"]}
:marion-background
{:source-paths ["src/empty"]}
:marion-content-script
{:source-paths ["src/empty"]}
:tasks
{:source-paths ["src/empty"]}
:scenarios01
{:source-paths ["src/empty"]}
:scenarios02
{:source-paths ["src/empty"]}
:scenarios03
{:source-paths ["src/empty"]}}}}
:pseudo-names
[:prevent-cljsbuild-defaults
{:cljsbuild {:builds
{:dirac-implant
{:compiler {:pseudo-names true}}
:dirac-background
{:compiler {:pseudo-names true}}
:dirac-options
{:compiler {:pseudo-names true}}}}}]
:parallel-build
[:prevent-cljsbuild-defaults
{:cljsbuild {:builds
{:dirac-implant
{:compiler {:parallel-build true}}
:dirac-background
{:compiler {:parallel-build true}}
:dirac-options
{:compiler {:parallel-build true}}
:marion-background
{:compiler {:parallel-build true}}
:marion-content-script
{:compiler {:parallel-build true}}
:tasks
{:compiler {:parallel-build true}}
:scenarios01
{:compiler {:parallel-build true}}
:scenarios02
{:compiler {:parallel-build true}}
:scenarios03
{:compiler {:parallel-build true}}}}}]
:dirac-whitespace
{:cljsbuild {:builds
{:dirac-implant
{:compiler {:optimizations :whitespace
:pretty-print true
:closure-output-charset "US-ASCII"}}
:dirac-background
{:compiler {:optimizations :whitespace
:pretty-print true
:closure-output-charset "US-ASCII"}}
:dirac-options
{:compiler {:optimizations :whitespace
:pretty-print true
:closure-output-charset "US-ASCII"}}}}}
; to develop browser tests:
;
; ./scripts/dev-browser-tests.sh
;
; after first launch you might need to reload extensions at chrome://extensions
; * 'dirac' should point to 'resources/unpacked'
; * 'marion' should point to 'test/marion/resources/unpacked'
;
; dev fixtures server is running at http://localhost:9080
:dev-browser-tests
{:cooper {"fixtures-server" ["scripts/launch-fixtures-server.sh"]
"dev-agent" ["lein" "run-browser-tests-agent"]
"fig-dirac" ["lein" "fig-dirac"]
"fig-marion" ["lein" "fig-marion"]
"marion-cs" ["lein" "auto-compile-marion-cs"]
"tests" ["lein" "auto-compile-browser-tests"]
"browser" ["scripts/launch-test-browser.sh"]}}}
:aliases {"check" ["shell" "scripts/check-code.sh"]
"test" ["shell" "scripts/test-all.sh"]
"test-backend" ["shell" "scripts/test-backend.sh"]
"test-browser" ["shell" "scripts/test-browser.sh"] ; this will run browser tests against fully optimized dirac extension (release build)
"test-browser-dev" ["shell" "scripts/test-browser-dev.sh"] ; this will run browser tests against unpacked dirac extension
"run-backend-tests-19" ["with-profile" "+test-runner,+clojure19" "run" "-m" "dirac.tests.backend.runner"]
"run-backend-tests-110" ["with-profile" "+test-runner,+clojure110" "run" "-m" "dirac.tests.backend.runner"]
"run-cli-tests-19" ["with-profile" "+test-runner,+clojure19" "run" "-m" "dirac.test-runner"]
"run-cli-tests-110" ["with-profile" "+test-runner,+clojure110" "run" "-m" "dirac.test-runner"]
"run-browser-tests" ["shell" "scripts/run-browser-tests.sh" "dirac.tests.browser.runner"]
"run-browser-tests-dev" ["shell" "scripts/run-browser-tests.sh" "dirac.tests.browser.runner/-dev-main"]
"run-browser-tests-agent" ["with-profile" "+test-runner,+debugger-5005" "run" "-m" "dirac.tests.browser.runner/run-agent"]
"dev-browser-tests" ["shell" "scripts/dev-browser-tests.sh"]
"fig-dirac" ["with-profile" "+cljs,+dirac-unpacked,+dirac-figwheel"
"figwheel"
"dirac-background" "dirac-options" "dirac-implant"]
"compile-dirac-dev" ["with-profile" "+cljs,+parallel-build,+dirac-unpacked"
"cljsbuild" "once"
"dirac-background" "dirac-options" "dirac-implant"]
"auto-compile-dirac-dev" ["with-profile" "+cljs,+parallel-build,+dirac-unpacked"
"cljsbuild" "auto"
"dirac-background" "dirac-options" "dirac-implant"]
"compile-dirac" ["with-profile" "+cljs,+parallel-build,+dirac-packed"
"cljsbuild" "once"
"dirac-background" "dirac-options" "dirac-implant"]
"compile-dirac-pseudo-names" ["with-profile" "+cljs,+parallel-build,+dirac-packed,+pseudo-names"
"cljsbuild" "once"
"dirac-background" "dirac-options" "dirac-implant"]
"compile-dirac-whitespace" ["with-profile" "+cljs,+parallel-build,+dirac-packed,+dirac-whitespace"
"cljsbuild" "once"
"dirac-background" "dirac-options" "dirac-implant"]
"fig-marion" ["with-profile" "+cljs,+marion,+marion-figwheel"
"figwheel"
"marion-background"]
"compile-marion" ["with-profile" "+cljs,+parallel-build,+marion"
"cljsbuild" "once"
"marion-background" "marion-content-script"]
"auto-compile-marion" ["with-profile" "+cljs,+parallel-build,+marion"
"cljsbuild" "auto"
"marion-background" "marion-content-script"]
"auto-compile-marion-cs" ["with-profile" "+cljs,+parallel-build,+marion"
"cljsbuild" "auto"
"marion-content-script"]
"compile-browser-tests" ["with-profile" "+cljs,+parallel-build,+browser-tests"
"cljsbuild" "once"]
"auto-compile-browser-tests" ["with-profile" "+cljs,+parallel-build,+browser-tests"
"cljsbuild" "auto"]
"release" ["shell" "scripts/release.sh"]
"package" ["shell" "scripts/package.sh"]
"publish" ["shell" "scripts/deploy-clojars.sh"]
"regenerate" ["shell" "scripts/regenerate.sh"]})