Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Commit

Permalink
Duplicate package references in the module hierarchy are now unified
Browse files Browse the repository at this point in the history
Protobuild will now unify working copies of packages inside the module
hierarchy.  This means that if a parent module depends on a package, and
a submodule depends on the same package, only one instance of that
package will reside in the directory tree, and both modules will refer
to the same copy.

This works for any tree of modules / submodules, including submodules
nested multiple times.
  • Loading branch information
hach-que committed Feb 8, 2015
1 parent 372d439 commit e6b2f4c
Show file tree
Hide file tree
Showing 343 changed files with 1,214 additions and 29 deletions.
12 changes: 12 additions & 0 deletions .arcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"unit.engine": "XUnit2TestEngine",
"unit.csharp.xunit.binary": "xunit/src/xunit.console/bin/Linux/AnyCPU/Release/xunit.console.exe",
"unit.csharp.discovery": {
"(.*?)\\.cs": [
[ "Protobuild.UnitTests/Protobuild.UnitTests.Linux.csproj", "Protobuild.UnitTests/bin/Linux/AnyCPU/Debug/Protobuild.UnitTests.dll" ],
[ "Protobuild.UnitTests/Protobuild.UnitTests.Windows.csproj", "Protobuild.UnitTests/bin/Windows/AnyCPU/Debug/Protobuild.UnitTests.dll" ],
[ "Protobuild.FunctionalTests/Protobuild.FunctionalTests.Linux.csproj", "Protobuild.FunctionalTests/bin/Linux/AnyCPU/Debug/Protobuild.FunctionalTests.dll" ],
[ "Protobuild.FunctionalTests/Protobuild.FunctionalTests.Windows.csproj", "Protobuild.FunctionalTests/bin/Windows/AnyCPU/Debug/Protobuild.FunctionalTests.dll" ]
]
}
}
28 changes: 19 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,26 @@ obj
*.userprefs
*.suo
*.user
Protobuild.Tests/TestData/**/Protobuild.exe
Protobuild.FunctionalTests/TestData/**/Protobuild.exe
*.speccache
packages/repositories.config
StyleCop.Cache
/Protobuild.Tests/TestData/PackageEverythingCorrectGZip/Test.tar.gz
/Protobuild.Tests/TestData/PackageEverythingCorrectLZMA/Test.tar.lzma
/Protobuild.Tests/TestData/PackageFilterCorrect/Linux.tar.lzma
/Protobuild.Tests/TestData/PackageFilterCorrect/Windows.tar.lzma
/Protobuild.Tests/TestData/PackageFilterCorrectModuleXml/Windows.tar.lzma
/Protobuild.Tests/TestData/ExtractXSLTWorks/Build/GenerateProject.xslt
/Protobuild.Tests/TestData/ExtractXSLTWorks/Build/GenerateSolution.xslt
/Protobuild.Tests/TestData/ExtractXSLTWorks/Build/GenerateProject.CSharp.xslt
/Protobuild.FunctionalTests/TestData/PackageEverythingCorrectGZip/Test.tar.gz
/Protobuild.FunctionalTests/TestData/PackageEverythingCorrectLZMA/Test.tar.lzma
/Protobuild.FunctionalTests/TestData/PackageFilterCorrect/Linux.tar.lzma
/Protobuild.FunctionalTests/TestData/PackageFilterCorrect/Windows.tar.lzma
/Protobuild.FunctionalTests/TestData/PackageFilterCorrectModuleXml/Windows.tar.lzma
/Protobuild.FunctionalTests/TestData/ExtractXSLTWorks/Build/GenerateProject.xslt
/Protobuild.FunctionalTests/TestData/ExtractXSLTWorks/Build/GenerateSolution.xslt
/Protobuild.FunctionalTests/TestData/ExtractXSLTWorks/Build/GenerateProject.CSharp.xslt
repositories.config
/Protobuild.FunctionalTests/TestData/PackageRedirectionToLocalPath/Package/
/Protobuild.FunctionalTests/TestData/PackageLocationParentAndSubmoduleSamePackage/Package/
/Protobuild.FunctionalTests/TestData/PackageLocationParentAndSubmoduleSamePackage/Submodule/Package/.redirect
/Protobuild.FunctionalTests/TestData/PackageLocationTwoSubmoduleSamePackage/SubmoduleA/Package/
/Protobuild.FunctionalTests/TestData/PackageLocationTwoSubmoduleSamePackage/SubmoduleB/Package/.redirect
/Protobuild.FunctionalTests/TestData/PackageLocationParentAndTwoSubmoduleSamePackage/Package/
/Protobuild.FunctionalTests/TestData/PackageLocationParentAndTwoSubmoduleSamePackage/SubmoduleB/Package/.redirect
/Protobuild.FunctionalTests/TestData/PackageLocationParentAndTwoSubmoduleSamePackage/SubmoduleA/Package/.redirect
/Protobuild.FunctionalTests/TestData/PackageLocationTwoNestedSubmoduleSamePackage/SubmoduleA/NestedSubmoduleA/Package/
/Protobuild.FunctionalTests/TestData/PackageLocationTwoNestedSubmoduleSamePackage/SubmoduleB/NestedSubmoduleB/Package/.redirect
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Name="Protobuild.Tests" Path="Protobuild.Tests" Type="Library">
<Project Name="Protobuild.FunctionalTests" Path="Protobuild.FunctionalTests" Type="Library">
<Properties>
<FrameworkVersions>
<Platform Name="Windows">
Expand Down Expand Up @@ -79,6 +79,11 @@
<Compile Include="PackageEverythingFailWhenProtobuildPresent.cs" />
<Compile Include="PackageFilterCorrectModuleXmlTest.cs" />
<Compile Include="PackageFilterCorrectTest.cs" />
<Compile Include="PackageLocationParentAndSubmoduleSamePackageTest.cs" />
<Compile Include="PackageLocationParentAndTwoSubmoduleSamePackageTest.cs" />
<Compile Include="PackageLocationTwoNestedSubmoduleSamePackageTest.cs" />
<Compile Include="PackageLocationTwoSubmoduleSamePackageTest.cs" />
<Compile Include="PackageRedirectionToLocalPathTest.cs" />
<Compile Include="ProjectSpecificOutputFolderTest.cs" />
<Compile Include="ProtobuildTest.cs" />
<Compile Include="ResyncPreventedWhenSyncIsDisabledTest.cs" />
Expand Down Expand Up @@ -247,6 +252,48 @@
<None Include="TestData\PackageFilterCorrectModuleXml\Console.definition" />
<None Include="TestData\PackageFilterCorrectModuleXml\Filter.Windows.txt" />
<None Include="TestData\PackageFilterCorrectModuleXml\Module.xml" />
<None Include="TestData\PackageLocationParentAndSubmoduleSamePackage\Build\Module.xml" />
<None Include="TestData\PackageLocationParentAndSubmoduleSamePackage\Build\Projects\Console.definition" />
<None Include="TestData\PackageLocationParentAndSubmoduleSamePackage\Console\Program.cs" />
<None Include="TestData\PackageLocationParentAndSubmoduleSamePackage\Submodule\Build\Module.xml" />
<None Include="TestData\PackageLocationParentAndSubmoduleSamePackage\Submodule\Build\Projects\Library.definition" />
<None Include="TestData\PackageLocationParentAndSubmoduleSamePackage\Submodule\Library\MyClass.cs" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\Build\Module.xml" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\Build\Projects\Console.definition" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\Console\Program.cs" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\SubmoduleA\Build\Module.xml" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\SubmoduleA\Build\Projects\LibraryA.definition" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\SubmoduleA\LibraryA\MyClass.cs" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\SubmoduleB\Build\Module.xml" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\SubmoduleB\Build\Projects\LibraryB.definition" />
<None Include="TestData\PackageLocationParentAndTwoSubmoduleSamePackage\SubmoduleB\LibraryB\MyClass.cs" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\Build\Projects\Console.definition" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\Console\Program.cs" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleA\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleA\Build\Projects\LibraryA.definition" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleA\LibraryA\MyClass.cs" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleA\NestedSubmoduleA\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleA\NestedSubmoduleA\Build\Projects\NestedLibraryA.definition" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleA\NestedSubmoduleA\NestedLibraryA\MyClass.cs" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleB\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleB\Build\Projects\LibraryB.definition" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleB\LibraryB\MyClass.cs" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleB\NestedSubmoduleB\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleB\NestedSubmoduleB\Build\Projects\NestedLibraryB.definition" />
<None Include="TestData\PackageLocationTwoNestedSubmoduleSamePackage\SubmoduleB\NestedSubmoduleB\NestedLibraryB\MyClass.cs" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\Build\Projects\Console.definition" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\Console\Program.cs" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\SubmoduleA\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\SubmoduleA\Build\Projects\LibraryA.definition" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\SubmoduleA\LibraryA\MyClass.cs" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\SubmoduleB\Build\Module.xml" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\SubmoduleB\Build\Projects\LibraryB.definition" />
<None Include="TestData\PackageLocationTwoSubmoduleSamePackage\SubmoduleB\LibraryB\MyClass.cs" />
<None Include="TestData\PackageRedirectionToLocalPath\Build\Module.xml" />
<None Include="TestData\PackageRedirectionToLocalPath\Build\Projects\Console.definition" />
<None Include="TestData\PackageRedirectionToLocalPath\Console\Program.cs" />
<None Include="TestData\ProjectSpecificOutputFolder\Build\Projects\ConsoleA.definition" />
<None Include="TestData\ProjectSpecificOutputFolder\Build\Projects\ConsoleB.definition" />
<None Include="TestData\ProjectSpecificOutputFolder\ConsoleA\Program.cs" />
Expand Down Expand Up @@ -294,5 +341,9 @@
<None Include="TestData\ServicesRelativeRequire\Console\Program.cs" />
<None Include="TestData\ServicesRelativeRequire\Submodule\Build\Projects\Library.definition" />
<None Include="TestData\ServicesRelativeRequire\Submodule\Library\MyClass.cs" />
<None Include="TestData\SrcPackage\Build\Module.xml" />
<None Include="TestData\SrcPackage\Build\Projects\PackageExternal.definition" />
<None Include="TestData\SrcPackage\Build\Projects\PackageLibrary.definition" />
<None Include="TestData\SrcPackage\PackageLibrary\PackageClass.cs" />
</Files>
</Project>
7 changes: 5 additions & 2 deletions Build/Projects/Protobuild.Internal.definition
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,18 @@
<Compile Include="Packages\PackageContent\BinaryPackageContent.cs" />
<Compile Include="Packages\PackageContent\IPackageContent.cs" />
<Compile Include="Packages\PackageContent\SourcePackageContent.cs" />
<Compile Include="Packages\PackageLocator\IPackageLocator.cs" />
<Compile Include="Packages\PackageLocator\PackageLocator.cs" />
<Compile Include="Packages\PackageLookup\IPackageLookup.cs" />
<Compile Include="Packages\PackageLookup\PackageLookup.cs" />
<Compile Include="Packages\PackageManager.cs" />
<Compile Include="Packages\PackageRedirector\IPackageRedirector.cs" />
<Compile Include="Packages\PackageRedirector\PackageRedirector.cs" />
<Compile Include="Packages\PackageRetrieval\IPackageRetrieval.cs" />
<Compile Include="Packages\PackageRetrieval\PackageRetrieval.cs" />
<Compile Include="Packages\PlatformAndServiceActiveDetection.cs" />
<Compile Include="Packages\Redirection\IPackageRedirector.cs" />
<Compile Include="Packages\Redirection\PackageRedirector.cs" />
<Compile Include="Packages\Reduplicator.cs" />
<Compile Include="PathUtils.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProgressRenderer\BaseProgressRenderer.cs" />
<Compile Include="ProgressRenderer\CompressProgressRenderer.cs" />
Expand Down
27 changes: 27 additions & 0 deletions Build/Projects/Protobuild.UnitTests.definition
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Name="Protobuild.UnitTests" Path="Protobuild.UnitTests" Type="Library">
<Properties>
<FrameworkVersions>
<Platform Name="Windows">
<Version>v4.5</Version>
</Platform>
<Platform Name="MacOS">
<Version>v4.5</Version>
</Platform>
<Platform Name="Linux">
<Version>v4.5</Version>
</Platform>
</FrameworkVersions>
</Properties>
<References>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Protobuild.Internal" />
<Reference Include="xunit" />
</References>
<Files>
<Compile Include="PathUtilsTests.cs" />
</Files>
</Project>
4 changes: 2 additions & 2 deletions Build/Rebuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if ($LASTEXITCODE -ne 0) {
}

echo "Running tests..."
.\xunit\src\xunit.console\bin\Windows\AnyCPU\Debug\xunit.console.exe Protobuild.Tests\bin\$PLATFORM\AnyCPU\Release\Protobuild.Tests.dll -noshadow
.\xunit\src\xunit.console\bin\Windows\AnyCPU\Debug\xunit.console.exe Protobuild.UnitTests\bin\$PLATFORM\AnyCPU\Release\Protobuild.UnitTests.dll Protobuild.FunctionalTests\bin\$PLATFORM\AnyCPU\Release\Protobuild.FunctionalTests.dll -noshadow

echo "Copying built Protobuild to root of repository..."
copy-item -Force Protobuild\bin\$PLATFORM\AnyCPU\Release\Protobuild.exe .\Protobuild.exe
copy-item -Force Protobuild\bin\$PLATFORM\AnyCPU\Release\Protobuild.exe .\Protobuild.exe
2 changes: 1 addition & 1 deletion Build/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo "Performing final-pass build..."
xbuild /p:Configuration=Release /t:Rebuild Protobuild.$PLATFORM.sln

echo "Running tests..."
mono --debug xunit/src/xunit.console/bin/$PLATFORM/AnyCPU/Release/xunit.console.exe Protobuild.Tests/bin/$PLATFORM/AnyCPU/Release/Protobuild.Tests.dll -noshadow
mono --debug xunit/src/xunit.console/bin/$PLATFORM/AnyCPU/Release/xunit.console.exe Protobuild.UnitTests/bin/$PLATFORM/AnyCPU/Release/Protobuild.UnitTests.dll Protobuild.FunctionalTests/bin/$PLATFORM/AnyCPU/Release/Protobuild.FunctionalTests.dll -noshadow

echo "Copying built Protobuild to root of repository..."
cp Protobuild/bin/$PLATFORM/AnyCPU/Release/Protobuild.exe ./
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace Protobuild.Tests
{
using System.IO;
using Xunit;

public class PackageLocationParentAndSubmoduleSamePackageTest : ProtobuildTest
{
[Fact]
public void GenerationIsCorrect()
{
this.SetupTest("PackageLocationParentAndSubmoduleSamePackage");

var src = this.SetupSrcPackage();

// Make sure the Package directory is removed so we have a clean test every time.
if (Directory.Exists(this.GetPath("Package")))
{
Directory.Delete(this.GetPath("Package"), true);
}

this.Generate(args: "--redirect http://protobuild.org/hach-que/TestEmptyPackage local-git://" + src);

Assert.True(File.Exists(this.GetPath("Package\\PackageLibrary\\PackageLibrary.Windows.csproj")));
Assert.True(File.Exists(this.GetPath("Submodule\\Package\\.redirect")));
Assert.True(File.Exists(this.GetPath("Submodule\\Library\\Library.Windows.csproj")));
Assert.True(File.Exists(this.GetPath("Console\\Console.Windows.csproj")));

var consoleContents = this.ReadFile("Console\\Console.Windows.csproj");
var libraryContents = this.ReadFile("Submodule\\Library\\Library.Windows.csproj");

Assert.Contains(
@"Include=""..\Package\PackageLibrary\PackageLibrary.Windows.csproj""",
consoleContents);
Assert.Contains(
@"Include=""..\..\Package\PackageLibrary\PackageLibrary.Windows.csproj""",
libraryContents);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace Protobuild.Tests
{
using System.IO;
using Xunit;

public class PackageLocationParentAndTwoSubmoduleSamePackageTest : ProtobuildTest
{
[Fact]
public void GenerationIsCorrect()
{
this.SetupTest("PackageLocationParentAndTwoSubmoduleSamePackage");

var src = this.SetupSrcPackage();

// Make sure the Package directory is removed so we have a clean test every time.
if (Directory.Exists(this.GetPath("Package")))
{
Directory.Delete(this.GetPath("Package"), true);
}
if (Directory.Exists(this.GetPath("SubmoduleA\\Package")))
{
Directory.Delete(this.GetPath("SubmoduleA\\Package"), true);
}
if (Directory.Exists(this.GetPath("SubmoduleB\\Package")))
{
Directory.Delete(this.GetPath("SubmoduleB\\Package"), true);
}

this.Generate(args: "--redirect http://protobuild.org/hach-que/TestEmptyPackage local-git://" + src);

Assert.True(File.Exists(this.GetPath("Package\\PackageLibrary\\PackageLibrary.Windows.csproj")));
Assert.False(File.Exists(this.GetPath("SubmoduleA\\Package\\PackageLibrary\\PackageLibrary.Windows.csproj")));
Assert.False(File.Exists(this.GetPath("SubmoduleB\\Package\\PackageLibrary\\PackageLibrary.Windows.csproj")));
Assert.True(File.Exists(this.GetPath("SubmoduleA\\Package\\.redirect")));
Assert.True(File.Exists(this.GetPath("SubmoduleB\\Package\\.redirect")));
Assert.True(File.Exists(this.GetPath("SubmoduleA\\LibraryA\\LibraryA.Windows.csproj")));
Assert.True(File.Exists(this.GetPath("SubmoduleB\\LibraryB\\LibraryB.Windows.csproj")));

var consoleContents = this.ReadFile("Console\\Console.Windows.csproj");
var libraryAContents = this.ReadFile("SubmoduleA\\LibraryA\\LibraryA.Windows.csproj");
var libraryBContents = this.ReadFile("SubmoduleB\\LibraryB\\LibraryB.Windows.csproj");

Assert.Contains(
@"Include=""..\Package\PackageLibrary\PackageLibrary.Windows.csproj""",
consoleContents);
Assert.Contains(
@"Include=""..\..\Package\PackageLibrary\PackageLibrary.Windows.csproj""",
libraryAContents);
Assert.Contains(
@"Include=""..\..\Package\PackageLibrary\PackageLibrary.Windows.csproj""",
libraryBContents);
}
}
}
Loading

0 comments on commit e6b2f4c

Please sign in to comment.