You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2022/11/23 07:38:55 UTC

[plc4x] branch develop updated: fix(build): Added a self-activating profile which adds the generated-sources for VSCode.

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 500732b326 fix(build): Added a self-activating profile which adds the generated-sources for VSCode.
500732b326 is described below

commit 500732b326422b50ce2236693f98a59e9a5e89c1
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Wed Nov 23 08:38:29 2022 +0100

    fix(build): Added a self-activating profile which adds the generated-sources for VSCode.
---
 code-generation/protocol-base-mspec/pom.xml | 24 ++++++++++++++++++-
 pom.xml                                     | 37 +++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/code-generation/protocol-base-mspec/pom.xml b/code-generation/protocol-base-mspec/pom.xml
index f25311140b..df8bc6e3cc 100644
--- a/code-generation/protocol-base-mspec/pom.xml
+++ b/code-generation/protocol-base-mspec/pom.xml
@@ -47,6 +47,29 @@
           </execution>
         </executions>
       </plugin>
+      <!--
+       This is an experiment to get things working for VSCode (IntelliJ and Maven pick them up automatically)
+       If this causes problems with IntelliJ, Eclipse or Maven we should probably come up with some other solution.
+       It might also help people using Eclipse.
+      -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>add-plc4x-test-sources</id>
+            <phase>generate-sources</phase>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>${project.build.directory}/generated-sources/antlr4/</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
@@ -90,7 +113,6 @@
       <artifactId>logback-classic</artifactId>
       <scope>test</scope>
     </dependency>
-
   </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 8bacf2cc09..9902e4b314 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1764,6 +1764,43 @@
       </build>
     </profile>
 
+    <!--
+      This is an experiment to get things working for VSCode (IntelliJ and Maven pick them up automatically)
+      Only if a "target/generated-source/plc4x" directory exists, will it be added. With this trick we don't need
+      to add this block to every module with generated code. If this causes problems with IntelliJ, Eclipse or Maven
+      we should probably come up with some other solution. It might also help people using Eclipse.
+     -->
+    <profile>
+      <id>add-generated-sources</id>
+      <activation>
+        <file>
+          <exists>target/generated-sources/plc4x</exists>
+        </file>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>add-plc4x-test-sources</id>
+                <phase>generate-sources</phase>
+                <goals>
+                  <goal>add-source</goal>
+                </goals>
+                <configuration>
+                  <sources>
+                    <source>${project.build.directory}/generated-sources/plc4x/</source>
+                  </sources>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+
     <!--
       This profile extends the default "apache-release" configuration with automatic checksum-
       generation for the release source artifact. It is automatically activated during the