Skip to content

Commit

Permalink
fix(build): Added a self-activating profile which adds the generated-…
Browse files Browse the repository at this point in the history
…sources for VSCode.
  • Loading branch information
chrisdutz committed Nov 23, 2022
1 parent 198882b commit 500732b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
24 changes: 23 additions & 1 deletion code-generation/protocol-base-mspec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -90,7 +113,6 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
37 changes: 37 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 500732b

Please sign in to comment.