Cleans up devicelab osx sdk module
Follow up of https://flutter-review.googlesource.com/c/recipes/+/43980 to remove the devicelab_osx_sdk module. Tree has been green for hours after the switch over.
Change-Id: I8bc89bb286e9f028922ac0e4aad4e315032a3c18
Bug: https://github.com/flutter/flutter/issues/117541
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/44001
Reviewed-by: Ricardo Amador <ricardoamador@google.com>
Commit-Queue: Keyong Han <keyonghan@google.com>
(cherry picked from commit 50a1cd0e3f5b0bdccaef52a144edbbfc88109f4e)
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/44604
Reviewed-by: Xilai Zhang <xilaizhang@google.com>
diff --git a/recipe_modules/devicelab_osx_sdk/__init__.py b/recipe_modules/devicelab_osx_sdk/__init__.py
deleted file mode 100644
index 79d9ba1..0000000
--- a/recipe_modules/devicelab_osx_sdk/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-DEPS = [
- 'recipe_engine/cipd',
- 'recipe_engine/context',
- 'recipe_engine/path',
- 'recipe_engine/platform',
- 'recipe_engine/step',
-]
-
-from recipe_engine.recipe_api import Property
-from recipe_engine.config import ConfigGroup, Single
-
-PROPERTIES = {
- '$flutter/devicelab_osx_sdk': Property(
- help='Properties specifically for the infra osx_sdk module.',
- param_name='sdk_properties',
- kind=ConfigGroup( # pylint: disable=line-too-long
- # XCode build version number. Internally maps to an XCode build id like
- # '9c40b'. See
- #
- # https://chrome-infra-packages.appspot.com/p/flutter_internal/ios/xcode/mac/+/
- #
- # For an up to date list of the latest SDK builds.
- sdk_version=Single(str),
- ), default={},
- )
-}
diff --git a/recipe_modules/devicelab_osx_sdk/api.py b/recipe_modules/devicelab_osx_sdk/api.py
deleted file mode 100644
index afce2c9..0000000
--- a/recipe_modules/devicelab_osx_sdk/api.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Functions to use fixed xcode installations.
-
-The cost of installing xcode from cold caches is prohibitely high for the
-Flutter Devicelab tasks. This module provide functions to use semi-hermetic
-Xcode installations pre-installed on Devicelab bots.
-
-XCode build version number. Internally maps to an XCode build id like '9c40b'.
-See:
-https://chrome-infra-packages.appspot.com/p/flutter_internal/ios/xcode/mac/+/
-for an up to date list of the latest SDK builds.
-"""
-
-from contextlib import contextmanager
-
-from recipe_engine import recipe_api
-
-
-class DevicelabOSXSDKApi(recipe_api.RecipeApi):
- """API for using OS X SDK distributed via CIPD."""
-
- def __init__(self, sdk_properties, *args, **kwargs):
- super(DevicelabOSXSDKApi, self).__init__(*args, **kwargs)
- self._sdk_properties = sdk_properties
- self._sdk_version = None
- self._tool_pkg = 'infra/tools/mac_toolchain/${platform}'
- self._tool_ver = 'latest'
-
- def initialize(self):
- """Initializes xcode, and ios versions.
-
- Versions are passed as recipe properties.
- """
- if not self.m.platform.is_mac:
- return
-
- if 'sdk_version' in self._sdk_properties:
- self._sdk_version = self._sdk_properties['sdk_version'].lower()
-
- @contextmanager
- def __call__(self, kind):
- """Sets up the XCode SDK environment.
-
- Is a no-op on non-mac platforms.
-
- This will deploy the helper tool and the XCode.app bundle at
- `/opt/flutter/xcode/<version>`.
-
- Usage:
- with api.devicelab_osx_sdk('mac'):
- # sdk with mac build bits
-
- with api.devicelab_osx_sdk('ios'):
- # sdk with mac+iOS build bits
-
- Args:
- kind ('mac'|'ios'): How the SDK should be configured. iOS includes the
- base XCode distribution, as well as the iOS simulators (which can be
- quite large).
-
- Raises:
- StepFailure or InfraFailure.
- """
- assert kind in ('mac', 'ios'), 'Invalid kind %r' % (kind,)
- if not self.m.platform.is_mac:
- yield
- return
-
- try:
- with self.m.context(infra_steps=True):
- app = '/opt/flutter/xcode/%s/XCode.app' % self._sdk_version
- self._ensure_sdk(kind, app)
- self.m.step('select XCode', ['sudo', 'xcode-select', '--switch', app])
- self.m.step('list simulators', ['xcrun', 'simctl', 'list'])
- yield
- finally:
- with self.m.context(infra_steps=True):
- self.m.step('reset XCode', ['sudo', 'xcode-select', '--reset'])
-
- def _ensure_sdk(self, kind, app):
- """Ensures the mac_toolchain tool and OS X SDK packages are installed."""
- tool_dir = self.m.path.mkdtemp().join('osx_sdk')
- ef = self.m.cipd.EnsureFile()
- ef.add_package(self._tool_pkg, self._tool_ver)
- self.m.cipd.ensure(tool_dir, ef)
- self.m.step(
- 'install xcode', [
- tool_dir.join('mac_toolchain'),
- 'install',
- '-kind',
- kind,
- '-xcode-version',
- self._sdk_version,
- '-output-dir',
- app,
- '-cipd-package-prefix',
- 'flutter_internal/ios/xcode',
- ]
- )
diff --git a/recipe_modules/devicelab_osx_sdk/examples/full.expected/explicit_version.json b/recipe_modules/devicelab_osx_sdk/examples/full.expected/explicit_version.json
deleted file mode 100644
index bf3b034..0000000
--- a/recipe_modules/devicelab_osx_sdk/examples/full.expected/explicit_version.json
+++ /dev/null
@@ -1,94 +0,0 @@
-[
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[CLEANUP]/tmp_tmp_1/osx_sdk",
- "-ensure-file",
- "infra/tools/mac_toolchain/${platform} latest",
- "-max-threads",
- "0",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "ensure_installed",
- "~followup_annotations": [
- "@@@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\": \"infra/tools/mac_toolchain/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": [
- "[CLEANUP]/tmp_tmp_1/osx_sdk/mac_toolchain",
- "install",
- "-kind",
- "mac",
- "-xcode-version",
- "deadbeef",
- "-output-dir",
- "/opt/flutter/xcode/deadbeef/XCode.app",
- "-cipd-package-prefix",
- "flutter_internal/ios/xcode"
- ],
- "infra_step": true,
- "name": "install xcode"
- },
- {
- "cmd": [
- "sudo",
- "xcode-select",
- "--switch",
- "/opt/flutter/xcode/deadbeef/XCode.app"
- ],
- "infra_step": true,
- "name": "select XCode"
- },
- {
- "cmd": [
- "xcrun",
- "simctl",
- "list"
- ],
- "infra_step": true,
- "name": "list simulators"
- },
- {
- "cmd": [
- "gn",
- "gen",
- "out/Release"
- ],
- "name": "gn"
- },
- {
- "cmd": [
- "ninja",
- "-C",
- "out/Release"
- ],
- "name": "ninja"
- },
- {
- "cmd": [
- "sudo",
- "xcode-select",
- "--reset"
- ],
- "infra_step": true,
- "name": "reset XCode"
- },
- {
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/devicelab_osx_sdk/examples/full.expected/linux.json b/recipe_modules/devicelab_osx_sdk/examples/full.expected/linux.json
deleted file mode 100644
index 5b0f352..0000000
--- a/recipe_modules/devicelab_osx_sdk/examples/full.expected/linux.json
+++ /dev/null
@@ -1,21 +0,0 @@
-[
- {
- "cmd": [
- "gn",
- "gen",
- "out/Release"
- ],
- "name": "gn"
- },
- {
- "cmd": [
- "ninja",
- "-C",
- "out/Release"
- ],
- "name": "ninja"
- },
- {
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/devicelab_osx_sdk/examples/full.expected/mac.json b/recipe_modules/devicelab_osx_sdk/examples/full.expected/mac.json
deleted file mode 100644
index bf3b034..0000000
--- a/recipe_modules/devicelab_osx_sdk/examples/full.expected/mac.json
+++ /dev/null
@@ -1,94 +0,0 @@
-[
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[CLEANUP]/tmp_tmp_1/osx_sdk",
- "-ensure-file",
- "infra/tools/mac_toolchain/${platform} latest",
- "-max-threads",
- "0",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "ensure_installed",
- "~followup_annotations": [
- "@@@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\": \"infra/tools/mac_toolchain/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": [
- "[CLEANUP]/tmp_tmp_1/osx_sdk/mac_toolchain",
- "install",
- "-kind",
- "mac",
- "-xcode-version",
- "deadbeef",
- "-output-dir",
- "/opt/flutter/xcode/deadbeef/XCode.app",
- "-cipd-package-prefix",
- "flutter_internal/ios/xcode"
- ],
- "infra_step": true,
- "name": "install xcode"
- },
- {
- "cmd": [
- "sudo",
- "xcode-select",
- "--switch",
- "/opt/flutter/xcode/deadbeef/XCode.app"
- ],
- "infra_step": true,
- "name": "select XCode"
- },
- {
- "cmd": [
- "xcrun",
- "simctl",
- "list"
- ],
- "infra_step": true,
- "name": "list simulators"
- },
- {
- "cmd": [
- "gn",
- "gen",
- "out/Release"
- ],
- "name": "gn"
- },
- {
- "cmd": [
- "ninja",
- "-C",
- "out/Release"
- ],
- "name": "ninja"
- },
- {
- "cmd": [
- "sudo",
- "xcode-select",
- "--reset"
- ],
- "infra_step": true,
- "name": "reset XCode"
- },
- {
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/devicelab_osx_sdk/examples/full.expected/win.json b/recipe_modules/devicelab_osx_sdk/examples/full.expected/win.json
deleted file mode 100644
index 5b0f352..0000000
--- a/recipe_modules/devicelab_osx_sdk/examples/full.expected/win.json
+++ /dev/null
@@ -1,21 +0,0 @@
-[
- {
- "cmd": [
- "gn",
- "gen",
- "out/Release"
- ],
- "name": "gn"
- },
- {
- "cmd": [
- "ninja",
- "-C",
- "out/Release"
- ],
- "name": "ninja"
- },
- {
- "name": "$result"
- }
-]
\ No newline at end of file
diff --git a/recipe_modules/devicelab_osx_sdk/examples/full.py b/recipe_modules/devicelab_osx_sdk/examples/full.py
deleted file mode 100644
index f0b7f99..0000000
--- a/recipe_modules/devicelab_osx_sdk/examples/full.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-DEPS = [
- 'flutter/devicelab_osx_sdk',
- 'recipe_engine/platform',
- 'recipe_engine/properties',
- 'recipe_engine/step',
-]
-
-
-def RunSteps(api):
- with api.devicelab_osx_sdk('mac'):
- api.step('gn', ['gn', 'gen', 'out/Release'])
- api.step('ninja', ['ninja', '-C', 'out/Release'])
-
-
-def GenTests(api):
- for platform in ('linux', 'mac', 'win'):
- yield (api.test(platform) +
- api.platform.name(platform) +
- api.properties(**{'$flutter/devicelab_osx_sdk': {
- 'sdk_version': 'deadbeef',
- }}))
-
- yield api.test(
- 'explicit_version',
- api.platform.name('mac'),
- api.properties(**{'$flutter/devicelab_osx_sdk': {
- 'sdk_version': 'deadbeef',
- }})
- )