From f057ab2c61106c873526728713312220fdd5798a Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Tue, 2 Sep 2025 16:46:57 -0400 Subject: [PATCH 01/14] test --- ios/HackerNews/ContentView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/HackerNews/ContentView.swift b/ios/HackerNews/ContentView.swift index 421fdedb..8061c2a8 100644 --- a/ios/HackerNews/ContentView.swift +++ b/ios/HackerNews/ContentView.swift @@ -5,8 +5,8 @@ // Created by Trevor Elkins on 6/20/23.. // -import SwiftUI import Common +import SwiftUI struct ContentView: View { @@ -33,7 +33,7 @@ struct ContentView: View { .accentColor(.hnOrange) } } - +// test struct ContentView_LoggedIn_Loading_Previews: PreviewProvider { static var previews: some View { @Previewable @State var appModel = AppViewModel( From 9a1249eaa944b0ec8283ded989c7dc46bb556395 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Tue, 2 Sep 2025 17:26:45 -0400 Subject: [PATCH 02/14] thin asset catalogs --- .github/workflows/ios_sentry_upload_pr.yml | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ios_sentry_upload_pr.yml b/.github/workflows/ios_sentry_upload_pr.yml index 819c2c0c..c404d3a8 100644 --- a/.github/workflows/ios_sentry_upload_pr.yml +++ b/.github/workflows/ios_sentry_upload_pr.yml @@ -55,6 +55,31 @@ jobs: CONFIGURATION: Release EMERGE_BUILD_TYPE: pull-request + - name: Thin asset catalogs in XCArchive + run: | + echo "Finding and thinning asset catalogs in XCArchive..." + + # Find all asset catalogs in the xcarchive + XCARCHIVE_PATH="./build/HackerNews.xcarchive" + + # Look for asset catalogs in the Products directory + find "$XCARCHIVE_PATH" -name "*.car" -type f | while read -r car_file; do + echo "Found asset catalog: $car_file" + + # Create backup of original + cp "$car_file" "${car_file}.backup" + + # Thin the asset catalog using assetutil + assetutil -i "phone" -s "3" -p "P3" -M "4" -g "MTL6,1" -r "13.0" "$car_file" -o "$car_file" + + if [ $? -eq 0 ]; then + echo "Successfully thinned: $car_file" + else + echo "Failed to thin: $car_file, restoring backup" + mv "${car_file}.backup" "$car_file" + fi + done + - name: Upload iOS size analysis binary to Sentry run: | sentry-cli \ From 41d5117376bd3a9563b9c83b6f7a5d973b40adfe Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Tue, 2 Sep 2025 17:44:49 -0400 Subject: [PATCH 03/14] rm --- .github/workflows/ios_sentry_upload_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ios_sentry_upload_pr.yml b/.github/workflows/ios_sentry_upload_pr.yml index c404d3a8..7251a3c8 100644 --- a/.github/workflows/ios_sentry_upload_pr.yml +++ b/.github/workflows/ios_sentry_upload_pr.yml @@ -74,6 +74,7 @@ jobs: if [ $? -eq 0 ]; then echo "Successfully thinned: $car_file" + rm "${car_file}.backup" else echo "Failed to thin: $car_file, restoring backup" mv "${car_file}.backup" "$car_file" From 18c36e644f809cf1e91cf20fdfe8c6c3298652e8 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Tue, 2 Sep 2025 18:00:59 -0400 Subject: [PATCH 04/14] revert --- ios/HackerNews/ContentView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/HackerNews/ContentView.swift b/ios/HackerNews/ContentView.swift index 8061c2a8..4c71eda9 100644 --- a/ios/HackerNews/ContentView.swift +++ b/ios/HackerNews/ContentView.swift @@ -33,7 +33,7 @@ struct ContentView: View { .accentColor(.hnOrange) } } -// test + struct ContentView_LoggedIn_Loading_Previews: PreviewProvider { static var previews: some View { @Previewable @State var appModel = AppViewModel( From 877cc776690298bbbc8323fc05506d3f7792785c Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 16:54:13 -0400 Subject: [PATCH 05/14] fastfile --- .github/workflows/ios_sentry_upload_pr.yml | 102 --------------------- ios/fastlane/Fastfile | 43 +++++++++ 2 files changed, 43 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/ios_sentry_upload_pr.yml diff --git a/.github/workflows/ios_sentry_upload_pr.yml b/.github/workflows/ios_sentry_upload_pr.yml deleted file mode 100644 index 152cc3fd..00000000 --- a/.github/workflows/ios_sentry_upload_pr.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Sentry PR iOS Upload (Size Analysis) - -on: - pull_request: - branches: [main] - paths: [ios/**, .github/workflows/ios_sentry_upload_pr.yml] - -jobs: - build: - runs-on: macos-15 - - defaults: - run: - working-directory: ./ios - - steps: - - name: Checkout - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Select Xcode version - run: sudo xcode-select -s '/Applications/Xcode_16.4.app/Contents/Developer' - - - name: Set up Ruby env - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.1.4 - bundler-cache: true - - - name: Install Sentry CLI - run: | - curl -L -o sentry-cli https://github.com/getsentry/sentry-cli/releases/download/2.53.0-alpha/sentry-cli-Darwin-universal - chmod +x sentry-cli - sudo mv sentry-cli /usr/local/bin/ - - - name: Setup gems - run: exec ../.github/scripts/ios/setup.sh - - - name: Decode signing certificate into a file - env: - CERTIFICATE_BASE64: ${{ secrets.IOS_DIST_SIGNING_KEY_BASE64 }} - run: | - echo $CERTIFICATE_BASE64 | base64 --decode > signing-cert.p12 - - - name: Build XCArchive - run: bundle exec fastlane ios build_only - env: - ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} - ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }} - ASC_KEY: ${{ secrets.ASC_PRIVATE_KEY }} - SIGNING_KEY_PASSWORD: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }} - SIGNING_KEY_FILE_PATH: signing-cert.p12 - EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }} - CONFIGURATION: Release - EMERGE_BUILD_TYPE: pull-request - - - name: Thin asset catalogs in XCArchive - run: | - echo "Finding and thinning asset catalogs in XCArchive..." - - # Find all asset catalogs in the xcarchive - XCARCHIVE_PATH="./build/HackerNews.xcarchive" - - # Look for asset catalogs in the Products directory - find "$XCARCHIVE_PATH" -name "*.car" -type f | while read -r car_file; do - echo "Found asset catalog: $car_file" - - # Create backup of original - cp "$car_file" "${car_file}.backup" - - # Thin the asset catalog using assetutil - assetutil -i "phone" -s "3" -p "P3" -M "4" -g "MTL6,1" -r "13.0" "$car_file" -o "$car_file" - - if [ $? -eq 0 ]; then - echo "Successfully thinned: $car_file" - rm "${car_file}.backup" - else - echo "Failed to thin: $car_file, restoring backup" - mv "${car_file}.backup" "$car_file" - fi - done - - - name: Upload iOS size analysis binary to Sentry - run: | - sentry-cli \ - --log-level=debug \ - --auth-token ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} \ - build \ - upload \ - ./build/HackerNews.xcarchive \ - --org sentry \ - --project launchpad-test-ios \ - --head-sha ${{ github.event.pull_request.head.sha }} \ - --base-sha ${{ github.event.pull_request.base.sha }} \ - --vcs-provider github \ - --head-repo-name ${{ github.repository }} \ - --base-repo-name ${{ github.repository }} \ - --head-ref ${{ github.head_ref }} \ - --base-ref ${{ github.base_ref }} \ - --pr-number ${{ github.event.number }} \ - --build-configuration Release diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 1717b2a5..39ca94c6 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -88,6 +88,47 @@ platform :ios do ) end + desc 'Thin asset catalogs in XCArchive' + lane :thin_asset_catalogs do + xcarchive_path = './build/HackerNews.xcarchive' + + UI.message('Finding and thinning asset catalogs in XCArchive...') + + # Find all asset catalogs in the xcarchive + car_files = Dir.glob("#{xcarchive_path}/**/*.car") + + car_files.each do |car_file| + UI.message("Found asset catalog: #{car_file}") + + # Create backup of original + backup_file = "#{car_file}.backup" + FileUtils.cp(car_file, backup_file) + + # Thin the asset catalog using assetutil + command = [ + 'assetutil', + '-i', 'phone', + '-s', '3', + '-p', 'P3', + '-M', '4', + '-g', 'MTL6,1', + '-r', '13.0', + car_file, + '-o', car_file + ] + + success = system(*command) + + if success + UI.success("Successfully thinned: #{car_file}") + FileUtils.rm(backup_file) + else + UI.error("Failed to thin: #{car_file}, restoring backup") + FileUtils.mv(backup_file, car_file) + end + end + end + desc 'Build the iOS app' lane :build_app_for_scheme do |options| app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) @@ -162,6 +203,7 @@ platform :ios do build_app_for_scheme(build_configuration: 'Release') upload_app emerge(tag: ENV['EMERGE_BUILD_TYPE']) + thin_asset_catalogs sentry_debug_files_upload( auth_token: ENV['SENTRY_AUTH_TOKEN'], org_slug: 'emerge-tools', @@ -184,6 +226,7 @@ platform :ios do tag: ENV['EMERGE_BUILD_TYPE'], app_id_suffix: ENV['APP_ID_SUFFIX'] ) + thin_asset_catalogs sentry_upload_mobile_app( auth_token: ENV['SENTRY_AUTH_TOKEN'], org_slug: 'emerge-tools', From 104cd098dae8c8a40615a58473fc222af0030c49 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 17:05:02 -0400 Subject: [PATCH 06/14] fix token --- .github/workflows/ios_emerge_upload_adhoc.yml | 2 +- .github/workflows/ios_emerge_upload_main.yml | 2 +- .github/workflows/ios_emerge_upload_pr.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ios_emerge_upload_adhoc.yml b/.github/workflows/ios_emerge_upload_adhoc.yml index b90b31b4..15dba2d5 100644 --- a/.github/workflows/ios_emerge_upload_adhoc.yml +++ b/.github/workflows/ios_emerge_upload_adhoc.yml @@ -50,7 +50,7 @@ jobs: SIGNING_KEY_PASSWORD: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }} SIGNING_KEY_FILE_PATH: signing-cert.p12 EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} CONFIGURATION: AdHoc EMERGE_BUILD_TYPE: pull-request-adhoc PROV_PROFILE_NAME: HackerNews AdHoc Distribution diff --git a/.github/workflows/ios_emerge_upload_main.yml b/.github/workflows/ios_emerge_upload_main.yml index 42d4aa6c..c0ae2479 100644 --- a/.github/workflows/ios_emerge_upload_main.yml +++ b/.github/workflows/ios_emerge_upload_main.yml @@ -46,7 +46,7 @@ jobs: SIGNING_KEY_PASSWORD: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }} SIGNING_KEY_FILE_PATH: signing-cert.p12 EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} CONFIGURATION: Release EMERGE_BUILD_TYPE: release diff --git a/.github/workflows/ios_emerge_upload_pr.yml b/.github/workflows/ios_emerge_upload_pr.yml index df11a44a..7a18866b 100644 --- a/.github/workflows/ios_emerge_upload_pr.yml +++ b/.github/workflows/ios_emerge_upload_pr.yml @@ -46,6 +46,6 @@ jobs: SIGNING_KEY_PASSWORD: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }} SIGNING_KEY_FILE_PATH: signing-cert.p12 EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }} - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} CONFIGURATION: Release EMERGE_BUILD_TYPE: pull-request From 6d4920711c061864eb857d392d8afcbec0be2d4c Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 17:17:09 -0400 Subject: [PATCH 07/14] fix --- ios/fastlane/Fastfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 39ca94c6..ddcbeb90 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -91,19 +91,19 @@ platform :ios do desc 'Thin asset catalogs in XCArchive' lane :thin_asset_catalogs do xcarchive_path = './build/HackerNews.xcarchive' - + UI.message('Finding and thinning asset catalogs in XCArchive...') - + # Find all asset catalogs in the xcarchive car_files = Dir.glob("#{xcarchive_path}/**/*.car") - + car_files.each do |car_file| UI.message("Found asset catalog: #{car_file}") - + # Create backup of original backup_file = "#{car_file}.backup" FileUtils.cp(car_file, backup_file) - + # Thin the asset catalog using assetutil command = [ 'assetutil', @@ -116,9 +116,9 @@ platform :ios do car_file, '-o', car_file ] - + success = system(*command) - + if success UI.success("Successfully thinned: #{car_file}") FileUtils.rm(backup_file) @@ -212,8 +212,8 @@ platform :ios do ) sentry_upload_mobile_app( auth_token: ENV['SENTRY_AUTH_TOKEN'], - org_slug: 'emerge-tools', - project_slug: 'hackernews-ios' + org_slug: 'sentry', + project_slug: 'launchpad-test-ios' ) end @@ -229,8 +229,8 @@ platform :ios do thin_asset_catalogs sentry_upload_mobile_app( auth_token: ENV['SENTRY_AUTH_TOKEN'], - org_slug: 'emerge-tools', - project_slug: 'hackernews-ios' + org_slug: 'sentry', + project_slug: 'launchpad-test-ios' ) end From eecceac8fc095a6ab34c2cb7f0b9d10eaf3e5c82 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 17:28:37 -0400 Subject: [PATCH 08/14] tet --- ios/fastlane/Fastfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index ddcbeb90..6fb5c780 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -93,9 +93,28 @@ platform :ios do xcarchive_path = './build/HackerNews.xcarchive' UI.message('Finding and thinning asset catalogs in XCArchive...') + + # Debug: Check if xcarchive exists + unless File.exist?(xcarchive_path) + UI.error("XCArchive not found at: #{xcarchive_path}") + return + end + + UI.message("XCArchive exists at: #{xcarchive_path}") + + # Debug: List contents to see structure + UI.message("XCArchive contents:") + Dir.glob("#{xcarchive_path}/**/*").each do |file| + UI.message(" #{file}") if file.end_with?('.car') || file.include?('Assets') + end # Find all asset catalogs in the xcarchive car_files = Dir.glob("#{xcarchive_path}/**/*.car") + + if car_files.empty? + UI.message("No .car files found in XCArchive") + return + end car_files.each do |car_file| UI.message("Found asset catalog: #{car_file}") From 6d766c984217f11e063fc48ed1a9c6b092a0e4e9 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 17:47:19 -0400 Subject: [PATCH 09/14] fix --- ios/fastlane/Fastfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 6fb5c780..d056b854 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -90,13 +90,13 @@ platform :ios do desc 'Thin asset catalogs in XCArchive' lane :thin_asset_catalogs do - xcarchive_path = './build/HackerNews.xcarchive' + xcarchive_path = lane_context[SharedValues::XCODE_ARCHIVE_PATH] UI.message('Finding and thinning asset catalogs in XCArchive...') # Debug: Check if xcarchive exists - unless File.exist?(xcarchive_path) - UI.error("XCArchive not found at: #{xcarchive_path}") + unless xcarchive_path && File.exist?(xcarchive_path) + UI.error("XCArchive not found. Path from lane context: #{xcarchive_path}") return end From dbbd2d8f4f3be784190e89d1fe161309edaab255 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 18:02:16 -0400 Subject: [PATCH 10/14] fix --- ios/fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index d056b854..3a409ea0 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -90,7 +90,7 @@ platform :ios do desc 'Thin asset catalogs in XCArchive' lane :thin_asset_catalogs do - xcarchive_path = lane_context[SharedValues::XCODE_ARCHIVE_PATH] + xcarchive_path = lane_context[SharedValues::XCODEBUILD_ARCHIVE] UI.message('Finding and thinning asset catalogs in XCArchive...') From ebb42767b886fce59207215ec793e61647e5ed28 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 18:13:32 -0400 Subject: [PATCH 11/14] remove returns --- ios/fastlane/Fastfile | 88 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 3a409ea0..e8891917 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -94,57 +94,55 @@ platform :ios do UI.message('Finding and thinning asset catalogs in XCArchive...') - # Debug: Check if xcarchive exists - unless xcarchive_path && File.exist?(xcarchive_path) - UI.error("XCArchive not found. Path from lane context: #{xcarchive_path}") - return - end - - UI.message("XCArchive exists at: #{xcarchive_path}") - - # Debug: List contents to see structure - UI.message("XCArchive contents:") - Dir.glob("#{xcarchive_path}/**/*").each do |file| - UI.message(" #{file}") if file.end_with?('.car') || file.include?('Assets') - end - - # Find all asset catalogs in the xcarchive - car_files = Dir.glob("#{xcarchive_path}/**/*.car") - - if car_files.empty? - UI.message("No .car files found in XCArchive") - return - end + # Check if xcarchive exists + if xcarchive_path && File.exist?(xcarchive_path) + UI.message("XCArchive exists at: #{xcarchive_path}") + + # Debug: List contents to see structure + UI.message("XCArchive contents:") + Dir.glob("#{xcarchive_path}/**/*").each do |file| + UI.message(" #{file}") if file.end_with?('.car') || file.include?('Assets') + end - car_files.each do |car_file| - UI.message("Found asset catalog: #{car_file}") + # Find all asset catalogs in the xcarchive + car_files = Dir.glob("#{xcarchive_path}/**/*.car") + + if car_files.empty? + UI.message("No .car files found in XCArchive") + else + car_files.each do |car_file| + UI.message("Found asset catalog: #{car_file}") - # Create backup of original - backup_file = "#{car_file}.backup" - FileUtils.cp(car_file, backup_file) + # Create backup of original + backup_file = "#{car_file}.backup" + FileUtils.cp(car_file, backup_file) - # Thin the asset catalog using assetutil - command = [ - 'assetutil', - '-i', 'phone', - '-s', '3', - '-p', 'P3', - '-M', '4', - '-g', 'MTL6,1', - '-r', '13.0', - car_file, - '-o', car_file - ] + # Thin the asset catalog using assetutil + command = [ + 'assetutil', + '-i', 'phone', + '-s', '3', + '-p', 'P3', + '-M', '4', + '-g', 'MTL6,1', + '-r', '13.0', + car_file, + '-o', car_file + ] - success = system(*command) + success = system(*command) - if success - UI.success("Successfully thinned: #{car_file}") - FileUtils.rm(backup_file) - else - UI.error("Failed to thin: #{car_file}, restoring backup") - FileUtils.mv(backup_file, car_file) + if success + UI.success("Successfully thinned: #{car_file}") + FileUtils.rm(backup_file) + else + UI.error("Failed to thin: #{car_file}, restoring backup") + FileUtils.mv(backup_file, car_file) + end + end end + else + UI.error("XCArchive not found. Path from lane context: #{xcarchive_path}") end end From 8f98c8555d3158c013a5f9b42cb65d5aa47debe5 Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 18:29:17 -0400 Subject: [PATCH 12/14] wtf --- ios/fastlane/Fastfile | 83 ++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 48 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index e8891917..8a349e97 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -90,59 +90,46 @@ platform :ios do desc 'Thin asset catalogs in XCArchive' lane :thin_asset_catalogs do - xcarchive_path = lane_context[SharedValues::XCODEBUILD_ARCHIVE] + xcarchive_path = './build/HackerNews.xcarchive' UI.message('Finding and thinning asset catalogs in XCArchive...') - # Check if xcarchive exists - if xcarchive_path && File.exist?(xcarchive_path) - UI.message("XCArchive exists at: #{xcarchive_path}") - - # Debug: List contents to see structure - UI.message("XCArchive contents:") - Dir.glob("#{xcarchive_path}/**/*").each do |file| - UI.message(" #{file}") if file.end_with?('.car') || file.include?('Assets') - end - - # Find all asset catalogs in the xcarchive - car_files = Dir.glob("#{xcarchive_path}/**/*.car") - - if car_files.empty? - UI.message("No .car files found in XCArchive") - else - car_files.each do |car_file| - UI.message("Found asset catalog: #{car_file}") - - # Create backup of original - backup_file = "#{car_file}.backup" - FileUtils.cp(car_file, backup_file) - - # Thin the asset catalog using assetutil - command = [ - 'assetutil', - '-i', 'phone', - '-s', '3', - '-p', 'P3', - '-M', '4', - '-g', 'MTL6,1', - '-r', '13.0', - car_file, - '-o', car_file - ] - - success = system(*command) - - if success - UI.success("Successfully thinned: #{car_file}") - FileUtils.rm(backup_file) - else - UI.error("Failed to thin: #{car_file}, restoring backup") - FileUtils.mv(backup_file, car_file) - end + # Find all asset catalogs in the xcarchive + car_files = Dir.glob("#{xcarchive_path}/**/*.car") + + if car_files.empty? + UI.message("No .car files found in XCArchive") + else + car_files.each do |car_file| + UI.message("Found asset catalog: #{car_file}") + + # Create backup of original + backup_file = "#{car_file}.backup" + FileUtils.cp(car_file, backup_file) + + # Thin the asset catalog using assetutil + command = [ + 'assetutil', + '-i', 'phone', + '-s', '3', + '-p', 'P3', + '-M', '4', + '-g', 'MTL6,1', + '-r', '13.0', + car_file, + '-o', car_file + ] + + success = system(*command) + + if success + UI.success("Successfully thinned: #{car_file}") + FileUtils.rm(backup_file) + else + UI.error("Failed to thin: #{car_file}, restoring backup") + FileUtils.mv(backup_file, car_file) end end - else - UI.error("XCArchive not found. Path from lane context: #{xcarchive_path}") end end From 6dd7269ddae3c452dc7aedc2bb924ed6e1cf5a5b Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 18:47:41 -0400 Subject: [PATCH 13/14] show --- ios/fastlane/Fastfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 8a349e97..36349c4b 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -94,11 +94,18 @@ platform :ios do UI.message('Finding and thinning asset catalogs in XCArchive...') + # Debug: Show what's actually in the archive + UI.message("Archive structure:") + sh("find #{xcarchive_path} -name '*.car' -type f") rescue UI.message("No .car files found with find command") + # Find all asset catalogs in the xcarchive car_files = Dir.glob("#{xcarchive_path}/**/*.car") if car_files.empty? - UI.message("No .car files found in XCArchive") + UI.message("No .car files found in XCArchive with Dir.glob") + # Show some files to understand structure + UI.message("Some files in archive:") + Dir.glob("#{xcarchive_path}/**/*").first(10).each { |f| UI.message(" #{f}") } else car_files.each do |car_file| UI.message("Found asset catalog: #{car_file}") From c2a35ab893471d12089cfe76d2aa96f6cbb6cf7c Mon Sep 17 00:00:00 2001 From: Trevor Elkins Date: Wed, 3 Sep 2025 21:15:46 -0400 Subject: [PATCH 14/14] fix --- ios/fastlane/Fastfile | 97 ++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 52 deletions(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 36349c4b..0744e880 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -88,58 +88,6 @@ platform :ios do ) end - desc 'Thin asset catalogs in XCArchive' - lane :thin_asset_catalogs do - xcarchive_path = './build/HackerNews.xcarchive' - - UI.message('Finding and thinning asset catalogs in XCArchive...') - - # Debug: Show what's actually in the archive - UI.message("Archive structure:") - sh("find #{xcarchive_path} -name '*.car' -type f") rescue UI.message("No .car files found with find command") - - # Find all asset catalogs in the xcarchive - car_files = Dir.glob("#{xcarchive_path}/**/*.car") - - if car_files.empty? - UI.message("No .car files found in XCArchive with Dir.glob") - # Show some files to understand structure - UI.message("Some files in archive:") - Dir.glob("#{xcarchive_path}/**/*").first(10).each { |f| UI.message(" #{f}") } - else - car_files.each do |car_file| - UI.message("Found asset catalog: #{car_file}") - - # Create backup of original - backup_file = "#{car_file}.backup" - FileUtils.cp(car_file, backup_file) - - # Thin the asset catalog using assetutil - command = [ - 'assetutil', - '-i', 'phone', - '-s', '3', - '-p', 'P3', - '-M', '4', - '-g', 'MTL6,1', - '-r', '13.0', - car_file, - '-o', car_file - ] - - success = system(*command) - - if success - UI.success("Successfully thinned: #{car_file}") - FileUtils.rm(backup_file) - else - UI.error("Failed to thin: #{car_file}, restoring backup") - FileUtils.mv(backup_file, car_file) - end - end - end - end - desc 'Build the iOS app' lane :build_app_for_scheme do |options| app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) @@ -250,6 +198,51 @@ platform :ios do emerge_snapshot(scheme: "HackerNews") end + desc 'Thin asset catalogs in XCArchive' + lane :thin_asset_catalogs do |options| + UI.message('Finding and thinning asset catalogs in XCArchive...') + + xcarchive_path = lane_context[SharedValues::XCODEBUILD_ARCHIVE] + UI.message("Using archive: #{xcarchive_path}") + + Dir.chdir('..') do + car_files = Dir.glob("#{xcarchive_path}/**/*.app/**/*.car") + + if car_files.empty? + UI.message("No .car files found in XCArchive") + else + car_files.each do |car_file| + UI.message("Found asset catalog: #{car_file}") + + backup_file = "#{car_file}.backup" + FileUtils.cp(car_file, backup_file) + + command = [ + 'assetutil', + '-i', 'phone', + '-s', '3', + '-p', 'P3', + '-M', '4', + '-g', 'MTL6,1', + '-r', '13.0', + car_file, + '-o', car_file + ] + + success = system(*command) + + if success + UI.success("Successfully thinned: #{car_file}") + FileUtils.rm(backup_file) + else + UI.error("Failed to thin: #{car_file}, restoring backup") + FileUtils.mv(backup_file, car_file) + end + end + end + end + end + desc 'Build the iOS app only (no uploads)' lane :build_only do load_asc_api_key