fastlane-plugin-xambuild 0.2.1 → 0.3.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
  SHA256:
3
- metadata.gz: df9c6b9018f9579fd9524eacbac76c2d3a602aad873b3ecef3a1fc97cb66dc8c
4
- data.tar.gz: b2df8c8e8f004bbae449d53b734f851e8fdffa0bbcb3dc80331750b452ae3f4e
3
+ metadata.gz: da832aeaecc62c6c8f348ae6fbaf1f3190268e059259a26363ab1df9157e3e60
4
+ data.tar.gz: 631e958e3af6d87eb5d8bf7e18080cb730e7798308845ee61c5982977c5bf3b0
5
5
  SHA512:
6
- metadata.gz: 1bbc3a005634bab1fa6d9d7b7cdaa2717473d9d0b02d9ee3e70d61c946407fd9268bb68f8847d513fbea2b71e71d9e6e5c64ebfaff38916ac1a632ee56bc3295
7
- data.tar.gz: dc44591c5de4a57c48ad028a7590d4aaaa3af3f5d046e20db063973198a0cf9a3b83877742c9cfa97063a38cca0ceb294e3f73df50af3ccd311b7a360137adf2
6
+ metadata.gz: f85a2af422326903378ac5281bb5c281f5aaf46de5dce7c35e5c99168e723bb2e53fd46212e7186cc1e3110a1a622dd3807a1760fff3a8c149e802778cb38011
7
+ data.tar.gz: 6cc421a9a65ddac6f998e4adb1fe8885e73fc51158118281b48dc57e0e18946469493844995e2eb23a9cc5b0ca2a4ab4d48c3df3a808ba576771ff14f92aa768
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Xambuild Fastlane Plugin
2
2
 
3
- [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xambuild)
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xambuild) [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-xambuild.svg)](https://badge.fury.io/rb/fastlane-plugin-xambuild)
4
4
 
5
5
  ## Getting Started
6
6
 
@@ -16,20 +16,6 @@ end
16
16
  require "fastlane"
17
17
 
18
18
  module Xambuild
19
- class << self
20
- attr_reader :config
21
-
22
- attr_accessor :project
23
-
24
- attr_accessor :cache
25
-
26
- def config=(value)
27
- @config = value
28
- DetectValues.set_additional_default_values
29
- @cache = {}
30
- end
31
- end
32
-
33
19
  Helper = FastlaneCore::Helper
34
20
  UI = FastlaneCore::UI
35
21
  end
@@ -1,6 +1,6 @@
1
1
  require "fastlane/plugin/xambuild/helpers/options"
2
- require "fastlane/plugin/xambuild/helpers/platform"
3
2
  require "fastlane/plugin/xambuild/helpers/manager"
3
+ require "csproj/platform"
4
4
 
5
5
  module Fastlane
6
6
  module Actions
@@ -11,12 +11,11 @@ module Fastlane
11
11
  end
12
12
 
13
13
  class XambuildAction < Action
14
-
15
14
  def self.run(values)
16
- values[:platform] = ::Xambuild::Platform.from_lane_context(Actions.lane_context)
17
- ::Xambuild.config = values
15
+ values[:platform] = ::CsProj::Platform.from_lane_context(Actions.lane_context)
16
+ ::CsProj.config = values
18
17
 
19
- if ::Xambuild.project.ios? || ::Xambuild.project.osx?
18
+ if ::CsProj.project.ios? || ::CsProj.project.osx?
20
19
  absolute_ipa_path = File.expand_path(::Xambuild::Manager.new.work(values))
21
20
  absolute_app_path = File.join(values[:output_path], "#{values[:assembly_name]}.app")
22
21
  absolute_dsym_path = absolute_ipa_path.gsub(".ipa", ".app.dSYM.zip")
@@ -30,10 +29,10 @@ module Fastlane
30
29
  ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path if File.exist?(absolute_dsym_path)
31
30
 
32
31
  absolute_ipa_path
33
- elsif ::Xambuild.project.android?
32
+ elsif ::CsProj.project.android?
34
33
  if values[:keystore_path] && values[:keystore_alias]
35
34
  unless values[:keystore_password]
36
- ::Xambuild.config[:keystore_password] = ask("Password (for #{values[:keystore_alias]}): ") { |q| q.echo = "*" }
35
+ ::CsProj.config[:keystore_password] = ask("Password (for #{values[:keystore_alias]}): ") { |q| q.echo = "*" }
37
36
  end
38
37
  end
39
38
  absolute_apk_path = File.expand_path(::Xambuild::Manager.new.work(values))
@@ -1,12 +1,12 @@
1
1
  module Xambuild
2
- class AndroidZipalignCommandGenerator
2
+ class AndroidZipalign
3
3
  class << self
4
4
  def generate
5
5
  parts = prefix
6
6
  parts << zipalign_apk
7
7
  parts += options
8
- parts << Xambuild.cache[:signed_apk_path]
9
- parts << Xambuild.cache[:build_apk_path]
8
+ parts << CsProj.cache[:signed_apk_path]
9
+ parts << CsProj.cache[:build_apk_path]
10
10
  parts += pipe
11
11
 
12
12
  parts
@@ -1,5 +1,5 @@
1
1
  module Xambuild
2
- class BuildCommandGenerator
2
+ class BuildCommand
3
3
  class << self
4
4
  def generate
5
5
  parts = prefix
@@ -17,17 +17,17 @@ module Xambuild
17
17
  end
18
18
 
19
19
  def compiler_bin
20
- Xambuild.config[:compiler_bin]
20
+ CsProj.config[:compiler_bin]
21
21
  end
22
22
 
23
23
  def options
24
- config = Xambuild.config
24
+ config = CsProj.config
25
25
 
26
26
  options = []
27
27
  options << config[:extra_build_options] if config[:extra_build_options]
28
28
  options << "-p:Configuration=#{config[:build_configuration]}" if config[:build_configuration]
29
- options << "-p:Platform=#{config[:build_platform]}" if Xambuild.project.ios? && config[:build_platform]
30
- options << "-p:BuildIpa=true" if Xambuild.project.ios?
29
+ options << "-p:Platform=#{config[:build_platform]}" if CsProj.project.ios? && config[:build_platform]
30
+ options << "-p:BuildIpa=true" if CsProj.project.ios?
31
31
  if config[:solution_path]
32
32
  solution_dir = File.dirname(config[:solution_path])
33
33
  options << "-p:SolutionDir=#{solution_dir}/"
@@ -37,13 +37,13 @@ module Xambuild
37
37
  end
38
38
 
39
39
  def build_targets
40
- Xambuild.config[:build_target].map! { |t| "-t:#{t}" }
40
+ CsProj.config[:build_target].map! { |t| "-t:#{t}" }
41
41
  end
42
42
 
43
43
  def targets
44
44
  targets = []
45
45
  targets += build_targets
46
- targets << "-t:SignAndroidPackage" if Xambuild.project.android?
46
+ targets << "-t:SignAndroidPackage" if CsProj.project.android?
47
47
 
48
48
  targets
49
49
  end
@@ -51,7 +51,7 @@ module Xambuild
51
51
  def project
52
52
  path = []
53
53
 
54
- path << Xambuild.config[:project_path]
54
+ path << CsProj.config[:project_path]
55
55
 
56
56
  path
57
57
  end
@@ -1,15 +1,15 @@
1
1
  module Xambuild
2
- class JavaSignCommandGenerator
2
+ class JavaSign
3
3
  class << self
4
4
  def generate
5
- build_apk_path = Xambuild.cache[:build_apk_path]
6
- Xambuild.cache[:signed_apk_path] = "#{build_apk_path}-unaligned"
5
+ build_apk_path = CsProj.cache[:build_apk_path]
6
+ CsProj.cache[:signed_apk_path] = "#{build_apk_path}-unaligned"
7
7
 
8
8
  parts = prefix
9
9
  parts << detect_jarsigner_executable
10
10
  parts += options
11
11
  parts << build_apk_path
12
- parts << Xambuild.config[:keystore_alias]
12
+ parts << CsProj.config[:keystore_alias]
13
13
  parts += pipe
14
14
 
15
15
  parts
@@ -26,7 +26,7 @@ module Xambuild
26
26
  end
27
27
 
28
28
  def options
29
- config = Xambuild.config
29
+ config = CsProj.config
30
30
 
31
31
  options = []
32
32
  options << "-verbose" if $verbose
@@ -35,7 +35,7 @@ module Xambuild
35
35
  options << "-storepass \"#{config[:keystore_password]}\""
36
36
  options << "-keystore \"#{config[:keystore_path]}\""
37
37
  options << "-tsa #{config[:keystore_tsa]}"
38
- options << "-signedjar \"#{Xambuild.cache[:signed_apk_path]}\""
38
+ options << "-signedjar \"#{CsProj.cache[:signed_apk_path]}\""
39
39
 
40
40
  options
41
41
  end
@@ -1,5 +1,5 @@
1
1
  module Xambuild
2
- class ZipDsymCommandGenerator
2
+ class ZipDsym
3
3
  class << self
4
4
  def generate
5
5
  parts = prefix
@@ -21,7 +21,7 @@ module Xambuild
21
21
  end
22
22
 
23
23
  def options
24
- build_dsym_path = Xambuild.cache[:build_dsym_path]
24
+ build_dsym_path = CsProj.cache[:build_dsym_path]
25
25
 
26
26
  options = []
27
27
  options << "-r"
@@ -5,9 +5,9 @@ require "fastlane/plugin/xambuild/version"
5
5
  module Xambuild
6
6
  class Manager
7
7
  def work(options)
8
- Xambuild.config = options
8
+ CsProj.config = options
9
9
 
10
- FastlaneCore::PrintTable.print_values(config: Xambuild.config,
10
+ FastlaneCore::PrintTable.print_values(config: CsProj.config,
11
11
  hide_keys: [],
12
12
  title: "Summary for xambuild #{Fastlane::Xambuild::VERSION}")
13
13
 
@@ -90,7 +90,7 @@ module Xambuild
90
90
  env_name: "XAMBUILD_ANDROID_KEYSTORE_PASSWORD",
91
91
  description: "Password of the keystore",
92
92
  optional: true),
93
-
93
+
94
94
  FastlaneCore::ConfigItem.new(key: :keystore_tsa,
95
95
  default_value: "http://timestamp.digicert.com",
96
96
  env_name: "XAMBUILD_ANDROID_KEYSTORE_TSA",
@@ -1,23 +1,22 @@
1
1
  require "fastlane"
2
- require "fastlane/plugin/xambuild/helpers/generators/build_command_generator"
3
- require "fastlane/plugin/xambuild/helpers/generators/zip_dsym_command_generator"
4
- require "fastlane/plugin/xambuild/helpers/generators/java_sign_command_generator"
5
- require "fastlane/plugin/xambuild/helpers/generators/android_zipalign_command_generator"
2
+ require "fastlane/plugin/xambuild/helpers/generators/build"
3
+ require "fastlane/plugin/xambuild/helpers/generators/zip_dsym"
4
+ require "fastlane/plugin/xambuild/helpers/generators/java_sign"
5
+ require "fastlane/plugin/xambuild/helpers/generators/android_zipalign"
6
6
 
7
7
  module Xambuild
8
8
  class Runner
9
-
10
9
  def run
11
- config = Xambuild.config
10
+ config = CsProj.config
12
11
 
13
12
  build_app
14
13
 
15
- if Xambuild.project.ios? || Xambuild.project.osx?
14
+ if CsProj.project.ios? || CsProj.project.osx?
16
15
  compress_and_move_dsym
17
16
  path = ipa_file
18
17
 
19
18
  path
20
- elsif Xambuild.project.android?
19
+ elsif CsProj.project.android?
21
20
  path = apk_file
22
21
  if config[:keystore_path] && config[:keystore_alias]
23
22
  UI.success "Jar it, sign it, zip it..."
@@ -30,45 +29,45 @@ module Xambuild
30
29
  end
31
30
 
32
31
  def build_app
33
- command = BuildCommandGenerator.generate
32
+ command = BuildCommand.generate
34
33
 
35
34
  FastlaneCore::CommandExecutor.execute(command: command,
36
35
  print_all: true,
37
- print_command: !Xambuild.config[:silent])
36
+ print_command: !CsProj.config[:silent])
38
37
  end
39
38
 
40
39
  def apk_file
41
- build_path = Xambuild.project.options[:output_path]
42
- assembly_name = Xambuild.project.options[:assembly_name]
40
+ build_path = CsProj.project.options[:output_path]
41
+ assembly_name = CsProj.project.options[:assembly_name]
43
42
 
44
- Xambuild.cache[:build_apk_path] = "#{build_path}/#{assembly_name}.apk"
43
+ CsProj.cache[:build_apk_path] = "#{build_path}/#{assembly_name}.apk"
45
44
 
46
45
  "#{build_path}/#{assembly_name}.apk"
47
46
  end
48
47
 
49
48
  def jarsign_and_zipalign
50
- command = JavaSignCommandGenerator.generate
49
+ command = JavaSign.generate
51
50
  FastlaneCore::CommandExecutor.execute(command: command,
52
51
  print_all: false,
53
- print_command: !Xambuild.config[:silent])
52
+ print_command: !CsProj.config[:silent])
54
53
 
55
- UI.success "Successfully signed apk #{Xambuild.cache[:build_apk_path]}"
54
+ UI.success "Successfully signed apk #{CsProj.cache[:build_apk_path]}"
56
55
 
57
- command = AndroidZipalignCommandGenerator.generate
56
+ command = AndroidZipalign.generate
58
57
  FastlaneCore::CommandExecutor.execute(command: command,
59
58
  print_all: true,
60
- print_command: !Xambuild.config[:silent])
59
+ print_command: !CsProj.config[:silent])
61
60
  end
62
61
 
63
62
  def package_path
64
- build_path = Xambuild.project.options[:output_path]
65
- assembly_name = Xambuild.project.options[:assembly_name]
63
+ build_path = CsProj.project.options[:output_path]
64
+ assembly_name = CsProj.project.options[:assembly_name]
66
65
 
67
66
  package_path = if File.exist? "#{build_path}/#{assembly_name}.ipa"
68
- # after Xamarin.iOS Cycle 9
67
+ # After Xamarin.iOS 9
69
68
  build_path
70
69
  else
71
- # before Xamarin.iOS Cycle 9
70
+ # Before Xamarin.iOS 9
72
71
  Dir.glob("#{build_path}/#{assembly_name} *").max
73
72
  end
74
73
 
@@ -76,14 +75,14 @@ module Xambuild
76
75
  end
77
76
 
78
77
  def ipa_file
79
- assembly_name = Xambuild.project.options[:assembly_name]
78
+ assembly_name = CsProj.project.options[:assembly_name]
80
79
 
81
80
  "#{package_path}/#{assembly_name}.ipa"
82
81
  end
83
82
 
84
83
  def compress_and_move_dsym
85
- build_path = Xambuild.project.options[:output_path]
86
- assembly_name = Xambuild.project.options[:assembly_name]
84
+ build_path = CsProj.project.options[:output_path]
85
+ assembly_name = CsProj.project.options[:assembly_name]
87
86
 
88
87
  build_dsym_path = "#{build_path}/#{assembly_name}.app.dSYM"
89
88
  unless File.exist? build_dsym_path
@@ -91,14 +90,14 @@ module Xambuild
91
90
  return
92
91
  end
93
92
 
94
- Xambuild.cache[:build_dsym_path] = build_dsym_path
93
+ CsProj.cache[:build_dsym_path] = build_dsym_path
95
94
 
96
- command = ZipDsymCommandGenerator.generate
95
+ command = ZipDsym.generate
97
96
  FastlaneCore::CommandExecutor.execute(command: command,
98
97
  print_all: true,
99
- print_command: !Xambuild.config[:silent])
98
+ print_command: !CsProj.config[:silent])
100
99
 
101
- # move dsym aside ipa
100
+ # Move dsym beside ipa
102
101
  dsym_path = "#{dsym_path}.zip"
103
102
  if File.exist? dsym_path
104
103
  FileUtils.mv(dsym_path, "#{package_path}/#{File.basename dsym_path}")
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Xambuild
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-xambuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Barnby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-25 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: fastlane
14
+ name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.156'
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: '2.156'
26
+ version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
- name: highline
28
+ name: csproj
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.7'
33
+ version: 0.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.7'
40
+ version: 0.1.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: nokogiri
42
+ name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.7'
48
- type: :runtime
47
+ version: '0'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.7'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: fastlane
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 2.169.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 2.169.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,62 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec_junit_formatter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.49.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 0.49.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-require_tools
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
111
167
  description:
112
168
  email: jakeb994@gmail.com
113
169
  executables: []
@@ -117,20 +173,14 @@ files:
117
173
  - LICENSE
118
174
  - README.md
119
175
  - lib/fastlane/plugin/xambuild.rb
120
- - lib/fastlane/plugin/xambuild/actions/app_version_action.rb
121
176
  - lib/fastlane/plugin/xambuild/actions/xambuild_action.rb
122
177
  - lib/fastlane/plugin/xambuild/helpers/commands_generator.rb
123
- - lib/fastlane/plugin/xambuild/helpers/detect_values.rb
124
- - lib/fastlane/plugin/xambuild/helpers/generators/android_zipalign_command_generator.rb
125
- - lib/fastlane/plugin/xambuild/helpers/generators/build_command_generator.rb
126
- - lib/fastlane/plugin/xambuild/helpers/generators/java_sign_command_generator.rb
127
- - lib/fastlane/plugin/xambuild/helpers/generators/zip_dsym_command_generator.rb
178
+ - lib/fastlane/plugin/xambuild/helpers/generators/android_zipalign.rb
179
+ - lib/fastlane/plugin/xambuild/helpers/generators/build.rb
180
+ - lib/fastlane/plugin/xambuild/helpers/generators/java_sign.rb
181
+ - lib/fastlane/plugin/xambuild/helpers/generators/zip_dsym.rb
128
182
  - lib/fastlane/plugin/xambuild/helpers/manager.rb
129
- - lib/fastlane/plugin/xambuild/helpers/msbuild/project.rb
130
- - lib/fastlane/plugin/xambuild/helpers/msbuild/solution.rb
131
- - lib/fastlane/plugin/xambuild/helpers/msbuild/solution_parser.rb
132
183
  - lib/fastlane/plugin/xambuild/helpers/options.rb
133
- - lib/fastlane/plugin/xambuild/helpers/platform.rb
134
184
  - lib/fastlane/plugin/xambuild/helpers/runner.rb
135
185
  - lib/fastlane/plugin/xambuild/version.rb
136
186
  homepage: https://github.com/abnegate/fastlane-plugin-xambuild
@@ -1,96 +0,0 @@
1
- require "fastlane/plugin/xambuild/helpers/options"
2
- require "fastlane/plugin/xambuild/helpers/platform"
3
-
4
- module Fastlane
5
- module Actions
6
- class AppVersionAction < Action
7
-
8
- def self.run(values)
9
- values[:platform] = ::Xambuild::Platform.from_lane_context(Actions.lane_context)
10
- ::Xambuild.config = values
11
-
12
- if ::Xambuild.project.ios? || ::Xambuild.project.osx?
13
- version, build = set_plist_version values[:version], values[:build], values[:plist_path]
14
- elsif ::Xambuild.project.android?
15
- version, build = set_manifest_version values[:version], values[:build], values[:manifest_path]
16
- end
17
-
18
- UI.important "Current Version is:"
19
- UI.message " Version: #{version}"
20
- UI.message " Build: #{build}"
21
- end
22
-
23
- def self.set_plist_version(version, build, plist_path = nil)
24
- plist_path ||= ::Xambuild.config[:plist_path]
25
- version ||= other_action.get_info_plist_value(path: plist_path, key: "CFBundleShortVersionString")
26
- build ||= other_action.get_info_plist_value(path: plist_path, key: "CFBundleVersion")
27
-
28
- other_action.set_info_plist_value(
29
- path: plist_path,
30
- key: "CFBundleShortVersionString",
31
- value: version
32
- )
33
-
34
- other_action.set_info_plist_value(
35
- path: plist_path,
36
- key: "CFBundleVersion",
37
- value: build
38
- )
39
-
40
- [version, build]
41
- end
42
-
43
- def self.set_manifest_version(version, build, manifest_path = nil)
44
- manifest_path ||= ::Xambuild.config[:manifest_path]
45
-
46
- f1 = File.open(manifest_path)
47
- doc = Nokogiri::XML(f1)
48
- f1.close
49
-
50
- attrs = doc.xpath("//manifest")[0]
51
-
52
- version ||= attrs["android:versionName"]
53
- build ||= attrs["android:versionCode"]
54
-
55
- if version || build
56
- attrs["android:versionName"] = version if version
57
- attrs["android:versionCode"] = build if build
58
-
59
- File.open(manifest_path, "w") do |f2|
60
- f2.print(doc.to_xml)
61
- end
62
- end
63
-
64
- [version, build]
65
- end
66
-
67
- def self.description
68
- "Easily set or print app version with `app_version`"
69
- end
70
-
71
- def self.author
72
- "Jake Barnby"
73
- end
74
-
75
- def self.available_options
76
- Xambuild::Options.available_options.concat(
77
- [
78
- FastlaneCore::ConfigItem.new(key: :version,
79
- env_name: "FL_APP_VERSION",
80
- description: "App version value",
81
- optional: true),
82
-
83
- FastlaneCore::ConfigItem.new(key: :build,
84
- env_name: "FL_APP_BUILD",
85
- description: "App build number value",
86
- optional: true)
87
- ]
88
- )
89
- end
90
-
91
- def self.is_supported?(platform)
92
- true
93
- end
94
- end
95
- end
96
- end
@@ -1,145 +0,0 @@
1
- require "nokogiri"
2
- require "fastlane/plugin/xambuild/helpers/msbuild/project"
3
- require "fastlane/plugin/xambuild/helpers/msbuild/solution_parser"
4
-
5
- module Xambuild
6
- class DetectValues
7
-
8
- def self.set_additional_default_values
9
- config = Xambuild.config
10
-
11
- # TODO: detect_platform automatically for :platform config
12
-
13
- if config[:platform] == Platform::ANDROID
14
- config[:build_platform] = "AnyCPU"
15
- end
16
-
17
- # Detect the project
18
- Xambuild.project = Msbuild::Project.new(config)
19
- detect_solution
20
- detect_project
21
-
22
- doc_csproj = get_parser_handle config[:project_path]
23
-
24
- detect_output_path doc_csproj
25
- detect_manifest doc_csproj
26
- detect_info_plist
27
- detect_assembly_name doc_csproj
28
-
29
- config
30
- end
31
-
32
- # Helper Methods
33
-
34
- def self.detect_solution
35
- return if Xambuild.config[:solution_path]
36
-
37
- sln = find_file("*.sln", 3)
38
- UI.user_error! "Not able to find solution file automatically, try to specify it via `solution_path` parameter." unless sln
39
-
40
- Xambuild.config[:solution_path] = abs_path sln
41
- end
42
-
43
- def self.detect_project
44
- return if Xambuild.config[:project_path]
45
-
46
- path = Xambuild.config[:solution_path]
47
- projects = Msbuild::SolutionParser.parse(path)
48
- .get_platform Xambuild.config[:platform]
49
-
50
- UI.user_error! "Not able to find any project in solution, that matches the platform `#{Xambuild.config[:platform]}`." unless projects.any?
51
-
52
- project = projects.first
53
- csproj = fix_path_relative project.project_path
54
-
55
- UI.user_error! "Not able to find project file automatically, try to specify it via `project_path` parameter." unless csproj
56
-
57
- Xambuild.config[:project_name] = project.project_name
58
- Xambuild.config[:project_path] = abs_path csproj
59
- end
60
-
61
- def self.detect_output_path(doc_csproj)
62
- return if Xambuild.config[:output_path]
63
-
64
- configuration = Xambuild.config[:build_configuration]
65
- platform = Xambuild.config[:build_platform]
66
-
67
- 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()")
68
- output_path = doc_node.text
69
- UI.user_error! "Not able to find output path automatically, try to specify it via `output_path` parameter." unless output_path
70
-
71
- Xambuild.config[:output_path] = abs_project_path output_path
72
- end
73
-
74
- def self.detect_manifest(doc_csproj)
75
- return if Xambuild.config[:manifest_path] || (Xambuild.config[:platform] != Platform::ANDROID)
76
-
77
- doc_node = doc_csproj.css("AndroidManifest").first
78
-
79
- Xambuild.config[:manifest_path] = abs_project_path doc_node.text
80
- end
81
-
82
- def self.detect_info_plist
83
- return if Xambuild.config[:plist_path] || (Xambuild.config[:platform] != Platform::IOS)
84
-
85
- plist_path = find_file("Info.plist", 1)
86
- UI.user_error! "Not able to find Info.plist automatically, try to specify it via `plist_path` parameter." unless plist_path
87
-
88
- Xambuild.config[:plist_path] = abs_project_path plist_path
89
- end
90
-
91
- def self.detect_assembly_name(doc_csproj)
92
- return if Xambuild.config[:assembly_name]
93
-
94
- if [Platform::IOS, Platform::OSX].include? Xambuild.config[:platform]
95
- Xambuild.config[:assembly_name] = doc_csproj.css("PropertyGroup > AssemblyName").text
96
- elsif Xambuild.config[:platform] == Platform::ANDROID
97
- doc = get_parser_handle Xambuild.config[:manifest_path]
98
- Xambuild.config[:assembly_name] = doc.xpath("string(//manifest/@package)")
99
- end
100
- end
101
-
102
- private_class_method
103
-
104
- def self.find_file(query, depth)
105
- itr = 0
106
- files = []
107
-
108
- loop do
109
- files = Dir.glob(query)
110
- query = "../#{query}"
111
- itr += 1
112
- break if files.any? || (itr > depth)
113
- end
114
-
115
- files.first
116
- end
117
-
118
- def self.get_parser_handle(filename)
119
- f = File.open(filename)
120
- doc = Nokogiri::XML(f)
121
- f.close
122
-
123
- doc
124
- end
125
-
126
- def self.fix_path_relative(path)
127
- root = File.dirname Xambuild.config[:solution_path]
128
- path = "#{root}/#{path}"
129
- path
130
- end
131
-
132
- def self.abs_project_path(path)
133
- path = path.tr('\\', "/")
134
- platform_path = Xambuild.config[:project_path]
135
- path = "#{File.dirname platform_path}/#{path}"
136
- path
137
- end
138
-
139
- def self.abs_path(path)
140
- path = path.tr('\\', "/")
141
- path = File.expand_path(path)
142
- path
143
- end
144
- end
145
- end
@@ -1,43 +0,0 @@
1
- module Xambuild
2
- module Msbuild
3
- class Project
4
- attr_accessor :options
5
-
6
- def initialize(options)
7
- @options = options
8
- end
9
-
10
- def project_name
11
- @options[:project_name]
12
- end
13
-
14
- def project_path
15
- @options[:project_path]
16
- end
17
-
18
- def ios?
19
- is_platform? Xambuild::Platform::IOS
20
- end
21
-
22
- def osx?
23
- is_platform? Xambuild::Platform::OSX
24
- end
25
-
26
- def android?
27
- is_platform? Xambuild::Platform::ANDROID
28
- end
29
-
30
- def is_platform?(platform)
31
- case platform
32
- when Xambuild::Platform::IOS
33
- then project_name.downcase.include? "ios"
34
- when Xambuild::Platform::OSX
35
- then project_name.downcase.include? "mac"
36
- when Xambuild::Platform::ANDROID
37
- then project_name.downcase.include? "droid"
38
- else false
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,19 +0,0 @@
1
- module Xambuild
2
- module Msbuild
3
- class Solution
4
- attr_accessor :projects
5
-
6
- def initialize
7
- @projects = []
8
- end
9
-
10
- def add_project(project)
11
- @projects << project
12
- end
13
-
14
- def get_platform(platform)
15
- @projects.select { |p| p.is_platform? platform }
16
- end
17
- end
18
- end
19
- end
@@ -1,36 +0,0 @@
1
- require "fastlane/plugin/xambuild/helpers/msbuild/solution"
2
-
3
- module Xambuild
4
- module Msbuild
5
- class SolutionParser
6
- def self.parse(filename)
7
- solution = Solution.new
8
-
9
- File.open(filename) do |f|
10
- f.read.split("\n").each do |line|
11
- if line.start_with? "Project"
12
- options = parse_line line
13
- solution.add_project Project.new(options)
14
- end
15
- end
16
- end
17
-
18
- solution
19
- end
20
-
21
- def self.parse_line(line)
22
- name = get_project_name line
23
- project_file = get_project_file line
24
- {project_name: name, project_path: project_file}
25
- end
26
-
27
- def self.get_project_name(project_line)
28
- project_line.split("\"")[3]
29
- end
30
-
31
- def self.get_project_file(project_line)
32
- project_line.split("\"")[5].tr('\\', "/")
33
- end
34
- end
35
- end
36
- end
@@ -1,13 +0,0 @@
1
- module Xambuild
2
- module Platform
3
- IOS = "ios"
4
- OSX = "osx"
5
- ANDROID = "android"
6
-
7
- def self.from_lane_context(context)
8
- current_platform = context[:PLATFORM_NAME].to_s
9
-
10
- current_platform
11
- end
12
- end
13
- end