Skip to content

Commit

Permalink
Add maven profile to verify readme (#6625)
Browse files Browse the repository at this point in the history
* Add maven profile to verify readme

* Revert changes to readme to pass the CI pipeline

* Separate profiles for Windows
  • Loading branch information
srnagar authored Dec 5, 2019
1 parent a2fa92b commit 2b4c453
Showing 1 changed file with 167 additions and 23 deletions.
190 changes: 167 additions & 23 deletions pom.client.xml
Original file line number Diff line number Diff line change
Expand Up @@ -936,29 +936,29 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version> <!-- {x-version-update;org.codehaus.mojo:exec-maven-plugin;external_dependency} -->
<executions>
<execution>
<id>generate-overview-from-readme</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>python</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>../../../eng/pipelines/scripts/generate_overview_from_readme.py</argument>
<argument>--rf</argument>
<argument>${project.basedir}/README.md</argument>
<argument>--v</argument>
<argument>${project.version}</argument>
</arguments>
</configuration>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version> <!-- {x-version-update;org.codehaus.mojo:exec-maven-plugin;external_dependency} -->
<executions>
<execution>
<id>generate-overview-from-readme</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>python</executable>
<workingDirectory>${project.basedir}</workingDirectory>
<arguments>
<argument>../../../eng/pipelines/scripts/generate_overview_from_readme.py</argument>
<argument>--rf</argument>
<argument>${project.basedir}/README.md</argument>
<argument>--v</argument>
<argument>${project.version}</argument>
</arguments>
</configuration>
</plugin>
<!-- Add the overview argument to the javadoc args -->
<plugin>
Expand All @@ -972,6 +972,150 @@
</plugins>
</build>
</profile>

<profile>
<!-- separate profile for windows as the executable on windows is named npx.cmd and npx on other os families -->
<id>readme-codesnippet-windows</id>
<activation>
<property>
<name>readme-codesnippet-windows</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version> <!-- {x-version-update;org.codehaus.mojo:exec-maven-plugin;external_dependency} -->
<executions>
<execution>
<id>code-snippet-for-readme-windows</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npx.cmd</executable>
<arguments>
<argument>embedme</argument>
<argument>sdk/*/azure-*/README.md</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<!-- Profiles for updating README file using embedme tool to inject code snippets from compilable Java source files.
Activate the profile below to update README files when corresponding Java files are updated. -->
<profile>
<id>readme-codesnippet</id>
<activation>
<property>
<name>readme-codesnippet</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version> <!-- {x-version-update;org.codehaus.mojo:exec-maven-plugin;external_dependency} -->
<executions>
<execution>
<id>code-snippet-for-readme</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npx</executable>
<arguments>
<argument>embedme</argument>
<argument>sdk/*/azure-*/README.md</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<!-- separate profile for windows as the executable on windows is named npx.cmd and npx on other os families -->
<id>verify-readme-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version> <!-- {x-version-update;org.codehaus.mojo:exec-maven-plugin;external_dependency} -->
<executions>
<execution>
<id>verify-readme-codesnippet-windows</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npx.cmd</executable>
<arguments>
<argument>embedme</argument>
<argument>--verify</argument>
<argument>sdk/*/azure-*/README.md</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<!-- Verify that there are no changes to readme file. Build fails if the there's a difference in README
after running the embedme tool. -->
<profile>
<id>verify-readme</id>
<activation>
<os>
<family>!windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version> <!-- {x-version-update;org.codehaus.mojo:exec-maven-plugin;external_dependency} -->
<executions>
<execution>
<id>verify-readme-codesnippet</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npx</executable>
<arguments>
<argument>embedme</argument>
<argument>--verify</argument>
<argument>sdk/*/azure-*/README.md</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<modules>
Expand Down

0 comments on commit 2b4c453

Please sign in to comment.