18 Commits

Author SHA1 Message Date
Craig Siemens 0500db212d Handle imports with same relative path (#1262)
* Added test for when includes contain relative paths with the same name.

* Updated mergedDictionary to handle includes with the same file path.

* Removed the need to multiple places to pass in cachedSpecFiles.

* Converts the projectRoot into a absolute path before loading a project.

* Updated changelog.
2023-01-16 17:57:43 +11:00
Mathieu Olivari e7f753785e Fix includes related issues and improve their performances (#1275)
* Fix recursive include path when relativePath is not set

If relativePath is not set on a particular include, the first level of
include will currently work, but starting at the second level of
iteration, the computed include path will fail as relativePath will be
appended over and over onto the filePath. We're fixing that recursion
problem here and adding the corresponding tests to make sure it doesn't
happen again.

* Include projectRoot in include paths

The projectRoot setting (when specified) is currently ignored when
computing the include paths. We're fixing that in that commit.

* Use memoization during recursive SpecFiles creation

SpecFile objects are created by recursive through includes. On a large
project with programatically generated SpecFile, it is not rare to have
hundreds of SpecFiles, creating a large web of include dependencies.
In such a case, it is not rare either for a particular SpecFile to be
included by multiple other SpecFiles. When that happens, XcodeGen
currently creates a SpecFile object every time a SpecFile gets included,
which can lead to an exponential growth of includes.

I have seen hundreds of files being turned into hundred of thousands of
SpecFile object creations, which leads to an impractical XcodeGen run of
tens of minutes.

This change adds memoization during SpecFile recursion, in order to
reuse the previously created SpecFiles, if available, instead of
re-creating them.

* Update CHANGELOG.md

Add the following changes to the changelog:
* b97bdc4 - Use memoization during recursive SpecFiles creation
* a6b96ad - Include projectRoot in include paths
* 557b074 - Fix recursive include path when relativePath is not set
2022-11-03 19:05:46 +11:00
freddi(Yuki Aki) 594c67fbe9 Add enable option for include to enable optional including for addtional spec (#1242)
* add new option enable for include of spec

* fix to see the environment variable when parsing include

* add test for include with environment variable

* fix how to parse boolean value

* add spec about enable for include

* add Change Log

* fix the number of PR in changelog

* fix include test to make more clear

* fix test to focus enable option more

* fix english error

* fix to expand variable only one time

* add new test case by setting environment object as NO
2022-08-12 16:21:43 +10:00
Akio Yasui f3d2d09cd6 Don't deduplicate files in include with different paths but a same name (#849)
* Distinguish included files by their full path

* Add test with same-name includes

* Update CHANGELOG
2020-04-29 10:20:28 +10:00
yonaskolb 0e4e08bfc4 run swift format for Swift 5.1 2019-11-10 11:56:23 +11:00
yonaskolb 44f9ffa51a formatting 2019-11-10 11:38:53 +11:00
Romuald Cari e38360d5e3 Fix crash on empty ${} variable expansion (#706)
This fix got lost in #704 reworks.
2019-11-06 14:12:11 -06:00
Romuald Cari 06a6616b88 Improving variable expansion runtime (#704)
* Improving variable expansion runtime

The current implementation of variable expansion is O(n x m) with n being the
number of strings in the project spec and m being the number of project variables.

This implementation is now O(n).

Also, this effectively deprecates the support for $legacy_variables in favor of the
${new_variables} making this whole patch possible.

* Adding option to disable variable expansion

* Adding performance test for spec loading

* Updating changelog
2019-11-06 08:33:54 -06:00
yonaskolb d0d509c1a5 swiftformat 2019-10-27 22:37:41 +11:00
Brian Clymer 7152d6aa9f Address CR. 2019-10-06 15:33:27 -05:00
Brian Clymer 6e5766a2bc Ensure that target names can be changed by template attributes. 2019-10-02 10:40:15 -05:00
Yuta Saito 4cda0bff5c Expand template variable in Array of Any 2019-09-09 15:28:08 +09:00
yonaskolb d921d14259 make format_code 2019-09-01 22:02:53 +10:00
haritowa 8e21cdfdb1 Include unique file only once
Fixes #574
2019-08-19 12:42:53 -05:00
Tom Quist c8aef74a93 Fix review suggestions 2019-06-17 00:01:33 +02:00
Tom Quist 25260963c7 Add environment variable expansion
closes #587
2019-06-16 23:48:58 +02:00
Yonas Kolb fb3f80d6af run swiftformat 2019-01-28 22:20:01 +11:00
Yonas Kolb 862b19aa1a refactor Spec 2019-01-28 21:51:17 +11:00