fastlane-plugin-sunny_project 0.1.16 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/sunny_project/actions/finalize_version_action.rb +1 -1
- data/lib/fastlane/plugin/sunny_project/actions/local_packages_action.rb +155 -0
- data/lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb +13 -11
- data/lib/fastlane/plugin/sunny_project/actions/sunny_build_runner.rb +71 -0
- data/lib/fastlane/plugin/sunny_project/actions/sunny_build_web.rb +110 -0
- data/lib/fastlane/plugin/sunny_project/actions/sunny_release_action.rb +74 -46
- data/lib/fastlane/plugin/sunny_project/helper/plugin_options.rb +28 -32
- data/lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb +78 -17
- data/lib/fastlane/plugin/sunny_project/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ce12ef710c532d745039014df9970dd64a5b0a3d76392ebe5feb7e84b0ae445
|
4
|
+
data.tar.gz: c4f5efa01f1c70f7f6ab043855e0f2c51f65611f75eab66d7ce04abb053c775d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6037740092fe97afd89e55a50fbc288005950495c4c4605fb0564aab0fb704cdb7f70aa5d772d1b57a5bd5fff3248616ee4ddd1a14d490b8713bce25e7aa9f3
|
7
|
+
data.tar.gz: 0653c4a208fddb510fe77e6fd6bacdbba167399ee07286f1a3586ba8ed29b040ff4a31509490830c08b9c613c0780eb45e38c9e3a5cea5b47604cccd6354229c
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
|
3
|
+
# require 'ci'
|
4
|
+
require_relative '../helper/sunny_project_helper'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
require_relative '../helper/plugin_options'
|
8
|
+
|
9
|
+
module Fastlane
|
10
|
+
module Actions
|
11
|
+
class LocalPackagesAction < Action
|
12
|
+
def self.run(options)
|
13
|
+
puts("Incoming: #{options.class}")
|
14
|
+
|
15
|
+
unless options
|
16
|
+
options = FastlaneCore::Configuration.create(self.available_options, {})
|
17
|
+
end
|
18
|
+
options.load_configuration_file("Sunnyfile")
|
19
|
+
options.load_configuration_file(".Sunnyfile")
|
20
|
+
|
21
|
+
params = options
|
22
|
+
params.all_keys.each do |k|
|
23
|
+
puts("#{k} => #{params[k]}")
|
24
|
+
end
|
25
|
+
|
26
|
+
plugins = params[:sunny_plugins]
|
27
|
+
plugin_folder = params[:sunny_plugin_folder]
|
28
|
+
# pubspec = YAML.load_file("pubspec.yaml")
|
29
|
+
local_mode = params[:sunny_local_mode]
|
30
|
+
is_local = "local".eql?(local_mode)
|
31
|
+
UI.command_output("Local #{local_mode} creates #{is_local}")
|
32
|
+
|
33
|
+
unless is_local
|
34
|
+
UI.user_error!("Not set to local development. Not checking out")
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
38
|
+
roots = []
|
39
|
+
Dir.chdir(plugin_folder) do
|
40
|
+
plugins.keys.each do |key|
|
41
|
+
info = plugins[key] ? plugins[key] : "#{key}"
|
42
|
+
folder = key
|
43
|
+
root_folder = nil
|
44
|
+
branch = nil
|
45
|
+
path = nil
|
46
|
+
repo = key
|
47
|
+
if info.is_a?(String)
|
48
|
+
repo = info
|
49
|
+
root_folder = key
|
50
|
+
else
|
51
|
+
path = info[:path]
|
52
|
+
branch = info[:branch] if info[:branch]
|
53
|
+
repo = info[:repo] if info[:repo]
|
54
|
+
folder = repo
|
55
|
+
root_folder = if path
|
56
|
+
repo
|
57
|
+
else
|
58
|
+
key
|
59
|
+
end
|
60
|
+
end
|
61
|
+
UI.header("#{folder}")
|
62
|
+
if roots.include?(root_folder)
|
63
|
+
UI.message "Skipping root #{root_folder} - already processed"
|
64
|
+
else
|
65
|
+
git_repo = "git@github.com:SunnyApp/#{repo}.git"
|
66
|
+
|
67
|
+
plugin_exists = Dir.exist?("./#{root_folder}")
|
68
|
+
if !plugin_exists || options[:force]
|
69
|
+
UI.important("Checking out plugin #{repo} to #{root_folder}")
|
70
|
+
Sunny.exec_cmd("clone #{key}", "git clone #{git_repo} #{root_folder}", quiet: true)
|
71
|
+
else
|
72
|
+
UI.message("Plugin already cloned: #{root_folder}")
|
73
|
+
end
|
74
|
+
|
75
|
+
roots.push(root_folder)
|
76
|
+
|
77
|
+
Dir.chdir("./#{folder}") do
|
78
|
+
if branch
|
79
|
+
UI.important("Verifying branch #{branch}")
|
80
|
+
unless Sunny.is_branch(branch)
|
81
|
+
if Sunny.is_clean
|
82
|
+
Sunny.exec_cmd("checkout branch #{branch}", "git checkout #{branch}")
|
83
|
+
else
|
84
|
+
UI.user_error!("Needs to be on branch #{branch}, but repo is not clean. You will need to manually fix this")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
if params[:update]
|
90
|
+
begin
|
91
|
+
Sunny.run_action(GitPullAction, rebase: true)
|
92
|
+
rescue StandardError => e
|
93
|
+
UI.error("---------- Failed to update ---------------")
|
94
|
+
UI.error("There are changes to the working tree. Check ")
|
95
|
+
UI.error("the status of each repo below and make any fixes.")
|
96
|
+
UI.error("------------------------------------------------")
|
97
|
+
|
98
|
+
UI.command_output(cmd("myrepos status", "git status --porcelain", args = options))
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.description
|
109
|
+
"Checks out local dart packages"
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.authors
|
113
|
+
["ericmartineau"]
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.return_value
|
117
|
+
# If your method provides a return value, you can describe here what it does
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.details
|
121
|
+
# Optional:
|
122
|
+
""
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.available_options
|
126
|
+
opts = [
|
127
|
+
FastlaneCore::ConfigItem.new(key: :update,
|
128
|
+
env_name: "SUNNY_UPDATE",
|
129
|
+
description: "Whether to update each plugin",
|
130
|
+
type: Object,
|
131
|
+
optional: true),
|
132
|
+
FastlaneCore::ConfigItem.new(key: :force,
|
133
|
+
env_name: "SUNNY_FORCE",
|
134
|
+
description: "Whether to update each plugin",
|
135
|
+
type: Object,
|
136
|
+
optional: true),
|
137
|
+
]
|
138
|
+
|
139
|
+
Fastlane::SunnyProject::Options.available_options.each do |option|
|
140
|
+
opts.push(option)
|
141
|
+
end
|
142
|
+
opts
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.is_supported?(platform)
|
146
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
147
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
148
|
+
#
|
149
|
+
# [:ios, :mac, :android].include?(platform)
|
150
|
+
true
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
@@ -26,20 +26,15 @@ end
|
|
26
26
|
module Fastlane
|
27
27
|
module Actions
|
28
28
|
class PubspecDoctorAction < Action
|
29
|
-
def self.run(
|
29
|
+
def self.run(params)
|
30
30
|
|
31
|
-
params
|
32
|
-
|
33
|
-
options.all_keys.each do |key|
|
34
|
-
puts("override #{key} => #{options[key]}")
|
35
|
-
params.set(key, options[key])
|
36
|
-
end
|
37
|
-
params.all_keys.each do |k|
|
38
|
-
puts("#{k} => #{params[k]}")
|
31
|
+
unless params
|
32
|
+
params = FastlaneCore::Configuration.create(self.available_options, {})
|
39
33
|
end
|
34
|
+
params.load_configuration_file("Sunnyfile")
|
35
|
+
params.load_configuration_file(".Sunnyfile")
|
40
36
|
|
41
37
|
plugins = params[:sunny_plugins]
|
42
|
-
branches = params[:sunny_plugins_branches]
|
43
38
|
plugin_folder = params[:sunny_plugin_folder]
|
44
39
|
pubspec = YAML.load_file("pubspec.yaml")
|
45
40
|
local_mode = params[:sunny_local_mode]
|
@@ -116,7 +111,14 @@ module Fastlane
|
|
116
111
|
end
|
117
112
|
|
118
113
|
def self.available_options
|
119
|
-
|
114
|
+
opts = [
|
115
|
+
|
116
|
+
]
|
117
|
+
|
118
|
+
Fastlane::SunnyProject::Options.available_options.each do |option|
|
119
|
+
opts.push(option)
|
120
|
+
end
|
121
|
+
opts
|
120
122
|
end
|
121
123
|
|
122
124
|
def self.is_supported?(platform)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../helper/sunny_project_helper'
|
2
|
+
require 'semantic'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
require_relative '../helper/plugin_options'
|
6
|
+
|
7
|
+
module Fastlane
|
8
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
9
|
+
module Actions
|
10
|
+
class SunnyBuildRunnerAction < Action
|
11
|
+
def self.run(options)
|
12
|
+
Sunny.build_runner(options)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.description
|
16
|
+
"Cleans and runs flutter build_runner"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.authors
|
20
|
+
["ericmartineau"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.return_value
|
24
|
+
# If your method provides a return value, you can describe here what it does
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.details
|
28
|
+
# Optional:
|
29
|
+
""
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.available_options
|
33
|
+
[
|
34
|
+
FastlaneCore::ConfigItem.new(key: :clean,
|
35
|
+
env_name: "SUNNY_CLEAN",
|
36
|
+
description: "Whether to clean",
|
37
|
+
optional: true, type: Object),
|
38
|
+
|
39
|
+
FastlaneCore::ConfigItem.new(key: :flutter,
|
40
|
+
env_name: "SUNNY_FLUTTER",
|
41
|
+
description: "Path to flutter sdk",
|
42
|
+
optional: true, type: String),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :skip_pub,
|
44
|
+
env_name: "SUNNY_SKIP_PUB",
|
45
|
+
description: "Whether to skip pub get",
|
46
|
+
optional: true, type: Object),
|
47
|
+
|
48
|
+
FastlaneCore::ConfigItem.new(key: :skip_gen,
|
49
|
+
env_name: "SUNNY_SKIP_GEN",
|
50
|
+
description: "Whether to skip generation",
|
51
|
+
optional: true, type: Object),
|
52
|
+
|
53
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
54
|
+
env_name: "SUNNY_VERBOSE",
|
55
|
+
description: "Verbose or not",
|
56
|
+
optional: true, type: Object),
|
57
|
+
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.is_supported?(platform)
|
62
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
63
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
64
|
+
#
|
65
|
+
# [:ios, :mac, :android].include?(platform)
|
66
|
+
true
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require_relative '../helper/sunny_project_helper'
|
2
|
+
require 'semantic'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
require_relative '../helper/plugin_options'
|
6
|
+
|
7
|
+
module Fastlane
|
8
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
9
|
+
module Actions
|
10
|
+
class SunnyBuildWebAction < Action
|
11
|
+
def self.run(options)
|
12
|
+
unless options[:skip_build_runner]
|
13
|
+
Sunny.build_runner(options)
|
14
|
+
end
|
15
|
+
flutter = Sunny.get_flutter(options[:flutter])
|
16
|
+
profile = if options[:profile]
|
17
|
+
" --profile"
|
18
|
+
else
|
19
|
+
""
|
20
|
+
end
|
21
|
+
|
22
|
+
build_cmd = "build web#{profile} --web-renderer #{options[:renderer]}"
|
23
|
+
Sunny.exec_cmd_options("flutter #{build_cmd}", "#{flutter} #{build_cmd}", options)
|
24
|
+
|
25
|
+
if options[:deploy]
|
26
|
+
Sunny.exec_cmd_options("firebase deploy", "firebase deploy", options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.description
|
31
|
+
"Builds a web project"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.authors
|
35
|
+
["ericmartineau"]
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.return_value
|
39
|
+
# If your method provides a return value, you can describe here what it does
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.details
|
43
|
+
# Optional:
|
44
|
+
""
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.available_options
|
48
|
+
[
|
49
|
+
FastlaneCore::ConfigItem.new(key: :skip_build_runner,
|
50
|
+
env_name: "SUNNY_SKIP_BUILD_RUNNER",
|
51
|
+
description: "Whether to skip the build_runner phase",
|
52
|
+
optional: true, type: Object),
|
53
|
+
|
54
|
+
FastlaneCore::ConfigItem.new(key: :clean,
|
55
|
+
env_name: "SUNNY_CLEAN",
|
56
|
+
description: "Whether to clean",
|
57
|
+
optional: true, type: Object),
|
58
|
+
|
59
|
+
FastlaneCore::ConfigItem.new(key: :flutter,
|
60
|
+
env_name: "SUNNY_FLUTTER",
|
61
|
+
description: "Path to flutter sdk",
|
62
|
+
optional: true, type: String),
|
63
|
+
FastlaneCore::ConfigItem.new(key: :skip_pub,
|
64
|
+
env_name: "SUNNY_SKIP_PUB",
|
65
|
+
description: "Whether to skip pub get",
|
66
|
+
optional: true, type: Object),
|
67
|
+
|
68
|
+
FastlaneCore::ConfigItem.new(key: :skip_gen,
|
69
|
+
env_name: "SUNNY_SKIP_GEN",
|
70
|
+
description: "Whether to skip generation",
|
71
|
+
optional: true, type: Object),
|
72
|
+
|
73
|
+
FastlaneCore::ConfigItem.new(key: :renderer,
|
74
|
+
env_name: "SUNNY_RENDERER",
|
75
|
+
description: "The flutter web renderer to build with",
|
76
|
+
optional: false,
|
77
|
+
default_value: "auto", type: String),
|
78
|
+
|
79
|
+
FastlaneCore::ConfigItem.new(key: :profile,
|
80
|
+
env_name: "SUNNY_PROFILE",
|
81
|
+
description: "Whether to run in profile mode",
|
82
|
+
optional: true,
|
83
|
+
type: Object),
|
84
|
+
|
85
|
+
FastlaneCore::ConfigItem.new(key: :deploy,
|
86
|
+
env_name: "SUNNY_DEPLOY",
|
87
|
+
description: "Whether to deploy to firebase",
|
88
|
+
optional: true,
|
89
|
+
type: Object),
|
90
|
+
|
91
|
+
FastlaneCore::ConfigItem.new(key: :verbose,
|
92
|
+
env_name: "SUNNY_VERBOSE",
|
93
|
+
description: "Whether to show verbose output",
|
94
|
+
optional: true,
|
95
|
+
type: Object),
|
96
|
+
|
97
|
+
]
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.is_supported?(platform)
|
101
|
+
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
102
|
+
# See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
|
103
|
+
#
|
104
|
+
# [:ios, :mac, :android].include?(platform)
|
105
|
+
true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
@@ -9,7 +9,7 @@ def resort_keys(input)
|
|
9
9
|
keys = []
|
10
10
|
input.each_key do |key|
|
11
11
|
puts("Key #{key} #{key.class}")
|
12
|
-
keys.push(
|
12
|
+
keys.push(key.to_s)
|
13
13
|
end
|
14
14
|
|
15
15
|
keys = keys.sort
|
@@ -29,28 +29,36 @@ module Fastlane
|
|
29
29
|
Sunny.run_action(EnsureGitStatusCleanAction)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
32
|
sunny_file = Sunny.config(SunnyProject::Options.available_options, {})
|
34
|
-
sunny_file.load_configuration_file("Sunnyfile")
|
33
|
+
sunny_file.load_configuration_file("Sunnyfile", skip_printing_values = true)
|
35
34
|
|
36
35
|
app_file = CredentialsManager::AppfileConfig
|
37
|
-
firebase_app_id=sunny_file[:firebase_app_id]
|
36
|
+
firebase_app_id = sunny_file[:firebase_app_id]
|
38
37
|
unless firebase_app_id
|
39
38
|
UI.user_error!("Missing firebase_app_id. Set this in Sunnyfile")
|
40
39
|
end
|
41
40
|
|
42
41
|
old_version = Sunny.current_semver
|
43
|
-
|
42
|
+
old_version_no_build = "#{old_version.major}.#{old_version.minor}.#{old_version.patch}"
|
43
|
+
|
44
|
+
new_version = ''
|
45
|
+
|
44
46
|
## If we're not going to build, we don't need to update
|
45
47
|
# version numbers.
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
|
49
|
+
if (not options[:skip_build]) && (not options[:no_bump])
|
50
|
+
if options[:patch]
|
51
|
+
new_version = Sunny.do_increase_version(type: "patch")
|
52
|
+
elsif options[:minor]
|
53
|
+
new_version = Sunny.do_increase_version(type: "minor")
|
54
|
+
elsif options[:build]
|
55
|
+
new_version = Sunny.do_increase_version(type: "build")
|
49
56
|
else
|
50
|
-
|
57
|
+
UI.user_error!("You must provide the type of version change. options are minor, patch, build.
|
58
|
+
You can also provide no_bump:true to keep the same build number")
|
51
59
|
end
|
52
60
|
|
53
|
-
unless
|
61
|
+
unless new_version
|
54
62
|
UI.user_error!("Version incrementing failed")
|
55
63
|
return
|
56
64
|
end
|
@@ -58,21 +66,34 @@ module Fastlane
|
|
58
66
|
|
59
67
|
# Whatever happened with the incrementing, this is the build number we're
|
60
68
|
# going with
|
61
|
-
version =
|
62
|
-
|
69
|
+
version = new_version
|
70
|
+
version_no_build = "#{version.major}.#{version.minor}.#{version.patch}"
|
71
|
+
is_version_changed = old_version_no_build.eql?(version_no_build) != true
|
72
|
+
build_number = version.build
|
63
73
|
changes = Sunny.release_notes(options)
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
74
|
+
app_name = options[:app_name]
|
75
|
+
release_target = options[:release_target]
|
76
|
+
|
77
|
+
puts("")
|
78
|
+
build_summary = [
|
79
|
+
["App name", (app_file.try_fetch_value(:app_identifier)).to_s],
|
80
|
+
["Target", app_name],
|
81
|
+
["Major version", is_version_changed ? "#{old_version_no_build} -> #{version_no_build}" : "#{version_no_build} (no change)"],
|
82
|
+
["Build number", "#{old_version.build} -> #{build_number}"],
|
83
|
+
["Releasing to", release_target,],
|
84
|
+
%W[Changelog #{changes}],
|
85
|
+
]
|
86
|
+
UI.important("\n\n#{Terminal::Table.new(rows: FastlaneCore::PrintTable.transform_output(build_summary),
|
87
|
+
title: 'Build Summary')}")
|
88
|
+
puts("")
|
68
89
|
# TRY to execute a build. if it fails, revert the version number changes
|
69
90
|
begin
|
70
|
-
|
91
|
+
unless options[:skip_build]
|
71
92
|
if options[:skip_flutter_build]
|
72
|
-
UI.important
|
93
|
+
UI.important("Skipping Flutter Build")
|
73
94
|
else
|
74
|
-
UI.header
|
75
|
-
Sunny.build_ios(build_number)
|
95
|
+
UI.header("Run Flutter Build")
|
96
|
+
Sunny.build_ios(version_no_build, build_number)
|
76
97
|
end
|
77
98
|
require 'match'
|
78
99
|
build_opts = options[:build_options]
|
@@ -84,16 +105,16 @@ module Fastlane
|
|
84
105
|
|
85
106
|
match_opts.load_configuration_file("Matchfile")
|
86
107
|
|
87
|
-
UI.header
|
108
|
+
UI.header("Read Appfile info")
|
88
109
|
# Read the app identifier from Appfile
|
89
110
|
app_identifier = app_file.try_fetch_value(:app_identifier)
|
90
|
-
UI.command_output
|
111
|
+
UI.command_output("App: #{app_identifier}")
|
91
112
|
unless app_identifier
|
92
113
|
UI.user_error!("No app_identifier could be found")
|
93
114
|
end
|
94
115
|
|
95
116
|
MatchAction.run(match_opts)
|
96
|
-
UI.header
|
117
|
+
UI.header("Run Xcode Build")
|
97
118
|
Sunny.run_action(BuildAppAction, workspace: "ios/Runner.xcworkspace",
|
98
119
|
scheme: "Runner",
|
99
120
|
export_method: build_opts[1],
|
@@ -102,7 +123,7 @@ module Fastlane
|
|
102
123
|
clean: options[:clean],
|
103
124
|
export_options: {
|
104
125
|
provisioningProfiles: {
|
105
|
-
|
126
|
+
app_identifier.to_s => "match #{build_opts[2]} #{app_identifier}",
|
106
127
|
}
|
107
128
|
},
|
108
129
|
output_directory: "build/ios")
|
@@ -116,28 +137,27 @@ module Fastlane
|
|
116
137
|
return
|
117
138
|
end
|
118
139
|
|
119
|
-
app_name = options[:app_name]
|
120
140
|
# Commits the version number, deletes changelog file
|
121
|
-
if options[:
|
141
|
+
if (not options[:skip_build]) || options[:post_build]
|
122
142
|
unless options[:skip_symbols]
|
123
|
-
UI.header
|
143
|
+
UI.header("Upload Symbols to Crashlytics")
|
124
144
|
Sunny.run_action(UploadSymbolsToCrashlyticsAction, dsym_path: "./build/ios/#{app_name}.app.dSYM.zip",
|
125
145
|
binary_path: "./ios/Pods/FirebaseCrashlytics/upload-symbols")
|
126
146
|
end
|
127
147
|
|
128
|
-
UI.header
|
148
|
+
UI.header("Commit pubspec.yaml, Info.plist for version updates")
|
129
149
|
# If we got this far, let's commit the build number and update the git tags. If the rest of the pro
|
130
150
|
# process fails, we should revert this because it will mess up our commit logs
|
131
151
|
Sunny.run_action(GitCommitAction,
|
132
152
|
allow_nothing_to_commit: true,
|
133
|
-
path: %w[./pubspec.yaml ./pubspec.lock ./Gemfile.lock ./ios/Runner/Info.plist],
|
134
|
-
message: "\"Version bump to: #{
|
135
|
-
UI.header
|
153
|
+
path: %w[./pubspec.yaml ./pubspec.lock ./ios/Podfile.lock ./Gemfile.lock ./ios/Runner/Info.plist],
|
154
|
+
message: "\"Version bump to: #{version_no_build}##{build_number}\"")
|
155
|
+
UI.header("Tagging repo v#{version.build}")
|
136
156
|
Sunny.run_action(AddGitTagAction,
|
137
157
|
grouping: "sunny-builds",
|
138
158
|
prefix: "v",
|
139
159
|
force: true,
|
140
|
-
build_number:
|
160
|
+
build_number: build_number
|
141
161
|
)
|
142
162
|
Sunny.run_action(PushGitTagsAction, force: false)
|
143
163
|
end
|
@@ -145,10 +165,9 @@ module Fastlane
|
|
145
165
|
unless options[:no_upload]
|
146
166
|
|
147
167
|
# platform :ios do
|
148
|
-
|
168
|
+
|
149
169
|
if release_target == "firebase"
|
150
|
-
UI.header
|
151
|
-
#require 'fastlane-plugin-firebase_app_distribution'
|
170
|
+
UI.header("Firebase: uploading build/ios/#{app_name}.ipa")
|
152
171
|
|
153
172
|
Sunny.run_action(FirebaseAppDistributionAction,
|
154
173
|
app: firebase_app_id,
|
@@ -157,7 +176,7 @@ module Fastlane
|
|
157
176
|
debug: true
|
158
177
|
)
|
159
178
|
elsif release_target == "testflight"
|
160
|
-
UI.header
|
179
|
+
UI.header("Testflight: uploading build/ios/#{app_name}.ipa")
|
161
180
|
Sunny.run_action(UploadToTestflightAction,
|
162
181
|
ipa: "build/ios/#{app_name}.ipa",
|
163
182
|
localized_build_info: {
|
@@ -178,7 +197,7 @@ module Fastlane
|
|
178
197
|
end
|
179
198
|
|
180
199
|
def self.description
|
181
|
-
"
|
200
|
+
"Perform ios or firebase release"
|
182
201
|
end
|
183
202
|
|
184
203
|
def self.authors
|
@@ -200,25 +219,34 @@ module Fastlane
|
|
200
219
|
env_name: "SUNNY_NO_BUMP",
|
201
220
|
description: "Whether to skip a bump",
|
202
221
|
optional: true, type: Object),
|
203
|
-
FastlaneCore::ConfigItem.new(key: :
|
204
|
-
env_name: "
|
205
|
-
description: "Whether to
|
222
|
+
FastlaneCore::ConfigItem.new(key: :skip_build,
|
223
|
+
env_name: "SUNNY_SKIP_BUILD",
|
224
|
+
description: "Whether to skip the building of the project",
|
206
225
|
optional: true, type: Object),
|
207
226
|
FastlaneCore::ConfigItem.new(key: :post_build,
|
208
227
|
env_name: "SUNNY_POST_BUILD",
|
209
|
-
description: "Whether to execute actions after building",
|
228
|
+
description: "Whether to execute actions after building. Can be used in conjunction with skip_build to avoid building the entire project, but still applying tags",
|
210
229
|
optional: true, type: Object),
|
211
230
|
FastlaneCore::ConfigItem.new(key: :skip_dirty_check,
|
212
231
|
env_name: "SUNNY_SKIP_DIRTY_CHECK",
|
213
232
|
description: "Whether to skip dirty repo check",
|
214
233
|
optional: true, type: Object),
|
234
|
+
|
215
235
|
FastlaneCore::ConfigItem.new(key: :clean,
|
216
236
|
env_name: "SUNNY_CLEAN",
|
217
237
|
description: "Whether to do a clean build",
|
218
238
|
optional: true, type: Object),
|
219
|
-
FastlaneCore::ConfigItem.new(key: :
|
220
|
-
env_name: "
|
221
|
-
description: "Whether to make a release
|
239
|
+
FastlaneCore::ConfigItem.new(key: :minor,
|
240
|
+
env_name: "SUNNY_MINOR",
|
241
|
+
description: "Whether to make a minor release",
|
242
|
+
optional: true, type: Object),
|
243
|
+
FastlaneCore::ConfigItem.new(key: :patch,
|
244
|
+
env_name: "SUNNY_PATCH",
|
245
|
+
description: "Whether to make a patch release",
|
246
|
+
optional: true, type: Object),
|
247
|
+
FastlaneCore::ConfigItem.new(key: :build,
|
248
|
+
env_name: "SUNNY_BUILD",
|
249
|
+
description: "Whether to increment only the build number for the release",
|
222
250
|
optional: true, type: Object),
|
223
251
|
FastlaneCore::ConfigItem.new(key: :changelog,
|
224
252
|
env_name: "SUNNY_CHANGELOG",
|
@@ -237,7 +265,7 @@ module Fastlane
|
|
237
265
|
|
238
266
|
FastlaneCore::ConfigItem.new(key: :release_target,
|
239
267
|
env_name: "SUNNY_RELEASE_TARGET",
|
240
|
-
description: "Where we're releasing to",
|
268
|
+
description: "Where we're releasing to, must be either fastlane or testflight",
|
241
269
|
optional: false,
|
242
270
|
type: String),
|
243
271
|
|
@@ -287,7 +315,7 @@ module Fastlane
|
|
287
315
|
|
288
316
|
def visit_Psych_Nodes_Scalar(o)
|
289
317
|
if o.value.is_a?(String)
|
290
|
-
str =
|
318
|
+
str = (o.value).to_s
|
291
319
|
if str.start_with?('^') || str.start_with?('..')
|
292
320
|
@handler.scalar(o.value, o.anchor, o.tag, o.plain, o.quoted, 1)
|
293
321
|
elsif str.start_with?('https://') || str.start_with?('git@')
|
@@ -12,38 +12,34 @@ module Fastlane
|
|
12
12
|
|
13
13
|
def self.available_options
|
14
14
|
[
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
description: "Whether the project uses local checked out packages",
|
44
|
-
type: String,
|
45
|
-
optional: true,
|
46
|
-
default_value: "git"),
|
15
|
+
FastlaneCore::ConfigItem.new(key: :sunny_plugins,
|
16
|
+
env_name: "SUNNY_PLUGINS",
|
17
|
+
description: "The plugins",
|
18
|
+
type: Hash,
|
19
|
+
optional: true,),
|
20
|
+
FastlaneCore::ConfigItem.new(key: :firebase_app_id,
|
21
|
+
env_name: "SUNNY_FIREBASE_APP_ID",
|
22
|
+
description: "Firebase app id",
|
23
|
+
type: String,
|
24
|
+
optional: true,),
|
25
|
+
FastlaneCore::ConfigItem.new(key: :firebase_cli_path,
|
26
|
+
env_name: "SUNNY_FIREBASE_CLI_PATH",
|
27
|
+
description: "Firebase cli path",
|
28
|
+
type: String,
|
29
|
+
optional: true,),
|
30
|
+
FastlaneCore::ConfigItem.new(key: :sunny_plugin_folder,
|
31
|
+
env_name: "SUNNY_PLUGIN_FOLDER",
|
32
|
+
description: "Folder that contains the packages",
|
33
|
+
type: String,
|
34
|
+
optional: false,
|
35
|
+
default_value: '../plugin'),
|
36
|
+
# value should be 'git' or 'local'
|
37
|
+
FastlaneCore::ConfigItem.new(key: :sunny_local_mode,
|
38
|
+
env_name: "SUNNY_LOCAL_MODE",
|
39
|
+
description: "Whether the project uses local checked out packages",
|
40
|
+
type: String,
|
41
|
+
optional: true,
|
42
|
+
default_value: "git"),
|
47
43
|
|
48
44
|
]
|
49
45
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fastlane_core/ui/ui'
|
2
|
+
require 'fastlane/helper/sh_helper'
|
2
3
|
require "fastlane"
|
3
4
|
|
4
5
|
module Fastlane
|
@@ -21,6 +22,20 @@ module Fastlane
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
25
|
+
def self.is_clean
|
26
|
+
self.run_action(Fastlane::Actions::EnsureGitStatusCleanAction)
|
27
|
+
true
|
28
|
+
rescue
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.is_branch(branch_name)
|
33
|
+
self.run_action(Fastlane::Actions::EnsureGitBranchAction, branch: branch_name)
|
34
|
+
true
|
35
|
+
rescue
|
36
|
+
false
|
37
|
+
end
|
38
|
+
|
24
39
|
def self.config(available_options, options)
|
25
40
|
FastlaneCore::Configuration.create(available_options, options)
|
26
41
|
end
|
@@ -30,46 +45,65 @@ module Fastlane
|
|
30
45
|
end
|
31
46
|
|
32
47
|
def self.do_increase_version(options)
|
33
|
-
|
34
|
-
|
35
|
-
|
48
|
+
bump_type = options[:type]
|
49
|
+
bump_type = "build" unless bump_type
|
50
|
+
command = "pubver bump #{bump_type}"
|
51
|
+
unless bump_type.eql?('build')
|
52
|
+
command += " -b"
|
53
|
+
end
|
54
|
+
self.exec_cmd(command.to_s, command)
|
55
|
+
|
56
|
+
unless bump_type.eql?('build')
|
57
|
+
self.exec_cmd("also bump build", "pubver bump build")
|
36
58
|
end
|
37
|
-
|
59
|
+
|
38
60
|
self.current_semver
|
39
61
|
end
|
40
62
|
|
63
|
+
def self.config_to_hash(options)
|
64
|
+
hash = Hash([])
|
65
|
+
options.all_keys.each do |key|
|
66
|
+
hash.store(key, options.fetch(key, ask: false))
|
67
|
+
end
|
68
|
+
return hash
|
69
|
+
end
|
70
|
+
|
41
71
|
def self.exec_cmd(name, *command, **args)
|
42
|
-
if
|
43
|
-
command = command.map { |item| Shellwords.escape
|
72
|
+
if command.count > 1
|
73
|
+
command = command.map { |item| Shellwords.escape(item) }
|
44
74
|
end
|
45
75
|
joined = command.join(" ")
|
46
76
|
if args[:verbose]
|
47
77
|
begin
|
48
|
-
return sh(command)
|
78
|
+
return Fastlane::Actions.sh(*command, log:true, error_callback: ->(str) { UI.user_error!(">> #{name} failed << \n #{str}") })
|
49
79
|
rescue StandardError => e
|
50
|
-
UI.user_error!
|
80
|
+
UI.user_error!(">> #{name} failed << \n #{e}")
|
51
81
|
end
|
52
82
|
else
|
53
83
|
if args[:cmd_out]
|
54
|
-
UI.command_output
|
84
|
+
UI.command_output(name)
|
55
85
|
elsif args[:quiet]
|
56
86
|
else
|
57
87
|
UI.command name
|
58
88
|
end
|
59
89
|
|
60
90
|
stdout, err, status = Open3.capture3(joined)
|
61
|
-
UI.user_error!
|
91
|
+
UI.user_error!(">> #{name} failed << \n command: #{joined}\n error: #{err}") unless status == 0
|
62
92
|
stdout
|
63
93
|
end
|
64
94
|
end
|
65
95
|
|
96
|
+
def self.exec_cmd_options(name, command, options)
|
97
|
+
return exec_cmd(name, command, **config_to_hash(options))
|
98
|
+
end
|
99
|
+
|
66
100
|
def self.release_notes_file
|
67
101
|
".release-notes"
|
68
102
|
end
|
69
103
|
|
70
104
|
### Reads the latest version from pubspec.yaml
|
71
105
|
def self.current_semver
|
72
|
-
Semantic::Version.new
|
106
|
+
Semantic::Version.new(current_version_string)
|
73
107
|
end
|
74
108
|
|
75
109
|
def self.release_notes(options)
|
@@ -113,7 +147,7 @@ module Fastlane
|
|
113
147
|
lines = ["## [#{v}]\n", " * #{changes}\n", "\n"] + lines
|
114
148
|
|
115
149
|
output = File.new("CHANGELOG.md", "w")
|
116
|
-
lines.each { |line| output.write
|
150
|
+
lines.each { |line| output.write(line) }
|
117
151
|
output.close
|
118
152
|
end
|
119
153
|
changes
|
@@ -123,10 +157,36 @@ module Fastlane
|
|
123
157
|
provided || ".fvm/flutter_sdk/bin/flutter"
|
124
158
|
end
|
125
159
|
|
160
|
+
def self.build_runner(options)
|
161
|
+
flutter = get_flutter(options[:flutter])
|
162
|
+
opt_hash = config_to_hash(options)
|
163
|
+
if options[:clean]
|
164
|
+
exec_cmd("flutter clean", "#{flutter} clean", **opt_hash)
|
165
|
+
end
|
166
|
+
|
167
|
+
if options[:clean] || (!options[:skip_pub])
|
168
|
+
exec_cmd("flutter pub get", "#{flutter} pub get", **opt_hash)
|
169
|
+
end
|
170
|
+
|
171
|
+
if options[:clean] || (!options[:skip_gen])
|
172
|
+
dc = if options[:clean]
|
173
|
+
" --delete-conflicting-outputs"
|
174
|
+
else
|
175
|
+
""
|
176
|
+
end
|
177
|
+
vb = if options[:verbose]
|
178
|
+
" -v"
|
179
|
+
else
|
180
|
+
""
|
181
|
+
end
|
182
|
+
exec_cmd("flutter pub run build_runner build#{dc}#{vb}", "#{flutter} pub run build_runner build#{dc}#{vb}", **opt_hash)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
126
186
|
def self.override_version(**options)
|
127
187
|
semver = options[:version]
|
128
188
|
unless semver
|
129
|
-
UI.user_error!
|
189
|
+
UI.user_error!("No version parameter found")
|
130
190
|
return
|
131
191
|
end
|
132
192
|
self.exec_cmd("set_version", "pubver set #{semver}", quiet: true)
|
@@ -138,16 +198,17 @@ module Fastlane
|
|
138
198
|
self.run_action(Fastlane::Actions::IncrementVersionNumberAction,
|
139
199
|
version_number: "#{version.major}.#{version.minor}.#{version.patch}",
|
140
200
|
xcodeproj: "ios/Runner.xcodeproj"
|
141
|
-
|
201
|
+
)
|
142
202
|
else
|
143
|
-
UI.user_error!
|
203
|
+
UI.user_error!("No version found")
|
144
204
|
end
|
145
205
|
|
146
206
|
end
|
147
207
|
|
148
|
-
def self.build_ios(build_num, **options)
|
208
|
+
def self.build_ios(build_ver, build_num, **options)
|
149
209
|
flutter = get_flutter(options[:flutter])
|
150
|
-
|
210
|
+
|
211
|
+
self.exec_cmd("build flutter ios release #{build_ver} #{build_num}", "#{flutter} build ios --release --no-tree-shake-icons --no-codesign")
|
151
212
|
end
|
152
213
|
|
153
214
|
### Reads the latest version from pubspec.yaml
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-sunny_project
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ericmartineau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -150,10 +150,13 @@ files:
|
|
150
150
|
- lib/fastlane/plugin/sunny_project/actions/finalize_version_action.rb
|
151
151
|
- lib/fastlane/plugin/sunny_project/actions/generate_icons_action.rb
|
152
152
|
- lib/fastlane/plugin/sunny_project/actions/increase_version_action.rb
|
153
|
+
- lib/fastlane/plugin/sunny_project/actions/local_packages_action.rb
|
153
154
|
- lib/fastlane/plugin/sunny_project/actions/pub_publish_action.rb
|
154
155
|
- lib/fastlane/plugin/sunny_project/actions/pubspec_doctor_action.rb
|
155
156
|
- lib/fastlane/plugin/sunny_project/actions/release_notes_action.rb
|
156
157
|
- lib/fastlane/plugin/sunny_project/actions/rename_assets_action.rb
|
158
|
+
- lib/fastlane/plugin/sunny_project/actions/sunny_build_runner.rb
|
159
|
+
- lib/fastlane/plugin/sunny_project/actions/sunny_build_web.rb
|
157
160
|
- lib/fastlane/plugin/sunny_project/actions/sunny_release_action.rb
|
158
161
|
- lib/fastlane/plugin/sunny_project/helper/plugin_options.rb
|
159
162
|
- lib/fastlane/plugin/sunny_project/helper/sunny_project_helper.rb
|