Commit graph

281 commits

Author SHA1 Message Date
David Sichma
85ff6e3e07
Fixed pre-commit-black file extensions
Now hook can find .py files.

(cherry picked from commit 3fe10c7e9d)
2021-11-18 22:23:59 +01:00
Rémi Verschelde
14c366ddd7
Bump version to 3.5-beta 2021-11-05 16:10:17 +01:00
Aaron Franke
69e90daae3
Rename "makerst.py" to "make_rst.py"
(cherry picked from commits 8f05e26198
and cce7797a75)
2021-10-26 13:34:36 +02:00
Rémi Verschelde
d09b33dab2
clang-format: Enable --Wno-error=unknown for compat with older versions
This prevents errors when encountering options which have been defined in newer
versions of clang-format, and are invalid in the YAML for the old version.

Bump minimum supported clang-format version to 12 (where `--Wno-error=unknown`
was added).

Use clang-format 12 on CI (13 is not available yet on the Ubuntu 20.04 images).

(cherry picked from commit 55d05565d0)
2021-10-25 11:16:13 +02:00
bruvzg
ea844046c3
[macOS] Add entitlements required by OIDN JIT for the editor build.
(cherry picked from commit 53cb556841)
2021-10-23 12:04:35 +02:00
Rémi Verschelde
093919196a
clang-format: Sync config with LLVM 13
Disable minimum amount of spaces in comment prefix for now, as it otherwise
modifies the whole codebase. That's something we probably want to use as it
matches our convention, but we should look into fully converting these
comments to our style guide at the same time.

(cherry picked from commit 63544c3a9d)
2021-10-23 12:03:51 +02:00
Fabio Alessandrelli
3a61d0990e [HTML5] Editor video driver option. Replace canvas on exit.
Default is "Auto", but can be forced to a specific WebGL version if the
automatic detection fails.

The game and editor canvas are now replaced with a new one in the exit
hooks. This helps the browser do some context cleanup, and allow us to
create a new context of a different type (WebGL/WebGL2).

Enable GLES3/WebGL2 in the Web Editor.
2021-10-19 15:52:02 +02:00
Hugo Locurcio
7c624b6b2b
Use a Big Sur-style macOS icon for the Godot editor
This provides a more coherent visual look with the rest of macOS.

Co-authored-by: Hazar <36481442+hazarek@users.noreply.github.com>
(cherry picked from commit 4589790348)
2021-10-04 14:33:46 +02:00
Hugo Locurcio
d1a4cb2bea
Print colored diffs when there are formatting failures in CI
This makes diffs more readable in CI logs.

(cherry picked from commit 38424714b1)
2021-09-14 13:41:26 +02:00
Rémi Verschelde
f0b37b1519
doc: Point URLs to 3.4 version of the online docs 2021-08-12 17:08:10 +02:00
Rémi Verschelde
91d29ddcfb
Add script to make source tarball with .git/HEAD
This allows to generate the `VERSION_HASH` constant with the Git commit hash
even when building from a source tarball which is not a Git repository (and
without dependency on Git itself).

(cherry picked from commit 9a71038e34)
2021-08-03 10:20:18 +02:00
Michael Alexsander
e74ee7294e
Properly tag project files as a subclass of plain text in the MIME info
(cherry picked from commit a47e48987d)
2021-08-03 09:15:33 +02:00
Michael Alexsander
e71640af2f
Make some small tweaks to the MIME info
(cherry picked from commit 0218616747)
2021-08-03 09:15:33 +02:00
Aaron Franke
7dc2edc430
[3.x] Allow reading shaders from .gdshader files 2021-07-19 23:34:23 -04:00
bruvzg
30393b6401
Add LSApplicationCategoryType to the template and export dialog.
(cherry picked from commit cb480376d8)
2021-06-17 12:47:55 +02:00
Hugo Locurcio
f80b15bebc
Allow clang-format 12 in the pre-commit hook
clang-format 12's formatting is identical to clang-format 11's.

(cherry picked from commit d74413ebd0)
2021-06-07 22:36:31 +02:00
Rémi Verschelde
80e1585a6e
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.

(cherry picked from commit c1c76850cb)
2021-06-07 12:06:59 +02:00
Ignacio Roldán Etchevery
c9047de455 C#+iOS: Fix simulator builds
Replaced obsolete preprocessor check for simulator/device in C code.
Architecture can no longer be used to determine this with Apple Silicon.
The new code uses `TARGET_OS_SIMULATOR` from `TargetConditionals.h`.

We have some mono libs which can only be used in devide builds.
We were adding them as static libs. Previously it was only causing
warnings because missing arch for the simulator, but now this
is treated as an error.

To fix this we turn them into xcframeworks with dummy static libs
for the simulator and the actual ones for devices.
2021-06-02 01:34:00 +02:00
bruvzg
683f96df35 Add separate simulator flag for iOS build, change main library to xcframework.
Build and export iOS Mono libs as `.xcframework`s, for Apple Silicon iOS simulator support.
2021-06-02 01:09:03 +02:00
Pedro J. Estébanez
0d7130f37c
Add iOS export option for device family
(cherry picked from commit 19ae8193ee)
2021-06-01 12:52:19 +02:00
Pedro J. Estébanez
857fd831c1
Set schemes' build config to debug/release in iOS Xcode export
(cherry picked from commit 1534b4e65e)
2021-06-01 12:52:19 +02:00
Rémi Verschelde
379ecd532a
Dist: Add macOS entitlements files for editor code signing
These are the entitlements we define for official macOS editor builds since
Godot 3.3.

Users making custom builds of the engine can use those files with `codesign` to
sign their own builds. E.g.:
```
codesign --force --timestamp \
  --options=runtime --entitlements editor.entitlements \
  -s <your key> -v osx_template.app
```

(cherry picked from commit 6999e332e4)
2021-05-21 13:41:27 +02:00
Rémi Verschelde
eb78f80f03
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:56:56 +02:00
Hugo Locurcio
fcfce4be67
Fix Ubuntu clang-format version detection in the pre-commit hook
(cherry picked from commit 61aa09097f)
2021-05-11 10:44:24 +02:00
Fabio Alessandrelli
73f19ec2da
[HTML5] Remove "fixed-size.html".
No longer used in 3.3+.

(cherry picked from commit 3faf8d6e40)
2021-05-09 17:14:36 +02:00
Fabio Alessandrelli
9446be7dad [HTML5] Export as Progressive Web App.
Adds possibility to export as a progressive web app.
Allows customizing base icons, display mode, orientation and offline
page.
2021-04-27 15:09:03 +02:00
Fabio Alessandrelli
a7f2b723d6 [HTML5] Optional icon generation, use export name for it.
We used to only generate the favicon if it was specified in the user
project settings, now it's optional, will export it to `NAME.icon.png`,
(falling back to the default project icon if none is set in project
settings), and the `<link>` tag is added using the `$HEAD_INCLUDE`
instead of being hardcoded in the template.
2021-04-27 15:09:03 +02:00
Rémi Verschelde
8851fa7808
OSX: Clarify min version requirement (10.12) in Info.plist
The min requirement was upped by #45618 to have proper support for C++14.

Related to #48222.
2021-04-27 09:54:27 +02:00
Rémi Verschelde
5e74554c9a
Bump version to 3.4-beta
Feature work in 3.x likely won't have a big impact on stability so we can skip
the dev/alpha phases and we'll start directly with a 3.4 beta 1 build once
significant changes have been implemented.
2021-04-22 15:27:35 +02:00
Hugo Locurcio
1304b85c63
Add a welcome dialog to the HTML5 editor
This modal dialog displayed when the page is loaded. It can be
dismissed permanently by clicking the "OK, don't show again" button.
Clicking outside the modal will only dismiss it once.

This dialog is used to remind people that the HTML5 editor is still in
release candidate stage and isn't considered production-ready yet.

(cherry picked from commit 8b08146894)
2021-04-20 20:12:52 +02:00
Rémi Verschelde
1d20bba0c4
HTML5: Fix link to documentation on editor template 2021-03-30 11:47:43 +02:00
Hugo Locurcio
4126d27468
Add Open Graph metadata to the HTML5 editor
- Consistently use double quotes in the HTML markup.
- Define English language to assist screen readers and search engines.
- Add missing `alt` text for the logo image.
- Remove duplicate `id` for the preload project ZIP input.

(cherry picked from commit 197d391f08)
2021-03-26 13:47:53 +01:00
Rémi Verschelde
015973df04
doc: Make all tutorial links point to 3.3 branch of docs 2021-03-26 10:43:43 +01:00
Fabio Alessandrelli
193233e893
[HTML5] Clarify editor PWA manifest.json
Update name and description to clarify it's the web version.

(cherry picked from commit ecb792b1da)
2021-03-24 11:53:08 +01:00
Fabio Alessandrelli
3ed72c3ef4
[HTML5] Fix bogus Web Editor manifest.
The `start_url` in the PWA manifest.json must be relative for it to
work in subfolders (like in the official Web Editor page).

(cherry picked from commit 85c1a41021)
2021-03-17 17:08:23 +01:00
Rémi Verschelde
0341251d0f
Bump version to 3.3-rc
We decided to rename the upcoming 3.2.4 release to 3.3 to better reflect that
it is a significant feature release, and not a maintenance update.

The `3.2` branch was also renamed to `3.x` and will now be the development
branch for future 3.x releases (3.3, 3.4, etc.).
2021-03-16 12:16:36 +01:00
Rémi Verschelde
c7c7a0b822
clang-format: Fix version number in hook warning
(cherry picked from commit f4d46f6290)
2021-03-14 12:03:21 +01:00
Fabio Alessandrelli
64feaed39b [HTML5] Drag and drop zip in project manager.
With a very nice hack, a new hidden configuration option that delays
dropped files removal at exit.

This still leaks while the project manager is running, but will clear
memory as soon as it exits or load something.
(reminder, dropped files are reguarly removed after the signal is
emitted specifically to avoid leaks, but I prefer hacking the HTML5
config then the project manager).

(cherry picked from commit f1e810adcb)
2021-03-12 10:43:52 +01:00
Fabio Alessandrelli
d942d553ef [HTML5] Add PWA support to the editor page.
This allows to install it as an app, and provide offline support (after
the first run).
Practically, this boils down to adding a JSON file as a manifest, an
offline page to be displayed when the cached files are not avaialble,
and a JS file to cache resources and return them.

The reason for the "first run requirements" is that some browsers, will
emit an "install" by just visiting the page (to see if the JS code is
compatibile), and we do not want to force casual visitors to just
download the 10 MiB+ compressed editor WebAssembly file without pressing
the start button.

Special thanks to Hugo Locurcio (Calinou) for the initial work.
2021-03-08 17:06:41 +01:00
Fabio Alessandrelli
e3664e971b [HTML5] Make editor HTML build tag scons4-proof.
We used to have it like `$GODOT_VERSION` which caused inconsistencies
between different scons versions when substituting it.
It's now `@GODOT_VERSION@`, which is safe on both scons3 and scons4.

(cherry picked from commit 4404eb57e4)
2021-02-26 15:22:51 +01:00
Hugo Locurcio
3b4dd88e56 Improve the editor HTML template
- Darken the header tab background to match the default editor
  background color.
- Hide the distracting focus outlines for the editor and game canvas.
- Use a pure black background for the game canvas to better distinguish it
  from the editor and provide a more neutral background.
- Use a bold font weight for the Start Godot editor button on the
  loader page.
- Link to the web editor documentation on the loader page.
- Clarify what happens when clicking "OK" in the persistent data removal
  warning dialog.
- Tidy up the HTML template by removing obsolete attributes.

(cherry picked from commit 3527756943)
2021-02-25 22:37:49 +01:00
Riteo Siuga
6d7b25b98a Improve the MIME source file
- Add MIME definitions for resources, scenes and scripts
- Remove the "weight" property, which defaults to 50, a much saner value than the previous 100, which was a bit excessive.
- Changes their icon names in order to follow the XDG icon naming conventions.

(cherry picked from commit 876e165a49)
2021-02-25 15:14:32 +01:00
Marcel Admiraal
95272e11c4 Remove unused variables from full-size.html
(cherry picked from commit 548edfc4fe)
2021-02-22 10:18:26 +01:00
Fabio Alessandrelli
45a67fab35 [HTML5] Better fullscreen, canvas resizing.
Three canvas resize policies:
- `None`: Godot window settings are ignored.
- `Project`: Godot handles the canvas like a native app (resizing it
  when setting the window size).
- `Adaptive`: Canvas size will always adapt to browser window size.

Use `None` if you want to control the canvas size with custom JavaScript
code.
2021-02-19 05:13:44 +01:00
Fabio Alessandrelli
1eef8a318b [HTML5] Easier HTML templates, better deinit/cleanup. 2021-02-19 05:13:44 +01:00
Rémi Verschelde
ad7710ae5e
Dynamically load libudev.so.1 on Linux if udev=yes
This makes it possibly to run Linux binaries compiled with udev support on
Linux systems which do not provide udev (typically systemd-less distros).

If udev is missing, we fall back to parsing `/dev/input` like when compiled
without udev support (`udev=no`).

Also adding some verbose debug statements to know which method we're using
when debugging Linux joypad issues.

The libudev so wrappers were generated on Mageia 8 with libudev 246.9 using
https://github.com/hpvb/dynload-wrapper:
```
./generate-wrapper.py --include /usr/include/libudev.h --sys-include '<libudev.h>' \
  --soname libudev.so.1 --init-name libudev --omit-prefix gnu_ \
  --output-header libudev-so_wrap.h --output-implementation libudev-so_wrap.c
```

(cherry picked from commits a10c259c1d
and e26a1f807b)

Edit: Updated to version 0.2 of dynload-wrapper to fix symbols clobbering as
done in #46143.
2021-02-18 10:31:31 +01:00
Hein-Pieter van Braam-Stewart
228803e9db Dynamically load libpulse.so.0 and libasound.so.1 on Linux
By generating stubs using https://github.com/hpvb/dynload-wrapper we
can dynamically load libpulse and libasound on systems where it is available.
Both are still a build-time requirement but no longer a run-time dependency.

For maintenance purposes the wrappers should not need to be re-generated
unless we want to bump pulse or asound to an incompatible version. It is
unlikely we will want to do this any time soon.

cherry-pick from 09f82fa6ea
2021-02-17 10:31:52 +01:00
Danil Alexeev
1fa8595bff
Change logo in the About dialog box (return Godot's teeth)
(cherry picked from commit c553ca54d5)

And fixup previous bogus cherry-pick that included merge conflicts.
2021-02-16 14:27:39 +01:00
Fabio Alessandrelli
5abe08f484
[HTML5] Editor: ensure canvas focus when switching tabs.
(cherry picked from commit b148ea2a64)
2021-02-11 13:17:08 +01:00
Fabio Alessandrelli
cd2a996d9e
[HTML5] Fix web editor "clear persistent data".
Was broken after update to new persistent path "/home/web_user".

(cherry picked from commit 7866cd5881)
2021-02-11 13:12:06 +01:00
Fabio Alessandrelli
2668ca7a8c [HTML5] Make home path persistent in editor.
We used to only persist specific sub-folder of /home/web_user/ when
running the Web Editor. This resulted in bad UX about default project
creation path etc.
This PR makes the whole folder persistent, move the zip preloading to a
different folder (to avoid persisting it), and automatically prompt the
user to import it if present.
2021-02-03 17:18:28 +01:00
Rémi Verschelde
c2ea80348c
Revert "[3.2] Add separate simulator flag for iOS build, change main library to xcframework." 2021-01-27 21:53:16 +01:00
Hugo Locurcio
3a3e796485
Check for clang-format version in the pre-commit hook
Different clang-format versions may result in different formatting.
Therefore, it's recommended to use the same version as used in CI.

(cherry picked from commit 3333b58a7f)
2021-01-26 17:00:17 +01:00
Rémi Verschelde
9f2c24e8ce
Cleanup: Remove executable bit from files which don't need it
Drop unused xpmfix.sh script.

(cherry picked from commit 76c6007aa6)
2021-01-26 17:00:15 +01:00
bruvzg
389a4bfa59
[3.2] Add separate simulator flag for iOS build, change main library to xcframework format. 2021-01-26 16:00:26 +02:00
Fabio Alessandrelli
276b831c45 [HTML5] Better editor HTML, small refactor.
Side and GDNative libraries are now added by engine.js , the dynlink pre
js had been deleted.
2021-01-25 20:16:44 +01:00
Sergey Minakov
d5047603a3 iOS Export: export modification to support plugins
Added plugin configuration.
Export options now use plugins that could be enabled/disabled.
Plugin changes are observed at runtime.
2021-01-14 15:38:05 +03:00
Sergey Minakov
614f701373 iOS Modules: separate main platform code from modules
Moved previously builtin modules 'GameCenter', 'AppStore', 'iCloud' to separate modules to be represented as plugin.
Modified 'ARKit' and 'Camera' to not be builtin into engine and work as plugin.
Changed platform code so it's not affected by the move.
Modified Xcode project file to remove parameters that doesn't make any effect.
Added basic '.gdip' plugin config file.
2021-01-14 15:30:00 +03:00
Hugo Locurcio
49c2f2fec2
Make links on the HTML5 editor more readable
This also tweaks the focus style to apply to all elements for
better keyboard navigation.

(cherry picked from commit 663466b882)
2021-01-13 16:17:08 +01:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Hugo Locurcio
3db7ff3d82
Fix and decrease Godot logo size in the HTML5 editor loader
The logo can no longer overflow the viewport.

(cherry picked from commit d80224934e)
2020-12-29 16:02:02 +01:00
Lorenzo Cerqua
70af74587a
Remove two very slightly displaced duplicate vertices on Gobot's face
They didn't show up at all in the rendered PNG, but were pretty annoying when working with Gobot face on Inkscape

(cherry picked from commit 17b9cb2cdf)
2020-12-29 13:54:08 +01:00
Fabio Alessandrelli
6936ac9d5d [HTML5] Add logo and favicon to editor html. 2020-12-09 18:09:30 +01:00
Hugo Locurcio
295b16dcf2 [HTML5] Improve the editor HTML template. 2020-12-09 15:35:17 +01:00
Fabio Alessandrelli
b4b1df613e [HTML5] Editor also persists cache. 2020-12-09 13:47:23 +01:00
Fabio Alessandrelli
4ad95cc039 [HTML5] EditorRunNative works with GDNative.
This "breaks" our loading bar logic (libraries are not counted).
Fixing it is non trivial and probably deserves investigating a different
strategy.
2020-12-05 01:00:29 +01:00
Marcel Admiraal
e1b72e1943
Add missing javascript semi-colons.
(cherry picked from commit f42284ed07)
2020-11-17 22:25:32 +01:00
Hugo Locurcio
312d4aa390
Add files to create a Windows editor installer using Inno Setup
This partially addresses
https://github.com/godotengine/godot-proposals/issues/1432.

To fully address the proposal above, official Windows installers will
have to be compiled and distributed.

(cherry picked from commit 8baa303d15)
2020-11-17 12:01:59 +01:00
Rémi Verschelde
2d821cab2b
CI: Refactor Android workflow, use pre-installed SDK and NDK
No need to waste time downloading all this when it's readily available :)
Also use the official action to setup Java 8.

Also build both architectures (armv7 and arm64v8) and generate the APK,
so we can upload it.

Remove now unused and outdated `misc/ci/android-tools-linux.sh`.

(cherry picked from commit 5f19e1d571)
2020-10-23 13:27:44 +02:00
Fabio Alessandrelli
294e9752bd Add JavaScript editor html file. 2020-10-14 11:20:20 +02:00
Rémi Verschelde
7ef6aa7342
Merge pull request #42266 from Faless/js/3.0_sync_fs_size_handlers
[3.2] [HTML5] Synchronous main, better persistence, handlers fixes, optional full screen.
2020-10-02 16:23:35 +02:00
Sergey Minakov
3386fac02c iOS: fix deprecations
Change deprecated method calls to new ones.
Guard iOS version dependant functionality behind availability checks.
2020-10-01 18:09:55 +03:00
Rémi Verschelde
0c3e0ab194
Merge pull request #40994 from qarmin/sanitization32
[3.2] Added Linux sanitizer with xvfb to github workspace
2020-10-01 13:56:09 +02:00
Fabio Alessandrelli
e7d00d08f5 Make canvas resize optional in HTML5. 2020-09-19 18:27:21 +02:00
Fabio Alessandrelli
40f73f74ce Better HiDPI support in HTML5. 2020-09-19 18:27:21 +02:00
Rémi Verschelde
2d52da7b8f
Bump version to 3.2.4-beta 2020-09-18 08:28:18 +02:00
Hazar
a430f68364
fix GDScript UTI
changed from public.data to public.script

(cherry picked from commit 5e5100afca)
2020-08-21 02:28:18 +02:00
Rafał Mikrut
abd7c1833e Added Linux sanitizer with xvfb to github workspace 2020-08-14 12:15:58 +02:00
Gordon MacPherson
5db6095bde update to use scons compile db tool
(cherry picked from commit 974a4cde9d)
2020-08-14 00:32:05 +02:00
Hugo Locurcio
c2d7d81ac8 Fix inconsistent indentation in the FreeDesktop MIME type XML
(cherry picked from commit 4dc6efc08e)
2020-08-14 00:32:04 +02:00
Aaron Franke
40d118ce4a Fix incorrect comments in file formatting script
(cherry picked from commit 05a418f9e6)
2020-07-28 11:27:27 +02:00
Rémi Verschelde
4b9bb50176 Style: Fix code format scripts compat with non-GNU Unices
It's too hard to get compatibility between GNU and BSD sed,
so let's just use perl oneliners.

And improve it to also remove trailing tabs, not just spaces.

(cherry picked from commit c71e189efd)
2020-07-28 00:41:52 +02:00
Rémi Verschelde
b40f3f9740 Style: Sync other changes from new fix_style.sh and clang_format.sh 2020-07-24 10:39:18 +02:00
Rémi Verschelde
eda03831d6 Style: Add missing newlines to SVGs 2020-07-24 10:39:18 +02:00
Rémi Verschelde
4567eee79e CI: Backport GitHub Actions setup from master
Removes AppVeyor and all Travis jobs but the iOS one, which hasn't been ported
to GitHub Actions yet (should be done soon).

Backports new style scripts from `master` branch too to do the same checks.
2020-07-24 10:39:17 +02:00
Sergey Minakov
46c6383c8d iOS Export: add option to use storyboard for launch screen 2020-07-07 00:01:35 +03:00
Sergey Minakov
e2a45fe840 iOS Export: Updated Info.plist. Framework embedding. Fixes for search paths 2020-07-02 12:46:57 +03:00
bruvzg
43888ebfaf
[macOS, 3.2] Add support for the Apple Silicon (ARM64) build target. 2020-06-29 14:43:29 +03:00
Rémi Verschelde
11bb4ef4c3 Bump version to 3.2.3-beta 2020-06-26 20:48:27 +02:00
Sergey Minakov
e564ca0c1b Export: Fix iOS enabling push notifications capability 2020-06-22 23:16:22 +03:00
Sergey Minakov
bc6a75786c Export: Remove system frameworks from xcode template 2020-06-22 23:16:22 +03:00
bruvzg
f99ead735c Git Hooks: Suppress "which" error messages.
(cherry picked from commit 05f041127d)
2020-06-10 15:33:27 +02:00
bruvzg
320ae61090 Git Hooks: Add support for GUI git clients.
[ci skip]

(cherry picked from commit fdad0e3bd1)
2020-06-10 15:33:23 +02:00
PouleyKetchoupp
ff11fdd017 Pre-commit hook instructions on Windows
(cherry picked from commit 7b6e664178)
2020-06-10 15:32:18 +02:00
Rémi Verschelde
efdeba3326 Travis: Add static check for Python black formatting
Also install and use pygmentize to visualize clang-format and black
diffs.

(cherry picked from commit 3644036fd3)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
243377ffac Hooks: Use pygmentize if available to visualize diff
(cherry picked from commit 4d52761da6)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
1ec7a73d1c Hooks: Add pre-commit hook for psf/black formatting
(cherry picked from commit 164826a39b)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
dcb68e0106 SCons: Improve registration of compilation_db tool, check version
There's a builtin `toolpath` option we can use for that, so no need to hack
around a custom `scons_site` path.

The script requires SCons 3.1.1 or later, so we enable it conditionally.

Follow-up to #32848.

(cherry picked from commit 22c718ab17)
2020-05-18 16:40:33 +02:00
RevoluPowered
9aa4648579 Added compilation database support for clang and gcc
This tool is originally from mongodb.

- Updated CPPSUFFIXES to use scons suffixes
- objective-c files will also be loaded into the compilation database where the compiler / tooling is available to compile the files.

Known limitations:

- This will not work with msvc as your compiler.

(cherry picked from commit 5a6f275b74)
2020-05-18 16:40:33 +02:00