Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Günther Wagner
gnome-builder
Commits
c1b88bea
Commit
c1b88bea
authored
Mar 21, 2018
by
Christian Hergert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: port to IdeTask
parent
2f71cf55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
65 deletions
+65
-65
src/plugins/cmake/gbp-cmake-build-system.c
src/plugins/cmake/gbp-cmake-build-system.c
+65
-65
No files found.
src/plugins/cmake/gbp-cmake-build-system.c
View file @
c1b88bea
...
...
@@ -99,17 +99,17 @@ gbp_cmake_build_system_ensure_config_cb (GObject *object,
gpointer
user_data
)
{
IdeBuildManager
*
build_manager
=
(
IdeBuildManager
*
)
object
;
g_autoptr
(
G
Task
)
task
=
user_data
;
g_autoptr
(
Ide
Task
)
task
=
user_data
;
g_autoptr
(
GError
)
error
=
NULL
;
g_assert
(
IDE_IS_BUILD_MANAGER
(
build_manager
));
g_assert
(
G_IS_ASYNC_RESULT
(
result
));
g_assert
(
G
_IS_TASK
(
task
));
g_assert
(
IDE
_IS_TASK
(
task
));
if
(
!
ide_build_manager_execute_finish
(
build_manager
,
result
,
&
error
))
g
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
ide
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
else
g
_task_return_boolean
(
task
,
TRUE
);
ide
_task_return_boolean
(
task
,
TRUE
);
}
static
void
...
...
@@ -118,16 +118,16 @@ gbp_cmake_build_system_ensure_config_async (GbpCMakeBuildSystem *self,
GAsyncReadyCallback
callback
,
gpointer
user_data
)
{
g_autoptr
(
G
Task
)
task
=
NULL
;
g_autoptr
(
Ide
Task
)
task
=
NULL
;
IdeBuildManager
*
build_manager
;
IdeContext
*
context
;
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
g_assert
(
!
cancellable
||
G_IS_CANCELLABLE
(
cancellable
));
task
=
g
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
g
_task_set_source_tag
(
task
,
gbp_cmake_build_system_ensure_config_async
);
g
_task_set_priority
(
task
,
G_PRIORITY_LOW
);
task
=
ide
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
ide
_task_set_source_tag
(
task
,
gbp_cmake_build_system_ensure_config_async
);
ide
_task_set_priority
(
task
,
G_PRIORITY_LOW
);
context
=
ide_object_get_context
(
IDE_OBJECT
(
self
));
build_manager
=
ide_context_get_build_manager
(
context
);
...
...
@@ -145,9 +145,9 @@ gbp_cmake_build_system_ensure_config_finish (GbpCMakeBuildSystem *self,
GError
**
error
)
{
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
g_assert
(
G
_IS_TASK
(
result
));
g_assert
(
IDE
_IS_TASK
(
result
));
return
g
_task_propagate_boolean
(
G
_TASK
(
result
),
error
);
return
ide
_task_propagate_boolean
(
IDE
_TASK
(
result
),
error
);
}
static
void
...
...
@@ -157,25 +157,25 @@ gbp_cmake_build_system_load_commands_load_cb (GObject *object,
{
IdeCompileCommands
*
compile_commands
=
(
IdeCompileCommands
*
)
object
;
GbpCMakeBuildSystem
*
self
;
g_autoptr
(
G
Task
)
task
=
user_data
;
g_autoptr
(
Ide
Task
)
task
=
user_data
;
g_autoptr
(
GError
)
error
=
NULL
;
g_assert
(
IDE_IS_COMPILE_COMMANDS
(
compile_commands
));
g_assert
(
G_IS_ASYNC_RESULT
(
result
));
g_assert
(
G
_IS_TASK
(
task
));
g_assert
(
IDE
_IS_TASK
(
task
));
self
=
g
_task_get_source_object
(
task
);
self
=
ide
_task_get_source_object
(
task
);
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
if
(
!
ide_compile_commands_load_finish
(
compile_commands
,
result
,
&
error
))
{
g
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
ide
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
return
;
}
g_set_object
(
&
self
->
compile_commands
,
compile_commands
);
g
_task_return_pointer
(
task
,
g_object_ref
(
compile_commands
),
g_object_unref
);
ide
_task_return_pointer
(
task
,
g_object_ref
(
compile_commands
),
g_object_unref
);
}
static
void
...
...
@@ -185,7 +185,7 @@ gbp_cmake_build_system_load_commands_config_cb (GObject *object,
{
GbpCMakeBuildSystem
*
self
=
(
GbpCMakeBuildSystem
*
)
object
;
g_autoptr
(
IdeCompileCommands
)
compile_commands
=
NULL
;
g_autoptr
(
G
Task
)
task
=
user_data
;
g_autoptr
(
Ide
Task
)
task
=
user_data
;
g_autoptr
(
GFileMonitor
)
monitor
=
NULL
;
g_autoptr
(
GError
)
error
=
NULL
;
g_autoptr
(
GFile
)
file
=
NULL
;
...
...
@@ -197,11 +197,11 @@ gbp_cmake_build_system_load_commands_config_cb (GObject *object,
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
g_assert
(
G_IS_ASYNC_RESULT
(
result
));
g_assert
(
G
_IS_TASK
(
task
));
g_assert
(
IDE
_IS_TASK
(
task
));
if
(
!
gbp_cmake_build_system_ensure_config_finish
(
self
,
result
,
&
error
))
{
g
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
ide
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
return
;
}
...
...
@@ -212,10 +212,10 @@ gbp_cmake_build_system_load_commands_config_cb (GObject *object,
if
(
pipeline
==
NULL
)
{
/* Unlikely, but possible */
g
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_FAILED
,
"No build pipeline is available"
);
ide
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_FAILED
,
"No build pipeline is available"
);
return
;
}
...
...
@@ -224,16 +224,16 @@ gbp_cmake_build_system_load_commands_config_cb (GObject *object,
if
(
!
g_file_test
(
path
,
G_FILE_TEST_IS_REGULAR
))
{
/* Unlikely, but possible */
g
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_NOT_FOUND
,
"Failed to locate compile_commands.json"
);
ide
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_NOT_FOUND
,
"Failed to locate compile_commands.json"
);
return
;
}
compile_commands
=
ide_compile_commands_new
();
file
=
g_file_new_for_path
(
path
);
cancellable
=
g
_task_get_cancellable
(
task
);
cancellable
=
ide
_task_get_cancellable
(
task
);
ide_compile_commands_load_async
(
compile_commands
,
file
,
...
...
@@ -250,7 +250,7 @@ gbp_cmake_build_system_load_commands_async (GbpCMakeBuildSystem *self,
GAsyncReadyCallback
callback
,
gpointer
user_data
)
{
g_autoptr
(
G
Task
)
task
=
NULL
;
g_autoptr
(
Ide
Task
)
task
=
NULL
;
IdeBuildManager
*
build_manager
;
IdeBuildPipeline
*
pipeline
;
IdeContext
*
context
;
...
...
@@ -258,9 +258,9 @@ gbp_cmake_build_system_load_commands_async (GbpCMakeBuildSystem *self,
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
g_assert
(
!
cancellable
||
G_IS_CANCELLABLE
(
cancellable
));
task
=
g
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
g
_task_set_source_tag
(
task
,
gbp_cmake_build_system_load_commands_async
);
g
_task_set_priority
(
task
,
G_PRIORITY_LOW
);
task
=
ide
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
ide
_task_set_source_tag
(
task
,
gbp_cmake_build_system_load_commands_async
);
ide
_task_set_priority
(
task
,
G_PRIORITY_LOW
);
/*
* If we've already load the compile commands database, use it and
...
...
@@ -270,9 +270,9 @@ gbp_cmake_build_system_load_commands_async (GbpCMakeBuildSystem *self,
if
(
self
->
compile_commands
!=
NULL
)
{
g
_task_return_pointer
(
task
,
g_object_ref
(
self
->
compile_commands
),
g_object_unref
);
ide
_task_return_pointer
(
task
,
g_object_ref
(
self
->
compile_commands
),
g_object_unref
);
return
;
}
...
...
@@ -330,9 +330,9 @@ gbp_cmake_build_system_load_commands_finish (GbpCMakeBuildSystem *self,
GError
**
error
)
{
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
g_assert
(
G
_IS_TASK
(
result
));
g_assert
(
IDE
_IS_TASK
(
result
));
return
g
_task_propagate_pointer
(
G
_TASK
(
result
),
error
);
return
ide
_task_propagate_pointer
(
IDE
_TASK
(
result
),
error
);
}
static
void
...
...
@@ -434,7 +434,7 @@ gbp_cmake_build_system_get_build_flags_cb (GObject *object,
{
GbpCMakeBuildSystem
*
self
=
(
GbpCMakeBuildSystem
*
)
object
;
g_autoptr
(
IdeCompileCommands
)
compile_commands
=
NULL
;
g_autoptr
(
G
Task
)
task
=
user_data
;
g_autoptr
(
Ide
Task
)
task
=
user_data
;
g_autoptr
(
GError
)
error
=
NULL
;
g_autoptr
(
GFile
)
directory
=
NULL
;
g_auto
(
GStrv
)
system_includes
=
NULL
;
...
...
@@ -447,17 +447,17 @@ gbp_cmake_build_system_get_build_flags_cb (GObject *object,
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
g_assert
(
G_IS_ASYNC_RESULT
(
result
));
g_assert
(
G
_IS_TASK
(
task
));
g_assert
(
IDE
_IS_TASK
(
task
));
compile_commands
=
gbp_cmake_build_system_load_commands_finish
(
self
,
result
,
&
error
);
if
(
compile_commands
==
NULL
)
{
g
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
ide
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
return
;
}
file
=
g
_task_get_task_data
(
task
);
file
=
ide
_task_get_task_data
(
task
);
g_assert
(
G_IS_FILE
(
file
));
/* Get non-standard system includes */
...
...
@@ -474,9 +474,9 @@ gbp_cmake_build_system_get_build_flags_cb (GObject *object,
&
error
);
if
(
build_flags
==
NULL
)
g
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
ide
_task_return_error
(
task
,
g_steal_pointer
(
&
error
));
else
g
_task_return_pointer
(
task
,
g_steal_pointer
(
&
build_flags
),
(
GDestroyNotify
)
g_strfreev
);
ide
_task_return_pointer
(
task
,
g_steal_pointer
(
&
build_flags
),
(
GDestroyNotify
)
g_strfreev
);
}
static
void
...
...
@@ -487,7 +487,7 @@ gbp_cmake_build_system_get_build_flags_async (IdeBuildSystem *build_system,
gpointer
user_data
)
{
GbpCMakeBuildSystem
*
self
=
(
GbpCMakeBuildSystem
*
)
build_system
;
g_autoptr
(
G
Task
)
task
=
NULL
;
g_autoptr
(
Ide
Task
)
task
=
NULL
;
GFile
*
gfile
;
IDE_ENTRY
;
...
...
@@ -498,10 +498,10 @@ gbp_cmake_build_system_get_build_flags_async (IdeBuildSystem *build_system,
gfile
=
ide_file_get_file
(
file
);
task
=
g
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
g
_task_set_priority
(
task
,
G_PRIORITY_LOW
);
g
_task_set_source_tag
(
task
,
gbp_cmake_build_system_get_build_flags_async
);
g
_task_set_task_data
(
task
,
g_object_ref
(
gfile
),
g_object_unref
);
task
=
ide
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
ide
_task_set_priority
(
task
,
G_PRIORITY_LOW
);
ide
_task_set_source_tag
(
task
,
gbp_cmake_build_system_get_build_flags_async
);
ide
_task_set_task_data
(
task
,
g_object_ref
(
gfile
),
g_object_unref
);
gbp_cmake_build_system_load_commands_async
(
self
,
cancellable
,
...
...
@@ -521,9 +521,9 @@ gbp_cmake_build_system_get_build_flags_finish (IdeBuildSystem *build_system,
IDE_ENTRY
;
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
build_system
));
g_assert
(
G
_IS_TASK
(
result
));
g_assert
(
IDE
_IS_TASK
(
result
));
build_flags
=
g
_task_propagate_pointer
(
G
_TASK
(
result
),
error
);
build_flags
=
ide
_task_propagate_pointer
(
IDE
_TASK
(
result
),
error
);
IDE_RETURN
(
build_flags
);
}
...
...
@@ -559,7 +559,7 @@ gbp_cmake_build_system_notify_pipeline (GbpCMakeBuildSystem *self,
}
static
void
gbp_cmake_build_system_init_worker
(
G
Task
*
task
,
gbp_cmake_build_system_init_worker
(
Ide
Task
*
task
,
gpointer
source_object
,
gpointer
task_data
,
GCancellable
*
cancellable
)
...
...
@@ -577,7 +577,7 @@ gbp_cmake_build_system_init_worker (GTask *task,
if
(
dzl_str_equal0
(
name
,
"CMakeLists.txt"
))
{
g
_task_return_pointer
(
task
,
g_object_ref
(
project_file
),
g_object_unref
);
ide
_task_return_pointer
(
task
,
g_object_ref
(
project_file
),
g_object_unref
);
IDE_EXIT
;
}
...
...
@@ -587,16 +587,16 @@ gbp_cmake_build_system_init_worker (GTask *task,
if
(
g_file_query_exists
(
cmake_file
,
cancellable
))
{
g
_task_return_pointer
(
task
,
g_object_ref
(
cmake_file
),
g_object_unref
);
ide
_task_return_pointer
(
task
,
g_object_ref
(
cmake_file
),
g_object_unref
);
IDE_EXIT
;
}
}
g
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_NOT_SUPPORTED
,
"%s is not supported by the cmake plugin"
,
name
);
ide
_task_return_new_error
(
task
,
G_IO_ERROR
,
G_IO_ERROR_NOT_SUPPORTED
,
"%s is not supported by the cmake plugin"
,
name
);
IDE_EXIT
;
}
...
...
@@ -609,7 +609,7 @@ gbp_cmake_build_system_init_async (GAsyncInitable *initable,
gpointer
user_data
)
{
GbpCMakeBuildSystem
*
self
=
(
GbpCMakeBuildSystem
*
)
initable
;
g_autoptr
(
G
Task
)
task
=
NULL
;
g_autoptr
(
Ide
Task
)
task
=
NULL
;
IdeBuildManager
*
build_manager
;
IdeContext
*
context
;
...
...
@@ -625,10 +625,10 @@ gbp_cmake_build_system_init_async (GAsyncInitable *initable,
build_manager
=
ide_context_get_build_manager
(
context
);
g_assert
(
IDE_IS_BUILD_MANAGER
(
build_manager
));
task
=
g
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
g
_task_set_source_tag
(
task
,
gbp_cmake_build_system_init_async
);
g
_task_set_priority
(
task
,
io_priority
);
g
_task_set_task_data
(
task
,
g_object_ref
(
self
->
project_file
),
g_object_unref
);
task
=
ide
_task_new
(
self
,
cancellable
,
callback
,
user_data
);
ide
_task_set_source_tag
(
task
,
gbp_cmake_build_system_init_async
);
ide
_task_set_priority
(
task
,
io_priority
);
ide
_task_set_task_data
(
task
,
g_object_ref
(
self
->
project_file
),
g_object_unref
);
/*
* We want to be notified of any changes to the current build manager.
...
...
@@ -640,7 +640,7 @@ gbp_cmake_build_system_init_async (GAsyncInitable *initable,
self
,
G_CONNECT_SWAPPED
);
g
_task_run_in_thread
(
task
,
gbp_cmake_build_system_init_worker
);
ide
_task_run_in_thread
(
task
,
gbp_cmake_build_system_init_worker
);
IDE_EXIT
;
}
...
...
@@ -656,9 +656,9 @@ gbp_cmake_build_system_init_finish (GAsyncInitable *initable,
IDE_ENTRY
;
g_assert
(
GBP_IS_CMAKE_BUILD_SYSTEM
(
self
));
g_assert
(
G
_IS_TASK
(
result
));
g_assert
(
IDE
_IS_TASK
(
result
));
project_file
=
g
_task_propagate_pointer
(
G
_TASK
(
result
),
error
);
project_file
=
ide
_task_propagate_pointer
(
IDE
_TASK
(
result
),
error
);
if
(
g_set_object
(
&
self
->
project_file
,
project_file
))
g_object_notify_by_pspec
(
G_OBJECT
(
self
),
properties
[
PROP_PROJECT_FILE
]);
...
...
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