annotate compiler/ubuild.vim @ 2:9235d8341a18

Refactor the build system invocation commands. Now we have proper knowledge of the projects inside a codebase ("branch"). The plugin should correctly parse configuration names, find the correct module to build based on the configuration, and so on. Also, added support for generating the clang compilation database.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 22 Jan 2021 16:38:18 -0800
parents ba03cac1b1c6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
1 " Compiler file for building Unreal Engine projects
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2 " Compiler: Unreal Build
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3 " Maintainer: Ludovic Chabant <https://ludovic.chabant.com>
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 if exists("current_compiler")
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
6 finish
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7 endif
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8 let current_compiler = "ubuild"
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
9
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
10 let s:keepcpo = &cpo
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
11
2
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
12 let s:scriptname = get(g:, '__unreal_makeprg_script', 'Build')
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
13 let s:prgpath = shellescape(
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
14 \unreal#get_script_path("Engine/Build/BatchFiles/".s:scriptname))
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
15 let s:prgargs = map(
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
16 \copy(get(g:, '__unreal_makeprg_args', [])),
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
17 \{idx, val -> escape(val, ' \"')})
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
18 let s:prgcmdline = fnameescape(s:prgpath).'\ '.join(s:prgargs, '\ ')
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
19
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
20 call unreal#trace("Setting makeprg to: ".s:prgcmdline)
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
21
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
22 if !get(g:, 'unreal_debug_build', 0)
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
23 execute "CompilerSet makeprg=".s:prgcmdline
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
24 else
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
25 execute "CompilerSet makeprg=echo\\ ".shellescape(s:prgcmdline)
0
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
26 endif
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
27
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
28 CompilerSet errorformat&
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
29
2
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
30 " Set the MSBuild error format on Windows.
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
31 "if has('win32') || has('win64')
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
32 " execute "CompilerSet errorformat=".vimcrosoft#get_msbuild_errorformat()
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
33 " echom "Set errorformat from vimcrosoft!"
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
34 " echom &errorformat
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
35 "else
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
36 " echom "Not setting error format"
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
37 "endif
9235d8341a18 Refactor the build system invocation commands.
Ludovic Chabant <ludovic@chabant.com>
parents: 0
diff changeset
38
0
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
39 let &cpo = s:keepcpo
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
40 unlet s:keepcpo
ba03cac1b1c6 Initial commit.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
41