Esempio n. 1
0
gchar *
ide_build_system_get_id (IdeBuildSystem *self)
{
  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);

  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_id)
    return IDE_BUILD_SYSTEM_GET_IFACE (self)->get_id (self);

  return g_strdup (G_OBJECT_TYPE_NAME (self));
}
Esempio n. 2
0
gchar *
ide_build_system_get_display_name (IdeBuildSystem *self)
{
  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);

  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_display_name)
    return IDE_BUILD_SYSTEM_GET_IFACE (self)->get_display_name (self);

  return ide_build_system_get_id (self);
}
Esempio n. 3
0
/**
 * ide_build_system_get_project_version:
 * @self: a #IdeBuildSystem
 *
 * If the build system supports it, gets the project version as configured
 * in the build system's configuration files.
 *
 * Returns: (transfer full) (nullable): a string containing the project version
 *
 * Since: 3.32
 */
gchar *
ide_build_system_get_project_version (IdeBuildSystem *self)
{
  g_return_val_if_fail (IDE_IS_MAIN_THREAD (), NULL);
  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);

  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_project_version)
    return IDE_BUILD_SYSTEM_GET_IFACE (self)->get_project_version (self);

  return NULL;
}
Esempio n. 4
0
gchar *
ide_build_system_get_builddir (IdeBuildSystem   *self,
                               IdePipeline *pipeline)
{
  gchar *ret = NULL;

  IDE_ENTRY;

  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);
  g_return_val_if_fail (IDE_IS_PIPELINE (pipeline), NULL);

  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_builddir)
    ret = IDE_BUILD_SYSTEM_GET_IFACE (self)->get_builddir (self, pipeline);

  if (ret == NULL)
    {
      g_autofree gchar *name = NULL;
      g_autofree gchar *branch = NULL;
      g_autoptr(GFile) base = NULL;
      g_autoptr(GFile) nosymlink = NULL;
      IdeConfig *config;
      const gchar *config_id;
      const gchar *runtime_id;
      IdeRuntime *runtime;
      IdeContext *context;
      IdeVcs *vcs;

      context = ide_object_get_context (IDE_OBJECT (self));
      vcs = ide_vcs_from_context (context);
      config = ide_pipeline_get_config (pipeline);
      config_id = ide_config_get_id (config);
      runtime = ide_pipeline_get_runtime (pipeline);
      runtime_id = ide_runtime_get_id (runtime);
      branch = ide_vcs_get_branch_name (vcs);

      if (branch != NULL)
        name = g_strdup_printf ("%s-%s-%s", config_id, runtime_id, branch);
      else
        name = g_strdup_printf ("%s-%s", config_id, runtime_id);

      g_strdelimit (name, "@:/ ", '-');

      /* Avoid symlink's when we can, so that paths with symlinks have at least
       * a chance of working.
       */
      base = ide_context_cache_file (context, "builds", name, NULL);
      nosymlink = _ide_g_file_readlink (base);

      ret = g_file_get_path (nosymlink);
    }

  IDE_RETURN (ret);
}
Esempio n. 5
0
/**
 * ide_build_system_get_build_flags_for_files_finish:
 * @self: an #IdeBuildSystem
 * @result: a #GAsyncResult
 * @error: a location for a #GError or %NULL
 *
 * Returns: (element-type Ide.File GStrv) (transfer full): a #GHashTable or #GFile to #GStrv
 *
 * Since: 3.32
 */
GHashTable *
ide_build_system_get_build_flags_for_files_finish (IdeBuildSystem  *self,
                                                   GAsyncResult    *result,
                                                   GError         **error)
{
  GHashTable *ret;

  IDE_ENTRY;

  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), NULL);
  g_return_val_if_fail (G_IS_ASYNC_RESULT (result), NULL);

  ret = IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_for_files_finish (self, result, error);

  if (ret != NULL)
    {
      GHashTableIter iter;
      gchar **flags;

      g_hash_table_iter_init (&iter, ret);

      while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&flags))
        ide_build_system_post_process_build_flags (self, flags);
    }

  IDE_RETURN (ret);
}
Esempio n. 6
0
/**
 * ide_build_system_supports_toolchain:
 * @self: an #IdeBuildSystem
 * @toolchain: a #IdeToolchain
 *
 * Checks whether the build system supports the given toolchain.
 *
 * Returns: %TRUE if the toolchain is supported by the build system, %FALSE otherwise
 *
 * Since: 3.32
 */
gboolean
ide_build_system_supports_toolchain (IdeBuildSystem *self,
                                     IdeToolchain   *toolchain)
{
  const gchar *toolchain_id;

  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), FALSE);
  g_return_val_if_fail (IDE_IS_TOOLCHAIN (toolchain), FALSE);

  toolchain_id = ide_toolchain_get_id (toolchain);
  if (g_strcmp0 (toolchain_id, "default") == 0)
    return TRUE;

  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->supports_toolchain)
    return IDE_BUILD_SYSTEM_GET_IFACE (self)->supports_toolchain (self, toolchain);

  return FALSE;
}
Esempio n. 7
0
/**
 * ide_build_system_get_builder:
 * @system: The #IdeBuildSystem to perform the build.
 * @configuration: An #IdeConfiguration.
 *
 * This function returns an #IdeBuilder that can be used to perform a
 * build of the project using the configuration specified.
 *
 * See ide_builder_build_async() for more information.
 *
 * Returns: (transfer full): An #IdeBuilder or %NULL and @error is set.
 */
IdeBuilder *
ide_build_system_get_builder (IdeBuildSystem    *system,
                              IdeConfiguration  *configuration,
                              GError           **error)
{
  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (system), NULL);
  g_return_val_if_fail (IDE_IS_CONFIGURATION (configuration), NULL);

  return IDE_BUILD_SYSTEM_GET_IFACE (system)->get_builder (system, configuration, error);
}
Esempio n. 8
0
/**
 * ide_build_system_get_build_flags_async:
 *
 * Asynchronously requests the build flags for a file. For autotools and C based projects, this
 * would be similar to the $CFLAGS variable and is suitable for generating warnings and errors
 * with clang.
 */
void
ide_build_system_get_build_flags_async (IdeBuildSystem      *self,
                                        IdeFile             *file,
                                        GCancellable        *cancellable,
                                        GAsyncReadyCallback  callback,
                                        gpointer             user_data)
{
  g_autoptr(GTask) task = NULL;

  g_return_if_fail (IDE_IS_BUILD_SYSTEM (self));
  g_return_if_fail (IDE_IS_FILE (file));
  g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));

  if (IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_async)
    return IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_async (self, file, cancellable,
                                                                     callback, user_data);

  task = g_task_new (self, cancellable, callback, user_data);
  g_task_return_pointer (task, NULL, NULL);
}
Esempio n. 9
0
gint
ide_build_system_get_priority (IdeBuildSystem *self)
{
  IdeBuildSystemInterface *iface;

  g_return_val_if_fail (IDE_IS_BUILD_SYSTEM (self), 0);

  iface = IDE_BUILD_SYSTEM_GET_IFACE (self);

  if (iface->get_priority != NULL)
    return iface->get_priority (self);

  return 0;
}
Esempio n. 10
0
/**
 * ide_build_system_get_build_flags_for_files_async:
 * @self: An #IdeBuildSystem instance.
 * @files: (element-type GFile) (transfer none): array of files whose build flags has to be retrieved.
 * @cancellable: (allow-none): a #GCancellable to cancel getting build flags.
 * @callback: function to be called after getting build flags.
 * @user_data: data to pass to @callback.
 *
 * This function will get build flags for all files and returns
 * map of file and its build flags as #GHashTable.
 *
 * Since: 3.32
 */
void
ide_build_system_get_build_flags_for_files_async (IdeBuildSystem       *self,
                                                  GPtrArray            *files,
                                                  GCancellable         *cancellable,
                                                  GAsyncReadyCallback   callback,
                                                  gpointer              user_data)
{
  IDE_ENTRY;

  g_return_if_fail (IDE_IS_BUILD_SYSTEM (self));
  g_return_if_fail ( files != NULL);
  g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));

  IDE_BUILD_SYSTEM_GET_IFACE (self)->get_build_flags_for_files_async (self, files, cancellable, callback, user_data);

  IDE_EXIT;
}