In Adacore's GPR file, how can I set the compiler to exclude file with full path












0














I have a project which contains several files which have the same name but in differents folders.



Ex :



 ->sources
->src
- a.c
- b.c
->stub
- a.c
- z.c


In my gprfile I included the source with



for Source_Dirs use ( "sources/**" )


Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".



Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.



for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both


Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?










share|improve this question



























    0














    I have a project which contains several files which have the same name but in differents folders.



    Ex :



     ->sources
    ->src
    - a.c
    - b.c
    ->stub
    - a.c
    - z.c


    In my gprfile I included the source with



    for Source_Dirs use ( "sources/**" )


    Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".



    Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.



    for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
    for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both


    Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?










    share|improve this question

























      0












      0








      0







      I have a project which contains several files which have the same name but in differents folders.



      Ex :



       ->sources
      ->src
      - a.c
      - b.c
      ->stub
      - a.c
      - z.c


      In my gprfile I included the source with



      for Source_Dirs use ( "sources/**" )


      Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".



      Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.



      for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
      for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both


      Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?










      share|improve this question













      I have a project which contains several files which have the same name but in differents folders.



      Ex :



       ->sources
      ->src
      - a.c
      - b.c
      ->stub
      - a.c
      - z.c


      In my gprfile I included the source with



      for Source_Dirs use ( "sources/**" )


      Now, I want to ignore the files in src by using the primitive "Excluded_Source_File".



      Unfortunatly, this primitive needs a file name, and not a full path, so when I want to ignore a.c, it ignore the both files in src and stub.



      for Excluded_Source_Files use ( "sources/src/a.c" ); -- KO by gprbuild
      for Excluded_Source_Files use ( "a.c" ); -- OK but ignore both


      Does anyone know how can I do this, without alterate the current folder architecture and without rename files ?







      compilation ada gprbuild






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 19 '18 at 15:18









      LnlB

      5310




      5310
























          2 Answers
          2






          active

          oldest

          votes


















          5














          Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c



          project Stubbed extends "my_project.gpr" is
          for Source_Dirs use ("stub");
          end Stubbed;


          You can read more about project extentions in the GPRBuild User Guide






          share|improve this answer





























            6














            I would use scenario variables; also, it sounds as though Excluded_Source_Dirs would be useful.



            type Source_T is ("normal", "stubbed");
            Sources : Source_T := external ("SOURCES", "normal");


            then either



            for Source_Dirs use ("sources/**");
            case Sources is
            when "normal" =>
            for Excluded_Source_Dirs use ("sources/stub");
            when "stubbed" =>
            for Excluded_Source_Dirs use ("sources/src");
            end case;


            or



            for Source_Dirs use ("sources");
            case Sources is
            when "normal" =>
            for Source_Dirs use project'Source_Dirs & "sources/src";
            when "stubbed" =>
            for Source_Dirs use project'Source_Dirs & "sources/stub";
            end case;


            In either case,



            gprbuild -P prj


            (you could add the defaulted -XSOURCES=normal) or



            gprbuild -P prj -XSOURCES=stubbed





            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377655%2fin-adacores-gpr-file-how-can-i-set-the-compiler-to-exclude-file-with-full-path%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              5














              Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c



              project Stubbed extends "my_project.gpr" is
              for Source_Dirs use ("stub");
              end Stubbed;


              You can read more about project extentions in the GPRBuild User Guide






              share|improve this answer


























                5














                Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c



                project Stubbed extends "my_project.gpr" is
                for Source_Dirs use ("stub");
                end Stubbed;


                You can read more about project extentions in the GPRBuild User Guide






                share|improve this answer
























                  5












                  5








                  5






                  Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c



                  project Stubbed extends "my_project.gpr" is
                  for Source_Dirs use ("stub");
                  end Stubbed;


                  You can read more about project extentions in the GPRBuild User Guide






                  share|improve this answer












                  Sounds like what you want is a project extension, ie. create a second project file, which extends the first. In this seconds project file, you can override a.c



                  project Stubbed extends "my_project.gpr" is
                  for Source_Dirs use ("stub");
                  end Stubbed;


                  You can read more about project extentions in the GPRBuild User Guide







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 19 '18 at 15:28









                  egilhh

                  3,59211017




                  3,59211017

























                      6














                      I would use scenario variables; also, it sounds as though Excluded_Source_Dirs would be useful.



                      type Source_T is ("normal", "stubbed");
                      Sources : Source_T := external ("SOURCES", "normal");


                      then either



                      for Source_Dirs use ("sources/**");
                      case Sources is
                      when "normal" =>
                      for Excluded_Source_Dirs use ("sources/stub");
                      when "stubbed" =>
                      for Excluded_Source_Dirs use ("sources/src");
                      end case;


                      or



                      for Source_Dirs use ("sources");
                      case Sources is
                      when "normal" =>
                      for Source_Dirs use project'Source_Dirs & "sources/src";
                      when "stubbed" =>
                      for Source_Dirs use project'Source_Dirs & "sources/stub";
                      end case;


                      In either case,



                      gprbuild -P prj


                      (you could add the defaulted -XSOURCES=normal) or



                      gprbuild -P prj -XSOURCES=stubbed





                      share|improve this answer


























                        6














                        I would use scenario variables; also, it sounds as though Excluded_Source_Dirs would be useful.



                        type Source_T is ("normal", "stubbed");
                        Sources : Source_T := external ("SOURCES", "normal");


                        then either



                        for Source_Dirs use ("sources/**");
                        case Sources is
                        when "normal" =>
                        for Excluded_Source_Dirs use ("sources/stub");
                        when "stubbed" =>
                        for Excluded_Source_Dirs use ("sources/src");
                        end case;


                        or



                        for Source_Dirs use ("sources");
                        case Sources is
                        when "normal" =>
                        for Source_Dirs use project'Source_Dirs & "sources/src";
                        when "stubbed" =>
                        for Source_Dirs use project'Source_Dirs & "sources/stub";
                        end case;


                        In either case,



                        gprbuild -P prj


                        (you could add the defaulted -XSOURCES=normal) or



                        gprbuild -P prj -XSOURCES=stubbed





                        share|improve this answer
























                          6












                          6








                          6






                          I would use scenario variables; also, it sounds as though Excluded_Source_Dirs would be useful.



                          type Source_T is ("normal", "stubbed");
                          Sources : Source_T := external ("SOURCES", "normal");


                          then either



                          for Source_Dirs use ("sources/**");
                          case Sources is
                          when "normal" =>
                          for Excluded_Source_Dirs use ("sources/stub");
                          when "stubbed" =>
                          for Excluded_Source_Dirs use ("sources/src");
                          end case;


                          or



                          for Source_Dirs use ("sources");
                          case Sources is
                          when "normal" =>
                          for Source_Dirs use project'Source_Dirs & "sources/src";
                          when "stubbed" =>
                          for Source_Dirs use project'Source_Dirs & "sources/stub";
                          end case;


                          In either case,



                          gprbuild -P prj


                          (you could add the defaulted -XSOURCES=normal) or



                          gprbuild -P prj -XSOURCES=stubbed





                          share|improve this answer












                          I would use scenario variables; also, it sounds as though Excluded_Source_Dirs would be useful.



                          type Source_T is ("normal", "stubbed");
                          Sources : Source_T := external ("SOURCES", "normal");


                          then either



                          for Source_Dirs use ("sources/**");
                          case Sources is
                          when "normal" =>
                          for Excluded_Source_Dirs use ("sources/stub");
                          when "stubbed" =>
                          for Excluded_Source_Dirs use ("sources/src");
                          end case;


                          or



                          for Source_Dirs use ("sources");
                          case Sources is
                          when "normal" =>
                          for Source_Dirs use project'Source_Dirs & "sources/src";
                          when "stubbed" =>
                          for Source_Dirs use project'Source_Dirs & "sources/stub";
                          end case;


                          In either case,



                          gprbuild -P prj


                          (you could add the defaulted -XSOURCES=normal) or



                          gprbuild -P prj -XSOURCES=stubbed






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 19 '18 at 16:32









                          Simon Wright

                          16.4k21836




                          16.4k21836






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377655%2fin-adacores-gpr-file-how-can-i-set-the-compiler-to-exclude-file-with-full-path%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              MongoDB - Not Authorized To Execute Command

                              in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

                              Npm cannot find a required file even through it is in the searched directory