AdaCore / AdaCore/gnatstudio

GPS project view puzzled by Project'Target.

Open
#80 2 comments 0 reactions 1 assignee View on GitHub

@AnthonyLeonardoGracio is already working on this.

Since Sep 3, 2019.

bug
Dominant language
Ada
Stars
531
Forks
65
PR merge metrics
No merged PRs in 30d

Description

Hello,
Configuration: GPS Community 2019, macOS 10.13.6.
The main source code essai_gps withs a unit put_os depending on the OS.
Thus three source files implement put_os.
In GPR file the choice TARGET_OS is made with the help of Project'Target:

project Proj_Essai_Gps is
   for Source_Dirs use ("src");
   for Object_Dir use "obj";
   for Main use ("essai_gps.adb");
   TARGET_OS := "None";
   TARGET := Project'Target;
   case TARGET is
      when "x86_64-linux" =>
         TARGET_OS := "Unix";
      when "i686-pc-mingw32" =>
         TARGET_OS := "mingw";
      when "x86_64-darwin" =>
         TARGET_OS := "macOS";
      when others =>
         TARGET_OS := "None";
   end case;
      case TARGET_OS is
         when "Unix" =>
            for Source_Files use ("essai_gps.adb", "put_unix.adb");
         when "macOS" =>
            for Source_Files use ("essai_gps.adb", "put_macos.adb");
         when "mingw" =>
            for Source_Files use ("essai_gps.adb", "put_mingw.adb");
        when Others =>
            null;
      end case;
   package Naming is
      case TARGET_OS is
         when "Unix" =>
            for Body ("Put_OS") use "put_unix.adb";
         when "macOS" =>
            for Body ("Put_OS") use "put_macos.adb";
         when "mingw" =>
            for Body ("Put_OS") use "put_mingw.adb";
        when Others =>
            null;
      end case;
   end Naming;
end Proj_Essai_Gps;

In my case on macOS the output is ok:

Compile
   [Ada]          essai_gps.adb
   [Ada]          put_macos.adb
Bind
   [gprbind]      essai_gps.bexch
   [Ada]          essai_gps.ali
Link
   [link]         essai_gps.adb

$ obj/essai_gps 
macOS

Building and running with GPS is also ok.
But the GPS project wiew is not updated accordingly, see screen capture 20190608-GPS-101.png:
20190608-GPS-101
While when TARGET_OS is hardcoded (see proj_essai_gps3.gpr) GPS project wiew is ok, see screen capture 20190608-GPS-102.png:
20190608-GPS-102
What could be done to update GPS project view automatically with Project'Target help?

Thanks Pascal.
See source files in archive.
essai-gps.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.