add changes made by test file
Change-Id: Ib811878d4285fbb96dd251e941241ab960e8e233
add ktlint as a dependency
Change-Id: I9d1b65bbe0978782c15db7deb435aad28417f7f8
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/56760
Reviewed-by: Keyong Han <keyonghan@google.com>
Commit-Queue: Gray Mackall <mackall@google.com>
diff --git a/recipe_modules/flutter_deps/api.py b/recipe_modules/flutter_deps/api.py
index 52f6f00..79d0f97 100644
--- a/recipe_modules/flutter_deps/api.py
+++ b/recipe_modules/flutter_deps/api.py
@@ -98,6 +98,7 @@
'ios_signing':
self.
apple_signing, # TODO(drewroen): Remove this line once ios_signing is not being referenced
+ 'ktlint': self.ktlint,
'ninja': self.ninja,
'open_jdk': self.open_jdk,
'ruby': self.ruby,
@@ -723,6 +724,24 @@
paths.insert(0, ruby_path.join('bin'))
env_prefixes['PATH'] = paths
+ # pylint: disable=unused-argument
+ def ktlint(self, env, env_prefixes, version=None):
+ """Installs a dependency on ktlint
+
+ Args:
+ env(dict): Current environment variables.
+ env_prefixes(dict): Current environment prefixes variables.
+ """
+ version = version or 'latest'
+ with self.m.step.nest('Install ktlint'):
+ ktlint_path = self.m.path['cache'].join('ktlint')
+ ktlint = self.m.cipd.EnsureFile()
+ ktlint.add_package('flutter/ktlint/${platform}', version)
+ self.m.cipd.ensure(ktlint_path, ktlint)
+ paths = env_prefixes.get('PATH', [])
+ paths.insert(0, ktlint_path)
+ 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 13d54f7..83e86aa 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/basic.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/basic.json
@@ -839,6 +839,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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 13d54f7..83e86aa 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/goldTryjob.json
@@ -839,6 +839,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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 13d54f7..83e86aa 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/linux.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/linux.json
@@ -839,6 +839,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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 7940ea7..f985449 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
@@ -923,6 +923,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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 e1bd509..ae939f4 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
@@ -923,6 +923,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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 208eb0b..fb2db31 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/mac.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/mac.json
@@ -855,6 +855,39 @@
},
{
"cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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": [],
"name": "Install swift-format"
},
{
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 e5bf405..3699c24 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/mac_old.json
@@ -855,6 +855,39 @@
},
{
"cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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": [],
"name": "Install swift-format"
},
{
diff --git a/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json b/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json
index 36ce9e7..aabc42c 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/noop_golds_official_builds.json
@@ -1190,6 +1190,51 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "luci_context": {
+ "realm": {
+ "name": "dart-internal:flutter"
+ },
+ "resultdb": {
+ "current_invocation": {
+ "name": "invocations/build:8945511751514863184",
+ "update_token": "token"
+ },
+ "hostname": "rdbhost"
+ }
+ },
+ "name": "Install ktlint.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/ktlint/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_vs_installed.json b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_installed.json
index dfbae26..ab11267 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/windows_vs_installed.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_installed.json
@@ -942,6 +942,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd.bat",
+ "ensure",
+ "-root",
+ "[CACHE]\\ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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/windows_vs_not_installed.json b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_not_installed.json
index b7d9596..ebe836f 100644
--- a/recipe_modules/flutter_deps/examples/full.expected/windows_vs_not_installed.json
+++ b/recipe_modules/flutter_deps/examples/full.expected/windows_vs_not_installed.json
@@ -1445,6 +1445,39 @@
]
},
{
+ "cmd": [],
+ "name": "Install ktlint"
+ },
+ {
+ "cmd": [
+ "cipd.bat",
+ "ensure",
+ "-root",
+ "[CACHE]\\ktlint",
+ "-ensure-file",
+ "flutter/ktlint/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Install ktlint.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/ktlint/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.py b/recipe_modules/flutter_deps/examples/full.py
index 55a535d..181e8a6 100644
--- a/recipe_modules/flutter_deps/examples/full.py
+++ b/recipe_modules/flutter_deps/examples/full.py
@@ -86,6 +86,7 @@
api.flutter_deps.certs(env, env_prefixes, '')
api.flutter_deps.vs_build(env, env_prefixes, 'version:vs2019')
api.flutter_deps.ruby(env, env_prefixes, '')
+ api.flutter_deps.ktlint(env, env_prefixes)
api.flutter_deps.android_virtual_device(env, env_prefixes, '34')
api.flutter_deps.swift_format(env, env_prefixes, '')