fastlane-plugin-wpmreleasetoolkit 2.3.0 → 3.0.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 +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +8 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_trigger_build_action.rb +90 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +1 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb +113 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +5 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +2 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_strings_files.rb +75 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +0 -20
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +8 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +2 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +3 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +108 -173
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb +207 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +3 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +1 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +23 -39
- data/bin/drawText +0 -20
- data/ext/drawText/drawText/Assets/style.css +0 -1
- data/ext/drawText/drawText/CoreTextStack.swift +0 -113
- data/ext/drawText/drawText/Helpers/CommandLineHelpers.swift +0 -36
- data/ext/drawText/drawText/Helpers/Extensions.swift +0 -27
- data/ext/drawText/drawText/Helpers/FileSystemHelper.swift +0 -24
- data/ext/drawText/drawText/Stylesheet.swift +0 -48
- data/ext/drawText/drawText/TextImage.swift +0 -100
- data/ext/drawText/drawText/main.swift +0 -61
- data/ext/drawText/drawText Tests/DigitParsingTests.swift +0 -21
- data/ext/drawText/drawText Tests/ExtensionsTests.swift +0 -5
- data/ext/drawText/drawText Tests/Info.plist +0 -22
- data/ext/drawText/drawText Tests/StylesheetTests.swift +0 -31
- data/ext/drawText/drawText Tests/Test Cases/default-stylesheet.txt +0 -10
- data/ext/drawText/drawText Tests/Test Cases/external-styles-sample.css +0 -3
- data/ext/drawText/drawText Tests/Test Cases/external-styles-test.txt +0 -13
- data/ext/drawText/drawText Tests/Test Cases/large-text-block.txt +0 -1
- data/ext/drawText/drawText Tests/Test Cases/regular-text-block.txt +0 -2
- data/ext/drawText/drawText Tests/Test Cases/rtl-text-block.txt +0 -2
- data/ext/drawText/drawText Tests/Test Cases/text-size-adjustment-test.txt +0 -10
- data/ext/drawText/drawText Tests/TextImageTests.swift +0 -99
- data/ext/drawText/drawText Tests/drawText_Tests.swift +0 -14
- data/ext/drawText/drawText.xcodeproj/project.pbxproj +0 -508
- data/ext/drawText/drawText.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/ext/drawText/drawText.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText Tests.xcscheme +0 -57
- data/ext/drawText/drawText.xcodeproj/xcshareddata/xcschemes/drawText.xcscheme +0 -109
- data/ext/drawText/extconf.rb +0 -36
- data/ext/drawText/makefile.example +0 -8
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +0 -106
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +0 -52
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f92b2b90c9f077ad4ea0ae25c5c84f0345ca2fb5e186d1c0cdfab70ea40770
|
4
|
+
data.tar.gz: 0c919f8e9ca2af18c3488898efe2fe48f4ca5a3a4c0464991e000681cc6c9546
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c0797c28da54495d995d856edb238631b70bf0126ae1516638a75e300717dd51a7f97f6fedd5cc3f9e7eef4e9cf328043c9fffcd34233a057338da8055307d
|
7
|
+
data.tar.gz: 17c8536dc94ab2ea0f3b394d3d9768c248683ba78fa4558d7c10ed1cc7fe81fc0aebd1390691282db601297b6f48e67af2dbd546daa3b0a13d16ffacd8c34f4c
|
@@ -36,12 +36,17 @@ module Fastlane
|
|
36
36
|
FastlaneCore::ConfigItem.new(key: :app_strings_path,
|
37
37
|
description: 'The path of the main strings file',
|
38
38
|
optional: false,
|
39
|
-
|
39
|
+
type: String),
|
40
|
+
# The name of this parameter is a bit misleading due to legacy. In practice it's expected to be an Array of Hashes, each describing a library to merge.
|
41
|
+
# See `Fastlane::Helper::Android::LocalizeHelper.merge_lib`'s YARD doc for more details on the keys expected for each Hash.
|
40
42
|
FastlaneCore::ConfigItem.new(key: :libs_strings_path,
|
41
43
|
env_name: 'LOCALIZE_LIBS_STRINGS_PATH',
|
42
|
-
description: 'The list of libs to merge'
|
44
|
+
description: 'The list of libs to merge. ' \
|
45
|
+
+ 'Each item in the provided array must be a Hash with the keys `:library` (The library display name),' \
|
46
|
+
+ '`:strings_path` (The path to the `strings.xml` file of the library) and ' \
|
47
|
+
+ '`:exclusions` (Array of string keys to exclude from merging)',
|
43
48
|
optional: false,
|
44
|
-
|
49
|
+
type: Array),
|
45
50
|
]
|
46
51
|
end
|
47
52
|
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class BuildkiteTriggerBuildAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
require 'buildkit'
|
6
|
+
|
7
|
+
UI.message "Triggering build on branch #{params[:branch]}, commit #{params[:commit]}, using pipeline from #{params[:pipeline_file]}"
|
8
|
+
|
9
|
+
pipeline_name = {
|
10
|
+
PIPELINE: params[:pipeline_file]
|
11
|
+
}
|
12
|
+
|
13
|
+
client = Buildkit.new(token: params[:buildkite_token])
|
14
|
+
response = client.create_build(
|
15
|
+
params[:buildkite_organization],
|
16
|
+
params[:buildkite_pipeline],
|
17
|
+
{
|
18
|
+
branch: params[:branch],
|
19
|
+
commit: params[:commit],
|
20
|
+
env: params[:environment].merge(pipeline_name)
|
21
|
+
}
|
22
|
+
)
|
23
|
+
|
24
|
+
response.state == 'scheduled' ? UI.message('Done!') : UI.crash!("Failed to start job\nError: [#{response}]")
|
25
|
+
end
|
26
|
+
|
27
|
+
#####################################################
|
28
|
+
# @!group Documentation
|
29
|
+
#####################################################
|
30
|
+
|
31
|
+
def self.description
|
32
|
+
'Triggers a job on Buildkite'
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(
|
38
|
+
key: :buildkite_token,
|
39
|
+
env_name: 'BUILDKITE_TOKEN',
|
40
|
+
description: 'Buildkite Personal Access Token',
|
41
|
+
type: String,
|
42
|
+
sensitive: true
|
43
|
+
),
|
44
|
+
FastlaneCore::ConfigItem.new(
|
45
|
+
key: :buildkite_organization,
|
46
|
+
env_name: 'BUILDKITE_ORGANIZTION',
|
47
|
+
description: 'The Buildkite organization that contains your pipeline',
|
48
|
+
type: String
|
49
|
+
),
|
50
|
+
FastlaneCore::ConfigItem.new(
|
51
|
+
key: :buildkite_pipeline,
|
52
|
+
env_name: 'BUILDKITE_PIPELINE',
|
53
|
+
description: %(The Buildkite pipeline you'd like to build),
|
54
|
+
type: String
|
55
|
+
),
|
56
|
+
FastlaneCore::ConfigItem.new(
|
57
|
+
key: :branch,
|
58
|
+
description: 'The branch you want to build',
|
59
|
+
type: String
|
60
|
+
),
|
61
|
+
FastlaneCore::ConfigItem.new(
|
62
|
+
key: :commit,
|
63
|
+
description: 'The commit hash you want to build',
|
64
|
+
type: String,
|
65
|
+
default_value: 'HEAD'
|
66
|
+
),
|
67
|
+
FastlaneCore::ConfigItem.new(
|
68
|
+
key: :pipeline_file,
|
69
|
+
description: 'The name of the pipeline file in the project',
|
70
|
+
type: String
|
71
|
+
),
|
72
|
+
FastlaneCore::ConfigItem.new(
|
73
|
+
key: :environment,
|
74
|
+
description: 'Any additional environment variables to provide to the job',
|
75
|
+
type: Hash,
|
76
|
+
default_value: {}
|
77
|
+
),
|
78
|
+
]
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.authors
|
82
|
+
['Automattic']
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.is_supported?(platform)
|
86
|
+
true
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -58,7 +58,7 @@ module Fastlane
|
|
58
58
|
is_string: false),
|
59
59
|
FastlaneCore::ConfigItem.new(key: :locales,
|
60
60
|
env_name: 'FL_DOWNLOAD_METADATA_LOCALES',
|
61
|
-
description: 'The hash with the
|
61
|
+
description: 'The hash with the GlotPress locale and the project locale association',
|
62
62
|
is_string: false),
|
63
63
|
FastlaneCore::ConfigItem.new(key: :source_locale,
|
64
64
|
env_name: 'FL_DOWNLOAD_METADATA_SOURCE_LOCALE',
|
data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_download_strings_files_from_glotpress.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class IosDownloadStringsFilesFromGlotpressAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
# TODO: Once we introduce the `Locale` POD via #296, check if the param is an array of locales and if so convert it to Hash{glotpress=>lproj}
|
6
|
+
locales = params[:locales]
|
7
|
+
download_dir = params[:download_dir]
|
8
|
+
|
9
|
+
UI.user_error!("The parent directory `#{download_dir}` (which contains all the `*.lproj` subdirectories) must already exist") unless Dir.exist?(download_dir)
|
10
|
+
|
11
|
+
locales.each do |glotpress_locale, lproj_name|
|
12
|
+
# Download the export in the proper `.lproj` directory
|
13
|
+
lproj_dir = File.join(download_dir, "#{lproj_name}.lproj")
|
14
|
+
destination = File.join(lproj_dir, "#{params[:table_basename]}.strings")
|
15
|
+
FileUtils.mkdir(lproj_dir) unless Dir.exist?(lproj_dir)
|
16
|
+
|
17
|
+
Fastlane::Helper::Ios::L10nHelper.download_glotpress_export_file(
|
18
|
+
project_url: params[:project_url],
|
19
|
+
locale: glotpress_locale,
|
20
|
+
filters: params[:filters],
|
21
|
+
destination: destination
|
22
|
+
)
|
23
|
+
# Do a quick check of the downloaded `.strings` file to ensure it looks valid
|
24
|
+
validate_strings_file(destination) unless params[:skip_file_validation]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Validate that a `.strings` file downloaded from GlotPress seems valid and does not contain empty translations
|
29
|
+
def self.validate_strings_file(destination)
|
30
|
+
return unless File.exist?(destination) # If the file failed to download, don't try to validate an non-existing file. We'd already have a separate error for the download failure anyway.
|
31
|
+
|
32
|
+
translations = Fastlane::Helper::Ios::L10nHelper.read_strings_file_as_hash(path: destination)
|
33
|
+
empty_keys = translations.select { |_, value| value.nil? || value.empty? }.keys.sort
|
34
|
+
unless empty_keys.empty?
|
35
|
+
UI.error(
|
36
|
+
"Found empty translations in `#{destination}` for the following keys: #{empty_keys.inspect}.\n" \
|
37
|
+
+ "This is likely a GlotPress bug, and will lead to copies replaced by empty text in the UI.\n" \
|
38
|
+
+ 'Please report this to the GlotPress team, and fix the file locally before continuing.'
|
39
|
+
)
|
40
|
+
end
|
41
|
+
rescue StandardError => e
|
42
|
+
UI.error("Error while validating the file exported from GlotPress (`#{destination}`) - #{e.message.chomp}")
|
43
|
+
end
|
44
|
+
|
45
|
+
#####################################################
|
46
|
+
# @!group Documentation
|
47
|
+
#####################################################
|
48
|
+
|
49
|
+
def self.description
|
50
|
+
'Downloads the `.strings` files from GlotPress for the various locales'
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.details
|
54
|
+
<<~DETAILS
|
55
|
+
Downloads the `.strings` files from GlotPress for the various locales,
|
56
|
+
validates them, and saves them in the relevant `*.lproj` directories for each locale
|
57
|
+
DETAILS
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.available_options
|
61
|
+
[
|
62
|
+
FastlaneCore::ConfigItem.new(key: :project_url,
|
63
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_PROJECT_URL',
|
64
|
+
description: 'URL to the GlotPress project',
|
65
|
+
type: String),
|
66
|
+
FastlaneCore::ConfigItem.new(key: :locales,
|
67
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_LOCALES',
|
68
|
+
description: 'The map of locales to download, each entry of the Hash corresponding to a { glotpress-locale-code => lproj-folder-basename } pair',
|
69
|
+
type: Hash), # TODO: also support an Array of `Locale` POD/struct type when we introduce it later (see #296)
|
70
|
+
FastlaneCore::ConfigItem.new(key: :download_dir,
|
71
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_DOWNLOAD_DIR',
|
72
|
+
description: 'The parent directory containing all the `*.lproj` subdirectories in which the downloaded files will be saved',
|
73
|
+
type: String),
|
74
|
+
FastlaneCore::ConfigItem.new(key: :table_basename,
|
75
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_TABLE_BASENAME',
|
76
|
+
description: 'The basename to save the `.strings` files under',
|
77
|
+
type: String,
|
78
|
+
optional: true,
|
79
|
+
default_value: 'Localizable'),
|
80
|
+
FastlaneCore::ConfigItem.new(key: :filters,
|
81
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_FILTERS',
|
82
|
+
description: 'The GlotPress filters to use when requesting the translations export',
|
83
|
+
type: Hash,
|
84
|
+
optional: true,
|
85
|
+
default_value: { status: 'current' }),
|
86
|
+
FastlaneCore::ConfigItem.new(key: :skip_file_validation,
|
87
|
+
env_name: 'FL_IOS_DOWNLOAD_STRINGS_FILES_FROM_GLOTPRESS_SKIP_FILE_VALIDATION',
|
88
|
+
description: 'If true, skips the validation of `.strings` files after download',
|
89
|
+
type: Fastlane::Boolean,
|
90
|
+
optional: true,
|
91
|
+
default_value: false),
|
92
|
+
]
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.return_type
|
96
|
+
# Describes what type of data is expected to be returned
|
97
|
+
# see RETURN_TYPES in https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/action.rb
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.return_value
|
101
|
+
# Textual description of what the return value is
|
102
|
+
end
|
103
|
+
|
104
|
+
def self.authors
|
105
|
+
['Automattic']
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.is_supported?(platform)
|
109
|
+
[:ios, :mac].include?(platform)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -17,8 +17,8 @@ module Fastlane
|
|
17
17
|
def self.run_linter(params)
|
18
18
|
UI.message 'Linting localizations for parameter placeholders consistency...'
|
19
19
|
|
20
|
-
require_relative '../../helper/ios/
|
21
|
-
helper = Fastlane::Helper::Ios::
|
20
|
+
require_relative '../../helper/ios/ios_l10n_linter_helper'
|
21
|
+
helper = Fastlane::Helper::Ios::L10nLinterHelper.new(
|
22
22
|
install_path: resolve_path(params[:install_path]),
|
23
23
|
version: params[:version]
|
24
24
|
)
|
@@ -92,7 +92,7 @@ module Fastlane
|
|
92
92
|
description: 'The path where to install the SwiftGen tooling needed to run the linting process. If a relative path, should be relative to your repo_root',
|
93
93
|
type: String,
|
94
94
|
optional: true,
|
95
|
-
default_value: "vendor/swiftgen/#{Fastlane::Helper::Ios::
|
95
|
+
default_value: "vendor/swiftgen/#{Fastlane::Helper::Ios::L10nLinterHelper::SWIFTGEN_VERSION}"
|
96
96
|
),
|
97
97
|
FastlaneCore::ConfigItem.new(
|
98
98
|
key: :version,
|
@@ -100,7 +100,7 @@ module Fastlane
|
|
100
100
|
description: 'The version of SwiftGen to install and use for linting',
|
101
101
|
type: String,
|
102
102
|
optional: true,
|
103
|
-
default_value: Fastlane::Helper::Ios::
|
103
|
+
default_value: Fastlane::Helper::Ios::L10nLinterHelper::SWIFTGEN_VERSION
|
104
104
|
),
|
105
105
|
FastlaneCore::ConfigItem.new(
|
106
106
|
key: :input_dir,
|
@@ -115,7 +115,7 @@ module Fastlane
|
|
115
115
|
description: 'The language that should be used as the base language that every other language will be compared against',
|
116
116
|
type: String,
|
117
117
|
optional: true,
|
118
|
-
default_value: Fastlane::Helper::Ios::
|
118
|
+
default_value: Fastlane::Helper::Ios::L10nLinterHelper::DEFAULT_BASE_LANG
|
119
119
|
),
|
120
120
|
FastlaneCore::ConfigItem.new(
|
121
121
|
key: :only_langs,
|
@@ -16,11 +16,11 @@ module Fastlane
|
|
16
16
|
#####################################################
|
17
17
|
|
18
18
|
def self.description
|
19
|
-
'Gathers the
|
19
|
+
'Gathers the strings to localise. Deprecated'
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.details
|
23
|
-
'Gathers the
|
23
|
+
'Gathers the strings to localise. Deprecated in favor of the new `ios_generate_strings_file_from_code`'
|
24
24
|
end
|
25
25
|
|
26
26
|
def self.category
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class IosMergeStringsFilesAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.message "Merging strings files: #{params[:paths].inspect}"
|
6
|
+
|
7
|
+
duplicates = Fastlane::Helper::Ios::L10nHelper.merge_strings(paths: params[:paths], output_path: params[:destination])
|
8
|
+
duplicates.each do |dup_key|
|
9
|
+
UI.important "Duplicate key found while merging the `.strings` files: `#{dup_key}`"
|
10
|
+
end
|
11
|
+
duplicates
|
12
|
+
end
|
13
|
+
|
14
|
+
#####################################################
|
15
|
+
# @!group Documentation
|
16
|
+
#####################################################
|
17
|
+
|
18
|
+
def self.description
|
19
|
+
'Merge multiple `.strings` files into one'
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.details
|
23
|
+
<<~DETAILS
|
24
|
+
Merge multiple `.strings` files into one.
|
25
|
+
|
26
|
+
Especially useful to prepare a single `.strings` file merging strings from both `Localizable.strings` from
|
27
|
+
the app code — typically previously extracted from `ios_generate_strings_file_from_code` —
|
28
|
+
and string files like `InfoPlist.strings` — which values may not be generated from the codebase but
|
29
|
+
manually maintained by developers.
|
30
|
+
|
31
|
+
The action only supports merging files which are in the OpenStep (`"key" = "value";`) text format (which is
|
32
|
+
the most common format for `.strings` files, and the one generated by `genstrings`), but can handle the case
|
33
|
+
of different files using different encodings (UTF8 vs UTF16) and is able to detect and report duplicates.
|
34
|
+
It does not handle `.strings` files in XML or binary-plist formats (which are valid but more rare)
|
35
|
+
DETAILS
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.available_options
|
39
|
+
[
|
40
|
+
FastlaneCore::ConfigItem.new(
|
41
|
+
key: :paths,
|
42
|
+
env_name: 'FL_IOS_MERGE_STRINGS_FILES_PATHS',
|
43
|
+
description: 'The paths of all the `.strings` files to merge together',
|
44
|
+
type: Array,
|
45
|
+
optional: false
|
46
|
+
),
|
47
|
+
FastlaneCore::ConfigItem.new(
|
48
|
+
key: :destination,
|
49
|
+
env_name: 'FL_IOS_MERGE_STRINGS_FILES_DESTINATION',
|
50
|
+
description: 'The path of the merged `.strings` file to generate. If nil, the merge will happen in-place in the first file in the `paths:` list',
|
51
|
+
type: String,
|
52
|
+
optional: true,
|
53
|
+
default_value: nil
|
54
|
+
),
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.return_type
|
59
|
+
:array_of_strings
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.return_value
|
63
|
+
'The list of duplicate keys found while merging the various `.strings` files'
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.authors
|
67
|
+
['automattic']
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.is_supported?(platform)
|
71
|
+
[:ios, :mac].include? platform
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -27,26 +27,6 @@ module Fastlane
|
|
27
27
|
)
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
31
|
-
# Calls the `tools/update-translations.sh` script from the project repo, then lint them using the provided gradle task
|
32
|
-
#
|
33
|
-
# Deprecated. Use the `android_download_translations` action instead.
|
34
|
-
#
|
35
|
-
# @env PROJECT_ROOT_FOLDER The path to the git root of the project
|
36
|
-
# @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
|
37
|
-
#
|
38
|
-
# @param [String] validate_translation_command The name of the gradle task to run to validate the translations
|
39
|
-
#
|
40
|
-
# @todo Remove this once every client has migrated to `android_download_translations` and we got rid of that legacy action.
|
41
|
-
#
|
42
|
-
def self.update_metadata(validate_translation_command)
|
43
|
-
Action.sh('./tools/update-translations.sh')
|
44
|
-
Action.sh('git', 'submodule', 'update', '--init', '--recursive')
|
45
|
-
Action.sh('./gradlew', validate_translation_command)
|
46
|
-
|
47
|
-
res_dir = File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'src', 'main', 'res')
|
48
|
-
Fastlane::Helper::GitHelper.commit(message: 'Update translations', files: res_dir, push: true)
|
49
|
-
end
|
50
30
|
end
|
51
31
|
end
|
52
32
|
end
|
@@ -92,6 +92,14 @@ module Fastlane
|
|
92
92
|
UI.user_error!("String #{string_name} [#{string_content}] was found in library #{library[:library]} but not in the main file.")
|
93
93
|
end
|
94
94
|
|
95
|
+
# Merge strings from a library into the strings.xml of the main app
|
96
|
+
#
|
97
|
+
# @param [String] main Path to the main strings.xml file (something like `…/res/values/strings.xml`)
|
98
|
+
# @param [Hash] library Hash describing the library to merge. The Hash should contain the following keys:
|
99
|
+
# - `:library`: The human readable name of the library, used to display in console messages
|
100
|
+
# - `:strings_path`: The path to the strings.xml file of the library to merge into the main one
|
101
|
+
# - `:exclusions`: An array of strings keys to exclude during merge. Any of those keys from the library's `strings.xml` will be skipped and won't be merged into the main one.
|
102
|
+
# @return [Boolean] True if at least one string from the library has been added to (or has updated) the main strings file.
|
95
103
|
def self.merge_lib(main, library)
|
96
104
|
UI.message("Merging #{library[:library]} strings into #{main}")
|
97
105
|
main_strings = File.open(main) { |f| Nokogiri::XML(f, nil, Encoding::UTF_8.to_s) }
|
@@ -5,10 +5,8 @@ module Fastlane
|
|
5
5
|
# Helper methods to execute git-related operations
|
6
6
|
#
|
7
7
|
module GitHelper
|
8
|
-
# Fallback default branch of the client repository.
|
9
|
-
|
10
|
-
# TODO: Set to 'trunk' for the next major release.
|
11
|
-
DEFAULT_GIT_BRANCH = 'develop'.freeze
|
8
|
+
# Fallback default branch of the client repository.
|
9
|
+
DEFAULT_GIT_BRANCH = 'trunk'.freeze
|
12
10
|
|
13
11
|
# Checks if the given path, or current directory if no path is given, is
|
14
12
|
# inside a Git repository
|
@@ -35,8 +35,9 @@ module Fastlane
|
|
35
35
|
# @env PROJECT_ROOT_FOLDER The path to the git root of the project
|
36
36
|
# @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
|
37
37
|
#
|
38
|
-
# @
|
39
|
-
#
|
38
|
+
# @deprecated This method is only used by the `ios_localize_project` action, which is itself deprecated
|
39
|
+
# in favor of the new `ios_generate_strings_file_from_code` action
|
40
|
+
# @todo [Next Major] Remove this method once we fully remove `ios_localize_project`
|
40
41
|
#
|
41
42
|
def self.localize_project
|
42
43
|
Action.sh("cd #{get_from_env!(key: 'PROJECT_ROOT_FOLDER')} && ./Scripts/localize.py")
|