souyuz 0.1.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 368484d22e8d6d287966ced20c877224071eb3f2
4
- data.tar.gz: c3c8638ab220b8c3c46ed778c0f87b7552f5bb5c
3
+ metadata.gz: f064a8e18a28767b799724c537915ae95d4f71b8
4
+ data.tar.gz: fb930ec7fea16848078229a09f8479902c6440be
5
5
  SHA512:
6
- metadata.gz: 0765c3c1902728fce692fb5ccf8512c09d68b4b7cc1609872598f1e15ca15c98501d03d81a24e10dad3e4a604a2b41da3a3e9af9295beb8ac1bcefae04430555
7
- data.tar.gz: 26ccd09dc6b46e041f5e83679c880515c29e748b1c25e2a475c99f550e12e359102c3fbb213623f76759297dff77dd59b6e8cdca45d9f0353d6e05b3ba74d355
6
+ metadata.gz: aa52e4eb5153d475c293aede7bcbe0eaa5ab3aaac914d81b626ce99eab806b652727a6bfe4163f87a9d0a945290d434946dc46c0f59c64c94f6d0c82e0c43f96
7
+ data.tar.gz: 505cdf930681b4e4ff9027df29f20d3d601d2f1a13d1b905648687458bc34d3f1d970121624090ae7b4c7a5017ecb4612e14c7392b80fb46dba67a32dc93b91d
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Felix Rudat
3
+ Copyright (c) 2016-2017 Felix Rudat
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Souyuz
2
2
 
3
- A fastlane component to make Xamarin builds a breeze.
3
+ A fastlane component to make Xamarin builds a breeze. *Souyuz is now avaialbe as an Fastlane plugin see [fastlane-plugin-souyuz](fastlane-plugin-souyuz) for details.*
4
4
 
5
5
  ## ToDos
6
6
 
7
+ * clean up code (!!!)
7
8
  * replace path concat with `File.join()`
8
- * automatically determine `:platform`
9
9
 
10
10
  ## Licensing
11
11
 
@@ -25,6 +25,7 @@ module Souyuz
25
25
 
26
26
  detect_output_path doc_csproj
27
27
  detect_manifest doc_csproj
28
+ detect_info_plist
28
29
  detect_assembly_name doc_csproj # we can only do that for android *after* we detected the android manitfest
29
30
 
30
31
  return config
@@ -73,7 +74,10 @@ module Souyuz
73
74
  platform = Souyuz.config[:build_platform]
74
75
 
75
76
  doc_node = doc_csproj.xpath("/*[local-name()='Project']/*[local-name()='PropertyGroup'][translate(@*[local-name() = 'Condition'],'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz') = \" '$(configuration)|$(platform)' == '#{configuration.downcase}|#{platform.downcase}' \"]/*[local-name()='OutputPath']/text()")
76
- Souyuz.config[:output_path] = abs_project_path doc_node.text
77
+ output_path = doc_node.text
78
+ UI.user_error! 'Not able to find output path automatically, try to specify it via `output_path` parameter.' unless output_path
79
+
80
+ Souyuz.config[:output_path] = abs_project_path output_path
77
81
  end
78
82
 
79
83
  def self.detect_manifest(doc_csproj)
@@ -83,10 +87,27 @@ module Souyuz
83
87
  Souyuz.config[:manifest_path] = abs_project_path doc_node.text
84
88
  end
85
89
 
90
+ def self.detect_info_plist
91
+ return if Souyuz.config[:plist_path] or Souyuz.config[:platform] != Platform::IOS
92
+ itr = 0
93
+ query = 'Info.plist'
94
+
95
+ begin
96
+ files = Dir.glob(query)
97
+ query = "*/#{query}"
98
+ itr += 1
99
+ end until files.any? or itr > 1
100
+
101
+ plist_path = files.first # pick first file as solution
102
+ UI.user_error! 'Not able to find Info.plist automatically, try to specify it via `plist_path` parameter.' unless plist_path
103
+
104
+ Souyuz.config[:plist_path] = abs_project_path plist_path
105
+ end
106
+
86
107
  def self.detect_assembly_name(doc_csproj)
87
108
  return if Souyuz.config[:assembly_name]
88
109
 
89
- if [ Platform::IOS, Platform::MAC ].include? Souyuz.config[:platform]
110
+ if [ Platform::IOS, Platform::OSX ].include? Souyuz.config[:platform]
90
111
  Souyuz.config[:assembly_name] = doc_csproj.css('PropertyGroup > AssemblyName').text
91
112
  elsif Souyuz.config[:platform] == Platform::ANDROID
92
113
  doc = get_parser_handle Souyuz.config[:manifest_path] # explicitly for this call, no cache needed
@@ -1,17 +1,22 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Souyuz
3
3
  # Responsible for building the zipalign command
4
- # TODO implement
5
4
  class AndroidZipalignCommandGenerator
6
5
  class << self
7
6
  def generate
8
-
7
+ build_apk_path = Souyuz.cache[:build_apk_path]
8
+ aligned_apk = "#{build_apk_path}-signed"
9
+
9
10
  parts = prefix
11
+ parts << zipalign_apk
12
+ parts += options
13
+ parts << Souyuz.cache[:signed_apk_path]
14
+ parts << Souyuz.cache[:build_apk_path]
10
15
  parts += pipe
11
16
 
12
17
  parts
13
18
  end
14
-
19
+
15
20
  def detect_build_tools
16
21
  # determine latest buildtool version
17
22
  buildtools = File.join(ENV['ANDROID_HOME'], 'build-tools')
@@ -26,8 +31,18 @@ module Souyuz
26
31
  buildtools, version = detect_build_tools
27
32
  zipalign = ENV['ANDROID_HOME'] ? File.join(buildtools, version, 'zipalign') : 'zipalign'
28
33
 
29
- sh "\"#{zipalign}\" -f -v 4 #{signed_apk} #{aligned_apk}"
30
- Helper.backticks(command, print: !Souyuz.config[:silent])
34
+ zipalign
35
+ end
36
+
37
+ def options
38
+ config = Souyuz.config
39
+
40
+ options = []
41
+ options << "-v" if $verbose
42
+ options << "-f"
43
+ options << "4"
44
+
45
+ options
31
46
  end
32
47
 
33
48
  def prefix
@@ -36,7 +51,7 @@ module Souyuz
36
51
 
37
52
  def pipe
38
53
  pipe = []
39
-
54
+
40
55
  pipe
41
56
  end
42
57
  end
@@ -8,7 +8,7 @@ module Souyuz
8
8
  parts << "xbuild"
9
9
  parts += options
10
10
  parts += targets
11
- parts << project
11
+ parts += project
12
12
  parts += pipe
13
13
 
14
14
  parts
@@ -42,15 +42,17 @@ module Souyuz
42
42
  end
43
43
 
44
44
  def project
45
- config = Souyuz.config
45
+ path = []
46
+
47
+ path << Souyuz.config[:project_path] if Souyuz.project.android?
48
+ path << Souyuz.config[:solution_path] if Souyuz.project.ios? or Souyuz.project.osx?
46
49
 
47
- Souyuz.config[:project_path] if Souyuz.project.android?
48
- Souyuz.config[:solution_path] if Souyuz.project.ios? or Souyuz.project.mac?
50
+ path
49
51
  end
50
52
 
51
53
  def pipe
52
54
  pipe = []
53
-
55
+
54
56
  pipe
55
57
  end
56
58
  end
@@ -1,12 +1,11 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Souyuz
3
3
  # Responsible for building the jarsigner command
4
- # TODO implement
5
4
  class JavaSignCommandGenerator
6
5
  class << self
7
6
  def generate
8
7
  build_apk_path = Souyuz.cache[:build_apk_path]
9
- signed_apk_path = "#{build_apk_path}-unaligned.apk"
8
+ Souyuz.cache[:signed_apk_path] = "#{build_apk_path}-unaligned"
10
9
 
11
10
  parts = prefix
12
11
  parts << detect_jarsigner_executable
@@ -23,10 +22,9 @@ module Souyuz
23
22
  end
24
23
 
25
24
  def detect_jarsigner_executable
26
- jarsigner = ENV['JAVA_HOME'] ? File.join(ENV['JAVA_HOME'], 'bin', 'jarsigner') : 'jarsigner'
27
- UI.user_error! 'Jarsigner executable not found, check if your `JAVA_HOME` env is set' unless system jarsigner
25
+ jarsigner = ENV['JAVA_HOME'] ? File.join(ENV['JAVA_HOME'], 'bin', 'jarsigner') : 'jarsigner'
28
26
 
29
- jarsigner
27
+ jarsigner
30
28
  end
31
29
 
32
30
  def options
@@ -39,14 +37,14 @@ module Souyuz
39
37
  options << "-storepass #{config[:keystore_password]}"
40
38
  options << "-keystore #{config[:keystore_path]}"
41
39
  options << "-tsa #{config[:keystore_tsa]}"
42
- options << "-signedjar #{Souyuz.cache[:build_apk_path]}"
40
+ options << "-signedjar #{Souyuz.cache[:signed_apk_path]}"
43
41
 
44
42
  options
45
43
  end
46
44
 
47
45
  def pipe
48
46
  pipe = []
49
-
47
+
50
48
  pipe
51
49
  end
52
50
  end
@@ -0,0 +1,46 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module Souyuz
3
+ # Responsible for building the zip dsym command
4
+ class ZipDsymCommandGenerator
5
+ class << self
6
+ def generate
7
+ parts = prefix
8
+ parts << detect_zip_executable
9
+ parts += options
10
+ parts << build_apk_path
11
+ parts += pipe
12
+
13
+ parts
14
+ end
15
+
16
+ def prefix
17
+ ["set -o pipefail &&"]
18
+ end
19
+
20
+ def detect_zip_executable
21
+ # dunno if anyone wants a zip which is not available thorgh PATH
22
+ # but if this case exists, we provide the opportunity to do so
23
+ zip = ENV['SOUYUZ_ZIP_PATH'] || 'zip'
24
+
25
+ zip
26
+ end
27
+
28
+ def options
29
+ build_dsym_path = Souyuz.cache[:build_dsym_path]
30
+
31
+ options = []
32
+ options << "-r"
33
+ options << "#{build_dsym_path}.zip"
34
+ options << build_dsym_path
35
+
36
+ options
37
+ end
38
+
39
+ def pipe
40
+ pipe = []
41
+
42
+ pipe
43
+ end
44
+ end
45
+ end
46
+ end
@@ -7,8 +7,8 @@ module Souyuz
7
7
  Souyuz.config = options
8
8
 
9
9
  FastlaneCore::PrintTable.print_values(config: Souyuz.config,
10
- hide_keys: [],
11
- title: "Summary for souyuz #{Souyuz::VERSION}")
10
+ hide_keys: [],
11
+ title: "Summary for souyuz #{Souyuz::VERSION}")
12
12
 
13
13
  return Runner.new.run
14
14
  end
@@ -20,8 +20,8 @@ module Souyuz
20
20
  is_platform? Souyuz::Platform::IOS
21
21
  end
22
22
 
23
- def mac?
24
- is_platform? Souyuz::Platform::MAC
23
+ def osx?
24
+ is_platform? Souyuz::Platform::OSX
25
25
  end
26
26
 
27
27
  def android?
@@ -32,7 +32,7 @@ module Souyuz
32
32
  return case platform
33
33
  when Souyuz::Platform::IOS
34
34
  then self.project_name.downcase.include? 'ios'
35
- when Souyuz::Platform::MAC
35
+ when Souyuz::Platform::OSX
36
36
  then self.project_name.downcase.include? 'mac'
37
37
  when Souyuz::Platform::ANDROID
38
38
  then self.project_name.downcase.include? 'droid'
@@ -1,6 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require "fastlane_core"
3
- require "credentials_manager"
4
3
 
5
4
  module Souyuz
6
5
  class Options
@@ -38,7 +37,7 @@ module Souyuz
38
37
  optional: true),
39
38
  FastlaneCore::ConfigItem.new(key: :platform,
40
39
  env_name: "SOUYUZ_PLATFORM",
41
- description: "Targeted device platform (i.e. android, ios, mac)",
40
+ description: "Targeted device platform (i.e. android, ios, osx)",
42
41
  optional: false),
43
42
  FastlaneCore::ConfigItem.new(key: :solution_path,
44
43
  env_name: "SOUYUZ_SOLUTION_PATH",
@@ -52,6 +51,27 @@ module Souyuz
52
51
  env_name: "SOUYUZ_ANDROID_MANIFEST_PATH",
53
52
  description: "Path to the android manifest (xml) file",
54
53
  optional: true),
54
+ FastlaneCore::ConfigItem.new(key: :plist_path,
55
+ env_name: "SOUYUZ_IOS_PLIST_PATH",
56
+ description: "Path to the iOS plist file",
57
+ optional: true),
58
+ FastlaneCore::ConfigItem.new(key: :keystore_path,
59
+ env_name: "SOUYUZ_ANDROID_KEYSTORE_PATH",
60
+ description: "Path to the keystore",
61
+ optional: true),
62
+ FastlaneCore::ConfigItem.new(key: :keystore_alias,
63
+ env_name: "SOUYUZ_ANDROID_KEYSTORE_ALIAS",
64
+ description: "Alias of the keystore",
65
+ optional: true),
66
+ FastlaneCore::ConfigItem.new(key: :keystore_password,
67
+ env_name: "SOUYUZ_ANDROID_KEYSTORE_PASSWORD",
68
+ description: "Password of the keystore",
69
+ optional: true),
70
+ FastlaneCore::ConfigItem.new(key: :keystore_tsa,
71
+ default_value: 'http://timestamp.digicert.com',
72
+ env_name: "SOUYUZ_ANDROID_KEYSTORE_TSA",
73
+ description: "TSA for jarsigner",
74
+ optional: true),
55
75
  ]
56
76
  end
57
77
  end
@@ -2,7 +2,15 @@
2
2
  module Souyuz
3
3
  module Platform
4
4
  IOS = 'ios'
5
- MAC = 'mac'
5
+ OSX = 'osx'
6
6
  ANDROID = 'android'
7
+
8
+ def self.from_lane_context(context)
9
+ current_platform = context[:PLATFORM_NAME].to_s
10
+
11
+ # map in the future, if necessary
12
+
13
+ current_platform
14
+ end
7
15
  end
8
16
  end
data/lib/souyuz/runner.rb CHANGED
@@ -2,16 +2,22 @@
2
2
  module Souyuz
3
3
  class Runner
4
4
  def run
5
+ config = Souyuz.config
6
+
5
7
  build_app
6
8
 
7
- if Souyuz.project.ios? or Souyuz.project.mac?
9
+ if Souyuz.project.ios? or Souyuz.project.osx?
8
10
  compress_and_move_dsym
9
11
  path = ipa_file
10
12
 
11
13
  path
12
14
  elsif Souyuz.project.android?
13
15
  path = apk_file
14
- # jarsign_and_zipalign TODO implement later
16
+ if (config[:keystore_path] && config[:keystore_alias])
17
+ UI.success "Jar it, sign it, zip it..."
18
+
19
+ jarsign_and_zipalign
20
+ end
15
21
 
16
22
  path
17
23
  end
@@ -20,8 +26,8 @@ module Souyuz
20
26
  def build_app
21
27
  command = BuildCommandGenerator.generate
22
28
  FastlaneCore::CommandExecutor.execute(command: command,
23
- print_all: true,
24
- print_command: !Souyuz.config[:silent])
29
+ print_all: true,
30
+ print_command: !Souyuz.config[:silent])
25
31
  end
26
32
 
27
33
  #
@@ -32,19 +38,23 @@ module Souyuz
32
38
  build_path = Souyuz.project.options[:output_path]
33
39
  assembly_name = Souyuz.project.options[:assembly_name]
34
40
 
41
+ Souyuz.cache[:build_apk_path] = "#{build_path}/#{assembly_name}.apk"
42
+
35
43
  "#{build_path}/#{assembly_name}.apk"
36
44
  end
37
45
 
38
46
  def jarsign_and_zipalign
39
47
  command = JavaSignCommandGenerator.generate
40
48
  FastlaneCore::CommandExecutor.execute(command: command,
41
- print_all: true,
42
- print_command: !Souyuz.config[:silent])
49
+ print_all: false,
50
+ print_command: !Souyuz.config[:silent])
51
+
52
+ UI.success "Successfully signed apk #{Souyuz.cache[:build_apk_path]}"
43
53
 
44
54
  command = AndroidZipalignCommandGenerator.generate
45
55
  FastlaneCore::CommandExecutor.execute(command: command,
46
- print_all: true,
47
- print_command: !Souyuz.config[:silent])
56
+ print_all: true,
57
+ print_command: !Souyuz.config[:silent])
48
58
  end
49
59
 
50
60
  #
@@ -65,20 +75,18 @@ module Souyuz
65
75
  end
66
76
 
67
77
  def compress_and_move_dsym
68
- require 'fileutils'
69
78
  build_path = Souyuz.project.options[:output_path]
70
79
  assembly_name = Souyuz.project.options[:assembly_name]
71
- dsym_path = "#{build_path}/#{assembly_name}.app.dSYM"
72
80
 
73
- # compress dsym using zip
74
- if File.exists? dsym_path
75
- zip = ENV['SOUYUZ_ZIP_PATH'] || 'zip'
76
- command = "#{zip} -r #{dsym_path}.zip #{dsym_path}"
77
- Helper.backticks(command, print: !Souyuz.config[:silent])
78
- dsym_path = "#{dsym_path}.zip"
79
- end
81
+ Souyuz.cache[:build_dsym_path] = "#{build_path}/#{assembly_name}.app.dSYM"
82
+
83
+ command = ZipDsymCommandGenerator.generate
84
+ FastlaneCore::CommandExecutor.execute(command: command,
85
+ print_all: true,
86
+ print_command: !Souyuz.config[:silent])
80
87
 
81
88
  # move dsym aside ipa
89
+ dsym_path = "#{dsym_path}.zip"
82
90
  if File.exists? dsym_path
83
91
  FileUtils.mv(dsym_path, "#{package_path}/#{File.basename dsym_path}")
84
92
  end
@@ -1,5 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Souyuz
3
- VERSION = "0.1.0"
3
+ VERSION = "0.6.0"
4
4
  DESCRIPTION = "A fastlane component to make Xamarin builds a breeze"
5
5
  end
data/lib/souyuz.rb CHANGED
@@ -3,6 +3,9 @@ require 'souyuz/version'
3
3
  require 'souyuz/platform'
4
4
  require 'souyuz/manager'
5
5
  require 'souyuz/generators/build_command_generator'
6
+ require 'souyuz/generators/android_zipalign_command_generator'
7
+ require 'souyuz/generators/java_sign_command_generator'
8
+ require 'souyuz/generators/zip_dsym_command_generator'
6
9
  require 'souyuz/runner'
7
10
  require 'souyuz/options'
8
11
  require 'souyuz/detect_values'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: souyuz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Rudat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -16,34 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
27
- - !ruby/object:Gem::Dependency
28
- name: fastlane_core
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 0.41.2
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: 1.0.0
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: 0.41.2
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: 1.0.0
26
+ version: '1.7'
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: magic_encoding
49
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,20 +66,6 @@ dependencies:
86
66
  - - ">="
87
67
  - !ruby/object:Gem::Version
88
68
  version: '0'
89
- - !ruby/object:Gem::Dependency
90
- name: rspec
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: 3.1.0
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: 3.1.0
103
69
  description: A fastlane component to make Xamarin builds a breeze
104
70
  email: voydz@hotmail.com
105
71
  executables:
@@ -116,6 +82,7 @@ files:
116
82
  - lib/souyuz/generators/android_zipalign_command_generator.rb
117
83
  - lib/souyuz/generators/build_command_generator.rb
118
84
  - lib/souyuz/generators/java_sign_command_generator.rb
85
+ - lib/souyuz/generators/zip_dsym_command_generator.rb
119
86
  - lib/souyuz/manager.rb
120
87
  - lib/souyuz/msbuild/project.rb
121
88
  - lib/souyuz/msbuild/solution.rb