Closed mgrojo closed 3 years ago
Fixed with patch https://github.com/reznikmm/matreshka/commit/d907a15b628f17df4ab469960373e2ae31e1edd3
Can be closed, I leave it open, just in case you want (me) to close it when the patch is delivered in Alire.
After alr build
and make install
I had to manually enter in the alire dependencies and install theme separately. It is not clear which is the expected procedure for installing after alr build
.
For example, for League I had to cd
to alire/cache/dependencies/matreshka_league_20.1.0_41ddb44a
and figure out this command: make install PREFIX=/opt/protobuf-ada-v1.0.0/ INSTALL_ALI_DIR=/opt/protobuf-ada-v1.0.0/lib INSTALL_EXEC_DIR=/opt/protobuf-ada-v1.0.0/bin GPRINSTALL=$GNAT/bin/gprinstall
I hope this installation method doesn't cause me problems in the future.
In any case, it's generating the Ada code! (haven't compiled it yet, though)
Another minor issue to make the process smoother: it takes the proto file name as Ada identifier, but my file contains hyphens. It is adding underscores, but it is not removing the hyphens, so the generated result is not directly compilable. I'll change the filename before generating to work around it.
Example: file test-file-with-hyphens.proto
generates package Testpkg.Test_-file_-with_-hyphens
in files: testpkg-test_-file_-with_-hyphens.adb testpkg-test_-file_-with_-hyphens.ads
@mgrojo
Issue with Matreshka should be fixed now: new crate for matreshka 21.0 has been merged. Also matreshka 20.1 build has been fixed too.
Regarding installing alr build
, in my POV, alr
isn't supposed to install anything. The main its purpose is for simplifying development. So I suggest you to put the executable directory in PATH
environment and use it in place.
I keep this issue as a bug report for files with hyphens.
@mgrojo
Issue with Matreshka should be fixed now: new crate for matreshka 21.0 has been merged. Also matreshka 20.1 build has been fixed too.
Thanks
Regarding installing
alr build
, in my POV,alr
isn't supposed to install anything. The main its purpose is for simplifying development. So I suggest you to put the executable directory inPATH
environment and use it in place.
I know, but building with alr
and then having to look at how to install the dependencies which were automatically downloaded and built with Alire seems to go only half of the way of the dependency automation. But no problem, in any case, I was able to figure it out and install all the needed dependencies, and so could do others in the future. And it is easier to do it in this way, than having to make all the process manually.
I keep this issue as a bug report for files with hyphens.
Ok, thanks.
@reznikmm
I've fixed the problem with the hyphens in the filename for me using this patch:
--- ./source/compiler/compiler-file_descriptors.adb~ 2021-11-09 12:20:36.519903040 +0000
+++ ./source/compiler/compiler-file_descriptors.adb 2021-11-09 12:20:14.968328895 +0000
@@ -21,6 +21,8 @@
-- DEALINGS IN THE SOFTWARE.
with Ada.Characters.Wide_Wide_Latin_1;
+with Ada.Strings.Fixed;
+with Ada.Strings.Maps;
with Ada.Directories;
with Ada_Pretty;
@@ -286,7 +288,11 @@
return League.Strings.Universal_String
is
File_Name : constant String := Self.Name.Value.To_UTF_8_String;
- Base_Name : constant String := Ada.Directories.Base_Name (File_Name);
+ Base_Name : constant String :=
+ Ada.Strings.Fixed.Translate
+ (Source => Ada.Directories.Base_Name (File_Name),
+ Mapping => Ada.Strings.Maps.To_Mapping
+ (From => "-", To => "_"));
PB_Pkg : League.Strings.Universal_String;
Result : League.Strings.Universal_String :=
Compiler.Context.To_Ada_Name
I can make a pull request if you want and like this solution.
By the way, protobuf for Ada is working fine for me. I've been able to communicate Ada with Java without issues. Thanks for everything.
Thank you. I think, I can do it a bit easier with Matreshka Split
/Join
functions.
Perfect, thanks for including the fix.
I tried building it with Alire, but got this error: