Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
242b7151
Unverified
Commit
242b7151
authored
May 25, 2020
by
Rémi Verschelde
Committed by
GitHub
May 25, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38996 from mbrlabs/android-plugin-fix
Perform a clean Gradle build if android plugins changed
parents
072646f5
abd66c1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
export.cpp
platform/android/export/export.cpp
+29
-0
godot_plugin_config.h
platform/android/plugin/godot_plugin_config.h
+16
-0
No files found.
platform/android/export/export.cpp
View file @
242b7151
...
...
@@ -254,6 +254,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
};
Vector
<
PluginConfig
>
plugins
;
String
last_plugin_names
;
uint64_t
last_custom_build_time
=
0
;
volatile
bool
plugins_changed
;
Mutex
plugins_lock
;
Vector
<
Device
>
devices
;
...
...
@@ -1831,6 +1833,29 @@ public:
return
list
;
}
inline
bool
is_clean_build_required
(
Vector
<
PluginConfig
>
enabled_plugins
)
{
String
plugin_names
=
get_plugins_names
(
enabled_plugins
);
bool
first_build
=
last_custom_build_time
==
0
;
bool
have_plugins_changed
=
false
;
if
(
!
first_build
)
{
have_plugins_changed
=
plugin_names
!=
last_plugin_names
;
if
(
!
have_plugins_changed
)
{
for
(
int
i
=
0
;
i
<
enabled_plugins
.
size
();
i
++
)
{
if
(
enabled_plugins
.
get
(
i
).
last_updated
>
last_custom_build_time
)
{
have_plugins_changed
=
true
;
break
;
}
}
}
}
last_custom_build_time
=
OS
::
get_singleton
()
->
get_unix_time
();
last_plugin_names
=
plugin_names
;
return
have_plugins_changed
||
first_build
;
}
virtual
Error
export_project
(
const
Ref
<
EditorExportPreset
>
&
p_preset
,
bool
p_debug
,
const
String
&
p_path
,
int
p_flags
=
0
)
{
ExportNotifier
notifier
(
*
this
,
p_preset
,
p_debug
,
p_path
,
p_flags
);
...
...
@@ -1877,8 +1902,12 @@ public:
String
local_plugins_binaries
=
get_plugins_binaries
(
BINARY_TYPE_LOCAL
,
enabled_plugins
);
String
remote_plugins_binaries
=
get_plugins_binaries
(
BINARY_TYPE_REMOTE
,
enabled_plugins
);
String
custom_maven_repos
=
get_plugins_custom_maven_repos
(
enabled_plugins
);
bool
clean_build_required
=
is_clean_build_required
(
enabled_plugins
);
List
<
String
>
cmdline
;
if
(
clean_build_required
)
{
cmdline
.
push_back
(
"clean"
);
}
cmdline
.
push_back
(
"build"
);
cmdline
.
push_back
(
"-Pexport_package_name="
+
package_name
);
// argument to specify the package name.
cmdline
.
push_back
(
"-Pplugins_local_binaries="
+
local_plugins_binaries
);
// argument to specify the list of plugins local dependencies.
...
...
platform/android/plugin/godot_plugin_config.h
View file @
242b7151
...
...
@@ -70,6 +70,8 @@ The `dependencies` section and fields are optional and defined as follow:
struct
PluginConfig
{
// Set to true when the config file is properly loaded.
bool
valid_config
=
false
;
// Unix timestamp of last change to this plugin.
uint64_t
last_updated
=
0
;
// Required config section
String
name
;
...
...
@@ -87,6 +89,7 @@ struct PluginConfig {
*/
static
const
PluginConfig
GODOT_PAYMENT
=
{
/*.valid_config =*/
true
,
/*.last_updated =*/
0
,
/*.name =*/
"GodotPayment"
,
/*.binary_type =*/
"local"
,
/*.binary =*/
"res://android/build/libs/plugins/GodotPayment.release.aar"
,
...
...
@@ -150,6 +153,18 @@ static inline bool is_plugin_config_valid(PluginConfig plugin_config) {
return
valid_name
&&
valid_binary
&&
valid_binary_type
&&
valid_local_dependencies
;
}
static
inline
uint64_t
get_plugin_modification_time
(
const
PluginConfig
&
plugin_config
,
const
String
&
config_path
)
{
uint64_t
last_updated
=
FileAccess
::
get_modified_time
(
config_path
);
last_updated
=
MAX
(
last_updated
,
FileAccess
::
get_modified_time
(
plugin_config
.
binary
));
for
(
int
i
=
0
;
i
<
plugin_config
.
local_dependencies
.
size
();
i
++
)
{
String
binary
=
plugin_config
.
local_dependencies
.
get
(
i
);
last_updated
=
MAX
(
last_updated
,
FileAccess
::
get_modified_time
(
binary
));
}
return
last_updated
;
}
static
inline
PluginConfig
load_plugin_config
(
Ref
<
ConfigFile
>
config_file
,
const
String
&
path
)
{
PluginConfig
plugin_config
=
{};
...
...
@@ -177,6 +192,7 @@ static inline PluginConfig load_plugin_config(Ref<ConfigFile> config_file, const
}
plugin_config
.
valid_config
=
is_plugin_config_valid
(
plugin_config
);
plugin_config
.
last_updated
=
get_plugin_modification_time
(
plugin_config
,
path
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment