Repository: incubator-ratis
Updated Branches:
  refs/heads/master 630ad7f4d -> 9591cbca0


RATIS-102. Clean generated sources as part of the default clean lifecycle.  
Contributed by Elek, Marton.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/9591cbca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/9591cbca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/9591cbca

Branch: refs/heads/master
Commit: 9591cbca0bea7d42ddb54e493f3c3445788baa31
Parents: 630ad7f
Author: Tsz-Wo Nicholas Sze <[email protected]>
Authored: Thu Nov 2 14:44:04 2017 -0700
Committer: Tsz-Wo Nicholas Sze <[email protected]>
Committed: Thu Nov 2 14:45:15 2017 -0700

----------------------------------------------------------------------
 BUILDING.md                 | 14 +++++-----
 ratis-hadoop-shaded/pom.xml | 57 ++++++++++++++++++++--------------------
 ratis-proto-shaded/pom.xml  | 57 ++++++++++++++++++++--------------------
 3 files changed, 65 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/9591cbca/BUILDING.md
----------------------------------------------------------------------
diff --git a/BUILDING.md b/BUILDING.md
index f31dcc5..0f3e682 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -42,19 +42,19 @@ ratis-hadoop-shaded/src/main/java/
 ```
 They are not checked-in to git though.
 
-If you want to force compiling the proto files (for example after changing 
them),
-you should run
+By default protobuf compilation and shading are triggered at every build. To 
make more faster the
+additional builds, you can turn them off:
 ```
-$ mvn package -DskipTests -Dcompile-protobuf
+$ mvn package -DskipTests -DskipShade
 ```
 
-For removing the shaded sources, run
+During the clean lifecycle all the shaded classes are also deleted. You can 
clean the
+compiled files but keep the shaded classes with the following command:
+
 ```
-$ mvn clean -Pclean-shade
+$ mvn clean -DskipCleanShade
 ```
 
-Note that `mvn clean` alone does not remove the shaded sources.
-
 ## What are shaded?
 
 | Original packages                   | Shaded packages                        
                      |

http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/9591cbca/ratis-hadoop-shaded/pom.xml
----------------------------------------------------------------------
diff --git a/ratis-hadoop-shaded/pom.xml b/ratis-hadoop-shaded/pom.xml
index cc47466..dd0ad2a 100644
--- a/ratis-hadoop-shaded/pom.xml
+++ b/ratis-hadoop-shaded/pom.xml
@@ -122,41 +122,40 @@
     </profile>
 
     <profile>
-      <id>skipCompileProto</id>
+      <id>clean-shade</id>
       <activation>
-        <file>
-          <exists>${shaded.sources.dir}</exists>
-        </file>
         <property>
-          <name>!compile-protobuf</name>
+          <name>!skipCleanShade</name>
         </property>
       </activation>
-    </profile>
-
-    <profile>
-      <id>clean-shade</id>
-      <activation>
-        <activeByDefault>false</activeByDefault>
-      </activation>
       <build>
         <plugins>
           <plugin>
             <artifactId>maven-clean-plugin</artifactId>
-            <configuration>
-              <filesets>
-                <fileset>
-                  <directory>${shaded.sources.dir}</directory>
-                  <followSymlinks>false</followSymlinks>
-                </fileset>
-                <fileset>
-                  <directory>.</directory>
-                  <includes>
-                    <include>dependency-reduced-pom.xml</include>
-                  </includes>
-                  <followSymlinks>false</followSymlinks>
-                </fileset>
-              </filesets>
-            </configuration>
+            <executions>
+              <execution>
+                <id>shaded-clean</id>
+                <goals>
+                  <goal>clean</goal>
+                </goals>
+                <phase>clean</phase>
+                <configuration>
+                  <filesets>
+                    <fileset>
+                      <directory>${shaded.sources.dir}</directory>
+                      <followSymlinks>false</followSymlinks>
+                    </fileset>
+                    <fileset>
+                      <directory>.</directory>
+                      <includes>
+                        <include>dependency-reduced-pom.xml</include>
+                      </includes>
+                      <followSymlinks>false</followSymlinks>
+                    </fileset>
+                  </filesets>
+                </configuration>
+              </execution>
+            </executions>
           </plugin>
         </plugins>
       </build>
@@ -168,7 +167,9 @@
          Shade and drop the generated java files under src/main/java.
       -->
       <activation>
-        <activeByDefault>true</activeByDefault>
+        <property>
+          <name>!skipShade</name>
+        </property>
       </activation>
       <properties>
         <profile.id>compile-protobuf</profile.id>

http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/9591cbca/ratis-proto-shaded/pom.xml
----------------------------------------------------------------------
diff --git a/ratis-proto-shaded/pom.xml b/ratis-proto-shaded/pom.xml
index 7824500..ef22f33 100644
--- a/ratis-proto-shaded/pom.xml
+++ b/ratis-proto-shaded/pom.xml
@@ -419,41 +419,40 @@
     </profile>
 
     <profile>
-      <id>skipCompileProto</id>
+      <id>clean-shade</id>
       <activation>
-        <file>
-          <exists>${shaded.sources.dir}</exists>
-        </file>
         <property>
-          <name>!compile-protobuf</name>
+          <name>!skipCleanShade</name>
         </property>
       </activation>
-    </profile>
-
-    <profile>
-      <id>clean-shade</id>
-      <activation>
-        <activeByDefault>false</activeByDefault>
-      </activation>
       <build>
         <plugins>
           <plugin>
             <artifactId>maven-clean-plugin</artifactId>
-            <configuration>
-              <filesets>
-                <fileset>
-                  <directory>${shaded.sources.dir}</directory>
-                  <followSymlinks>false</followSymlinks>
-                </fileset>
-                <fileset>
-                  <directory>.</directory>
-                  <includes>
-                    <include>dependency-reduced-pom.xml</include>
-                  </includes>
-                  <followSymlinks>false</followSymlinks>
-                </fileset>
-              </filesets>
-            </configuration>
+            <executions>
+              <execution>
+                <id>shaded-clean</id>
+                <goals>
+                  <goal>clean</goal>
+                </goals>
+                <phase>clean</phase>
+                <configuration>
+                  <filesets>
+                    <fileset>
+                      <directory>${shaded.sources.dir}</directory>
+                      <followSymlinks>false</followSymlinks>
+                    </fileset>
+                    <fileset>
+                      <directory>.</directory>
+                      <includes>
+                        <include>dependency-reduced-pom.xml</include>
+                      </includes>
+                      <followSymlinks>false</followSymlinks>
+                    </fileset>
+                  </filesets>
+                </configuration>
+              </execution>
+            </executions>
           </plugin>
         </plugins>
       </build>
@@ -467,7 +466,9 @@
          files or update the protobuf version.
       -->
       <activation>
-        <activeByDefault>true</activeByDefault>
+        <property>
+          <name>!skipShade</name>
+        </property>
       </activation>
       <properties>
         <profile.id>compile-protobuf</profile.id>

Reply via email to