Commit graph

757 commits

Author SHA1 Message Date
Rémi Verschelde
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde
07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Rémi Verschelde
69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde
e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Rémi Verschelde
03b13e0c69 Style: Add missing copyright headers 2020-05-10 13:12:16 +02:00
Rémi Verschelde
6038325470 clang-format: Add JavaImportGroups for Java code 2020-05-06 23:26:43 +02:00
Fredia Huya-Kouadio
ef62506e5c Address OS.request_permissions() bug when non-platform permission(s) is included 2020-05-05 10:33:46 +02:00
Rémi Verschelde
fdf58a5858 Rename InputFilter back to Input
It changed name as part of the DisplayServer and input refactoring
in #37317, with the rationale that input no longer goes through the
main loop, so the previous Input singleton now only does filtering.

But the gains in consistency are quite limited in the renaming, and
it breaks compatibility for all scripts and tutorials that access
the Input singleton via the scripting language. A temporary option
was suggested to keep the scripting singleton named `Input` even if
its type is `InputFilter`, but that adds inconsistency and breaks C#.

Fixes godotengine/godot-proposals#639.
Fixes #37319.
Fixes #37690.
2020-04-28 15:19:49 +02:00
Rémi Verschelde
e71b05d365
Merge pull request #37193 from madmiraal/fix-android-export-unicode-errors
Fix Android export throwing Unicode errors.
2020-04-28 14:27:56 +02:00
Fredia Huya-Kouadio
328354f878 Fix detection logic for the Android sdk path
The previous logic used the 'tools' directory within the Android sdk to validate it. That directory was recently deprecated and removed from the Android sdk folder (https://developer.android.com/studio/releases/sdk-tools)
2020-04-24 04:21:36 -07:00
Fredia Huya-Kouadio
2f38cfd9ab Fix Android templates size regression
The issue was caused by PR #36906 which changes prevented the generated shared libraries from being stripped.
Since the change is only needed for development (debugging) purposes, it's commented out by default.
2020-04-23 00:21:39 -07:00
fhuya
c591cb8fda Migrate legacy apache dependency to the GodotPayment plugin
This is the only location in the codebase where it's being used, so no need to make the main lib have a dependency on it.
2020-04-15 22:36:58 -07:00
Rémi Verschelde
ca896ddbf0 Android: Bump build tools to 29.0.3 2020-04-14 13:47:13 +02:00
fhuya
73d4e2eefb Delete unused drawable resources. 2020-04-13 16:15:37 -07:00
SkyJJ
7fcd13575e Validate supported architectures when exporting to Android 2020-04-13 12:16:08 +02:00
fhuya
948c3cbb88 Add signal support to Godot Android plugin:
Supports registering and emitting signal from a Godot Android plugin
2020-04-10 09:22:21 -07:00
Rémi Verschelde
35c8ec065c
Merge pull request #37256 from m4gr3d/add_custom_build_gradle_settings
Update Android custom template build configuration
2020-04-10 13:57:56 +02:00
PouleyKetchoupp
802bbe87ad Fix extra warnings in Android build 2020-04-10 11:06:11 +02:00
PouleyKetchoupp
e167af3737 Display Server support 2020-04-08 01:47:09 +02:00
fhuya
9c11076a20 Update Android custom template build configuration. 2020-04-07 09:07:44 -07:00
PouleyKetchoupp
af424b1c7c Vulkan rendering for Android 2020-04-03 11:18:59 +02:00
Rémi Verschelde
ba2ec53a26 Android: Downgrade gradle plugin to 3.5.3
With the NDK installed locally, gradle plugin 3.6.0 seems to enforce
a specific older NDK version, and will fail building if you don't have
it installed with:

```
No version of NDK matched the requested version 20.0.5594570.
Versions available locally: 21.0.6113669
```

Upstream issue: https://github.com/gradle/gradle/issues/12440
2020-04-02 23:16:54 +02:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde
cd4e46ee65 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.
2020-03-30 09:05:53 +02:00
Rémi Verschelde
60d486acc8 Fix copyright headers for recently added files 2020-03-28 13:29:29 +01:00
Juan Linietsky
a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Juan Linietsky
8e6960a69e Refactored input, goes all via windows now.
Also renamed Input to InputFilter because all it does is filter events.
2020-03-26 15:49:39 +01:00
Juan Linietsky
4396e98834 Refactored Input, create DisplayServer and DisplayServerX11 2020-03-26 15:49:32 +01:00
Rémi Verschelde
cbbe0743a9
Merge pull request #37219 from RajatGoswami/missing-include-guards
Adding missing include guards to header files identified by LGTM
2020-03-23 11:17:24 +01:00
Rajat Goswami
2ecf928ae3 Adding missing include guards to header files identified by LGTM.
This addresses the issue godotengine/godot#37143
2020-03-23 04:52:36 -04:00
Aaron Franke
7dbe8b65ae
Make file formatting comply with POSIX and Unix standards
UTF-8, LF, no BOM, and newlines at the end of files
2020-03-21 17:41:03 -04:00
Marcel Admiraal
e74f8aaaf1 Fix Android export throwing Unicode errors. 2020-03-20 17:23:40 +00:00
fhuya
d7b10beb1b Update the naming scheme for the GodotPlugin's methods in preparate of the vulkan integration. 2020-03-19 15:28:33 -07:00
unknown
90cdacd741 Removed unused code in android detect.py and SCsub 2020-03-18 18:12:50 +05:30
fhuya
99173c5fc4 Complete the implementation of the GodotPayment plugin.
Move the remaining plugin components within the plugin source code.
2020-03-17 17:43:09 -07:00
Rémi Verschelde
6c74f38f0b
Merge pull request #36906 from m4gr3d/enable_android_studio_debugging
Enable Android Studio debugging
2020-03-17 16:31:04 +01:00
Rémi Verschelde
b8577ecce1
Merge pull request #37106 from akien-mga/clang-format-cpp11
Style: Set clang-format Standard to Cpp11
2020-03-17 08:42:39 +01:00
Rémi Verschelde
cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
PouleyKetchoupp
c169367e83 Fix text_entered signal when max_length is used in LineEdit on Android
Fixes #35954
2020-03-13 17:04:40 +01:00
fhuya
7aa1c3e490 Fix initialization of the GodotPayment plugin
The `onGLRegisterPluginWithGodotNative()` method is supposed to be invoked only by `Godot`.
2020-03-09 10:32:23 +01:00
fhuya
41dadb2b2b Enable Android studio debugger. 2020-03-08 12:37:46 +01:00
fhuya
7dea2ad1de Trim the whitespace around the plugins names. 2020-03-06 17:22:04 -08:00
fhuya
f097defba1 Re-architecture of the Godot Android plugin. 2020-03-05 10:00:19 -08:00
fhuya
c090caa58b Provides a base implementation of the Vulkan surface view (VkSurfaceView.kt) and its accompanying components.
The implementation is meant to be extended and updated in order to integrate it with the existing Godot java and native codebase.
2020-03-05 08:01:42 -08:00
fhuya
b38283a6b7 Miscellaneous cleanup for the Android codebase:
- update gradle plugins versions
- add formatting rules for AndroidManifest and gradle build files
- cleanup java_godot_lib_jni

Note: logic was mostly moved around and no new logic/functionality was added.
2020-03-04 12:16:17 -08:00
Rémi Verschelde
080b5df625
Merge pull request #36682 from nekomatata/android-compilation-fix
Compilation fixes on Android
2020-03-04 16:22:16 +01:00
PouleyKetchoupp
ed0655cdfb Compilation fixes on Android 2020-03-04 13:15:37 +01:00
Pedro J. Estébanez
aee586553a Improve UX of drive letters
Namely, move the drive dropdown to just the left of the path text box and don't include the former
in the latter.

This improves the UX on Windows.

In the UNIX case, since its concept of drives is (ab)used to provide shortcuts to useful paths, its
dropdown is kept at the original location.
2020-03-03 10:38:34 +01:00