Skip to content
This repository has been archived by the owner on Oct 2, 2018. It is now read-only.

Mark Xcode archives generated by gym with extended attribute #206

Merged
merged 2 commits into from
Feb 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/gym/runner.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'pty'
require 'open3'
require 'fileutils'
require 'shellwords'
Copy link

Choose a reason for hiding this comment

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

Does this need to be added to the gemspec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, excellent question. Other fastlane tools (fastlane, sign, snapshot) have .rb files that similarly require 'shellwords', but do not declare it in the gemspec. That's what I modeled this on, but perhaps I'm misunderstanding what needs to go in the gemspec?

Copy link
Contributor

Choose a reason for hiding this comment

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

Good call, AFAIK it's in the standard library and doesn't need to be added. We use it already in gym


module Gym
class Runner
Expand Down Expand Up @@ -71,6 +72,11 @@ def fix_package
Gym::XcodebuildFixes.watchkit2_fix
end

def mark_archive_as_built_by_gym(archive_path)
escaped_archive_path = archive_path.shellescape
system("xattr -w info.fastlane.generated_by_gym 1 #{escaped_archive_path}")
end

# Builds the app and prepares the archive
def build_app
command = BuildCommandGenerator.generate
Expand All @@ -82,6 +88,7 @@ def build_app
ErrorHandler.handle_build_error(output)
end)

mark_archive_as_built_by_gym(BuildCommandGenerator.archive_path)
UI.success "Successfully stored the archive. You can find it in the Xcode Organizer."
UI.verbose("Stored the archive in: " + BuildCommandGenerator.archive_path)
end
Expand Down