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

Commit 3049e2d

Browse files
committed
[packages,XcodeBuilder] Fixes #246. Added synchronization for more Xcode generation functions.
1 parent 1bce04a commit 3049e2d

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
18-May-2016 Fixes #246. Added synchronization for more Xcode generation functions.
2+
13
10-May-2016 ======== Version 1.0.2 beta 3 Release ========
24

35
09-May-2016 Fixes #192. Bam.Core now exposes IOWrapper.CreateDirectory and IOWrapper.CreateDirectoryIfNotExists functions, which wrap around System.IO.Directory.CreateDirectory (and System.IO.Directory.Exists for the latter), but which importantly re-throw any exceptions caught from directory creation and includes the failing path in the exception message, which the System methods do not.

packages/XcodeBuilder/bam/Scripts/Target.cs

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,16 @@ public void
183183
FileReference.EFileType type,
184184
Target.EProductType productType)
185185
{
186-
this.SetProductType(productType);
187-
188-
var fileRef = this.Project.EnsureFileReferenceExists(path, type, sourceTree: FileReference.ESourceTree.BuiltProductsDir);
189-
if (null == this.FileReference)
186+
lock (this)
190187
{
191-
this.FileReference = fileRef;
192-
this.Project.ProductRefGroup.AddChild(fileRef);
188+
this.SetProductType(productType);
189+
190+
var fileRef = this.Project.EnsureFileReferenceExists(path, type, sourceTree: FileReference.ESourceTree.BuiltProductsDir);
191+
if (null == this.FileReference)
192+
{
193+
this.FileReference = fileRef;
194+
this.Project.ProductRefGroup.AddChild(fileRef);
195+
}
193196
}
194197
}
195198

@@ -198,19 +201,21 @@ private BuildFile
198201
Bam.Core.TokenizedString path,
199202
FileReference.EFileType type)
200203
{
201-
var fileRef = this.Project.EnsureFileReferenceExists(
202-
path,
203-
type,
204-
sourceTree: FileReference.ESourceTree.Absolute);
205-
var buildFile = this.Project.EnsureBuildFileExists(fileRef, this);
206-
return buildFile;
204+
lock (this.Project)
205+
{
206+
var fileRef = this.Project.EnsureFileReferenceExists(
207+
path,
208+
type,
209+
sourceTree: FileReference.ESourceTree.Absolute);
210+
var buildFile = this.Project.EnsureBuildFileExists(fileRef, this);
211+
return buildFile;
212+
}
207213
}
208214

209215
private Group
210216
CreateGroupHierarchy(
211217
Bam.Core.TokenizedString path)
212218
{
213-
Group group = null;
214219
lock (this.Project)
215220
{
216221
var found = this.Project.GroupMap.Where(item => item.Key == path.Parse()).FirstOrDefault();
@@ -219,7 +224,7 @@ private Group
219224
return found.Value;
220225
}
221226
var basename = this.Module.CreateTokenizedString("@basename($(0))", path).Parse();
222-
group = new Group(basename);
227+
var group = new Group(basename);
223228
this.Project.Groups.Add(group);
224229
this.Project.GroupMap.Add(path.Parse(), group);
225230
if (path.Parse().Contains(System.IO.Path.DirectorySeparatorChar))
@@ -228,8 +233,8 @@ private Group
228233
var parentGroup = this.CreateGroupHierarchy(parent);
229234
parentGroup.AddChild(group);
230235
}
236+
return group;
231237
}
232-
return group;
233238
}
234239

235240
private void
@@ -311,7 +316,10 @@ public void
311316
EnsureHeaderFileExists(
312317
Bam.Core.TokenizedString path)
313318
{
314-
this.EnsureFileOfTypeExists(path, FileReference.EFileType.HeaderFile);
319+
lock (this)
320+
{
321+
this.EnsureFileOfTypeExists(path, FileReference.EFileType.HeaderFile);
322+
}
315323
}
316324

317325
public void

0 commit comments

Comments
 (0)