Address PR comments

This commit is contained in:
Andrea Cipriani 2020-09-01 17:17:56 -04:00
parent 4b06074ed3
commit ee3679b651
3 changed files with 32 additions and 156 deletions

View File

@ -1,126 +1,11 @@
# Changelog # Changelog
Please, check out guidelines: https://keepachangelog.com/en/1.0.0/ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
## Next ## Next
### Added ### Added
- Allow specifying Development Region via new `developmentRegion` parameter in `Config`s GenerationOption. [#1062](https://github.com/tuist/tuist/pull/1867) by [@svastven](https://github.com/svastven). - `tuist migration list-targets` command to list the targets of a project sorted by number of dependencies [#1732]((https://github.com/tuist/tuist/pull/1732)) by [@andreacipriani](https://github.com/andreacipriani)
- Require the `Config.swift` file to be in the Tuist directory [#693](https://github.com/tuist/tuist/issues/693) by [@mollyIV](https://github.com/mollyIV).
- Mapper for the caching logic to locate the built products directory [#1929](https://github.com/tuist/tuist/pull/1929) by [@pepibumur](https://github.com/pepibumur).
- Extended `BuildPhaseGenerator` to generate script build phases [#1932](https://github.com/tuist/tuist/pull/1932) by [@pepibumur](https://github.com/pepibumur).
- Extend the `TargetContentHasher` to account for the `Target.scripts` attribute [#1933](https://github.com/tuist/tuist/pull/1933) by [@pepibumur](https://github.com/pepibumur).
- Extend the `CacheController` to generate projects with the build phase to locate the targets' built products directory [#1933](https://github.com/tuist/tuist/pull/1933) by [@pepibumur](https://github.com/pepibumur).
### Fixed
- Fixed non-framework/library targets having a header build phase [#367](https://github.com/tuist/tuist/issues/367) by [@eito](https://github.com/eito).
- Fixed missing profile scheme arguments when specified in manifest [#1543](https://github.com/tuist/tuist/issues/1543) by [@lakpa](https://github.com/lakpa).
- Fixed cache warming exporting unrelated .frameworks [#1939](https://github.com/tuist/tuist/pull/1939) by [@pepibumur](https://github.com/pepibumur).
- Fixed cache warming building from a clean state for every target [#1939](https://github.com/tuist/tuist/pull/1939) by [@pepibumur](https://github.com/pepibumur).
### Changed
- Some renames in the generation logic to make the generation logic easier to reason about [#1942](https://github.com/tuist/tuist/pull/1942) by [@pepibumur](https://github.com/pepibumur).
## 1.22.0 - Heimat
### Changed
- Autogenerated `xxx-Project` scheme is now shared [#1902](https://github.com/tuist/tuist/pull/1902) by [@fortmarek](https://github.com/fortmarek)
### Added
- Allow build phase scripts to disable dependency analysis [#1883](https://github.com/tuist/tuist/pull/1883) by [@bhuemer](https://github.com/bhuemer).
- The default generated project does not include a LaunchScreen storyboard [#265](https://github.com/tuist/tuist/issues/265) by [@mollyIV](https://github.com/mollyIV).
## 1.21.0 - PBWerk
### Added
- Allow ignoring cache when running tuist focus [#1879](https://github.com/tuist/tuist/pull/1879) by [@natanrolnik](https://github.com/natanrolnik).
### Changed
- Improve error message to have more actionable information [#921](https://github.com/tuist/tuist/issues/921) by [@mollyIV](https://github.com/mollyIV).
### Fixed
- Fix calculation of Settings hash related to Cache commands [#1869](Fix calculation of Settings hash related to Cache commands) by [@natanrolnik](https://github.com/natanrolnik)
- Fixed handling of `.tuist_version` file if the file had a trailing line break [#1900](Allow trailing line break in `.tuist_version`) by [@kalkwarf](https://github.com/kalkwarf)
## 1.20.0 - Heideberg
### Changed
- Revert using root `.package.resolved` [#1830](https://github.com/tuist/tuist/pull/1830) by [@fortmarek](https://github.com/fortmarek)
### Added
- Support for caching frameworks instead of xcframeworks [#1851](https://github.com/tuist/tuist/pull/1851)
### Fixed
- Skip synthesizing resource accessors when the file/folder is empty [#1829](https://github.com/tuist/tuist/pull/1829) by [@fortmarek](https://github.com/fortmarek)
- The redirect after the cloud authentication is not being captured from the CLI [#1846](https://github.com/tuist/tuist/pull/1846) by [@pepibumur](https://github.com/pepibumur).
## 1.19.0 - Milano
### Fixed
- Ensure `DEVELOPER_DIR` is used in all `swiftc` calls [#1819](https://github.com/tuist/tuist/pull/1819) by [@kwridan](https://github.com/kwridan)
- Fixed decoding bug on DefaultSettings [#1817](https://github.com/tuist/tuist/issues/1817) by [@jakeatoms](https://github.com/jakeatoms)
- Bool compiler error when generating accessor for plists [#1827](https://github.com/tuist/tuist/pull/1827) by [@fortmarek](https://github.com/fortmarek)
### Added
- Add Workspace Mappers [#1767](https://github.com/tuist/tuist/pull/1767) by [@kwridan](https://github.com/kwridan)
- Extended `Config`'s generationOptions with `.disableShowEnvironmentVarsInScriptPhases`. It does what you'd think. [#1782](https://github.com/tuist/tuist/pull/1782) by [@kalkwarf](https://github.com/kalkwarf)
- Generate `xxx-Project` scheme to build and test all available targets by [#1765](https://github.com/tuist/tuist/pull/1765) by [@fortmarek](https://github.com/fortmarek)
### Changed
- The `tuist edit` command adds `Setup.swift` and `Config.swift` to the generated project if they exist. [#1745](https://github.com/tuist/tuist/pull/1745) by [@laxmorek](https://github.com/laxmorek)
## 1.18.1 - Manaslu
### Fixed
- Added `tuist lint code` support for custom .swiftlint.yml files. [1764](https://github.com/tuist/tuist/pull/1764) by [@facumenzella](https://github.com/facumenzella)
- Fix GenerationOptions decoding [#1781](https://github.com/tuist/tuist/pull/1781) by [@alvarhansen](https://github.com/alvarhansen)
## 1.18.0 - Himalaya
### Fixed
- Support initializing projects with dashes [#1766](https://github.com/tuist/tuist/pull/1766) by [@fortmarek](https://github.com/fortmarek)
### Added
- Possibility to build schemes that are not part of any entry node [#1761](https://github.com/tuist/tuist/pull/1761) by [@fortmarek](htttps://github.com/fortmarek)
- `tuist lint code` - command to lint the Swift code using Swiftlint [#1682](https://github.com/tuist/tuist/pull/1682) by [@laxmorek](https://github.com/laxmorek)
- `tuist doc` - command to generate documentation for your modules using SwiftDoc [#1683](https://github.com/tuist/tuist/pull/1683) by [@facumenzella](https://github.com/facumenzella)
### Changed
- **Breaking** Command for linting a workspace or a project has been renamed from `tuist lint` to `tuist lint project` [#1682](https://github.com/tuist/tuist/pull/1682) by [@laxmorek](https://github.com/laxmorek)
- **Breaking** UpCarthage should perform bootstrap instead of update [#1744](https://github.com/tuist/tuist/pull/1744) by [@softmaxsg](https://github.com/softmaxsg)
- Add excluding argument to `recommended`/`essential` `DefaultSettings` [#1746](https://github.com/tuist/tuist/pull/1739) by [@rist](https://github.com/rist).
- Synthesize resource interface accessors [#1635](https://github.com/tuist/tuist/pull/1635) by [@fortmarek](https://github.com/fortmarek)
- Graph command now adds different colors and shapes for different types of targets and dependencies [#1763](https://github.com/tuist/tuist/pull/1763) by [@natanrolnik](https://github.com/natanrolnik)
## 1.17.0 - Luft
### Changed
- **Breaking** `tuist focus` only works with `Project.swift` [#1739](https://github.com/tuist/tuist/pull/1739) by [@pepibumur](https://github.com/pepibumur).
- **Breaking** a target or a list of targets is required for `tuist focus` [#1739](https://github.com/tuist/tuist/pull/1739) by [@pepibumur](https://github.com/pepibumur).
- **Breaking** cache is enabled by default in `tuist focus` [#1739](https://github.com/tuist/tuist/pull/1739) by [@pepibumur](https://github.com/pepibumur).
### Fixed
- Use relative paths for Local Swift Packages [#1706](https://github.com/tuist/tuist/pull/1706) by [@kwridan](https://github.com/kwridan)
## 1.16.0 - Alhambra ## 1.16.0 - Alhambra
@ -144,11 +29,8 @@ Please, check out guidelines: https://keepachangelog.com/en/1.0.0/
### Changed ### Changed
- `Target.dependsOnXCTest` returns true if the target is a test bundle [#1679](https://github.com/tuist/tuist/pull/1679) by [@pepibumur](https://github.com/pepibumur) - `Target.dependsOnXCTest` returns true if the target is a test bundle [#1679](https://github.com/tuist/tuist/pull/1679) by [@pepibumur](https://github.com/pepibumur)
- Support multiple rendering algorithms in Tuist Graph [#1655](<[1655](https://github.com/tuist/tuist/pull/1655/)>) by [@andreacipriani][https://github.com/andreacipriani] - Support multiple rendering algorithms in Tuist Graph [#1655](<[1655](https://github.com/tuist/tuist/pull/1655/)>) by [@andreacipriani](https://github.com/andreacipriani)
### Added
- `tuist migration list-targets` command to list the targets of a project sorted by number of dependencies by [@andreacipriani](https://github.com/tuist/tuist/pull/1732)
## 1.15.0 - Riga ## 1.15.0 - Riga

View File

@ -4,6 +4,33 @@ import TSCBasic
import TuistSupport import TuistSupport
import XcodeProj import XcodeProj
enum TargetsExtractorError: FatalError, Equatable {
case missingProject
case noTargets
case failedToExtractTargets(String)
public var description: String {
switch self {
case .missingProject: return "The project's pbxproj file contains no projects."
case .noTargets: return "The project doesn't have any targets."
case let .failedToExtractTargets(reason): return "Failed to extract targets for reason: \(reason)."
}
}
public var type: ErrorType {
switch self {
case .missingXcodeProj:
return .abort
case .missingProject:
return .abort
case .noTargets:
return .abort
case .failedToExtractTargets:
return .bug
}
}
}
/// An interface to extract all targets from an xcode project, sorted by number of dependencies /// An interface to extract all targets from an xcode project, sorted by number of dependencies
public protocol TargetsExtracting { public protocol TargetsExtracting {
/// - Parameters: /// - Parameters:
@ -25,11 +52,7 @@ public final class TargetsExtractor: TargetsExtracting {
if targets.isEmpty { if targets.isEmpty {
throw TargetsExtractorError.noTargets throw TargetsExtractorError.noTargets
} }
do {
return try sortTargetsByDependenciesCount(targets) return try sortTargetsByDependenciesCount(targets)
} catch {
throw TargetsExtractorError.failedToExtractTargets(error.localizedDescription)
}
} }
private func sortTargetsByDependenciesCount(_ targets: [PBXTarget]) throws -> [(targetName: String, dependenciesCount: Int)] { private func sortTargetsByDependenciesCount(_ targets: [PBXTarget]) throws -> [(targetName: String, dependenciesCount: Int)] {
@ -52,32 +75,3 @@ public final class TargetsExtractor: TargetsExtracting {
return count return count
} }
} }
enum TargetsExtractorError: FatalError, Equatable {
case missingXcodeProj(AbsolutePath)
case missingProject
case noTargets
case failedToExtractTargets(String)
public var description: String {
switch self {
case let .missingXcodeProj(path): return "Couldn't find Xcode project at path \(path.pathString)."
case .missingProject: return "The project's pbxproj file contains no projects."
case .noTargets: return "The project doesn't have any targets"
case let .failedToExtractTargets(reason): return "Failed to extract targets for reason: \(reason)"
}
}
public var type: ErrorType {
switch self {
case .missingXcodeProj:
return .abort
case .missingProject:
return .abort
case .noTargets:
return .abort
case .failedToExtractTargets:
return .bug
}
}
}

View File

@ -83,7 +83,7 @@ tuist migration check-empty-settings -p Project.xcodeproj -t MyApp
## List targets sorted by dependencies ## List targets sorted by dependencies
Migration of big Xcode projects to Tuist can happen iteratively, one target at a time. It makes sense to start from the target with the lowest number of dependencies. Migration of big Xcode projects to Tuist can happen iteratively, one target at a time. It makes sense to start from the target with the lowest number of dependencies.
To help with that, Tuist includes a command that lists the targets of a project sorted by number dependencies ascending. To help with that, Tuist includes a command that lists the targets of a project sorted by number dependencies ascending. The count only includes dependencies that are declared in build phases.
```bash ```bash
tuist migration list-targets -p Project.xcodeproj tuist migration list-targets -p Project.xcodeproj