blob: b94fccbd73997b03c200ccac8dfd199d3ae29da4 [file] [log] [blame]
<Project>
<!--
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 (thee
"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.
-->
<PropertyGroup>
<AssemblyName>Org.Apache.REEF.Client</AssemblyName>
<Description>Client for REEF.NET</Description>
<PackageTags>REEF Client</PackageTags>
<!-- Disable default embedded resources as we override this in the project -->
<EnableDefaultEmbeddedResourceItems>False</EnableDefaultEmbeddedResourceItems>
</PropertyGroup>
<Import Project="..\build.Library.props" />
<PropertyGroup>
<TempResxFile Condition="$(TempResxFile) == ''">$(OutputPath)\$(TargetFramework)\Resources.resx</TempResxFile>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="$(TempResxFile)">
<Generator>ResXFileCodeGenerator</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Batch" Version="8.0.0" />
<PackageReference Include="Microsoft.Avro.Core" Version="$(AvroVersion)" />
<PackageReference Include="System.Reactive.Interfaces" Version="$(SystemReactiveVersion)" />
<PackageReference Include="EnterpriseLibrary.TransientFaultHandling.Core" Version="$(TransientFaultHandlingVersion)" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="4.3.0" />
</ItemGroup>
<!-- Project Reference conditionals allow for targeting specific projects based upon the target framework. -->
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<ProjectReference Include="..\Org.Apache.REEF.Bridge\Org.Apache.REEF.Bridge.vcxproj" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ProjectReference Include="..\Org.Apache.REEF.Bridge.CLR\Org.Apache.REEF.Bridge.CLR.csproj" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj" />
<ProjectReference Include="..\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj" />
<ProjectReference Include="..\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj" />
<ProjectReference Include="..\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj" />
<ProjectReference Include="..\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj" />
<ProjectReference Include="..\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj" />
<ProjectReference Include="..\Org.Apache.REEF.Examples\Org.Apache.REEF.Examples.csproj" />
<ProjectReference Include="..\Org.Apache.REEF.IO\Org.Apache.REEF.IO.csproj" />
</ItemGroup>
<Import Project="..\build.targets" />
<!--
########################################################################
ReWrite client resx to point to correct version of jars
########################################################################
-->
<!--A Task that extracts the version from the pom in a given folder.-->
<UsingTask TaskName="UpdateClientResources" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<SnapshotNumber />
<ProjectFolder Required="true" />
<DebugOrRelease Required="true" />
<resxOutputPath Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Xml" />
<Using Namespace="System.Linq" />
<Using Namespace="System.Xml.Linq" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var Version = XDocument.Load(Path.Combine(ProjectFolder, "pom.xml")).Descendants()
.Where(x => x.Name.ToString().Contains("version"))
.FirstOrDefault().Value;
var snapshortNumberAsString = ($(SnapshotNumber) >= 0 && $(SnapshotNumber) <=9) ? "0" + $(SnapshotNumber) : $(SnapshotNumber).ToString();
var reefVersion = Version;
var srcDir = @"lang\cs\Org.Apache.REEF.Client\Properties";
var binDir = @"lang\cs\bin\.netcore";
var resxInputPath = Path.Combine(ProjectFolder, srcDir, "Resources.xml");
var resourceDir = Path.Combine(ProjectFolder, binDir, DebugOrRelease, "Org.Apache.REEF.Bridge.JAR", "net461");
var clrDriverDir = Path.Combine(ProjectFolder, binDir, DebugOrRelease, "Org.Apache.REEF.Bridge");
var byteArrayType = ";System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
var jarRest = reefVersion + "-shaded.jar" + byteArrayType;
var dllResources = new Dictionary<string,string>();
dllResources.Add("reef_bridge_client", resourceDir + @"\reef-bridge-client-" + jarRest);
dllResources.Add("reef_bridge_driver", resourceDir + @"\reef-bridge-java-" + jarRest);
dllResources.Add("evaluator", resourceDir + "Org.Apache.REEF.Evaluator.exe" + byteArrayType);
dllResources.Add("reef_clrdriver", clrDriverDir + @"\Org.Apache.REEF.Bridge.exe" + byteArrayType);
dllResources.Add("ClientJarFullName", "reef-bridge-client-" + reefVersion + "-shaded.jar");
dllResources.Add("DriverJarFullName", "reef-bridge-java-" + reefVersion + "-shaded.jar");
dllResources.Add("ClrDriverFullName", "Org.Apache.REEF.Bridge.exe");
XElement root = XElement.Load(resxInputPath);
var resources = root.Descendants().Where(x => x.Name.LocalName == "data").ToList();
foreach (var resource in resources)
{
var resourceName = resource.Attribute("name").Value;
string replaceValue;
if (dllResources.TryGetValue(resourceName, out replaceValue))
{
var resourceValue = resource.Descendants().Where(x => x.Name.LocalName == "value").FirstOrDefault();
if (resourceValue != null)
{
resourceValue.Value = replaceValue;
}
}
}
var settings = new XmlWriterSettings
{
Indent = true,
IndentChars = " ",
NewLineChars = "\r\n",
NewLineHandling = NewLineHandling.Replace
};
(new FileInfo(resxOutputPath)).Directory.Create();
using (var wr = XmlWriter.Create(resxOutputPath, settings))
{
root.WriteTo(wr);
}
]]>
</Code>
</Task>
</UsingTask>
<!--
A Target that reWrites client resx to point to correct version of jars
-->
<Target Name="RewriteClientResources" BeforeTargets="BeforeBuild">
<Message Text="Generating temporary resx file" Importance="high" />
<UpdateClientResources ProjectFolder="$(REEF_Source_Folder)" DebugOrRelease="$(Configuration)" resxOutputPath="$(TempResxFile)">
</UpdateClientResources>
</Target>
<Target Name="CopyJarFiles" BeforeTargets="RewriteClientResources">
<MSBuild Targets="Build" BuildInParallel="$(BuildInParallel)" Properties="Chip=$(Chip);Lang=$(Lang)" Projects="@(ProjectFile)" />
<ItemGroup>
<MySourceFiles Include="$(BinDir)$(Configuration)\Org.Apache.REEF.Bridge.JAR\$(TargetFramework)\*.jar" />
</ItemGroup>
<Copy SourceFiles="@(MySourceFiles)" DestinationFiles="@(MySourceFiles->'$(TargetDir)%(Filename)%(Extension)')" />
</Target>
<Target Name="RemovingTempResx" AfterTargets="AfterBuild">
<Message Text="Removing temporary resx file" Importance="high"/>
<Delete Files="$(TempResxFile)" />
</Target>
</Project>