Open stefjoosten opened 2 years ago
Indeed, the templates have been moved to the prototype
repository. This is the most logical place for them to be. When generating the prototype files, the templates must be available, for they are used to generate the correct files. These templates are part of the framework. Consequence is, that the proto
command can only be run when a prototype framework is available.
@Michiel-s , do you agree, or do you see other options?
We might consider to modify this error message explaining that a prototype framework is missing, and maybe even supply some hints.
Indeed, as @hanjoosten explained correctly templates files are decoupled. That is because they need to be always in sync with the current framework version to work.
@stefjoosten You can run the proto command with the --no-frontend
command. This will skip the frontend files that need the templates, but does generate backend configuration files, like the sql queries and more.
Aha, we have a workaround!
Alas, the cup isn't empty yet. Here is the result of running ampersand proto
with the option--no-frontend
:
sjo00577@BA92-VYF9TXMD9G FuncSpec % ampersand proto --no-frontend Foo.adl
Generating backend...
.proto/generics/database.sql: openFile: does not exist (No such file or directory)
ampersand: .proto/generics/database.sql: openFile: does not exist (No such file or directory)
sjo00577@BA92-VYF9TXMD9G FuncSpec %
That sounds like plenty of ideas. I suggest that the solution consists of three things:
ampersand proto
works self-contained, without any reference to the prototype framework. This ensures that the decoupling is a true decoupling.--no-frontend
a default option for ampersand proto
, to make the decoupling perfect and to save the unknowing user an unpleasant stumbling block. Consequently, we have to add the option--frontend
to the Dockerfiles that generate prototypes (or add the correct environment variable for the compiler if there is one). That extra effort is tolerable because the writer of the Dockerfile
is aware of frontend-backend matters.Agreed?
What happened
I tried to compile a prototype using just the Ampersand compiler
What I expected
I expected this file to generate some code, because foo.adl contains no errors
Version of ampersand that was used
Ampersand-v4.6.2 [51c3de2e65c540ef026925fe8547c991765a5588:refs/tags/v4.6.2]
Perception of the problem
This might have to do something with decoupling the prototype framework with the Ampersand compiler. I can imagine that the prototype templates are no longer available when using the compiler in standalone modus. However, it would be nice that a prototype without templates was generated instead of getting an error message.