Skip to content

Commit f91b09b

Browse files
beysimstcNickolas
authored andcommitted
[REEF-1197] Fix .NET build concurrency issues around JAR creation and NuGet cleanup
This addressed the issue by * Refactoring build property and target files. * Fixing nuget clean problems * Making only the client project depend on CopyJar target JIRA: [REEF-1197](https://issues.apache.org/jira/browse/REEF-1197) Pull request: This closes apache#835
1 parent 0357e4f commit f91b09b

13 files changed

Lines changed: 102 additions & 122 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ nb-configuration.xml
2525
.idea
2626
atlassian-ide-plugin.xml
2727
*.sln.DotSettings.user
28+
*.VC.opendb
2829
#
2930
# ----------------------------------------------------------------------
3031
# OS Files

lang/cs/.nuget/NuGet.targets

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ under the License.
3333
<!-- Download NuGet.exe if it does not already exist -->
3434
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
3535
</PropertyGroup>
36-
36+
<Import Project="$(SolutionDir)\build.props" Condition="'$(BuildDotPropsIsImported)'!='true'" />
37+
<Import Project="$(SolutionDir)\build.targets" Condition="'$(BuildDotTargetsIsImported)'!='true'"/>
3738
<ItemGroup Condition=" '$(PackageSources)' == '' ">
3839
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
3940
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
@@ -51,6 +52,7 @@ under the License.
5152
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
5253
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
5354
<NuGetToolsPath>$(SolutionDir)\.nuget</NuGetToolsPath>
55+
<ThisNugetPackagePath>$(SolutionDir2).nuget\packages\$(RootNamespace).$(REEF_NugetVersion).nupkg</ThisNugetPackagePath>
5456
</PropertyGroup>
5557

5658
<PropertyGroup>
@@ -108,12 +110,7 @@ under the License.
108110

109111
<!-- Make sure clean will clean up .nuget/packages and .nuget/nuspec directories -->
110112
<PropertyGroup>
111-
<CleanDependsOn>$(CleanDependsOn);CleanNugetPackages</CleanDependsOn>
112-
</PropertyGroup>
113-
114-
<!-- Make sure clean will clean up .nuget/packages and .nuget/nuspec directories -->
115-
<PropertyGroup>
116-
<CleanDependsOn>$(CleanDependsOn);CleanNugetPackages</CleanDependsOn>
113+
<CleanDependsOn>$(CleanDependsOn);CleanNugetPackages</CleanDependsOn>
117114
</PropertyGroup>
118115

119116
<Target Name="CheckPrerequisites">
@@ -155,12 +152,7 @@ under the License.
155152
</Target>
156153

157154
<Target Name="CleanNugetPackages">
158-
<PropertyGroup>
159-
<NuspecFilesDir>$(SolutionDir)\.nuget\nuspec</NuspecFilesDir>
160-
<PackagesDir>$(SolutionDir)\.nuget\packages</PackagesDir>
161-
</PropertyGroup>
162-
163-
<RemoveDir Directories="$(NuspecFilesDir);$(PackagesDir)" />
155+
<Delete Files="$(ThisNugetPackagePath)" />
164156
</Target>
165157

166158
<Choose>
@@ -178,7 +170,7 @@ under the License.
178170

179171
<Target Name="PushPackages" >
180172
<ItemGroup>
181-
<PackageFile Include="$(SolutionDir2).nuget\packages\$(RootNamespace).$(REEF_NugetVersion).nupkg" />
173+
<PackageFile Include="$(ThisNugetPackagePath)" />
182174
</ItemGroup>
183175

184176
<PropertyGroup>

lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ under the License.
2525
<ConfigurationType>Application</ConfigurationType>
2626
</PropertyGroup>
2727
<Import Project="$(SolutionDir)\build.props" />
28+
<Import Project="$(SolutionDir)\build.targets" />
2829
<ItemGroup Label="ProjectConfigurations">
2930
<ProjectConfiguration Include="Debug|x64">
3031
<Configuration>Debug</Configuration>

lang/cs/Org.Apache.REEF.Bridge/Org.Apache.REEF.Bridge.vcxproj.filters

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
<ClCompile Include="DriverRestartCompletedClr2Java.cpp">
120120
<Filter>Source Files</Filter>
121121
</ClCompile>
122+
<ClCompile Include="DriverLauncher.cpp">
123+
<Filter>Source Files</Filter>
124+
</ClCompile>
122125
</ItemGroup>
123126
<ItemGroup>
124127
<Text Include="ReadMe.txt" />
@@ -133,7 +136,4 @@
133136
<Filter>Resource Files</Filter>
134137
</Image>
135138
</ItemGroup>
136-
<ItemGroup>
137-
<None Include="Org.Apache.REEF.Bridge.nuspec" />
138-
</ItemGroup>
139139
</Project>

lang/cs/Org.Apache.REEF.Client.Tests/Org.Apache.REEF.Client.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ under the License.
2828
<FileAlignment>512</FileAlignment>
2929
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
3030
<TestProjectType>UnitTest</TestProjectType>
31-
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
31+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
3232
<RestorePackages>true</RestorePackages>
3333
</PropertyGroup>
3434
<Import Project="$(SolutionDir)\build.props" />

lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ under the License.
2626
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
2727
<FileAlignment>512</FileAlignment>
2828
<RestorePackages>true</RestorePackages>
29-
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
30-
<TempResxFile Condition="$(TempResxFile) == ''">$(SolutionDir)bin\$(Platform)\$(Configuration)\$(AssemblyName)\Resources.resx</TempResxFile>
29+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
3130
</PropertyGroup>
3231
<PropertyGroup>
3332
<StartupObject />
3433
</PropertyGroup>
3534
<Import Project="$(SolutionDir)\build.props" />
3635
<PropertyGroup>
36+
<TempResxFile Condition="$(TempResxFile) == ''">$(SolutionDir)bin\$(PlatformTarget)\$(Configuration)\$(AssemblyName)\Resources.resx</TempResxFile>
3737
<UseVSHostingProcess>false</UseVSHostingProcess>
3838
</PropertyGroup>
3939
<ItemGroup>
@@ -299,6 +299,7 @@ under the License.
299299
NewLineChars = "\r\n",
300300
NewLineHandling = NewLineHandling.Replace
301301
};
302+
(new FileInfo(resxOutputPath)).Directory.Create();
302303
using (var wr = XmlWriter.Create(resxOutputPath, settings))
303304
{
304305
root.WriteTo(wr);
@@ -309,6 +310,16 @@ under the License.
309310
<!--
310311
A Target that reWrites client resx to point to correct version of jars
311312
-->
313+
<Target Name="CopyJarFiles">
314+
<MSBuild Targets="Build" BuildInParallel="$(BuildInParallel)" Properties="Chip=$(Chip);Lang=$(Lang)" Projects="@(ProjectFile)" />
315+
<ItemGroup>
316+
<MySourceFiles Include="$(Bindir)\**\Org.Apache.REEF.Bridge.JAR\*.jar"/>
317+
</ItemGroup>
318+
<Copy
319+
SourceFiles="@(MySourceFiles)"
320+
DestinationFiles="@(MySourceFiles->'$(TargetDir)%(Filename)%(Extension)')"
321+
/>
322+
</Target>
312323
<Target Name="RewriteClientResources" DependsOnTargets="CopyJarFiles">
313324
<UpdateClientResources ProjectFolder="$(REEF_Source_Folder)" DebugOrRelease="$(Configuration)" resxOutputPath="$(TempResxFile)">
314325
</UpdateClientResources>
@@ -319,4 +330,4 @@ under the License.
319330
</Target>
320331
<Target Name="BeforeBuild" DependsOnTargets="$(BeforeBuildDependsOn);RewriteClientResources">
321332
</Target>
322-
</Project>
333+
</Project>

lang/cs/Org.Apache.REEF.Examples.AllHandlers/Org.Apache.REEF.Examples.AllHandlers.csproj

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,6 @@ under the License.
113113
<None Include="Readme.md" />
114114
</ItemGroup>
115115
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
116-
<!--begin jar reference-->
117-
<PropertyGroup>
118-
<AfterBuildDependsOn>
119-
$(AfterBuildDependsOn);
120-
CopyJarFiles;
121-
</AfterBuildDependsOn>
122-
</PropertyGroup>
123-
<Target Name="AfterBuild" DependsOnTargets="$(AfterBuildDependsOn);" />
124116
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
125117
<Import Project="$(PackagesDir)\StyleCop.MSBuild.4.7.49.1\build\StyleCop.MSBuild.Targets" Condition="Exists('$(PackagesDir)\StyleCop.MSBuild.4.7.49.1\build\StyleCop.MSBuild.Targets')" />
126118
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
@@ -129,5 +121,4 @@ under the License.
129121
</PropertyGroup>
130122
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
131123
</Target>
132-
<!--end jar reference-->
133-
</Project>
124+
</Project>

lang/cs/Org.Apache.REEF.IO.TestClient/Org.Apache.REEF.IO.TestClient.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ under the License.
2828
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..</SolutionDir>
2929
</PropertyGroup>
3030
<Import Project="$(SolutionDir)\build.props" />
31+
<Import Project="$(SolutionDir)\build.targets" />
3132
<PropertyGroup>
3233
<BuildPackage>false</BuildPackage>
3334
<RestorePackages>true</RestorePackages>

lang/cs/Org.Apache.REEF.Network.Examples.Client/Org.Apache.REEF.Network.Examples.Client.csproj

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,6 @@ under the License.
9898
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9999
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
100100
<Import Project="$(PackagesDir)\StyleCop.MSBuild.4.7.49.1\build\StyleCop.MSBuild.Targets" Condition="Exists('$(PackagesDir)\StyleCop.MSBuild.4.7.49.1\build\StyleCop.MSBuild.Targets')" />
101-
<!--begin jar reference-->
102-
<PropertyGroup>
103-
<AfterBuildDependsOn>
104-
$(AfterBuildDependsOn);
105-
CopyJarFiles;
106-
</AfterBuildDependsOn>
107-
</PropertyGroup>
108-
<Target Name="AfterBuild" DependsOnTargets="$(AfterBuildDependsOn);" />
109-
<!--end jar reference-->
110101
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
111102
Other similar extension points exist, see Microsoft.Common.targets.
112103
<Target Name="BeforeBuild">

lang/cs/Org.Apache.REEF.Tests/Org.Apache.REEF.Tests.csproj

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,23 +173,14 @@ under the License.
173173
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
174174
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
175175
<Import Project="$(PackagesDir)\StyleCop.MSBuild.4.7.49.1\build\StyleCop.MSBuild.Targets" Condition="Exists('$(PackagesDir)\StyleCop.MSBuild.4.7.49.1\build\StyleCop.MSBuild.Targets')" />
176-
<!--begin jar reference-->
177-
<PropertyGroup>
178-
<AfterBuildDependsOn>
179-
$(AfterBuildDependsOn);
180-
CopyJarFiles;
181-
</AfterBuildDependsOn>
182-
</PropertyGroup>
183-
<Target Name="AfterBuild" DependsOnTargets="$(AfterBuildDependsOn);" />
184176
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
185177
<PropertyGroup>
186178
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
187179
</PropertyGroup>
188180
<Error Condition="!Exists('$(SolutionDir)\packages\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '$(PackagesDir)\xunit.core.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.core.props'))" />
189181
<Error Condition="!Exists('$(SolutionDir)\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '$(PackagesDir)\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
190182
</Target>
191-
<!--end jar reference-->
192-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
183+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
193184
Other similar extension points exist, see Microsoft.Common.targets.
194185
<Target Name="BeforeBuild">
195186
</Target>

0 commit comments

Comments
 (0)