Commit Graph

59 Commits

Author SHA1 Message Date
Luis Padron 54900f2640
Project Plugins: Add GitHandler Service (#2107)
* Project Plugins: Add GitHandler Service

* Update Sources/TuistSupport/Utils/GitHandler.swift

* Fix linting issues

Co-authored-by: Pedro Piñera <pepibumur@gmail.com>
2020-12-07 17:42:03 +01:00
Pedro Piñera Buendía eb38790bcc
Add Combine API to System (#2108)
* Add Combine API to System

* Update CHANGELOG

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-12-05 18:32:46 +01:00
Pedro Piñera 9514ba5652 Fix tests 2020-11-08 19:03:00 +01:00
Pedro Piñera b2f284b3df Implement and test AsyncQueuePersistor 2020-10-31 17:25:37 +01:00
Lucia V 59ce5d0aff
Cache targets as frameworks (#1851)
* Remove Workspace in ios_workspace_with_microfeature_architecture fixture

* Add a xcframework flag on the cache warm command

* Add CacheControllerFactory

* Add ArtifactType

* Update CacheMapper

* Update CacheController

* Add --xcframeworks flag in the print hashes command

* Add --xcframeworks flag in the focus command

* Move the Dependency enum up from XCFrameworkNode up to PrecompiledNode, as it is also needed for FrameworkNode

* Refactor the cached binary building code to treat binaries as framework first

* Update graph and mapping logic to treat binaries as framework first

* Linter

* Improved wording

* Update TargetContentHasher

* Swiftformat

* Fix linting

* Extend the cache implementation to support storing multiple artifacts

* Some fixes and fix tests

* Fix the derived data path

* Fix all the tests

* Fix acceptance tests

* Fix acceptance tests

* Fix failing tests

Co-authored-by: Pedro Piñera <pepibumur@gmail.com>
2020-10-01 17:55:22 +02:00
Kas ba14dc1d82
Enable debugging Tuist in Xcode (#1786)
- When launching Tuist in Xcode via opening the `Package.swift` file, locating and using the `ProjectDescription` framework fails
- This is due to a slightly different structure of where the built products are located when using Xcode and Swift Packages
- The built `.framework` resides in a subdirectory `PackageFrameworks`, while the `.swiftmodule` remains within built products directory

_Note: One aspect that doesn't work quite well is if you use an Xcode version that mismatches your `xcode-select -p` version. It seems, when Xcode is working with Swift Packages it no longer sets the `DEVELOPER_DIR` environment setting._

Test Plan:

- Open tuist in Xcode (via opening `Package.swift`)
- Update the scheme to include the launch arguments `tuist generate --path /path/to/some/fixture"
- Run tuist and verify generation works (note: repeat the test after delete `~/.tuist/Cache` to ensure manifest loading is taking place)
2020-09-18 14:14:32 +02:00
Marek Fořt abe36f6766
Buildable schemes (#1761)
* Buildable schemes should include all buildable schemes, not just entry-level.

* Add list flag.

* Edit changelog.

* Remove list flag.

* Fix build acceptance test.
2020-09-12 08:16:10 +02:00
Pedro Piñera Buendía 317a8d520f
Tuist lint command (#1682)
* Implement command and service for code linting

* [code-lint] remove mismatched comment

* [code-lint] start using proper `FatalError` type in `LintCodeService`

* [code-lint] Refactor `LintCodeService`. Increase readability.

* [code-lint] remove `SwiftLintFramework` form TuistKit's  dependencies

* [code-lint] add `swiftlint` binary

* [code-lint] add `BinaryLocator`

* [code-lint] calling swift lint shell command

* [code-lint] lint list of paths

* [code-lint] add documentation

* [code-lint] fix `LintProjectServiceTests`, tests pass now

* [code-lint] add unit tests

* [code-lint] fix docs

* [code-lint] fix tests

* [code-lint] run `bundle exec rake style_correct`

* [code-lint] acceptance tests - WIP

* [code-lint] fix acceptance_tests

* [code-lint] add acceptance tests

* [code-lint] more unit tests

* [code-lint] changelog

* [code-lint] fix code format

* [code-lint] update changelog

* [code-lint] prints the messages forwared through the standard error using `printStandardError`

* [code-lint] styling

* [code-lint] fix identation

* [code-lint] update docs

* [code-lint] fix docs

* [code-lint] fix acceptance tests

* [code-lint] fix Changelog

* [code-lint] add docs

* [code-lint] add `CodeLinterTests`

* [code-lint] fix typos

* [code-lint] fix acceptance tests

* [code-lint] extend acceptance tests

* [code-lint] style_correct

Co-authored-by: Kamil Harasimowicz <kamil.harasimowicz@gmail.com>
2020-09-09 08:51:41 +02:00
Romain Boulay 30148c560d
Add logging when manifest can't be loaded (#1684)
* [logging_when_manifest_loading_fails] Add logging when manifest can't be loaded

* [logging_when_manifest_loading_fails] package.resolved

* [logging_when_manifest_loading_fails] Fix MockEnvironment

* [logging_when_manifest_loading_fails] Fix MockEnvironment

* Address SchemeLinterTests tests

* Update ManifestLoader.swift

* address PR comment
2020-08-25 23:20:36 +02:00
Pedro Piñera Buendía d87346b65e
Re-format code (#1603)
Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-08-04 21:56:47 +02:00
Pedro Piñera Buendía 26caa5fc06
Prettify the redirect screen (#1521)
* Prettify the redirect screen

* Change path to the logo

* Update CHANGELOG

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-07-06 18:38:46 +02:00
Romain Boulay 223395c469
[Cache] Implement remote fetch logic (#1498)
* [cache-download] Implement remote fetch logic

* [cache-download] Add tests in CacheRemoteStorageTests to cover the fetch part

* [cache-download] Moving FileClient to TuistSupport

* [cache-download] Rename zipFlow to unzip

* [cache-download] Force cast in test

* [cache-download] Streamlined errors output

* [cache-download] Expect an xcframework inside the unzipped archive or throw an error
2020-06-30 19:43:34 +02:00
Pedro Piñera Buendía c03381ebfa
Edit projects with the selected Xcode version (#1511)
* Edit projects with the selected Xcode version

* Update CHANGELOG

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-06-30 07:45:39 +02:00
Pedro Piñera Buendía abc1eed11a
Add utility for fetching simulator devices and runtimes (#1491)
* Add tests, mocks and test data

* Fix linting issues

* Remove old utility and fix tests

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-06-29 19:05:01 +02:00
Romain Boulay 8d4c46f707
[Cache] Add the cache storing logic (#1470)
* [cache-store] Add FileDownloader

* [cache-store] Add Zip as dependency

* [cache-store] Add server side error parsing

* [cache-store] Add CacheRemoteStorage in the default storage array

* [cache-store] Add md5 logic

* [cache-store] Refactor HTTPResource to be able to handle the HEAD cases more easily

* [cache-store] Add the Cache store functionality

* [cache-store] Linting

* [cache-store] Move zip logic into its own class to ease testing

* [cache-store] Added FileUploading to ease testing

* [cache-store] Fix unit tests and more cases to CacheRemoteStorageTests

* [cache-store] Linting

* [cache-store] Addressed PR comments about errors

* [cache-store] Remove unfinished FileDownloader.swift

* [cache-store] More precise FileUploaderError descriptions

* [cache-store] Move file size utility function to FileHandler

* [cache-store] Move md5 utility functions to FileHandler

* [cache-store] Remove hash parameter in Zip class

* [cache-store] Better error messages

* [cache-store] Add better error case and documentation in FileHandlerError

* [cache-store] Add mechanism to remove archive when the FileArchiver instance is deallocated

* [cache-store] Add FatalError conformity to HTTPRequestDispatcherError

* Some fixes

* [cache-store] Fix bug where the file archiver gets deallocated before it could delete its temporary files

* [cache-store] Move zip dependency to TuistSupport

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-06-26 16:55:08 +02:00
Pedro Piñera Buendía 2a69479a7f
Add secret command (#1471)
* Add command for generating a secret

* Document secret command

* Update CHANGELOG

* Rename to edit your projects

* Some style fixes

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-06-23 18:28:47 +02:00
Marek Fořt d7f167ffa4
Signing install (#1186)
* Install provisioning profile.

* Import signing cert.

* Add SigningInstallerTests.

* Add SecurityControllerTests.

* Add keepFiles option.

* Fix SigningInstaller tests.

* Encrypt files only when necessary.

* Install signing on generate.

* Install signing only when signing dir exists.

* Run swiftformat.

* Make finding signing dir optional.

* Fix typo in keepFiles.

* Name variable in zip.

* Install certs and profiles in SigningMapper.

* Install certs into new keychain.

* Setup signing settings.

* Add signing linting.

* Do not create git changes on generate from reencryption.

* Run SigningInteractor.

* Create keychain at Derived.

* Restrict mutability of TuistCore models.

* Add errors to certificateparser.

* Better error handling.

* Build tests.

* Add Certificate test data.

* Add SigningInteractor tests.

* SigningMatcher tests.

* Add signing mapper tests.

* Fix finding certificate and privateKey.

* Add signing integration tests.

* Minor changes.

* Run swiftformat.

* Fix SecurityControllerTests.

* Edit changelog.

* Fix Xcode 11.3.1 compiler error.

* Fix generate when root dir not found.

* Refactor SigningMapper to be a ProjectMapper.

* Generate keychain into project derived directory.

* Change certificate naming convention.

* Code review changes, fix wildcard support.

* Fix tests.

* Added signing fixture.

* Change handling of duplicate keychain.

* Remove provision profiles from .gitignore.

* Add signing documentation.

* Fix signing section.
2020-06-15 20:59:51 +02:00
Romain Boulay cbb01b97e7
Add CacheRemoteStorage foundations (#1420)
* Add client

* [remote_cache] Add the userConfig in the CacheStoraging protocol

* [remote_cache] Rename Storaging to Storing

* [remote_cache] Add MockCloudClienting

* [remote_cache] Updates to ease unit testing

* [remote_cache] Add CloudCacheResponse

* [remote_cache] Silence warning

* [remote_cache] Add CacheRemoteStorage and tests

* [remote_cache] Linting and formatting

* [remote_cache] Fix structural issues

* [remote_cache] Move CloudClienting to the Cloud directory

* [remote_cache] Rename userConfig to config

* [remote_cache] Remove loadConfig function

* [remote_cache] Move resources functions into their respective response classes

* [remote_cache] Propagate errors up

* [remote_cache] Improve type readability in CloudCacheResponse

* [remote_cache] Linting

* [remote_cache] Formatting

* [remote_cache] Fix tests

* [remote_cache] Remove bad import to fix unit test compilation

* [remote_cache] Address comments

* [remote_cache] Rollback throw additions

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-06-10 11:43:17 +02:00
Pedro Piñera Buendía 5dc8b7ab92
Move the auto-generation of schemes to a mapper (#1357)
* Add empty AutogeneratedSchemesGraphMapper

* Don't generate the schemes at generation time

* Implement AutogeneratedSchemesGraphMapper

* Update CHANGELOG

* Remove unnecessary method

* Turn the graph mapper into a project mapper

* Address some comments

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-06-03 17:41:36 +02:00
Pedro Piñera Buendía 351982105a
Wait when editing the project (#1356)
* Wait when editing the project

* Update CHANGELOG

Co-authored-by: Pedro Piñera <pedro@ppinera.es>
2020-05-18 17:47:18 +02:00
Pedro Piñera Buendía 25f3b13404
Inherit defaultSettings from the project when the target's defaultSettings is nil (#1338)
* Inherit the project settings behavior when the target doesn't specify defaultSettings

* Update CHANGELOG

* Style fixes
2020-05-14 09:28:16 +02:00
Pedro Piñera Buendía 142ed6ebfe
Read the Swift version from the system (#1317)
* Read the Swift version from the system

* Update CHANGELOG

* Output a warning when SWIFT_VERSION is set automatically

* Remove warning
2020-05-06 13:38:38 +02:00
Marek Fořt 8337c02bc9
Move from SPM libs to TSC (#1230)
* Convert from SPM libs to TSC.

* Edit changelog.

* Fix flaky duplicate configuration name test.

* Fix lint project duplicate config names.
2020-04-17 08:24:24 +02:00
Pedro Piñera Buendía 7365df1ce1
Allow passing the data to the manifest through environment variables (#1183)
* Add Environment struct to the ProjectDescription framework

* Add tuistVariables to environment

* Pass down tuist environment variables when compiling the manifest and the helpers

* Add acceptance test

* Extract helpers hashing logic into a class and add unit tests

* Add documentation

* Update CHANGELOG

* Remove usage of Swift-5.2-only API

* Address some comments
2020-04-07 08:53:32 +02:00
Pedro Piñera 862ad763b4 Use the cache from the focus command 2020-04-03 14:54:21 +02:00
Pedro Piñera 9703ec219e Fix tests 2020-04-02 12:41:27 +02:00
Pedro Piñera 9b016b07a7 Implement authentication logic 2020-04-01 18:21:37 +02:00
Pedro Piñera 1ba8f46dff Implement MockHTTPRedirectListener 2020-04-01 18:21:37 +02:00
Pedro Piñera 57856f053f Change CredetialsStore API 2020-04-01 18:21:36 +02:00
Pedro Piñera b0d9af5f40 Implement CredentialsStorer 2020-04-01 18:21:36 +02:00
Pedro Piñera Buendía 2bd39046b6
Print errors that arise when parsing the manifest (#1125)
* Print errors that arise when parsing the manifest

* Some style fixes

* Update the CHANGELOG

* Revert fixture change

* Add acceptance test
2020-03-31 09:08:06 +02:00
Kas 70676b0e89
Concurrent project generation (#1096)
- Each project within a workspace is currently generated independently and non of the project share any mutable state
- The graph is static during the generation process
- As such one option to gain some overall performance improvement is to generate project concurrently as well serialise them to disk concurrently.
- An additional stress test was added to ensure there were no concurrency issues during workspace generation
- The test logger needed some small thread safetey improvement
- Fix concurrency issues in Atomic
- Leverage execution contexts to control threading behavior of components
- Update `XcodeController` to minimize synchronization calls (via `Atomic`)

Test Plan:

- Verify all automated tests pass
- Stress test tuist via running this script in the `fixtures` directory

```sh
#!/bin/bash -e

# skip fixtures that are testing failure cases
declare -a skipped_fixtures=(
    "invalid_workspace_manifest_name" 
    "ios_app_with_incompatible_dependencies" 
    "ios_app_with_incompatible_xcode" 
    "ios_workspace_with_dependency_cycle"
)

# Generate all fixtures in a loop
for i in {1..20}; do
    for f in *
    do
        if [[ ! " ${skipped_fixtures[@]} " =~ " ${f} " ]]; then
            if [[ -d $f ]]; then
                echo ">> Generating: $f"
                swift run tuist generate --path $f
                echo ""
            fi
        fi
    done
done
```
2020-03-17 10:32:44 +00:00
Oliver Atkinson 8b459052f6 swiftformat . 2020-03-05 21:48:10 +00:00
Oliver Atkinson 52fe8fd119 Merge remote-tracking branch 'origin/master' into verbose-logging 2020-03-05 18:01:17 +00:00
Oliver Atkinson edcdecb054 Update testing API to use TestingLogHandler for collecting results 2020-03-05 17:23:45 +00:00
Pedro Piñera a25861b0a5 Change the XCFrameworkBuilder to use XcodeBuildController 2020-02-27 19:04:46 +01:00
Pedro Piñera 062ebb3ae9 Update the installer to print the errors when the commands fail 2020-02-25 15:12:23 +01:00
Pedro Piñera c6e0023a38 Return as errors the HTTP requests that failed 2020-02-24 16:57:42 +01:00
Pedro Piñera 1dc7692786 Fix compilation issue 2020-02-22 08:16:55 +01:00
Pedro Piñera c99568685d Implement XcodeBuildController 2020-02-21 19:28:31 +01:00
Pedro Piñera ecb8ef7513 Rename xcrun to observable 2020-02-21 19:28:31 +01:00
Pedro Piñera cbed3afc2a Implement GoogleCloudStorageClient 2020-02-21 17:25:01 +01:00
Kas 15d2ec36c4
Enable Pull Request Checks (#1018)
- Fix for a recently regressed unit test due to missing PR checks
- Re-enable pull request actions
- To avoid duplicate jobs the on push action only triggers the checks when the branch is master
- Added a conditional for tuist uploads for master only

Test Plan:

- Verify github actions are run on this PR
2020-02-19 14:11:54 +00:00
Kas fbdbf99c55
Preserve xcuserdata when re-generating projects (#1006)
- The project generation process was replacing the entire `.xcodeproj` and `.xcworkspace` directories
- This lead to wiping all previous contents within those directories
- This included a nested `xcuserdata` directory which is usually gitignored and holds the Xcode UI state
- To reoslve this, only a the individual files are replaced rather than the entire directory

Test Plan:

- Run `tuist generate` within any fixture
- Open the generated project
- Navigate around, set breakpoints
- Re-order one of the source files (i.e. to cause a re-generation)
- Close Xcode
- Run `tuist generate` again
- Open the generated project
- Verify the last viewed file is opened automatically, breakpoints, the recently viewed files list are all still there
2020-02-18 14:06:36 +00:00
Pedro Piñera c66c50851e Add a tool that checks whether Tuist is running on CI 2020-02-07 15:02:53 +09:00
ldindu 891ec9fef1 Auto correct with swiftformat 2020-01-05 23:21:41 +00:00
Pedro Piñera ba441a0b18 Address nitpick 2019-12-10 11:33:11 -05:00
Pedro Piñera 9e65239387 Add operators 2019-12-10 11:33:10 -05:00
Pedro Piñera 8428793d73 Add an interface to launch processes and subscribe to the standard output and error using observables 2019-12-10 11:33:10 -05:00
Pedro Piñera 418b3a3949 Support modifying Tuist's directories with environment variables 2019-12-07 18:09:32 +01:00