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..



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

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

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

  "#{build_path}/#{assembly_name}.apk"
end

#build_appObject



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

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

#compress_and_move_dsymObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/souyuz/runner.rb', line 88

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

  Souyuz.cache[:build_dsym_path] = "#{build_path}/#{assembly_name}.app.dSYM"

  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.exists? dsym_path
    FileUtils.mv(dsym_path, "#{package_path}/#{File.basename dsym_path}")
  end
end

#ipa_fileObject



82
83
84
85
86
# File 'lib/souyuz/runner.rb', line 82

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

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

#jarsign_and_zipalignObject



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/souyuz/runner.rb', line 46

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

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

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

#package_pathObject

ios build stuff to follow..



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/souyuz/runner.rb', line 64

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.exists? "#{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



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

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])
      UI.success "Jar it, sign it, zip it..."

      jarsign_and_zipalign
    end

    path
  end
end