blob: a9303f72dec2646eb175c98d269ef9afc6285bf4 [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 InitialTargets="ExtractPOMVersion" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Common build paths -->
<PropertyGroup>
<Prefer32Bit>false</Prefer32Bit>
<PlatformTarget>x64</PlatformTarget>
<BinDir Condition="$(BinDir) == '' Or $(BinDir) == '*Undefined*'">$(SolutionDir)\bin</BinDir>
<PackagesDir Condition="$(PackagesDir) == '' Or $(PackagesDir) == '*Undefined*'">$(SolutionDir)\packages</PackagesDir>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
<BaseIntermediateOutputPath>$(BinDir)\Temp\$(RootNamespace)\$(Platform)\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(SolutionDir)\keyfile.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<!-- Common build configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>612,618</WarningsNotAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<BuildPackage>true</BuildPackage>
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>612,618</WarningsNotAsErrors>
</PropertyGroup>
<!-- REEF NuGet properties -->
<PropertyGroup>
<RemoveIncubating>true</RemoveIncubating>
<IsSnapshot>false</IsSnapshot>
<SnapshotNumber>00</SnapshotNumber>
<PushPackages>false</PushPackages>
<NuGetRepository>https://www.nuget.org</NuGetRepository>
</PropertyGroup>
<!-- Package versions -->
<PropertyGroup>
<AvroVersion>1.5.6</AvroVersion>
<NewtonsoftJsonVersion>6.0.8</NewtonsoftJsonVersion>
<ProtobufVersion>2.0.0.668</ProtobufVersion>
<RxVersion>2.2.5</RxVersion>
</PropertyGroup>
<!-- Locations -->
<PropertyGroup>
<!--The root directory of the REEF source tree. -->
<REEF_Source_Folder>$([System.IO.Path]::GetFullPath($(SolutionDir)\..\..))</REEF_Source_Folder>
</PropertyGroup>
<!--
########################################################################
Extract the REEF Version from the POM file
########################################################################
-->
<!--A Task that extracts the version from the pom in a given folder.-->
<UsingTask
TaskName="GetMavenProjectVersion"
TaskFactory="CodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup>
<SnapshotNumber/>
<ProjectFolder Required="true"/>
<Version Output="true"/>
<NugetVersion Output="true"/>
</ParameterGroup>
<Task>
<Reference Include="System.Xml"/>
<Reference Include="System.Xml.Linq"/>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Using Namespace="System.Linq"/>
<Using Namespace="System.Xml.Linq"/>
<Code Type="Fragment" Language="cs">
<![CDATA[
Version = XDocument.Load(Path.Combine(ProjectFolder, "pom.xml")).Descendants()
.Where(x => x.Name.ToString().Contains("version"))
.FirstOrDefault().Value;
var shortVer = $(RemoveIncubating) ? Version.Replace("-incubating","") : Version ;
var snapshortNumberAsString = ($(SnapshotNumber) >= 0 && $(SnapshotNumber) <=9) ? "0" + $(SnapshotNumber) : $(SnapshotNumber).ToString();
NugetVersion = $(IsSnapshot) ? shortVer + "-" + snapshortNumberAsString : shortVer.Replace("-SNAPSHOT","");
]]>
</Code>
</Task>
</UsingTask>
<!--
A Target that extract the REEF version from the pom and makes it available as REEF_Version
-->
<Target Name="ExtractPOMVersion">
<Message Text="The root directory of the source tree is $(REEF_Source_Folder)" />
<GetMavenProjectVersion ProjectFolder="$(REEF_Source_Folder)">
<Output PropertyName="REEF_Version" TaskParameter="Version"/>
<Output PropertyName="REEF_NugetVersion" TaskParameter="NugetVersion"/>
</GetMavenProjectVersion>
<Message Text="Extracted the following version from the POM: $(REEF_Version)"/>
</Target>
<Target Name="BuildJarProject">
<ItemGroup>
<AllConfigs Include="$(SolutionDir)\Org.Apache.REEF.Bridge.JAR\Org.Apache.REEF.Bridge.JAR.csproj" />
</ItemGroup>
<MSBuild Projects="@(AllConfigs)" Targets="Build"/>
</Target>
<Target Name="CopyJarFiles" DependsOnTargets="BuildJarProject">
<MSBuild Targets="Build" BuildInParallel="$(BuildInParallel)" Properties="Chip=$(Chip);Lang=$(Lang)" Projects="@(ProjectFile)" />
<ItemGroup>
<MySourceFiles Include="$(Bindir)\**\*.jar"/>
</ItemGroup>
<Copy
SourceFiles="@(MySourceFiles)"
DestinationFiles="@(MySourceFiles->'$(TargetDir)%(Filename)%(Extension)')"
/>
</Target>
<ItemGroup>
<DirectoriesToRemove Include="$(IntermediateOutputPath)" />
</ItemGroup>
<Target Name="RemoveIntermediateDirectories" AfterTargets="clean">
<RemoveDir Directories="@(DirectoriesToRemove)" Condition="!Exists('$(IntermediateOutputPath)\$(RootNamespace).log')"/>
<RemoveDir Directories="$(OutputPath)" />
</Target>
</Project>