Add a new ruby dependency.
This dependency will replace the gems dependency.
Bug: https://github.com/flutter/flutter/issues/136377
Change-Id: I8d82cc407df7f488e515a151dff5fddbfcb0a0bd
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/51547
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
Reviewed-by: Keyong Han <keyonghan@google.com>
diff --git a/recipe_modules/flutter_deps/api.py b/recipe_modules/flutter_deps/api.py
index 9c39860..b51e8d5 100644
--- a/recipe_modules/flutter_deps/api.py
+++ b/recipe_modules/flutter_deps/api.py
@@ -100,6 +100,7 @@
'jazzy': self.jazzy,
'ninja': self.ninja,
'open_jdk': self.open_jdk,
+ 'ruby': self.ruby,
'vs_build': self.vs_build,
}
parsed_deps = []
@@ -709,6 +710,24 @@
temp_paths.append(jazzy_path.join('ruby', ruby_version, 'bin'))
env_prefixes['PATH'] = temp_paths
+ # pylint: disable=unused-argument
+ def ruby(self, env, env_prefixes, version=None):
+ """Installs a self contained Ruby.
+
+ Args:
+ env(dict): Current environment variables.
+ env_prefixes(dict): Current environment prefixes variables.
+ """
+ version = version or 'latest'
+ with self.m.step.nest('Install ruby'):
+ ruby_path = self.m.path['cache'].join('ruby')
+ ruby = self.m.cipd.EnsureFile()
+ ruby.add_package('flutter/ruby/${platform}', version)
+ self.m.cipd.ensure(ruby_path, ruby)
+ paths = env_prefixes.get('PATH', [])
+ paths.insert(0, ruby_path.join('bin'))
+ env_prefixes['PATH'] = paths
+
def contexts(self):
"""Available contexts across recipes repository."""
return {
diff --git a/recipe_modules/flutter_deps/examples/full.expected/basic.json b/recipe_modules/flutter_deps/examples/full.expected/basic.json
index f614031..bb4f38e 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/basic.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/basic.json
@@ -876,6 +876,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json b/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
index f614031..bb4f38e 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
@@ -876,6 +876,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/linux.json b/recipe_modules/flutter_deps/examples/full.expected/linux.json
index f614031..bb4f38e 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/linux.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/linux.json
@@ -876,6 +876,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json b/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json
index 3795979..80b2166 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/local_engine_cas.json
@@ -963,6 +963,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json b/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json
index 3e4cd8d..c4ad416 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/local_web_sdk_cas.json
@@ -962,6 +962,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/mac.json b/recipe_modules/flutter_deps/examples/full.expected/mac.json
index f6761e7..af24307 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/mac.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/mac.json
@@ -893,6 +893,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/mac_old.json b/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
index bab760c..4535453 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
@@ -893,6 +893,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/windows.json b/recipe_modules/flutter_deps/examples/full.expected/windows.json
index 0506170..f1a38a6 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/windows.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/windows.json
@@ -1035,6 +1035,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd.bat",
+ "ensure",
+ "-root",
+ "[CACHE]\\ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"git",
"rev-parse",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/with-arm64ruby.json b/recipe_modules/flutter_deps/examples/full.expected/with-arm64ruby.json
index 67ca940..3e9c3bb 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/with-arm64ruby.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/with-arm64ruby.json
@@ -876,6 +876,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
@@ -922,7 +955,7 @@
},
{
"cmd": [],
- "name": "Install ruby"
+ "name": "Install ruby (2)"
},
{
"cmd": [
@@ -955,7 +988,7 @@
"[START_DIR]/flutter\\ sdk/bin/cache/dart-sdk/bin"
]
},
- "name": "Install ruby.ensure_installed",
+ "name": "Install ruby (2).ensure_installed",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
"@@@STEP_LOG_LINE@json.output@{@@@",
diff --git a/recipe_modules/flutter_deps/examples/full.expected/with-gems.json b/recipe_modules/flutter_deps/examples/full.expected/with-gems.json
index 7d24b24..653edda 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/with-gems.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/with-gems.json
@@ -876,6 +876,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ruby"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ruby",
+ "-ensure-file",
+ "flutter/ruby/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ruby.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\",@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter/ruby/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
"cmd": [
"cipd",
"ensure",
@@ -922,7 +955,7 @@
},
{
"cmd": [],
- "name": "Install ruby"
+ "name": "Install ruby (2)"
},
{
"cmd": [
@@ -955,7 +988,7 @@
"[START_DIR]/flutter\\ sdk/bin/cache/dart-sdk/bin"
]
},
- "name": "Install ruby.ensure_installed",
+ "name": "Install ruby (2).ensure_installed",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@",
"@@@STEP_LOG_LINE@json.output@{@@@",
diff --git a/recipe_modules/flutter_deps/examples/full.py b/recipe_modules/flutter_deps/examples/full.py
index a5a746e..dcddaf6 100644
--- a/recipe_modules/flutter_deps/examples/full.py
+++ b/recipe_modules/flutter_deps/examples/full.py
@@ -72,6 +72,7 @@
api.flutter_deps.certs(env, env_prefixes, '')
api.flutter_deps.vs_build(env, env_prefixes, '')
api.flutter_deps.jazzy(env, env_prefixes, '')
+ api.flutter_deps.ruby(env, env_prefixes, '')
api.flutter_deps.contexts()
with contextlib.ExitStack() as exit_stack:
api.flutter_deps.enter_contexts(exit_stack, ['osx_sdk'], env, env_prefixes)