31 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
Ian Leitch b1edbda583 Add --project-root option to generate command. (#828) 2020-04-08 14:20:54 -05:00
yonaskolb ce787d9e40 use mxcl/Version to fix parsing 2020-02-07 10:49:28 +11:00
yonaskolb 0e4e08bfc4 run swift format for Swift 5.1 2019-11-10 11:56:23 +11:00
yonaskolb 43cd0ec33e add dump command 2019-11-10 11:37:52 +11: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 518d8e578b restructure test targets 2019-10-27 23:15:12 +11:00
Yonas Kolb 862b19aa1a refactor Spec 2019-01-28 21:51:17 +11:00
Ell Neal 370963ec73 Move PathContainer & PathProperty into their own file 2019-01-27 15:26:58 +00:00
Ell Neal 720b2eede1 Move [PathProperty] resolver to spec loader file 2019-01-27 15:24:22 +00:00
Ell Neal 060aca8327 Rename Project.Spec --> Spec 2019-01-27 15:23:23 +00:00
Ell Neal 1d62b46423 #whitespace 2019-01-27 12:46:00 +00:00
Ell Neal 25a4d48b83 Remove deprecations 2019-01-27 12:24:16 +00:00
Ell Neal d2579bfe43 Refactor the PathContainer protocol to be a bit more expressive 2019-01-24 12:50:34 +00:00
Ell Neal 151d78ef98 Rename PathContaining -> PathContainer 2019-01-21 13:32:13 +00:00
Ell Neal 8f4c0953b3 Add back deleted public functions and deprecate (prevent breaking public API) 2019-01-15 12:26:47 +00:00
Ell Neal f9df768ec0 Add a PathContaining protocol for expanding paths to the source file's directory 2019-01-13 18:18:48 +00:00
Ell Neal 8928088dfe Use the Spec struct rather than dictionaries directly 2019-01-13 18:14:52 +00:00
Ell Neal a9ecef37bc Remove the $(CURDIR) expansion (it was a bad idea) 2019-01-13 18:06:05 +00:00
Ell Neal 05fa244a89 Add $(CURDIR) helper to expand the base path of the spec file 2019-01-10 11:43:04 +00:00
Yonas Kolb e30aeee957 add lockfile 2018-11-08 21:35:38 +11:00
Yonas Kolb c50d1dd157 add target templates 2018-07-22 21:49:39 +10:00
Yonas Kolb e589364ae8 rename ProjectSpec to Project and Project.Options to SpecOptions 2018-04-12 23:13:12 +10:00
Yonas Kolb a176f85875 xcproj 4.0 2018-01-25 20:59:28 +10:30
Yonas Kolb 0c1325cc5f remove header comments 2017-11-22 13:01:17 +01:00
Yonas Kolb e8188ad9f8 swiftformat 2017-11-13 21:33:59 +01:00
Yonas Kolb 68b4214c24 json loading refactoring
- don't convert to string and back
2017-11-04 02:05:39 +01:00
rmalik 91056efc8a Load json files directly with NSJSONSerialization if the spec path extension is
`json`
2017-11-03 12:10:00 -07:00
Yonas Kolb f8b4b5792e move and rename files 2017-10-29 22:15:02 +01:00