Repository: incubator-ratis Updated Branches: refs/heads/master fdbbdf98c -> 5a94eac05
RATIS-33. Protobuf gets compiled only when both activation conditions are triggered. Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/5a94eac0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/5a94eac0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/5a94eac0 Branch: refs/heads/master Commit: 5a94eac05810309436e316616fc40181aa892ae8 Parents: fdbbdf9 Author: Jing Zhao <[email protected]> Authored: Thu Mar 2 14:33:24 2017 -0800 Committer: Jing Zhao <[email protected]> Committed: Thu Mar 2 14:33:24 2017 -0800 ---------------------------------------------------------------------- BUILDING.md | 10 +++++++--- ratis-proto-shaded/pom.xml | 24 +++++++++++++----------- 2 files changed, 20 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/5a94eac0/BUILDING.md ---------------------------------------------------------------------- diff --git a/BUILDING.md b/BUILDING.md index 6fa19b7..4c634a4 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -4,7 +4,9 @@ at least Java-1.8. When Ratis is build for the first time, shaded protobuf files needs to be generated first which happens only in the mvn package phase. That is why you should run: -`$ mvn install -DskipTests` +``` +$ mvn package -DskipTests +``` the first time the sources are checked out first. After doing that mvn compile or mvn test can be used as normal. @@ -15,11 +17,13 @@ applications using Raft may use protobuf and other libraries with versions diffe from the versions used here. The library requires the shaded sources for compilation. The generated sources are stored in -`ratis-proto-shaded/src/main/java/`. They are not checked-in git though. +`ratis-proto-shaded/src/main/java/`. They are not checked-in git though. If you want to force-compile the proto files (for example after changing them), you should run with -$ mvn install -Dcompile-protobuf +``` +$ mvn package -DskipTests -Dcompile-protobuf +``` ## What are shaded? http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/5a94eac0/ratis-proto-shaded/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/pom.xml b/ratis-proto-shaded/pom.xml index ff5444e..5370837 100644 --- a/ratis-proto-shaded/pom.xml +++ b/ratis-proto-shaded/pom.xml @@ -118,6 +118,18 @@ </profile> <profile> + <id>skipCompileProto</id> + <activation> + <file> + <exists>${sources.dir}</exists> + </file> + <property> + <name>!compile-protobuf</name> + </property> + </activation> + </profile> + + <profile> <id>compile-protobuf</id> <!-- Generate and shade proto files. Drops generated java files @@ -139,17 +151,7 @@ The result needs to be checked in. --> <activation> - <!-- Activate this if the generated source directory is missing. It will automatically - kick the protoc compilation if you are doing a mvn install for the first time. Otherwise - it will only compile the resources under src/main/java as usual. If you want to - force-compile the proto files (for example after changing them), you should run with - mvn install -Dcompile-protobuf --> - <file> - <missing>${sources.dir}</missing> - </file> - <property> - <name>compile-protobuf</name> - </property> + <activeByDefault>true</activeByDefault> </activation> <properties> <profile.id>compile-protobuf</profile.id>
