Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 0cdcba3

Browse files
committed
[packages,C] Fixes #90. HeaderLibraries are now considered for forwarded dependencies when required by another HeaderLibrary or StaticLibrary. This captures any dependents on that HeaderLibrary which are required by a future link step.
1 parent 8a180f9 commit 0cdcba3

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
25-Aug-2016 Fixes #90. HeaderLibraries are now considered for forwarded dependencies when required by another HeaderLibrary or StaticLibrary. This captures any dependents on that HeaderLibrary which are required by a future link step.
2+
13
25-Aug-2016 Issue #90. Added test HeaderLibraryTest2, to exercise a header library having a dependency on a static library, and an application then uses the header library. The static library dependency must be forwarded to the application link step.
24

35
23-Aug-2016 Fixes #285. VisualStudio solution files now embed a format version number dependent on the VisualC package used.

packages/C/bam/Scripts/HeaderLibrary.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,9 @@ public void
100100
{
101101
this.Requires(dependent);
102102
}
103-
else
104-
{
105-
// this delays the dependency until a link
106-
this.forwardedDeps.AddUnique(dependent);
107-
}
103+
// this delays the dependency until a link
104+
// (and recursively checks the dependent for more forwarded dependencies)
105+
this.forwardedDeps.AddUnique(dependent);
108106
}
109107
}
110108
}

packages/C/bam/Scripts/StaticLibrary.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,17 @@ public void
155155
{
156156
this.Requires(dependent);
157157
}
158-
else
158+
// this delays the dependency until a link
159+
// (and recursively checks the dependent for more forwarded dependencies)
160+
// because there is no explicit DependsOn call, perform a cyclic dependency check here too
161+
if (dependent is IForwardedLibraries)
159162
{
160-
// this delays the dependency until a link
161-
// because there is no explicit DependsOn call, perform a cyclic dependency check here too
162-
if (dependent is IForwardedLibraries)
163+
if ((dependent as IForwardedLibraries).ForwardedLibraries.Contains(this))
163164
{
164-
if ((dependent as IForwardedLibraries).ForwardedLibraries.Contains(this))
165-
{
166-
throw new Bam.Core.Exception("Cyclic dependency found between {0} and {1}", this.ToString(), dependent.ToString());
167-
}
165+
throw new Bam.Core.Exception("Cyclic dependency found between {0} and {1}", this.ToString(), dependent.ToString());
168166
}
169-
this.forwardedDeps.AddUnique(dependent);
170167
}
168+
this.forwardedDeps.AddUnique(dependent);
171169
}
172170

173171
/// <summary>

tests/bamtests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,7 @@ def configure_repository():
102102
configs["ChangeDefaultSettings"] = TestSetup(win={"Native": [visualc64, visualc32, mingw32], "VSSolution": [visualc64, visualc32]},
103103
linux={"Native": [gcc64, gcc32], "MakeFile": [gcc64, gcc32]},
104104
osx={"Native": [clang64, clang32], "MakeFile": [clang64, clang32], "Xcode": [clang64, clang32]})
105+
configs["HeaderLibraryTest2"] = TestSetup(win={"Native": [visualc64, visualc32, mingw32], "VSSolution": [visualc64, visualc32]},
106+
linux={"Native": [gcc64, gcc32], "MakeFile": [gcc64, gcc32]},
107+
osx={"Native": [clang64, clang32], "MakeFile": [clang64, clang32], "Xcode": [clang64, clang32]})
105108
return configs

0 commit comments

Comments
 (0)