Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#494] Migrate make.sh to Swift command #504

Merged
merged 8 commits into from
Aug 22, 2023

Conversation

blyscuit
Copy link
Collaborator

@blyscuit blyscuit commented Jul 20, 2023

What happened 👀

Migrate make.sh to Swift Command Line

Insight 📝

  • Keep make.sh for running the project with minimal change to command. Will be removed in Package all Swift Commands #495
  • Add copy and createDirectory in FileManager.
  • Add regex ~= matcher to String.
  • Move SetUpCICDService to struct to be called by SetUpIOSProject.
  • Move SetUpDeliveryConstants to struct to be called by SetUpIOSProject.
  • Move SetUpInterface to struct to be called by SetUpIOSProject.
  • Create SetUpIOSProject.swift which will replace make.sh

Proof Of Work 📹

Projects build successfully and CICD test works.

@blyscuit blyscuit self-assigned this Jul 20, 2023
@blyscuit blyscuit force-pushed the chore/494-make-sh-swift-command branch 9 times, most recently from 00d257d to 7650872 Compare July 20, 2023 10:29
@blyscuit blyscuit changed the title [#494] make sh swift command [#494] Migrate make.sh to Swift command Jul 20, 2023
@blyscuit blyscuit force-pushed the chore/494-make-sh-swift-command branch 2 times, most recently from 14bbb59 to 77e08a0 Compare July 21, 2023 03:08
@blyscuit blyscuit changed the base branch from develop to chore/491-migrate-set-up-firebase-test-swift-command July 21, 2023 03:08
Comment on lines 88 to 100
print("=> 🔎 Replacing package and package name within files...")

try fileManager.replaceAllOccurrences(of: CONSTANT_BUNDLE_STAGING, to: bundleIdStaging)
try fileManager.replaceAllOccurrences(of: CONSTANT_BUNDLE_PRODUCTION, to: bundleIdProduction)
try fileManager.replaceAllOccurrences(of: CONSTANT_PROJECT_NAME, to: projectNameNoSpace)
try fileManager.replaceAllOccurrences(of: CONSTANT_MINIMUM_VERSION, to: minimumVersion)
print("✅ Completed")
Copy link
Member

@luongvo luongvo Jul 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the project info replacement, such as project name, package, app id, etc., we might consider using a Mustache template implementation in Swift https://github.com/groue/GRMustache.swift to reduce the boilerplate code and even make the core template to be more flexible with extra mustache supported rules 🤔

Just my suggestion for the next steps, not in this PR @nimblehq/ios-chapter. This is what we're doing in Flutter 😛

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luongvo What do you use to generate folders and replace in files? The GRMustache.swift seems to only generate text based on the template.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blyscuit In Dart, we have mason tool that wraps all the necessary actions. In Kotlin or Swift, I can not find one yet, so basically, we need to keep the current logic to list files for processing, but use Mustache to process instead of our manual replace API in Kotlin or Swift.

@blyscuit blyscuit force-pushed the chore/494-make-sh-swift-command branch 5 times, most recently from caf74b2 to 7e77550 Compare July 21, 2023 05:27
@blyscuit blyscuit force-pushed the chore/491-migrate-set-up-firebase-test-swift-command branch from 67030aa to 27a283c Compare August 4, 2023 10:49
@blyscuit blyscuit force-pushed the chore/494-make-sh-swift-command branch from 7e77550 to ad686eb Compare August 4, 2023 10:51
@blyscuit blyscuit marked this pull request as ready for review August 4, 2023 10:58
@blyscuit blyscuit force-pushed the chore/494-make-sh-swift-command branch from 38eb870 to 20759d8 Compare August 8, 2023 08:58
Base automatically changed from chore/491-migrate-set-up-firebase-test-swift-command to develop August 9, 2023 03:41
Scripts/Swift/SetUpiOSProject.swift Outdated Show resolved Hide resolved
blyscuit

This comment was marked as off-topic.

Copy link
Contributor

@ducbm051291 ducbm051291 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to go 👍 Great job

@blyscuit blyscuit added this pull request to the merge queue Aug 22, 2023
Merged via the queue into develop with commit 00e6deb Aug 22, 2023
4 checks passed
@blyscuit blyscuit deleted the chore/494-make-sh-swift-command branch August 22, 2023 02:49
@blyscuit blyscuit modified the milestones: 4.7.0, 4.8.0 Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants