-
Notifications
You must be signed in to change notification settings - Fork 0
/
nev.nimble
157 lines (125 loc) · 8.62 KB
/
nev.nimble
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
# Package
# This is required for LSP to work with this file and not show tons of errros
when defined(nimsuggest):
import system/nimscript
var commandLineParams: seq[string]
version = "0.2.2"
author = "Nimaoth"
description = "Text Editor"
license = "MIT"
srcDir = "src"
bin = @["nev"]
# Dependencies
requires "nim >= 2.0.0"
requires "nimgen >= 0.5.4"
requires "https://github.com/Nimaoth/vmath#661bdaa"
requires "pixie >= 5.0.7"
requires "chroma >= 0.2.7"
requires "winim >= 3.9.4"
requires "fusion >= 1.2"
requires "nimsimd >= 1.2.13"
requires "regex >= 0.25.0"
requires "glob#64f71af" # "glob >= 0.11.2" # the newest version of glob doesn't have a version but is required for Nim 2.0
requires "patty >= 0.3.5"
requires "nimclipboard >= 0.1.2"
requires "npeg >= 1.3.0"
requires "asynctools#a1a17d0"
requires "stew >= 0.1.0"
requires "results >= 0.5.0"
requires "chronos >= 4.0.3"
requires "https://github.com/Nimaoth/ws >= 0.5.0"
requires "https://github.com/Nimaoth/windy >= 0.0.2"
requires "https://github.com/Nimaoth/wasm3 >= 0.1.15"
requires "https://github.com/Nimaoth/lrucache.nim >= 1.1.4"
requires "https://github.com/Nimaoth/boxy >= 0.4.4"
requires "https://github.com/Nimaoth/nimtreesitter-api#498d284"
requires "https://github.com/Nimaoth/nimwasmtime >= 0.1.9"
requires "https://github.com/Nimaoth/nimsumtree >= 0.3.9"
# Use this to include all treesitter languages (takes longer to download)
requires "https://github.com/Nimaoth/nimtreesitter >= 0.1.6"
# Use these to only install specific treesitter languages. These don't work with the lock file
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_nim >= 0.1.3"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_cpp >= 0.1.3"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_agda >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_bash >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_c >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_css >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_go >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_html >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_java >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_javascript >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_python >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_ruby >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_rust >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_scala >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_c_sharp >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_haskell >= 0.1.2"
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_zig >= 0.1.4"
# typescript doesn't build on linux
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_typescript >= 0.1.2"
# php doesn't build
# requires "https://github.com/Nimaoth/nimtreesitter?subdir=treesitter_php >= 0.1.2"
import strformat, strutils
task createScriptingDocs, "Build the documentation for the scripting API":
exec "nim doc --project --index:on --git.url:https://github.com/Nimaoth/Nev/ --git.commit:main ./scripting/plugin_runtime.nim"
exec "nim buildIndex -o:./scripting/htmldocs/theindex.html ./scripting/htmldocs"
exec "nim ./tools/postprocess_docs.nims"
const exe = when defined(windows):
".exe"
else:
""
echo fmt"extension: {exe}"
const crossCompileWinArgs = "--gcc.exe:x86_64-w64-mingw32-gcc --gcc.linkerexe:x86_64-w64-mingw32-gcc --os:windows --cpu:amd64 -d:crossCompileToWindows"
proc getCommandLineParams(): string =
defer:
echo fmt"Additional command line params: {result}"
if commandLineParams.len < 3:
return ""
return commandLineParams[3..^1].join(" ")
task setup2, "Setup":
exec "nimble setup"
when defined(windows):
cpFile "nimble.paths", "nimble-win.paths"
else:
cpFile "nimble.paths", "nimble-linux.paths"
task buildDesktop, "Build the desktop version":
selfExec fmt"c -o:nev{exe} -d:exposeScriptingApi -d:appBuildWasmtime --passC:-std=gnu11 {getCommandLineParams()} ./src/desktop_main.nim"
# selfExec fmt"c --passL:advapi32.lib -o:nev{exe} -d:exposeScriptingApi -d:appBuildWasmtime {getCommandLineParams()} ./src/desktop_main.nim"
# selfExec fmt"c -o:nev{exe} -d:exposeScriptingApi -d:appBuildWasmtime --objChecks:off --fieldChecks:off --rangeChecks:off --boundChecks:off --overflowChecks:off --floatChecks:off --nanChecks:off --infChecks:off {getCommandLineParams()} ./src/desktop_main.nim"
task buildTerminal, "Build the terminal version":
selfExec fmt"c -o:nev{exe} -d:exposeScriptingApi -d:appBuildWasmtime -d:enableTerminal -d:enableGui=false --passC:-std=gnu11 {getCommandLineParams()} ./src/desktop_main.nim"
task buildTerminalDebug, "Build the terminal version (debug)":
selfExec fmt"c -o:nev{exe} --debuginfo:on --debugger:native --lineDir:off -d:exposeScriptingApi -d:appBuildWasmtime -d:enableTerminal -d:enableGui=false --passC:-std=gnu11 {getCommandLineParams()} ./src/desktop_main.nim"
task buildDebug, "Build the debug version":
selfExec fmt"c -o:nev{exe} --debuginfo:on --debugger:native --lineDir:off -d:exposeScriptingApi -d:appBuildWasmtime --passC:-std=gnu11 --nimcache:nimcache/debug {getCommandLineParams()} ./src/desktop_main.nim"
task buildDebugVcc, "Build the debug version":
selfExec fmt"c -o:nevd{exe} -d:debug -u:release --linetrace:on --stacktrace:on --debuginfo:on -d:treesitterBuiltins= -d:futureLogging --debugger:native --nimcache:C:/nc -d:enableSystemClipboard=false --cc:vcc --lineDir:off -d:exposeScriptingApi -d:appBuildWasmtime {getCommandLineParams()} ./src/desktop_main.nim"
task buildDesktopDebug, "Build the desktop version (debug)":
selfExec fmt"c -o:nevd{exe} -d:exposeScriptingApi -d:appBuildWasmtime --debuginfo:on -g -D:debug --lineDir:on --nilChecks:on --panics:off --passC:-g --passC:-std=gnu11 --stacktrace:on --linetrace:on --nimcache:nimcache/debug {getCommandLineParams()} ./src/desktop_main.nim"
# selfExec fmt"c -o:nev{exe} -d:exposeScriptingApi -d:appBuildWasmtime --objChecks:off --fieldChecks:off --rangeChecks:off --boundChecks:off --overflowChecks:off --floatChecks:off --nanChecks:off --infChecks:off {getCommandLineParams()} ./src/desktop_main.nim"
task buildDesktopWindows, "Build the desktop version for windows":
selfExec fmt"c -o:nev{exe} {crossCompileWinArgs} -d:exposeScriptingApi -d:appBuildWasmtime {getCommandLineParams()} ./src/desktop_main.nim"
task buildDll, "Build the dll version":
# Disable clipboard for now because it breaks hot reloading
selfExec fmt"c -o:nev.dll -d:exposeScriptingApi -d:appBuildWasmtime -d:enableSystemClipboard=false --noMain --app:lib {getCommandLineParams()} ./src/dynlib_main.nim"
task buildWorkspaceServer, "Build the server for hosting workspaces":
selfExec fmt"c -o:./tools/workspace-server{exe} {getCommandLineParams()} ./src/servers/workspace_server.nim"
task buildLanguagesServer, "Build the server for hosting languages servers":
selfExec fmt"c -o:./tools/languages-server{exe} {getCommandLineParams()} ./src/servers/languages_server.nim"
task buildRemoteWorkspaceHost, "Build the server for hosting workspaces and language servers":
selfExec fmt"c -o:./tools/remote-workspace-host{exe} {getCommandLineParams()} ./src/servers/server_main.nim"
task buildRemoteWorkspaceHostWindows, "Build the server for hosting workspaces and language servers":
selfExec fmt"c -o:./tools/remote-workspace-host{exe} {crossCompileWinArgs} {getCommandLineParams()} ./src/servers/server_main.nim"
task buildLspWs, "Build the websocket proxy for language servers":
selfExec fmt"c -o:./tools/lsp-ws{exe} {getCommandLineParams()} ./tools/lsp_ws.nim"
task buildLspWsWindows, "Build the websocket proxy for language servers":
selfExec fmt"c -o:./tools/lsp-ws{exe} {crossCompileWinArgs} {getCommandLineParams()} ./tools/lsp_ws.nim"
task buildNimConfigWasm, "Compile the nim script config file to wasm":
withDir "config":
selfExec fmt"c -d:release -o:wasm/{projectName()}.wasm {getCommandLineParams()}"
task buildNimConfigWasmAll, "Compile the nim script config file to wasm":
exec fmt"nimble buildNimConfigWasm keybindings_plugin.nim"
exec fmt"nimble buildNimConfigWasm harpoon.nim"
exec fmt"nimble buildNimConfigWasm vscode_config_plugin.nim"
task flamegraph, "Perf/flamegraph":
exec "PERF=/usr/lib/linux-tools/5.4.0-186-generic/perf ~/.cargo/bin/flamegraph -o flamegraph.svg -- nevtd -s:linux.nev-session"