blob: 7a1ac39dd76504dead68643cc128a78dafe6dda8 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<!--Set configuration parameters usually set in the Solution. This is needed for build.props to work.-->
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
<RootNamespace>Org.Apache.REEF.Bridge.JAR</RootNamespace>
<ProjectGuid>{62905C7C-1A7E-4923-B78D-1BF42D7FAD40}</ProjectGuid>
<AssemblyName>Org.Apache.REEF.Bridge.JAR</AssemblyName>
<RestorePackages>true</RestorePackages>
<BuildPackage>false</BuildPackage>
</PropertyGroup>
<Import Project="$(SolutionDir)\build.props" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Import Project="$(MSBuildBinPath)\Microsoft.Common.targets" />
<!--
Check that maven is installed
-->
<Target Name="CheckMavenInstall">
<Error Condition=" '$(M2_HOME)' == '' " Text="$M2_HOME is not set. Please make sure that Maven is installed and configured. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." />
<Error Condition=" '$(JAVA_HOME)' == '' " Text="$JAVA_HOME is not set. Please make sure that Java is installed and configured. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." />
<Message Text="Using the maven installation found in $(M2_HOME)" />
</Target>
<Target Name="CheckJavaInstall">
<Error Condition=" '$(JAVA_HOME)' == '' " Text="$JAVA_HOME is not set. Please make sure that Java is installed and configured. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." />
<Message Text="Using the java installation found in $(JAVA_HOME)" />
</Target>
<Target Name="CheckProtocInstall">
<Exec ContinueOnError="True" IgnoreExitCode="true" Command="&quot;cmd /c where protoc.exe&quot;">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Message Text="The exit code is $(ErrorCode)" />
<Message Text="BuildPackage is $(BuildPackage)" />
<Error Text="protoc.exe not found. Please make sure that protoc.exe is on the path. See https://cwiki.apache.org/confluence/display/REEF/Compiling+REEF for details." Condition="'$(ErrorCode)' &gt; '0'" />
</Target>
<!--
Executes 'mvn install', if the JAR does not exist.
-->
<Target Name="Build"
DependsOnTargets="CheckMavenInstall;CheckJavaInstall;CheckProtocInstall"
Outputs="$(OutputPath)">
<PropertyGroup>
<!--The shaded jar of the bridge (driver side) -->
<Bridge_JAR_Name>reef-bridge-java-$(REEF_Version)-shaded.jar</Bridge_JAR_Name>
<Bridge_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-java\target\$(Bridge_JAR_Name)</Bridge_JAR>
<!--The shaded jar of the bridge (client side) -->
<Client_JAR_Name>reef-bridge-client-$(REEF_Version)-shaded.jar</Client_JAR_Name>
<Client_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-client\target\$(Client_JAR_Name)</Client_JAR>
</PropertyGroup>
<Exec Command='call "$(M2_HOME)\bin\mvn.cmd" --projects lang/java/reef-bridge-java,lang/java/reef-bridge-client --also-make -TC1 -DskipTests -P!code-quality -q install' Condition="!Exists('$(Bridge_JAR)')" WorkingDirectory="$(REEF_Source_Folder)" />
<Copy DestinationFolder="$(OutputPath)" SourceFiles="$(Bridge_JAR)" />
<Copy DestinationFolder="$(OutputPath)" SourceFiles="$(Client_JAR)" />
</Target>
<!--
Executes 'mvn clean', if the JAR exists.
-->
<Target Name="Clean" DependsOnTargets="CheckMavenInstall;CheckJavaInstall;CheckProtocInstall">
<PropertyGroup>
<!--The shaded jar of the bridge (driver side) -->
<Bridge_JAR_Name>reef-bridge-java-$(REEF_Version)-shaded.jar</Bridge_JAR_Name>
<Bridge_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-java\target\$(Bridge_JAR_Name)</Bridge_JAR>
<!--The shaded jar of the bridge (client side) -->
<Client_JAR_Name>reef-bridge-client-$(REEF_Version)-shaded.jar</Client_JAR_Name>
<Client_JAR>$(REEF_Source_Folder)\lang\java\reef-bridge-client\target\$(Client_JAR_Name)</Client_JAR>
</PropertyGroup>
<Exec Command='call "$(M2_HOME)\bin\mvn.cmd" -TC1 -DskipTests -q clean' Condition="Exists('$(Bridge_JAR)')" WorkingDirectory="$(REEF_Source_Folder)" />
<Delete Files="$(OutputPath)\$(Bridge_JAR_Name)" />
<Delete Files="$(OutputPath)\$(Client_JAR_Name)" />
</Target>
<!--
Standard Rebuild target: Clean, then build
-->
<Target Name="Rebuild" DependsOnTargets="Clean;Build"/>
<Target Name="CheckPrerequisites" DependsOnTargets="Build"/>
</Project>