From afd3acf5b230f925dd4e1ac07fb67811419063ed Mon Sep 17 00:00:00 2001 From: Andrew Watt Date: Tue, 3 Dec 2024 17:37:20 -0800 Subject: [PATCH 1/2] build: remove CocoaPods --- .gitignore | 21 +-- .../xcschemes/BlueprintUI-Package.xcscheme | 143 ------------------ .../xcschemes/BlueprintUI.xcscheme | 67 -------- .../BlueprintUICommonControls.xcscheme | 67 -------- BlueprintUI.podspec | 34 ----- BlueprintUICommonControls.podspec | 25 --- CHANGELOG.md | 2 + Documentation/Tutorials/Setup.md | 23 +-- Gemfile | 4 +- Gemfile.lock | 3 - README.md | 100 +++++------- RELEASING.md | 56 +------ Scripts/release.sh | 4 + version.rb | 7 - 14 files changed, 56 insertions(+), 500 deletions(-) delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI-Package.xcscheme delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI.xcscheme delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/BlueprintUICommonControls.xcscheme delete mode 100644 BlueprintUI.podspec delete mode 100644 BlueprintUICommonControls.podspec delete mode 100644 version.rb diff --git a/.gitignore b/.gitignore index d7abe8831..51d767b54 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,16 @@ # OS .DS_Store -# cocoapods-generate -gen/ - # Xcode xcuserdata/ -# Cocoapods +# CocoaPods cruft Pods/ -*.xcworkspace - -# SPM - -# Disabled so that we can commit the generated schemes that live in -# .swiftpm/xcode/xcshareddata/xcschemes/*.xcscheme, to work around an Xcode 14 bug. -# -# See https://stackoverflow.com/q/72741060 -# -# That's the only thing in .swiftpm now. Make this pattern more complicated if you want to exclude -# other things. -# -# .swiftpm/ +gen/ +# SwiftPM .build/ +.swiftpm/ # jazzy .docs/ diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI-Package.xcscheme deleted file mode 100644 index e23c38b92..000000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI-Package.xcscheme +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI.xcscheme deleted file mode 100644 index 1e4884768..000000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUI.xcscheme +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUICommonControls.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUICommonControls.xcscheme deleted file mode 100644 index f429bfe5d..000000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/BlueprintUICommonControls.xcscheme +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BlueprintUI.podspec b/BlueprintUI.podspec deleted file mode 100644 index 4b2149f6c..000000000 --- a/BlueprintUI.podspec +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require_relative 'version' - -Pod::Spec.new do |s| - s.name = 'BlueprintUI' - s.version = BLUEPRINT_VERSION - s.summary = 'Swift library for declarative UI construction' - s.homepage = 'https://www.github.com/square/blueprint' - s.license = 'Apache License, Version 2.0' - s.author = 'Square' - s.source = { git: 'https://github.com/square/blueprint.git', tag: s.version } - - s.swift_version = SWIFT_VERSION - - s.ios.deployment_target = BLUEPRINT_IOS_DEPLOYMENT_TARGET - - s.source_files = 'BlueprintUI/Sources/**/*.swift' - - s.weak_framework = 'SwiftUI' - - s.pod_target_xcconfig = { - 'APPLICATION_EXTENSION_API_ONLY' => 'YES', - } - - s.test_spec 'Tests' do |test_spec| - test_spec.library = 'swiftsimd' - test_spec.source_files = 'BlueprintUI/Tests/**/*.swift' - test_spec.framework = 'XCTest' - test_spec.pod_target_xcconfig = { - 'APPLICATION_EXTENSION_API_ONLY' => 'NO', - } - end -end diff --git a/BlueprintUICommonControls.podspec b/BlueprintUICommonControls.podspec deleted file mode 100644 index 2499ded02..000000000 --- a/BlueprintUICommonControls.podspec +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -require_relative 'version' - -Pod::Spec.new do |s| - s.name = 'BlueprintUICommonControls' - s.version = BLUEPRINT_VERSION - s.summary = 'UIKit-backed elements for Blueprint' - s.homepage = 'https://www.github.com/square/blueprint' - s.license = 'Apache License, Version 2.0' - s.author = 'Square' - s.source = { git: 'https://github.com/square/blueprint.git', tag: s.version } - - s.swift_version = SWIFT_VERSION - - s.ios.deployment_target = BLUEPRINT_IOS_DEPLOYMENT_TARGET - - s.source_files = 'BlueprintUICommonControls/Sources/**/*.swift' - - s.dependency 'BlueprintUI', BLUEPRINT_VERSION - - s.pod_target_xcconfig = { - 'APPLICATION_EXTENSION_API_ONLY' => 'YES', - } -end diff --git a/CHANGELOG.md b/CHANGELOG.md index 8baf137b3..b6353288f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed +- CocoaPods podspecs removed. Blueprint will only be vended via Swift Package Manager. + ### Changed ### Deprecated diff --git a/Documentation/Tutorials/Setup.md b/Documentation/Tutorials/Setup.md index 0e75d3d19..81b436c57 100644 --- a/Documentation/Tutorials/Setup.md +++ b/Documentation/Tutorials/Setup.md @@ -5,33 +5,16 @@ The easiest way to complete the Blueprint tutorials is to use the sample app inc 1. Clone the Blueprint repo ```bash -git clone git@github.com:square/Blueprint.git +git clone https://github.com/square/Blueprint ``` ```bash cd Blueprint ``` -2. CocoaPods +2. Generate a project -The sample app uses CocoaPods to integrate dependencies. First, we'll make sure CocoaPods and all of its dependencies are installed. - -```bash -bundle install -``` - -Next, we'll use CocoaPods to integrate the workspace that we will use for completing the tutorials. - -```bash -cd SampleApp -bundle exec pod install -``` - -Finally... - -```bash -open SampleApp.xcworkspace -``` +Follow [the main README instructions](../../README.md#local-development) to set up a local development environment with Tuist. 3. Code! diff --git a/Gemfile b/Gemfile index c88aff040..f9bb6c6c2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,6 @@ source 'https://rubygems.org' # Read the current Ruby version from the .ruby-version file -ruby Bundler.read_file(Bundler.root.join('.ruby-version')).strip +ruby Bundler.read_file(File.join(__dir__, '.ruby-version')).strip -gem 'cocoapods', '~> 1.11' -gem 'cocoapods-generate', '~> 1.0' gem 'jazzy', '~> 0.13' diff --git a/Gemfile.lock b/Gemfile.lock index e29edb502..f773cb811 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,7 +52,6 @@ GEM typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) cocoapods-downloader (2.1) - cocoapods-generate (1.4.1) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -125,8 +124,6 @@ PLATFORMS x86_64-linux DEPENDENCIES - cocoapods (~> 1.11) - cocoapods-generate (~> 1.0) jazzy (~> 0.13) RUBY VERSION diff --git a/README.md b/README.md index 96cb5240f..3d9802f08 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,39 @@ -[![Build Status](https://travis-ci.com/square/Blueprint.svg?branch=master)](https://travis-ci.com/square/Blueprint) - # Blueprint -### Declarative UI construction for iOS, written in Swift +[![Tests](https://github.com/square/Blueprint/actions/workflows/tests.yaml/badge.svg)](https://github.com/square/Blueprint/actions/workflows/tests.yaml) +[![Generate and publish docs](https://github.com/square/Blueprint/actions/workflows/docs.yml/badge.svg)](https://github.com/square/Blueprint/actions/workflows/docs.yml) +[![Linter](https://github.com/square/Blueprint/actions/workflows/lint.yml/badge.svg)](https://github.com/square/Blueprint/actions/workflows/lint.yml) -Blueprint greatly simplifies the task of building and updating views as application state changes. +## Declarative UI construction for iOS, written in Swift -*We still consider Blueprint experimental (and subject to major breaking API changes), but it has been used within Square's production iOS apps.* +Blueprint greatly simplifies the task of building and updating views as application state changes. ```swift -let rootElement = Label(text: "Hello from Blueprint!") -let view = BlueprintView(element: rootElement) +let view = BlueprintView(element: Label(text: "Hello from Blueprint!")) ``` -Generated documentation is available at [square.github.io/Blueprint](https://square.github.io/Blueprint/) +### What does this library do? -### Getting Started +Blueprint provides an architecture that allows you to: +- Declaratively define a UI hierarchy as pure values (Swift structs and enums). +- Display that hierarchy within your application. +- Update that hierarchy as application state changes (including animated transitions). + +### When should I use it? + +Use Blueprint any time you want to display a view hierarchy, but don't want to manage view lifecycle (hint: managing view lifecycle is a large portion of most conventional UIKit code). There are times when you *want* to manage view lifecycle (complex animations and transitions are a good example), and for these cases you may want to stick with a conventional approach. + +### How does it interact with UIKit? + +Blueprint is not a replacement for UIKit! From the beginning, Blueprint has been designed as a compliment to all of the powerful tools that come with the platform. You can use Blueprint to manage the display of a single view controller, or of a single view representing a small part of the screen. Likewise, it's straightforward to host standard views and controls *within* a blueprint hierarchy, always leaving you with an escape hatch. + +### How does it interact with SwiftUI? + +They serve similar purposes, and SwiftUI has heavily influenced Blueprint's API. However, Blueprint predates SwiftUI, and works a bit differently. You can host a `BlueprintView` in SwiftUI to embed Blueprint within SwiftUI, and you can also use the provided `ElementView` to create Xcode previews of Blueprint. Because SwiftUI is hosted by a UIViewController, and Blueprint is hosted in a UIView, we don't provide a way to embed SwiftUI within Blueprint. + +## Getting Started -#### Swift Package Manager +### Swift Package Manager [![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-orange.svg)](#swift-package-manager) @@ -26,47 +42,22 @@ in `Package.swift`: ```swift dependencies: [ - .package(url: "git@github.com:square/Blueprint.git", from: "0.3.0") + .package(url: "https://github.com/square/Blueprint", from: "5.1.0") ] ``` In Xcode 11+, add Blueprint directly as a dependency to your project with `File` > `Swift Packages` > `Add Package Dependency...`. Provide the git URL when prompted: `git@github.com:square/Blueprint.git`. -#### Cocoapods - -[![CocoaPods compatible](https://img.shields.io/cocoapods/v/BlueprintUI.svg)](https://cocoapods.org/pods/BlueprintUI) - -If you use CocoaPods to manage your dependencies, simply add BlueprintUI and BlueprintUICommonControls to your -Podfile: - -```ruby -pod 'BlueprintUI' -pod 'BlueprintUICommonControls' -``` - ---- - -##### What does this library do? - -Blueprint provides an architecture that allows you to: -- Declaratively define a UI hierarchy as pure values (Swift structs and enums). -- Display that hierarchy within your application. -- Update that hierarchy as application state changes (including animated transitions). - -##### When should I use it? - -Use Blueprint any time you want to display a view hierarchy, but don't want to manage view lifecycle (hint: managing view lifecycle is a large portion of most conventional UIKit code). There are times when you *want* to manage view lifecycle (complex animations and transitions are a good example), and for these cases you may want to stick with a conventional approach. - -##### How does it interact with `UIKit`? - -Blueprint is not a replacement for UIKit! From the beginning, Blueprint has been designed as a compliment to all of the powerful tools that come with the platform. You can use Blueprint to manage the display of a single view controller, or of a single view representing a small part of the screen. Likewise, it's straightforward to host standard views and controls *within* a blueprint hierarchy, always leaving you with an escape hatch. - ---- +Two modules are provided: +- `BlueprintUI` contains the core architecture and layout types. +- `BlueprintUICommonControls` includes elements representing some common `UIKit` views and controls. ## Documentation -#### Getting Started +API documentation is available at [square.github.io/Blueprint](https://square.github.io/Blueprint/) + +### Getting Started 1. **[Hello, World](Documentation/GettingStarted/HelloWorld.md)** @@ -77,7 +68,7 @@ Blueprint is not a replacement for UIKit! From the beginning, Blueprint has been 1. **[Layout](Documentation/GettingStarted/Layout.md)** -#### Reference +### Reference 1. **[`Element`](Documentation/Reference/Element.md)** @@ -88,7 +79,7 @@ Blueprint is not a replacement for UIKit! From the beginning, Blueprint has been 1. **[Transitions](Documentation/Reference/Transitions.md)** -#### Tutorials +### Tutorials [Tutorial setup instructions](Documentation/Tutorials/Setup.md) @@ -96,23 +87,6 @@ Blueprint is not a replacement for UIKit! From the beginning, Blueprint has been 1. **[Building a receipt layout with Blueprint](Documentation/Tutorials/Tutorial2.md)** ---- - -## Adding Blueprint to an existing project - -Two modules are provided: -- **`BlueprintUI`** contains the core architecture and layout types. -- **`BlueprintUICommonControls`** includes elements representing some common `UIKit` views and controls. - -Blueprint is available via CocoaPods. Add it to your `Podfile` to integrate: - -```ruby -target MyTarget do - pod 'BlueprintUI' - pod 'BlueprintUICommonControls' -end -``` - ## Local Development This project uses [Mise](https://mise.jdx.dev/) and [Tuist](https://tuist.io/) to generate a project for local development. Follow the steps below for the recommended setup for zsh. @@ -137,10 +111,6 @@ tuist generate --path SampleApp --- -[Release instructions](./RELEASING.md) - ---- - Copyright 2019 Square, Inc. Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/RELEASING.md b/RELEASING.md index 442a44238..afbab78ef 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,65 +1,23 @@ # Releasing a new version -1. Prepare a release - - ``` - # Cuts a release off of main with the given version number. - Scripts/release.sh --version 1.2.3 - ``` - -Manual instructions can be found here: - -
- -1. You must be listed as an owner of the pods `BlueprintUI` and `BlueprintUICommonControls`. - - To check this run: - - ```bash - bundle exec pod trunk info BlueprintUI - bundle exec pod trunk info BlueprintUICommonControls - ``` - - See [the CocoaPods documentation for pod trunk](https://guides.cocoapods.org/making/getting-setup-with-trunk) for more information about setting up credentials on your device. If you need to be added as an owner, ping in #blueprint on Slack (Square only). +1. Prepare a release by updating the changelog. 1. Make sure you're on the `main` branch, and `git pull` to get the latest commits. -1. Create a branch off `main` to update the version numbers and `Podfile.lock`. An example name would be `your-username/release-0.1.0`. - -1. Update the library version in `version.rb` if it has not already been updated (it should match the version number that you are about to release). +1. Create a branch off `main`. 1. Update `CHANGELOG.md` (in the root of the repo), moving current changes under `Main` to a new section for the version you are releasing. The changelog uses [reference links](https://daringfireball.net/projects/markdown/syntax#link) to link each version's changes. Remember to add a link to the new version at the bottom of the file, and to update the link to `[main]`. -1. Change directory into the `SampleApp` dir: `cd SampleApp`. - -1. Run `bundle exec pod install` to update the `Podfile.lock` with the new versions. - -1. Change back to the root directory (`cd ..`) to commit the podspec version bumps and the `Podfile.lock` update. - ```bash - git commit -am "Bumping versions to 0.1.0." - ``` - 1. Push your branch and open a PR into `main`. -
+1. Go to the [Releases](https://github.com/square/Blueprint/releases) and `Draft a new release`. -1. Once the PR is merged, fetch changes and tag the release, using the merge commit: - ```bash - git fetch - git tag 0.1.0 - git push origin 0.1.0 - ``` +1. `Choose a tag` and create a tag for the new version. -1. Publish to CocoaPods +1. In the release notes, copy the changes from the changelog. - Note: You may also need to quit Xcode before running these commands in order for the linting builds to succeed. +1. Ensure the `Title` corresponds to the version we're publishing. - ```bash - bundle exec pod trunk push BlueprintUI.podspec - # The --synchronous argument ensures this command builds against the - # version of BlueprintUI that we just published. - bundle exec pod trunk push --synchronous BlueprintUICommonControls.podspec - ``` - \ No newline at end of file +1. Hit `Publish release`. diff --git a/Scripts/release.sh b/Scripts/release.sh index 1e801a2b2..2580c7604 100755 --- a/Scripts/release.sh +++ b/Scripts/release.sh @@ -1,5 +1,9 @@ #!/bin/bash +echo "TODO: Update this script to use the new release process." +echo "Use the manual steps in RELEASING.md for now." +exit 0 + set -euo pipefail branch="main" diff --git a/version.rb b/version.rb deleted file mode 100644 index d815ea054..000000000 --- a/version.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -BLUEPRINT_VERSION ||= '5.2.0' - -SWIFT_VERSION ||= File.read(File.join(__dir__, '.swift-version')) - -BLUEPRINT_IOS_DEPLOYMENT_TARGET ||= '15.0' From 58fed6c67e8e39c12eb7fb08f7ec3cc5e4c4d5f0 Mon Sep 17 00:00:00 2001 From: Andrew Watt Date: Tue, 14 Jan 2025 17:57:38 -0800 Subject: [PATCH 2/2] build: bump bundler --- Gemfile | 3 +-- Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index f9bb6c6c2..dfed6d986 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,5 @@ source 'https://rubygems.org' -# Read the current Ruby version from the .ruby-version file -ruby Bundler.read_file(File.join(__dir__, '.ruby-version')).strip +ruby file: '.ruby-version' gem 'jazzy', '~> 0.13' diff --git a/Gemfile.lock b/Gemfile.lock index f773cb811..e62ca3b80 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -130,4 +130,4 @@ RUBY VERSION ruby 3.2.2p53 BUNDLED WITH - 2.4.10 + 2.5.5