Commit graph

50 commits

Author SHA1 Message Date
Rémi Verschelde
1e61fb1e37 i18n: Sync editor translations with Weblate 2022-04-25 17:14:49 +02:00
bruvzg
fd2fba7c2c
Add binary MO translation file support. Add brotli decoder and WOFF2 support.
Use smaller .mo files instead of .po, if gettext is available.
Convert editor fonts to .woff2 format.
2022-03-25 19:51:39 +02:00
Rémi Verschelde
751769ed45 i18n: Sync editor translations with Weblate 2022-03-09 10:33:03 +01:00
Rémi Verschelde
0b694eb8e7
i18n: Sync classref translations with Weblate
German (de) is now above the threshold for inclusion.
2021-11-03 15:00:52 +01:00
Rémi Verschelde
74bcf37f90
i18n: Sync editor translations with Weblate
Latvian (lv) is now above the threshold for inclusion.
2021-11-03 14:56:44 +01:00
Rémi Verschelde
8425c58991
i18n: Only include editor translations above a threshold
This reduces the size of the editor binaries significantly, as we otherwise
embed all WIP translations, including ones with very low completion ratios,
and end up paying for the size of all `msgid`s for each locale.

Cf. https://github.com/godotengine/godot-proposals/issues/3421 for details.

The thresholds used are:
- 30% for the editor interface (should already include most common strings
  while more obscure ones like UndoRedo action names might be untranslated).
- 10% for the class reference: this is a HUGE resource and 10% is already
  a lot of useful content, especially if focused on the most used APIs.

For 3.x, we also exclude languages that require complex text layout support
to be displayed properly.

This currently reduces the size of the editor binary by 17% on Linux.

The list will be synced manually every now and then.
2021-10-20 14:39:21 +02:00
Rémi Verschelde
a5093d64ac
SCons: List .gen.cpp sources explicitly to avoid globbing errors
Whenever we change the name (or remove) generated cpp files with the `.gen.cpp`
extension, users run into build issues when switching between branches (i.e.
switching before and after the name change/removal). This is because we glob
`*.cpp` so if a now-obsolete file from a previous build is present, we'll
include it too, potentially leading to bugs or compilation failure (due to
missing headers or invalid code).

So globbing patterns in `add_source_files` will now skip files ending with
`.gen.cpp`, which should instead be passed explicitly where they're used.

(cherry picked from commit c133480531)
2021-10-16 10:59:14 +02:00
Rémi Verschelde
9729432ec0
i18n: Add support for translating the class reference
- Parse `.po` files from `doc/translations/*.po` like already done
  with `editor/translations/*.po`.
- Add logic to register a doc translation mapping in `TranslationServer`
  and `EditorSettings`.
- Add `DTR()` to lookup the doc translation mapping (similar to `TTR()`).
  Strings are automatically dedented and stripped of whitespace to ensure
  that they would match the translation catalog.
- Use `DTR()` to translate relevant strings in `EditorHelp`,
  `EditorInspector`, `CreateDialog`, `ConnectionsDialog`.
- Small simplification to `TranslationLoaderPO`, the path argument was
  not really meaningful.

(cherry picked from commit 4857648a16)
2021-10-07 12:48:23 +02:00
ne0fhyk
0cfbe354d7 Refactor Android platform export structure. 2021-09-09 10:48:29 -07: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
Andrii Doroshenko (Xrayez)
133997654c Add custom_modules build option to compile external user modules
This patch adds ability to include external, user-defined C++ modules
to be compiled as part of Godot via `custom_modules` build option
which can be passed to `scons`.

```
scons platform=x11 tools=yes custom_modules="../project/modules"
```

Features:

- detects all available modules under `custom_modules` directory the
same way as it does for built-in modules (not recursive);
- works with both relative and absolute paths on the filesystem;
- multiple search paths can be specified as a comma-separated list.

Module custom documentation and editor icons collection and generation
process is adapted to work with absolute paths needed by such modules.
Also fixed doctool bug mixing absolute and relative paths respectively.

Implementation details:

- `env.module_list` is a dictionary now, which holds both module name as
  key and either a relative or absolute path to a module as a value.
- `methods.detect_modules` is run twice: once for built-in modules, and
  second for external modules, all combined later.
- `methods.detect_modules` was not doing what it says on the tin. It is
  split into `detect_modules` which collects a list of available modules
  and `write_modules` which generates `register_types` sources for each.
- whether a module is built-in or external is distinguished by relative
  or absolute paths respectively. `custom_modules` scons converter
  ensures that the path is absolute even if relative path is supplied,
  including expanding user paths and symbolic links.
- treats the parent directory as if it was Godot's base directory, so
  that there's no need to change include paths in cases where custom
  modules are included as dependencies in other modules.

(cherry picked from commit a96f0e98d7)
2020-05-25 17:08:38 +03:00
Rémi Verschelde
66d09a6b4c SCons: Fix uses of [].append instead of env.add_source_files()
Also added support for SCons project-absolute paths (starting with #) and
warning about duplicates in add_source_files(), and fixed
default_controller_mappings.gen.cpp being included twice after first build
due to *.cpp globbing.

Part of #30270.
2019-07-22 15:08:32 +02:00
Andrii Doroshenko (Xrayez)
9bf48db891 Build Clipper with tools=no and patch it to auto-disable exceptions
Reverts "Build polygon clipper only in tools builds" (see #17319)
which allows to build Clipper with tools disabled (release) and because
of that, Clipper has to be patched to optionally disable exceptions in
order to be built on some platforms.

Patched Clipper 6.4.2 to be compiled with exceptions enabled/disabled.
and ensure that Clipper-specific exception macros are defined: don't use
exceptions by default unless exception handling is detected.

Compilation with exceptions will be determined by various
C++ exceptions defines:

* ` __cpp_exceptions` is part of C++ feature testing macros (since C++98);
* `__EXCEPTIONS` is used by some GNU compilers;
* `_CPPUNWIND` is used by MSVC.

The user can override specific exceptions behavior via corresponding
`*_USER` macros (i.e. compiling for embedded systems).
2019-05-22 13:12:21 +03:00
Rémi Verschelde
6bfb7944d9 SCons: Remove avoidable defines from main env's CPPPATH
Also finally move freetype to its own env and disable warnings for it.
Still needs some work to fix the awkward situation of the freetype and
svg modules used in scene/ and editor/ respectively.
2018-10-01 11:59:22 +02:00
Rémi Verschelde
3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Fabio Alessandrelli
d2b38aabec Bundle SSL certs with the templates.
If this is undesired it can be avoided by specifying builtin_certs=no .
Bundled SSL certs will be used unless you specify an override in:
Project Settings -> SSL -> Certificates .
2018-09-15 10:54:00 +02:00
Ibrahn Sahir
02693b9af6 Removed some unneeded generated headers from the editor directory SCsub.
These headers are currently built in (and included from) the core directory.
Removing the editor directory versions to avoid confusion.
2018-09-01 13:00:04 +01:00
Bernhard M. Wiedemann
83b856c046 BuildSystem: Sort input file lists
so that godot package builds reproducibly
in spite of indeterministic filesystem readdir order
and http://bugs.python.org/issue30461

See https://reproducible-builds.org/ for why this is good.

Sort font input file list, so that builtin_fonts.gen.h
is created in a reproducible way

Sort list of platforms, so that editor/register_exporters.gen.cpp
is created in a reproducible way

Sort list of source files, so that .a files and resulting godot binaries
are created in a reproducible way
2018-08-29 10:24:07 +02:00
Bernhard M. Wiedemann
f312582326 BuildSystem: Fix font list
We want to add the individual strings to the list
and not add a list object to the list.

Without this patch, sorting failed because "str < list"
is not a valid operation in python.
2018-08-29 10:24:07 +02:00
Viktor Ferenczi
c5bd0c37ce Running builder (content generator) functions in subprocesses on Windows
- Refactored all builder (make_*) functions into separate Python modules along to the build tree
- Introduced utility function to wrap all invocations on Windows, but does not change it elsewhere
- Introduced stub to use the builders module as a stand alone script and invoke a selected function

There is a problem with file handles related to writing generated content (*.gen.h and *.gen.cpp)
on Windows, which randomly causes a SHARING VIOLATION error to the compiler resulting in flaky
builds. Running all such content generators in a new subprocess instead of directly inside the
build script works around the issue.

Yes, I tried the multiprocessing module. It did not work due to conflict with SCons on cPickle.
Suggested workaround did not fully work either.

Using the run_in_subprocess wrapper on osx and x11 platforms as well for consistency. In case of
running a cross-compilation on Windows they would still be used, but likely it will not happen
in practice. What counts is that the build itself is running on which platform, not the target
platform.

Some generated files are written directly in an SConstruct or SCsub file, before the parallel build starts. They don't need to be written in a subprocess, apparently, so I left them as is.
2018-07-27 21:37:55 +02:00
Rhody Lugo
920224a535 add NoCache wrapper to Command 2018-06-21 03:00:33 -04:00
Ibrahn Sahir
1433c2cbbb GDScript access to copyright, license, author and donor information.
Adds following functions to the Engine singleton:
get_author_info - names of Godot authors
get_copyright_info - detailed source copyright get_license_info
get_donor_info - donor names
get_license_info - full text of licenses used, indexed by license names
get_license_text - the text of the Godot Expat license
2018-05-19 00:40:16 +01:00
Rémi Verschelde
4287c7822b
Merge pull request #17440 from viktor-ferenczi/issue-5042
Properly closing all files in Python build code
2018-03-13 11:49:58 +01:00
Viktor Ferenczi
272ecddb28 Properly closing all files in Python code 2018-03-11 14:55:50 +01:00
Leon Krause
fa760082f5 Build polygon clipper only in tools builds 2018-03-06 21:53:37 +01:00
Rhody Lugo
a65c0939fd disable caching for targets using helper functions 2017-11-28 23:24:12 -04:00
Rhody Lugo
a4a222d62d use the same cache for all branches for appveyor 2017-11-28 03:23:33 -04:00
Zher Huei Lee
fbcb2edeeb Added modules' doc files to make_doc_header
They were somehow never included. This fixes that.
2017-11-17 01:57:28 +08:00
Rémi Verschelde
ed2b66f023 Improve code style of generated headers 2017-11-15 21:29:34 +01:00
mhilbrunner
487afde3bb Ignore files not ending with '.xml' when building doc header 2017-11-07 22:57:17 +01:00
Rémi Verschelde
6361e24f29 Cleanup unnecessary debug prints 2017-10-21 20:41:07 +02:00
Marius Guggenmos
1d380bf03d fixed double escape for quotes in editor/SCsub 2017-10-07 21:15:35 +02:00
Matthias Hoelzl
727a381fc9 Fix Python 3 build
- Take care of the differences in handling unicode characters in
  `escape_string` (formerly in `editor/SCsub`, now in `compat.py)`.
- Conditionally include `_winreg` or `winreg` in the Mono editor
  module.
2017-10-04 23:21:32 +02:00
Andreas Haas
de9cc6ed96 Merge pull request #11592 from SaracenOne/header_generator_fix
Python header generator now generates strings with escape characters.
2017-10-02 23:31:40 +02:00
Saracen
07ccfa6a07 Python header generator now generates strings with escape characters. 2017-09-26 00:48:17 +01:00
Elliott Sales de Andrade
ffab67b8da Use BoolVariable in target/component/advanced options. 2017-09-25 14:36:02 -04:00
Matthias Hoelzl
f3745a23be Fix errors in Python 3 build 2017-09-16 04:18:14 +02:00
Juan Linietsky
4f929a0fdf Changed the doc class generation to individual files per class. It is also possible to save module files in module directories and the build system will
recognize them.
2017-09-12 17:45:41 -03:00
Poommetee Ketson
345dfd4504 EditorAbout: add donors tab 2017-09-04 00:39:57 +07:00
Matthias Hoelzl
b6e1e47e3a Make build scripts Python3 compatible
- The Windows, UWP, Android (on Windows) and Linux builds are
  tested with Scons 3.0 alpha using Python 3.
- OSX and iOS should hopefully work but are not tested since
  I don't have a Mac.
- Builds using SCons 2.5 and Python 2 should not be impacted.
2017-08-27 23:05:39 +02:00
Matthias Hoelzl
a919a013f5 Fix mixed tab/whitespace in build files 2017-08-27 23:05:39 +02:00
Rémi Verschelde
7ad14e7a3e Dead code tells no tales 2017-08-27 22:13:45 +02:00
Rémi Verschelde
21e53c4267 Buildsystem: Reduce verbosity of font and translation generation 2017-08-27 13:45:56 +02:00
Poommetee Ketson
e4dc52ba81 Fix Zlib license not extracted 2017-07-18 08:02:56 +07:00
Poommetee Ketson
da2de8932c About: add thirdparty license info 2017-07-06 14:42:47 +07:00
Poommetee Ketson
272cfdc0c8 About: Add License info 2017-07-04 22:07:43 +07:00
Poommetee Ketson
21f6cc75a1 Authors/About: support for multiple sections 2017-07-03 09:40:56 +07:00
Poommetee Ketson
e3998528e0 BuildSystem: generated files have .gen.extension 2017-06-25 07:55:01 +07:00
Poommetee Ketson
db439308e6 About: add contributors list 2017-06-01 18:15:15 +07:00
Rémi Verschelde
49c065d29c Refactoring: rename tools/editor/ to editor/
The other subfolders of tools/ had already been moved to either
editor/, misc/ or thirdparty/, so the hiding the editor code that
deep was no longer meaningful.
2017-03-05 14:21:25 +01:00
Renamed from tools/editor/SCsub (Browse further)