kintsugi 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kintsugi/apply_change_to_project.rb +262 -65
- data/lib/kintsugi/cli.rb +7 -0
- data/lib/kintsugi/settings.rb +18 -0
- data/lib/kintsugi/version.rb +1 -1
- data/spec/kintsugi_apply_change_to_project_spec.rb +292 -111
- metadata +4 -3
@@ -34,7 +34,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
34
34
|
changes_to_apply = get_diff(theirs_project, base_project)
|
35
35
|
|
36
36
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
37
|
-
base_project.save
|
38
37
|
|
39
38
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
40
39
|
end
|
@@ -46,7 +45,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
46
45
|
changes_to_apply = get_diff(theirs_project, base_project)
|
47
46
|
|
48
47
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
49
|
-
base_project.save
|
50
48
|
|
51
49
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
52
50
|
end
|
@@ -60,7 +58,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
60
58
|
changes_to_apply = get_diff(theirs_project, base_project)
|
61
59
|
|
62
60
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
63
|
-
base_project.save
|
64
61
|
|
65
62
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
66
63
|
end
|
@@ -72,29 +69,29 @@ describe Kintsugi, :apply_change_to_project do
|
|
72
69
|
changes_to_apply = get_diff(theirs_project, base_project)
|
73
70
|
|
74
71
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
75
|
-
base_project.save
|
76
72
|
|
77
73
|
expect(base_project).to be_equivalent_to_project(theirs_project, ignore_keys: ["containerPortal"])
|
78
74
|
end
|
79
75
|
|
80
|
-
it "
|
81
|
-
|
76
|
+
it "removes reference proxy from subproject with the same display name as another reference proxy" do
|
77
|
+
framework_filename = "baz"
|
78
|
+
subproject = add_new_subproject_to_project(base_project, "subproj", framework_filename)
|
82
79
|
|
83
|
-
subproject
|
84
|
-
|
80
|
+
subproject.new_target("com.apple.product-type.library.static", framework_filename, :ios)
|
81
|
+
base_project.root_object.project_references[0][:product_group] <<
|
82
|
+
create_reference_proxy_from_product_reference(base_project,
|
83
|
+
base_project.root_object.project_references[0][:project_ref],
|
84
|
+
subproject.products_group.files[-1])
|
85
|
+
base_project.save
|
85
86
|
|
86
|
-
|
87
|
-
|
87
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
88
|
+
theirs_project.root_object.project_references[0][:product_group].children[-1].remove_from_project
|
88
89
|
|
89
90
|
changes_to_apply = get_diff(theirs_project, base_project)
|
90
91
|
|
91
|
-
described_class.apply_change_to_project(
|
92
|
-
ours_project.save
|
92
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
93
93
|
|
94
|
-
expect(
|
95
|
-
.not_to equal(ours_project.root_object.project_references[1][:project_ref].uuid)
|
96
|
-
expect(ours_project.root_object.project_references[0][:project_ref].proxy_containers).not_to be_empty
|
97
|
-
expect(ours_project.root_object.project_references[1][:project_ref].proxy_containers).not_to be_empty
|
94
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
98
95
|
end
|
99
96
|
|
100
97
|
# Checks that the order the changes are applied in is correct.
|
@@ -110,7 +107,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
110
107
|
changes_to_apply = get_diff(theirs_project, base_project)
|
111
108
|
|
112
109
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
113
|
-
base_project.save
|
114
110
|
|
115
111
|
expect(base_project).to be_equivalent_to_project(theirs_project, ignore_keys: ["containerPortal"])
|
116
112
|
end
|
@@ -152,11 +148,28 @@ describe Kintsugi, :apply_change_to_project do
|
|
152
148
|
changes_to_apply = get_diff(theirs_project, base_project)
|
153
149
|
|
154
150
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
155
|
-
base_project.save
|
156
151
|
|
157
152
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
158
153
|
end
|
159
154
|
|
155
|
+
it "raises when a file is split into two" do
|
156
|
+
base_project.main_group.find_subpath("new_group", true)
|
157
|
+
base_project.main_group.find_subpath("new_group2", true)
|
158
|
+
base_project.save
|
159
|
+
|
160
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
161
|
+
new_group = theirs_project.main_group.find_subpath("new_group")
|
162
|
+
file_reference = theirs_project.main_group.find_file_by_path(filepath)
|
163
|
+
file_reference.move(new_group)
|
164
|
+
theirs_project.main_group.find_subpath("new_group2").new_reference(filepath)
|
165
|
+
|
166
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
167
|
+
|
168
|
+
expect {
|
169
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
170
|
+
}.to raise_error(Kintsugi::MergeError)
|
171
|
+
end
|
172
|
+
|
160
173
|
it "adds file to new group" do
|
161
174
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
162
175
|
|
@@ -165,8 +178,21 @@ describe Kintsugi, :apply_change_to_project do
|
|
165
178
|
changes_to_apply = get_diff(theirs_project, base_project)
|
166
179
|
|
167
180
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
181
|
+
|
182
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
183
|
+
end
|
184
|
+
|
185
|
+
it "removes group" do
|
186
|
+
base_project.main_group.find_subpath("new_group", true)
|
168
187
|
base_project.save
|
169
188
|
|
189
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
190
|
+
theirs_project["new_group"].remove_from_project
|
191
|
+
|
192
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
193
|
+
|
194
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
195
|
+
|
170
196
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
171
197
|
end
|
172
198
|
|
@@ -179,7 +205,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
179
205
|
changes_to_apply = get_diff(theirs_project, base_project)
|
180
206
|
|
181
207
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
182
|
-
base_project.save
|
183
208
|
|
184
209
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
185
210
|
end
|
@@ -203,7 +228,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
203
228
|
changes_to_apply = get_diff(theirs_project, base_project)
|
204
229
|
|
205
230
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
206
|
-
base_project.save
|
207
231
|
|
208
232
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
209
233
|
end
|
@@ -225,6 +249,22 @@ describe Kintsugi, :apply_change_to_project do
|
|
225
249
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
226
250
|
end
|
227
251
|
|
252
|
+
it "ignores removal of a non-existent group" do
|
253
|
+
base_project.main_group.find_subpath("new_group", true)
|
254
|
+
base_project.save
|
255
|
+
|
256
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
257
|
+
theirs_project.main_group.children.delete_at(-1)
|
258
|
+
|
259
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
260
|
+
|
261
|
+
base_project.main_group.children.delete_at(-1)
|
262
|
+
|
263
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
264
|
+
|
265
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
266
|
+
end
|
267
|
+
|
228
268
|
it "removes build files of a removed file" do
|
229
269
|
target = base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
|
230
270
|
target.source_build_phase.add_file_reference(
|
@@ -244,7 +284,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
244
284
|
changes_to_apply = get_diff(theirs_project, base_project)
|
245
285
|
|
246
286
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
247
|
-
base_project.save
|
248
287
|
|
249
288
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
250
289
|
end
|
@@ -260,7 +299,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
260
299
|
changes_to_apply = get_diff(theirs_project, base_project)
|
261
300
|
|
262
301
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
263
|
-
base_project.save
|
264
302
|
|
265
303
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
266
304
|
end
|
@@ -275,25 +313,21 @@ describe Kintsugi, :apply_change_to_project do
|
|
275
313
|
changes_to_apply = get_diff(theirs_project, base_project)
|
276
314
|
|
277
315
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
278
|
-
base_project.save
|
279
316
|
|
280
317
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
281
318
|
end
|
282
319
|
|
283
320
|
it "handles moved file to an existing group with a different path on filesystem" do
|
284
321
|
base_project.main_group.find_subpath("new_group", true).path = "some_path"
|
285
|
-
|
286
322
|
base_project.save
|
287
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
288
323
|
|
324
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
289
325
|
new_group = theirs_project.main_group.find_subpath("new_group")
|
290
|
-
|
291
326
|
theirs_project.main_group.find_file_by_path(filepath).move(new_group)
|
292
327
|
|
293
328
|
changes_to_apply = get_diff(theirs_project, base_project)
|
294
329
|
|
295
330
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
296
|
-
base_project.save
|
297
331
|
|
298
332
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
299
333
|
end
|
@@ -312,7 +346,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
312
346
|
ours_project_before_applying_changes = create_copy_of_project(ours_project.path, "ours")
|
313
347
|
|
314
348
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
315
|
-
ours_project.save
|
316
349
|
|
317
350
|
expect(ours_project).to be_equivalent_to_project(ours_project_before_applying_changes)
|
318
351
|
end
|
@@ -330,7 +363,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
330
363
|
ours_project_before_applying_changes = create_copy_of_project(ours_project.path, "ours")
|
331
364
|
|
332
365
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
333
|
-
ours_project.save
|
334
366
|
|
335
367
|
expect(ours_project).to be_equivalent_to_project(ours_project_before_applying_changes)
|
336
368
|
end
|
@@ -348,7 +380,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
348
380
|
ours_project_before_applying_changes = create_copy_of_project(ours_project.path, "ours")
|
349
381
|
|
350
382
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
351
|
-
ours_project.save
|
352
383
|
|
353
384
|
expect(ours_project).to be_equivalent_to_project(ours_project_before_applying_changes)
|
354
385
|
end
|
@@ -363,7 +394,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
363
394
|
changes_to_apply = get_diff(theirs_project, base_project)
|
364
395
|
|
365
396
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
366
|
-
ours_project.save
|
367
397
|
|
368
398
|
expect(ours_project).to be_equivalent_to_project(theirs_project)
|
369
399
|
end
|
@@ -377,6 +407,54 @@ describe Kintsugi, :apply_change_to_project do
|
|
377
407
|
base_project.save
|
378
408
|
end
|
379
409
|
|
410
|
+
it "moves file that is referenced by a target from main group to a new group" do
|
411
|
+
file_reference = base_project.main_group.new_reference("bar")
|
412
|
+
base_project.targets[0].source_build_phase.add_file_reference(file_reference)
|
413
|
+
base_project.save
|
414
|
+
|
415
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
416
|
+
new_group = theirs_project.main_group.find_subpath("new_group", true)
|
417
|
+
file_reference = theirs_project.main_group.find_file_by_path("bar")
|
418
|
+
file_reference.move(new_group)
|
419
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
420
|
+
|
421
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
422
|
+
|
423
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
424
|
+
end
|
425
|
+
|
426
|
+
it "moves file that is referenced by a target from a group to the main group" do
|
427
|
+
file_reference = base_project.main_group.find_subpath("new_group", true).new_reference("bar")
|
428
|
+
base_project.targets[0].source_build_phase.add_file_reference(file_reference)
|
429
|
+
base_project.save
|
430
|
+
|
431
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
432
|
+
file_reference = theirs_project["new_group/bar"]
|
433
|
+
file_reference.move(theirs_project.main_group)
|
434
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
435
|
+
|
436
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
437
|
+
|
438
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
439
|
+
end
|
440
|
+
|
441
|
+
it "moves file that is referenced by a target and has a different file encoding" do
|
442
|
+
file_reference = base_project.main_group.find_subpath("new_group", true).new_reference("bar")
|
443
|
+
target.frameworks_build_phase.add_file_reference(file_reference)
|
444
|
+
base_project.save
|
445
|
+
|
446
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
447
|
+
file_reference = theirs_project["new_group/bar"]
|
448
|
+
file_reference.move(theirs_project.main_group)
|
449
|
+
file_reference.fileEncoding = "4"
|
450
|
+
|
451
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
452
|
+
|
453
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
454
|
+
|
455
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
456
|
+
end
|
457
|
+
|
380
458
|
it "changes framework from file reference to reference proxy" do
|
381
459
|
framework_filename = "baz"
|
382
460
|
|
@@ -389,7 +467,7 @@ describe Kintsugi, :apply_change_to_project do
|
|
389
467
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
390
468
|
|
391
469
|
build_phase = theirs_project.targets[0].frameworks_build_phase
|
392
|
-
build_phase.files
|
470
|
+
build_phase.files.find { |build_file| build_file.display_name == "baz" }.remove_from_project
|
393
471
|
build_phase.add_file_reference(
|
394
472
|
theirs_project.root_object.project_references[0][:product_group].children[0]
|
395
473
|
)
|
@@ -397,7 +475,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
397
475
|
changes_to_apply = get_diff(theirs_project, base_project)
|
398
476
|
|
399
477
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
400
|
-
base_project.save
|
401
478
|
|
402
479
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
403
480
|
end
|
@@ -410,7 +487,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
410
487
|
changes_to_apply = get_diff(theirs_project, base_project)
|
411
488
|
|
412
489
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
413
|
-
base_project.save
|
414
490
|
|
415
491
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
416
492
|
end
|
@@ -440,7 +516,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
440
516
|
# hierarchy.
|
441
517
|
base_project.files[-1].name = "foo"
|
442
518
|
theirs_project.files[-1].name = "foo"
|
443
|
-
base_project.save
|
444
519
|
|
445
520
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
446
521
|
end
|
@@ -467,7 +542,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
467
542
|
changes_to_apply["rootObject"].delete("projectReferences")
|
468
543
|
|
469
544
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
470
|
-
base_project.save
|
471
545
|
|
472
546
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
473
547
|
end
|
@@ -494,7 +568,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
494
568
|
changes_to_apply = get_diff(theirs_project, base_project)
|
495
569
|
|
496
570
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
497
|
-
base_project.save
|
498
571
|
|
499
572
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
500
573
|
end
|
@@ -511,7 +584,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
511
584
|
changes_to_apply = get_diff(theirs_project, base_project)
|
512
585
|
|
513
586
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
514
|
-
base_project.save
|
515
587
|
|
516
588
|
expect(base_project).to be_equivalent_to_project(theirs_project, ignore_keys: ["containerPortal"])
|
517
589
|
end
|
@@ -531,16 +603,13 @@ describe Kintsugi, :apply_change_to_project do
|
|
531
603
|
changes_to_apply = get_diff(theirs_project, base_project)
|
532
604
|
|
533
605
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
534
|
-
base_project.save
|
535
606
|
|
536
607
|
expect(base_project).to be_equivalent_to_project(theirs_project, ignore_keys: ["containerPortal"])
|
537
608
|
end
|
538
609
|
|
539
610
|
it "adds build file to a file reference that already exists" do
|
540
611
|
base_project.main_group.new_reference("bar")
|
541
|
-
|
542
612
|
base_project.main_group.new_reference("bar")
|
543
|
-
|
544
613
|
base_project.save
|
545
614
|
|
546
615
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
@@ -554,17 +623,14 @@ describe Kintsugi, :apply_change_to_project do
|
|
554
623
|
changes_to_apply = get_diff(theirs_project, base_project)
|
555
624
|
|
556
625
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
557
|
-
base_project.save
|
558
626
|
|
559
627
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
560
628
|
end
|
561
629
|
|
562
630
|
it "adds file reference to build file" do
|
563
631
|
file_reference = base_project.main_group.new_reference("bar")
|
564
|
-
|
565
632
|
build_file = base_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
|
566
633
|
build_file.file_ref = nil
|
567
|
-
|
568
634
|
base_project.save
|
569
635
|
|
570
636
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
@@ -575,7 +641,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
575
641
|
changes_to_apply = get_diff(theirs_project, base_project)
|
576
642
|
|
577
643
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
578
|
-
base_project.save
|
579
644
|
|
580
645
|
expect(base_project).to be_equivalent_to_project(theirs_project, ignore_keys: ["containerPortal"])
|
581
646
|
end
|
@@ -585,7 +650,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
585
650
|
base_project.save
|
586
651
|
|
587
652
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
588
|
-
|
589
653
|
file_reference = theirs_project.main_group.files.find { |file| file.display_name == "bar" }
|
590
654
|
build_file =
|
591
655
|
theirs_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
|
@@ -595,7 +659,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
595
659
|
|
596
660
|
other_project = create_copy_of_project(base_project.path, "other")
|
597
661
|
described_class.apply_change_to_project(other_project, changes_to_apply)
|
598
|
-
other_project.save
|
599
662
|
|
600
663
|
expect(other_project).to be_equivalent_to_project(base_project)
|
601
664
|
end
|
@@ -621,7 +684,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
621
684
|
changes_to_apply = get_diff(theirs_project, base_project)
|
622
685
|
|
623
686
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
624
|
-
base_project.save
|
625
687
|
|
626
688
|
expect(base_project).to be_equivalent_to_project(theirs_project, ignore_keys: ["containerPortal"])
|
627
689
|
end
|
@@ -637,7 +699,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
637
699
|
changes_to_apply = get_diff(theirs_project, base_project)
|
638
700
|
|
639
701
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
640
|
-
base_project.save
|
641
702
|
|
642
703
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
643
704
|
end
|
@@ -646,7 +707,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
646
707
|
base_project.targets[0].build_configurations.each do |configuration|
|
647
708
|
configuration.build_settings = {}
|
648
709
|
end
|
649
|
-
|
650
710
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
651
711
|
|
652
712
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
@@ -659,7 +719,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
659
719
|
changes_to_apply = get_diff(theirs_project, base_project)
|
660
720
|
|
661
721
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
662
|
-
base_project.save
|
663
722
|
|
664
723
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
665
724
|
end
|
@@ -677,7 +736,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
677
736
|
changes_to_apply = get_diff(theirs_project, base_project)
|
678
737
|
|
679
738
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
680
|
-
base_project.save
|
681
739
|
|
682
740
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
683
741
|
end
|
@@ -701,7 +759,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
701
759
|
changes_to_apply = get_diff(theirs_project, base_project)
|
702
760
|
|
703
761
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
704
|
-
base_project.save
|
705
762
|
|
706
763
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
707
764
|
end
|
@@ -718,10 +775,8 @@ describe Kintsugi, :apply_change_to_project do
|
|
718
775
|
ours_project.targets[0].build_configurations.each do |configuration|
|
719
776
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
|
720
777
|
end
|
721
|
-
ours_project.save
|
722
778
|
|
723
779
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
724
|
-
ours_project.save
|
725
780
|
|
726
781
|
expected_project = create_copy_of_project(base_project.path, "expected")
|
727
782
|
expected_project.targets[0].build_configurations.each do |configuration|
|
@@ -742,10 +797,8 @@ describe Kintsugi, :apply_change_to_project do
|
|
742
797
|
ours_project.targets[0].build_configurations.each do |configuration|
|
743
798
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo]
|
744
799
|
end
|
745
|
-
ours_project.save
|
746
800
|
|
747
801
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
748
|
-
ours_project.save
|
749
802
|
|
750
803
|
expected_project = create_copy_of_project(base_project.path, "expected")
|
751
804
|
expected_project.targets[0].build_configurations.each do |configuration|
|
@@ -761,10 +814,9 @@ describe Kintsugi, :apply_change_to_project do
|
|
761
814
|
"$(SRCROOT)/../Bar"
|
762
815
|
]
|
763
816
|
end
|
764
|
-
|
765
817
|
base_project.save
|
766
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
767
818
|
|
819
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
768
820
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
769
821
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = nil
|
770
822
|
end
|
@@ -772,7 +824,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
772
824
|
changes_to_apply = get_diff(theirs_project, base_project)
|
773
825
|
|
774
826
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
775
|
-
base_project.save
|
776
827
|
|
777
828
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
778
829
|
end
|
@@ -781,10 +832,9 @@ describe Kintsugi, :apply_change_to_project do
|
|
781
832
|
base_project.targets[0].build_configurations.each do |configuration|
|
782
833
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
|
783
834
|
end
|
784
|
-
|
785
835
|
base_project.save
|
786
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
787
836
|
|
837
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
788
838
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
789
839
|
configuration.build_settings =
|
790
840
|
configuration.build_settings.reject { |key, _| key == "HEADER_SEARCH_PATHS" }
|
@@ -793,7 +843,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
793
843
|
changes_to_apply = get_diff(theirs_project, base_project)
|
794
844
|
|
795
845
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
796
|
-
base_project.save
|
797
846
|
|
798
847
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
799
848
|
end
|
@@ -802,8 +851,8 @@ describe Kintsugi, :apply_change_to_project do
|
|
802
851
|
base_project.targets[0].build_configurations.each do |configuration|
|
803
852
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
|
804
853
|
end
|
805
|
-
|
806
854
|
base_project.save
|
855
|
+
|
807
856
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
808
857
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
809
858
|
configuration.build_settings = nil
|
@@ -812,7 +861,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
812
861
|
changes_to_apply = get_diff(theirs_project, base_project)
|
813
862
|
|
814
863
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
815
|
-
base_project.save
|
816
864
|
|
817
865
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
818
866
|
end
|
@@ -822,8 +870,8 @@ describe Kintsugi, :apply_change_to_project do
|
|
822
870
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
|
823
871
|
configuration.build_settings["foo"] = "baz"
|
824
872
|
end
|
825
|
-
|
826
873
|
base_project.save
|
874
|
+
|
827
875
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
828
876
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
829
877
|
configuration.build_settings = nil
|
@@ -837,7 +885,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
837
885
|
changes_to_apply = get_diff(theirs_project, base_project)
|
838
886
|
|
839
887
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
840
|
-
base_project.save
|
841
888
|
|
842
889
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
843
890
|
end
|
@@ -858,7 +905,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
858
905
|
changes_to_apply = get_diff(theirs_project, before_theirs_project)
|
859
906
|
|
860
907
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
861
|
-
base_project.save
|
862
908
|
|
863
909
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
864
910
|
end
|
@@ -879,7 +925,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
879
925
|
changes_to_apply = get_diff(theirs_project, before_theirs_project)
|
880
926
|
|
881
927
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
882
|
-
base_project.save
|
883
928
|
|
884
929
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
885
930
|
end
|
@@ -940,10 +985,9 @@ describe Kintsugi, :apply_change_to_project do
|
|
940
985
|
base_project.targets[0].build_configurations.each do |configuration|
|
941
986
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo]
|
942
987
|
end
|
943
|
-
|
944
988
|
base_project.save
|
945
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
946
989
|
|
990
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
947
991
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
948
992
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = "baz"
|
949
993
|
end
|
@@ -951,7 +995,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
951
995
|
changes_to_apply = get_diff(theirs_project, base_project)
|
952
996
|
|
953
997
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
954
|
-
base_project.save
|
955
998
|
|
956
999
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
957
1000
|
end
|
@@ -960,10 +1003,9 @@ describe Kintsugi, :apply_change_to_project do
|
|
960
1003
|
base_project.targets[0].build_configurations.each do |configuration|
|
961
1004
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
|
962
1005
|
end
|
963
|
-
|
964
1006
|
base_project.save
|
965
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
966
1007
|
|
1008
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
967
1009
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
968
1010
|
configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[baz foo]
|
969
1011
|
end
|
@@ -971,7 +1013,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
971
1013
|
changes_to_apply = get_diff(theirs_project, base_project)
|
972
1014
|
|
973
1015
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
974
|
-
base_project.save
|
975
1016
|
|
976
1017
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
977
1018
|
end
|
@@ -998,7 +1039,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
998
1039
|
changes_to_apply = get_diff(theirs_project, before_theirs_project)
|
999
1040
|
|
1000
1041
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1001
|
-
base_project.save
|
1002
1042
|
|
1003
1043
|
expect(base_project).to be_equivalent_to_project(expected_project)
|
1004
1044
|
end
|
@@ -1062,37 +1102,32 @@ describe Kintsugi, :apply_change_to_project do
|
|
1062
1102
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1063
1103
|
|
1064
1104
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1065
|
-
base_project.save
|
1066
1105
|
|
1067
1106
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1068
1107
|
end
|
1069
1108
|
|
1070
1109
|
it "adds build phase with a simple attribute value that has non nil default" do
|
1071
1110
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1072
|
-
|
1073
1111
|
theirs_project.targets[0].new_shell_script_build_phase("bar")
|
1074
1112
|
theirs_project.targets[0].build_phases.last.shell_script = "Other value"
|
1075
1113
|
|
1076
1114
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1077
1115
|
|
1078
1116
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1079
|
-
base_project.save
|
1080
1117
|
|
1081
1118
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1082
1119
|
end
|
1083
1120
|
|
1084
1121
|
it "removes build phase" do
|
1085
1122
|
base_project.targets[0].new_shell_script_build_phase("bar")
|
1086
|
-
|
1087
1123
|
base_project.save
|
1088
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1089
1124
|
|
1125
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1090
1126
|
theirs_project.targets[0].shell_script_build_phases[0].remove_from_project
|
1091
1127
|
|
1092
1128
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1093
1129
|
|
1094
1130
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1095
|
-
base_project.save
|
1096
1131
|
|
1097
1132
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1098
1133
|
end
|
@@ -1102,33 +1137,29 @@ describe Kintsugi, :apply_change_to_project do
|
|
1102
1137
|
file = variant_group.new_reference("Base")
|
1103
1138
|
file.last_known_file_type = "text.plist.strings"
|
1104
1139
|
target.resources_build_phase.add_file_reference(variant_group)
|
1105
|
-
|
1106
1140
|
base_project.save
|
1107
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1108
1141
|
|
1142
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1109
1143
|
theirs_variant_group = theirs_project.main_group.find_subpath("foo.strings")
|
1110
1144
|
theirs_variant_group.new_reference("en")
|
1111
1145
|
|
1112
1146
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1113
1147
|
|
1114
1148
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1115
|
-
base_project.save
|
1116
1149
|
|
1117
1150
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1118
1151
|
end
|
1119
1152
|
|
1120
1153
|
it "adds target dependency" do
|
1121
1154
|
base_project.new_target("com.apple.product-type.library.static", "bar", :ios)
|
1122
|
-
|
1123
1155
|
base_project.save
|
1124
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1125
1156
|
|
1157
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1126
1158
|
theirs_project.targets[1].add_dependency(theirs_project.targets[0])
|
1127
1159
|
|
1128
1160
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1129
1161
|
|
1130
1162
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1131
|
-
base_project.save
|
1132
1163
|
|
1133
1164
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1134
1165
|
end
|
@@ -1137,10 +1168,9 @@ describe Kintsugi, :apply_change_to_project do
|
|
1137
1168
|
base_project.targets[0].build_configurations.each do |configuration|
|
1138
1169
|
configuration.build_settings["GCC_PREFIX_HEADER"] = "foo"
|
1139
1170
|
end
|
1140
|
-
|
1141
1171
|
base_project.save
|
1142
|
-
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1143
1172
|
|
1173
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1144
1174
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
1145
1175
|
configuration.build_settings["GCC_PREFIX_HEADER"] = "bar"
|
1146
1176
|
end
|
@@ -1148,16 +1178,13 @@ describe Kintsugi, :apply_change_to_project do
|
|
1148
1178
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1149
1179
|
|
1150
1180
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1151
|
-
base_project.save
|
1152
1181
|
|
1153
1182
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1154
1183
|
end
|
1155
1184
|
|
1156
1185
|
it "adds build settings to new target" do
|
1157
1186
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1158
|
-
|
1159
1187
|
theirs_project.new_target("com.apple.product-type.library.static", "bar", :ios)
|
1160
|
-
|
1161
1188
|
theirs_project.targets[1].build_configurations.each do |configuration|
|
1162
1189
|
configuration.build_settings["GCC_PREFIX_HEADER"] = "baz"
|
1163
1190
|
end
|
@@ -1165,7 +1192,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
1165
1192
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1166
1193
|
|
1167
1194
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1168
|
-
base_project.save
|
1169
1195
|
|
1170
1196
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1171
1197
|
end
|
@@ -1174,7 +1200,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
1174
1200
|
base_project.main_group.new_reference("baz")
|
1175
1201
|
|
1176
1202
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1177
|
-
|
1178
1203
|
configuration_reference = theirs_project.main_group.find_subpath("baz")
|
1179
1204
|
theirs_project.targets[0].build_configurations.each do |configuration|
|
1180
1205
|
configuration.base_configuration_reference = configuration_reference
|
@@ -1183,35 +1208,29 @@ describe Kintsugi, :apply_change_to_project do
|
|
1183
1208
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1184
1209
|
|
1185
1210
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1186
|
-
base_project.save
|
1187
1211
|
|
1188
1212
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1189
1213
|
end
|
1190
1214
|
end
|
1191
1215
|
|
1192
1216
|
it "adds known regions" do
|
1193
|
-
base_project.save
|
1194
1217
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1195
|
-
|
1196
1218
|
theirs_project.root_object.known_regions += ["fr"]
|
1197
1219
|
|
1198
1220
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1199
1221
|
|
1200
1222
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1201
|
-
base_project.save
|
1202
1223
|
|
1203
1224
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1204
1225
|
end
|
1205
1226
|
|
1206
1227
|
it "removes known regions" do
|
1207
1228
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1208
|
-
|
1209
1229
|
theirs_project.root_object.known_regions = nil
|
1210
1230
|
|
1211
1231
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1212
1232
|
|
1213
1233
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1214
|
-
base_project.save
|
1215
1234
|
|
1216
1235
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1217
1236
|
end
|
@@ -1225,7 +1244,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
1225
1244
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1226
1245
|
|
1227
1246
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1228
|
-
base_project.save
|
1229
1247
|
|
1230
1248
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1231
1249
|
end
|
@@ -1235,14 +1253,12 @@ describe Kintsugi, :apply_change_to_project do
|
|
1235
1253
|
base_project.save
|
1236
1254
|
|
1237
1255
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1238
|
-
|
1239
1256
|
theirs_project.root_object.attributes["TargetAttributes"] =
|
1240
1257
|
{"foo" => {"LastSwiftMigration" => "1140"}}
|
1241
1258
|
|
1242
1259
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1243
1260
|
|
1244
1261
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1245
|
-
base_project.save
|
1246
1262
|
|
1247
1263
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1248
1264
|
end
|
@@ -1252,14 +1268,12 @@ describe Kintsugi, :apply_change_to_project do
|
|
1252
1268
|
base_project.save
|
1253
1269
|
|
1254
1270
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1255
|
-
|
1256
1271
|
theirs_project.root_object.attributes["TargetAttributes"] =
|
1257
1272
|
{"foo" => {"LastSwiftMigration" => "1140"}}
|
1258
1273
|
|
1259
1274
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1260
1275
|
|
1261
1276
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1262
|
-
base_project.save
|
1263
1277
|
|
1264
1278
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1265
1279
|
end
|
@@ -1270,13 +1284,11 @@ describe Kintsugi, :apply_change_to_project do
|
|
1270
1284
|
base_project.save
|
1271
1285
|
|
1272
1286
|
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1273
|
-
|
1274
1287
|
theirs_project.root_object.attributes["TargetAttributes"]["foo"] = {}
|
1275
1288
|
|
1276
1289
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1277
1290
|
|
1278
1291
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1279
|
-
base_project.save
|
1280
1292
|
|
1281
1293
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1282
1294
|
end
|
@@ -1295,7 +1307,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
1295
1307
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1296
1308
|
|
1297
1309
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
1298
|
-
ours_project.save
|
1299
1310
|
|
1300
1311
|
expect(ours_project).to be_equivalent_to_project(theirs_project)
|
1301
1312
|
end
|
@@ -1313,7 +1324,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
1313
1324
|
changes_to_apply = get_diff(theirs_project, base_project)
|
1314
1325
|
|
1315
1326
|
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
1316
|
-
ours_project.save
|
1317
1327
|
|
1318
1328
|
expect(ours_project).to be_equivalent_to_project(theirs_project)
|
1319
1329
|
end
|
@@ -1341,7 +1351,6 @@ describe Kintsugi, :apply_change_to_project do
|
|
1341
1351
|
changes_to_apply = get_diff(ours_project, theirs_project)
|
1342
1352
|
|
1343
1353
|
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1344
|
-
base_project.save
|
1345
1354
|
|
1346
1355
|
expect(base_project).to be_equivalent_to_project(ours_project, ignore_keys: ["containerPortal"])
|
1347
1356
|
end
|
@@ -1365,6 +1374,30 @@ describe Kintsugi, :apply_change_to_project do
|
|
1365
1374
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1366
1375
|
end
|
1367
1376
|
|
1377
|
+
it "adds build configuration list" do
|
1378
|
+
base_project.root_object.build_configuration_list = nil
|
1379
|
+
base_project.save
|
1380
|
+
|
1381
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1382
|
+
theirs_project.root_object.build_configuration_list =
|
1383
|
+
theirs_project.new(Xcodeproj::Project::XCConfigurationList)
|
1384
|
+
|
1385
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1386
|
+
|
1387
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1388
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1389
|
+
end
|
1390
|
+
|
1391
|
+
it "removes build configuration list" do
|
1392
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1393
|
+
theirs_project.build_configuration_list.remove_from_project
|
1394
|
+
|
1395
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1396
|
+
|
1397
|
+
described_class.apply_change_to_project(base_project, changes_to_apply)
|
1398
|
+
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1399
|
+
end
|
1400
|
+
|
1368
1401
|
it "adds group to product group" do
|
1369
1402
|
base_project_path = make_temp_directory("base", ".xcodeproj")
|
1370
1403
|
base_project = Xcodeproj::Project.new(base_project_path)
|
@@ -1400,6 +1433,154 @@ describe Kintsugi, :apply_change_to_project do
|
|
1400
1433
|
expect(base_project).to be_equivalent_to_project(theirs_project)
|
1401
1434
|
end
|
1402
1435
|
|
1436
|
+
describe "avoiding duplicate references to the same component" do
|
1437
|
+
it "avoids adding file reference that already exists" do
|
1438
|
+
base_project.main_group.new_reference("bar")
|
1439
|
+
base_project.save
|
1440
|
+
|
1441
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1442
|
+
theirs_project.main_group.new_reference("bar")
|
1443
|
+
|
1444
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1445
|
+
other_project = create_copy_of_project(base_project.path, "theirs")
|
1446
|
+
described_class.apply_change_to_project(other_project, changes_to_apply)
|
1447
|
+
|
1448
|
+
expect(other_project).to be_equivalent_to_project(base_project)
|
1449
|
+
end
|
1450
|
+
|
1451
|
+
it "avoids adding group that already exists" do
|
1452
|
+
base_project.main_group.new_group("bar")
|
1453
|
+
base_project.save
|
1454
|
+
|
1455
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1456
|
+
theirs_project.main_group.new_group("bar")
|
1457
|
+
|
1458
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1459
|
+
other_project = create_copy_of_project(base_project.path, "theirs")
|
1460
|
+
described_class.apply_change_to_project(other_project, changes_to_apply)
|
1461
|
+
|
1462
|
+
expect(other_project).to be_equivalent_to_project(base_project)
|
1463
|
+
end
|
1464
|
+
|
1465
|
+
it "avoids adding variant group that already exists" do
|
1466
|
+
base_project.main_group.new_variant_group("bar")
|
1467
|
+
base_project.save
|
1468
|
+
|
1469
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1470
|
+
theirs_project.main_group.new_variant_group("bar")
|
1471
|
+
|
1472
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1473
|
+
other_project = create_copy_of_project(base_project.path, "theirs")
|
1474
|
+
described_class.apply_change_to_project(other_project, changes_to_apply)
|
1475
|
+
|
1476
|
+
expect(other_project).to be_equivalent_to_project(base_project)
|
1477
|
+
end
|
1478
|
+
|
1479
|
+
it "avoids adding subproject that already exists" do
|
1480
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1481
|
+
|
1482
|
+
subproject = add_new_subproject_to_project(theirs_project, "foo", "foo")
|
1483
|
+
|
1484
|
+
ours_project = create_copy_of_project(base_project.path, "ours")
|
1485
|
+
add_existing_subproject_to_project(ours_project, subproject, "foo")
|
1486
|
+
|
1487
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1488
|
+
|
1489
|
+
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
1490
|
+
|
1491
|
+
expect(ours_project.root_object.project_references.count).to equal(1)
|
1492
|
+
end
|
1493
|
+
|
1494
|
+
it "avoids adding build file that already exists" do
|
1495
|
+
file_reference = base_project.main_group.new_reference("bar")
|
1496
|
+
target = base_project.new_target("com.apple.product-type.library.static", "foo", :ios)
|
1497
|
+
target.frameworks_build_phase.add_file_reference(file_reference)
|
1498
|
+
base_project.save
|
1499
|
+
|
1500
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1501
|
+
file_reference = theirs_project.main_group.new_reference("bar")
|
1502
|
+
theirs_project.targets[0].frameworks_build_phase.add_file_reference(file_reference)
|
1503
|
+
|
1504
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1505
|
+
other_project = create_copy_of_project(base_project.path, "theirs")
|
1506
|
+
described_class.apply_change_to_project(other_project, changes_to_apply)
|
1507
|
+
|
1508
|
+
expect(other_project).to be_equivalent_to_project(base_project)
|
1509
|
+
end
|
1510
|
+
|
1511
|
+
it "avoids adding reference proxy that already exists" do
|
1512
|
+
framework_filename = "baz"
|
1513
|
+
subproject = add_new_subproject_to_project(base_project, "subproj", framework_filename)
|
1514
|
+
base_project.save
|
1515
|
+
|
1516
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1517
|
+
|
1518
|
+
theirs_project.root_object.project_references[0][:product_group] <<
|
1519
|
+
create_reference_proxy_from_product_reference(theirs_project,
|
1520
|
+
theirs_project.root_object.project_references[0][:project_ref],
|
1521
|
+
subproject.products_group.files[-1])
|
1522
|
+
|
1523
|
+
|
1524
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1525
|
+
|
1526
|
+
other_project = create_copy_of_project(base_project.path, "theirs")
|
1527
|
+
described_class.apply_change_to_project(other_project, changes_to_apply)
|
1528
|
+
|
1529
|
+
expect(other_project).to be_equivalent_to_project(base_project)
|
1530
|
+
end
|
1531
|
+
|
1532
|
+
it "keeps array if adding string value that already exists in array" do
|
1533
|
+
base_project.new_target("com.apple.product-type.library.static", "bar", :ios)
|
1534
|
+
base_project.save
|
1535
|
+
|
1536
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1537
|
+
theirs_project.targets[0].build_configurations.each do |configuration|
|
1538
|
+
configuration.build_settings["HEADER_SEARCH_PATHS"] = "bar"
|
1539
|
+
end
|
1540
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1541
|
+
|
1542
|
+
ours_project = create_copy_of_project(base_project.path, "ours")
|
1543
|
+
ours_project.targets[0].build_configurations.each do |configuration|
|
1544
|
+
configuration.build_settings["HEADER_SEARCH_PATHS"] = %w[bar foo]
|
1545
|
+
end
|
1546
|
+
ours_project.save
|
1547
|
+
|
1548
|
+
expected_project = create_copy_of_project(ours_project.path, "expected")
|
1549
|
+
|
1550
|
+
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
1551
|
+
|
1552
|
+
expect(ours_project).to be_equivalent_to_project(expected_project)
|
1553
|
+
end
|
1554
|
+
end
|
1555
|
+
|
1556
|
+
describe "allowing adding reference to the same component" do
|
1557
|
+
before do
|
1558
|
+
Kintsugi::Settings.allow_duplicates = true
|
1559
|
+
end
|
1560
|
+
|
1561
|
+
after do
|
1562
|
+
Kintsugi::Settings.allow_duplicates = false
|
1563
|
+
end
|
1564
|
+
|
1565
|
+
it "adds subproject that already exists" do
|
1566
|
+
theirs_project = create_copy_of_project(base_project.path, "theirs")
|
1567
|
+
|
1568
|
+
subproject = add_new_subproject_to_project(theirs_project, "foo", "foo")
|
1569
|
+
|
1570
|
+
ours_project = create_copy_of_project(base_project.path, "ours")
|
1571
|
+
add_existing_subproject_to_project(ours_project, subproject, "foo")
|
1572
|
+
|
1573
|
+
changes_to_apply = get_diff(theirs_project, base_project)
|
1574
|
+
|
1575
|
+
described_class.apply_change_to_project(ours_project, changes_to_apply)
|
1576
|
+
|
1577
|
+
expect(ours_project.root_object.project_references[0][:project_ref].uuid)
|
1578
|
+
.not_to equal(ours_project.root_object.project_references[1][:project_ref].uuid)
|
1579
|
+
expect(ours_project.root_object.project_references[0][:project_ref].proxy_containers).not_to be_empty
|
1580
|
+
expect(ours_project.root_object.project_references[1][:project_ref].proxy_containers).not_to be_empty
|
1581
|
+
end
|
1582
|
+
end
|
1583
|
+
|
1403
1584
|
def create_copy_of_project(project_path, new_project_prefix)
|
1404
1585
|
copied_project_path = make_temp_directory(new_project_prefix, ".xcodeproj")
|
1405
1586
|
FileUtils.cp(File.join(project_path, "project.pbxproj"), copied_project_path)
|