Skip to content

Commit f050da7

Browse files
authored
Used daml codegen java instead of calling the codegen from maven (#5537)
* Used `daml codegen java` instead of calling the codegen from maven This should hopefully fix the issues with mismatched versions of slf4j. changelog_begin changelog_end * Move config to daml.yaml * Remove alternative invocation via maven from docs
1 parent 000bb04 commit f050da7

File tree

6 files changed

+14
-29
lines changed

6 files changed

+14
-29
lines changed

daml-assistant/integration-tests/src/DA/Daml/Assistant/IntegrationTests.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ quickstartTests quickstartDir mvnDir = testGroup "quickstart"
417417
runConduitRes
418418
$ sourceFileBS mvnDbTarball
419419
.| Tar.Conduit.Extra.untar (Tar.Conduit.Extra.restoreFile throwError mvnDir)
420+
callCommand "daml codegen java"
420421
callCommand $ unwords ["mvn", mvnRepoFlag, "-q", "compile"]
421422
, testCase "mvn exec:java@run-quickstart" $
422423
withCurrentDirectory quickstartDir $

docs/source/app-dev/bindings-java/codegen.rst

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,7 @@ In the following example the logging is set to print most of the output with det
8888
Integrate with build tools
8989
--------------------------
9090

91-
While we currently don’t provide direct integration with Maven, Groovy, SBT, etc., you can run the Java codegen as described in :ref:`daml-codegen-java-running` just like any other external process (for example the protobuf compiler). Alternatively you can integrate it as a runnable dependency in your ``pom.xml`` file for Maven.
92-
93-
The following snippet is an excerpt from the ``pom.xml`` that is part of the :ref:`quickstart` guide.
94-
95-
.. literalinclude:: quickstart/template-root/pom.xml
96-
:language: xml
97-
:lines: 47-78,94-95
98-
:dedent: 12
99-
91+
While we currently don’t provide direct integration with Maven, Groovy, SBT, etc., you can run the Java codegen as described in :ref:`daml-codegen-java-running` just like any other external process (for example the protobuf compiler).
10092

10193
.. _daml-codegen-java-compiling:
10294

docs/source/app-dev/bindings-java/quickstart.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,12 @@ A distributed ledger only forms the core of a full DAML application.
475475

476476
To build automations and integrations around the ledger, the SDK has :doc:`language bindings </app-dev/bindings-java/index>` for the Ledger API in several programming languages.
477477

478-
To compile the Java integration for the quickstart application, run ``mvn compile``.
478+
479+
To compile the Java integration for the quickstart application, we first need to run the Java codegen on the DAR we built before::
480+
481+
daml codegen java
482+
483+
Once the code has been generated, we can now compile it using ``mvn compile``.
479484

480485
Now start the Java integration with ``mvn exec:java@run-quickstart``. Note that
481486
this step requires that the sandbox started :ref:`earlier

docs/source/app-dev/bindings-java/quickstart/template-root/pom.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,25 +57,6 @@
5757
</dependency>
5858
</dependencies>
5959
<executions>
60-
<execution>
61-
<id>daml-codegen-java</id>
62-
<phase>generate-sources</phase>
63-
<goals>
64-
<goal>java</goal>
65-
</goals>
66-
<configuration>
67-
<includeProjectDependencies>false</includeProjectDependencies>
68-
<includePluginDependencies>true</includePluginDependencies>
69-
<mainClass>com.daml.lf.codegen.Main</mainClass>
70-
<arguments>
71-
<argument>-o</argument>
72-
<argument>${daml-codegen-java.output}</argument>
73-
<argument>-d</argument>
74-
<argument>com.daml.quickstart.iou.TemplateDecoder</argument>
75-
<argument>${project.basedir}/.daml/dist/quickstart-0.0.1.dar=com.daml.quickstart.model</argument>
76-
</arguments>
77-
</configuration>
78-
</execution>
7960
<execution>
8061
<id>run-quickstart</id>
8162
<goals>

release/RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ latest commit on master.
120120
1. `daml sandbox --wall-clock-time --port 6865 .daml/dist/quickstart-0.0.1.dar`
121121
1. `daml script --dar .daml/dist/quickstart-0.0.1.dar --script-name Setup:initialize --ledger-host localhost --ledger-port 6865 --wall-clock-time`
122122
1. `daml navigator server localhost 6865 --port 7500`
123+
1. `daml codegen java`
123124
1. `mvn compile exec:java@run-quickstart`
124125
125126
> Note: It takes some time for our artifacts to be available on Maven

templates/quickstart-java/daml.yaml.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,8 @@ dependencies:
1414
- daml-script
1515
sandbox-options:
1616
- --wall-clock-time
17+
codegen:
18+
java:
19+
package-prefix: com.daml.quickstart.model
20+
output-directory: target/generated-sources/iou
21+
decoderClass: com.daml.quickstart.iou.TemplateDecoder

0 commit comments

Comments
 (0)