Class: Souyuz::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/souyuz/runner.rb

Instance Method Summary collapse

Instance Method Details

#apk_fileObject

android build stuff to follow..



36
37
38
39
40
41
42
43
44
# File 'lib/souyuz/runner.rb', line 36

def apk_file
  build_path = Souyuz.project.options[:output_path]
  assembly_name = Souyuz.project.options[:assembly_name]

  build_apk_path = "#{build_path}/#{assembly_name}.apk"
  Souyuz.cache[:build_apk_path] = build_apk_path

  build_apk_path
end

#apksign_and_zipalignObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/souyuz/runner.rb', line 46

def apksign_and_zipalign
  UI.success "Start signing process..."

  command = ZipalignCommandGenerator.generate
  FastlaneCore::CommandExecutor.execute(command: command,
                                        print_all: true,
                                        print_command: !Souyuz.config[:silent])

  command = ApkSignCommandGenerator.generate
  FastlaneCore::CommandExecutor.execute(command: command,
                                        print_all: false,
                                        print_command: !Souyuz.config[:silent])

  # move signed apk back to build apk path
  FileUtils.cp_r(
    Souyuz.cache[:signed_apk_path],
    Souyuz.cache[:build_apk_path],
    :remove_destination => true)

  UI.success "Successfully signed apk #{Souyuz.cache[:build_apk_path]}"
end

#build_appObject



25
26
27
28
29
30
# File 'lib/souyuz/runner.rb', line 25

def build_app
  command = BuildCommandGenerator.generate
  FastlaneCore::CommandExecutor.execute(command: command,
                                        print_all: true,
                                        print_command: !Souyuz.config[:silent])
end

#compress_and_move_dsymObject



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/souyuz/runner.rb', line 96

def compress_and_move_dsym
  build_path = Souyuz.project.options[:output_path]
  assembly_name = Souyuz.project.options[:assembly_name]

  build_dsym_path = "#{build_path}/#{assembly_name}.app.dSYM"
  unless File.exist? build_dsym_path
    UI.success "Did not found dSYM at #{build_dsym_path}, skipping..."
    return
  end

  Souyuz.cache[:build_dsym_path] = build_dsym_path

  command = ZipDsymCommandGenerator.generate
  FastlaneCore::CommandExecutor.execute(command: command,
                                        print_all: true,
                                        print_command: !Souyuz.config[:silent])

  # move dsym aside ipa
  dsym_path = "#{dsym_path}.zip"
  if File.exist? dsym_path
    FileUtils.mv(dsym_path, "#{package_path}/#{File.basename dsym_path}")
  end
end

#ipa_fileObject



90
91
92
93
94
# File 'lib/souyuz/runner.rb', line 90

def ipa_file
  assembly_name = Souyuz.project.options[:assembly_name]

  "#{package_path}/#{assembly_name}.ipa"
end

#package_pathObject

ios build stuff to follow..



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/souyuz/runner.rb', line 72

def package_path
  build_path = Souyuz.project.options[:output_path]
  assembly_name = Souyuz.project.options[:assembly_name]

  # in the upcomming switch we determin the output path of iOS ipa files
  # those change in the Xamarin.iOS Cycle 9 release
  # see https://developer.xamarin.com/releases/ios/xamarin.ios_10/xamarin.ios_10.4/
  if File.exist? "#{build_path}/#{assembly_name}.ipa"
    # after Xamarin.iOS Cycle 9
    package_path = build_path
  else
    # before Xamarin.iOS Cycle 9
    package_path = Dir.glob("#{build_path}/#{assembly_name} *").sort.last
  end

  package_path
end

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/souyuz/runner.rb', line 5

def run
  config = Souyuz.config

  build_app

  if Souyuz.project.ios? or Souyuz.project.osx?
    compress_and_move_dsym
    path = ipa_file

    path
  elsif Souyuz.project.android?
    path = apk_file
    if config[:keystore_path] && config[:keystore_alias]
      apksign_and_zipalign
    end

    path
  end
end