Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 12 additions & 57 deletions scripts/gha/build_testapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
import datetime
from distutils import dir_util
import os
import pathlib
import platform
import shutil
import subprocess
import sys

from absl import app
from absl import flags
Expand All @@ -81,8 +81,8 @@
import attr

from integration_testing import config_reader
from integration_testing import provisioning
from integration_testing import xcodebuild
import utils

# Environment variables
_JAVA_HOME = "JAVA_HOME"
Expand Down Expand Up @@ -199,10 +199,14 @@ def main(argv):
config = config_reader.read_config()
cmake_flags = _get_desktop_compiler_flags(FLAGS.compiler, config.compilers)
if _DESKTOP in platforms and FLAGS.use_vcpkg:
_run(["git", "submodule", "update", "--init"])
vcpkg = Vcpkg.generate(os.path.join(sdk_dir, config.vcpkg_dir))
vcpkg.install_and_run()
cmake_flags.extend(vcpkg.cmake_flags)
installer = os.path.join(sdk_dir, "scripts", "gha", "build_desktop.py")
_run([sys.executable, installer, "--vcpkg_step_only"])
toolchain_file = os.path.join(
sdk_dir, "external", "vcpkg", "scripts", "buildsystems", "vcpkg.cmake")
cmake_flags.extend((
"-DCMAKE_TOOLCHAIN_FILE=%s" % toolchain_file,
"-DVCPKG_TARGET_TRIPLET=%s" % utils.get_vcpkg_triplet(arch="x64")
))

failures = []
for testapp in testapps:
Expand Down Expand Up @@ -462,7 +466,7 @@ def _build_ios(
app_podfile_path = os.path.join(
project_dir, "Podfile")
podfile_patcher_args = [
"python", podfile_tool_path,
sys.executable, podfile_tool_path,
"--sdk_podfile", sdk_podfile_path,
"--app_podfile", app_podfile_path
]
Expand Down Expand Up @@ -515,7 +519,7 @@ def _run_setup_script(root_dir, testapp_dir):
"""Runs the setup_integration_tests.py script if needed."""
script_path = os.path.join(root_dir, "setup_integration_tests.py")
if os.path.isfile(script_path):
_run(["python", script_path, testapp_dir])
_run([sys.executable, script_path, testapp_dir])
else:
logging.info("setup_integration_tests.py not found")

Expand Down Expand Up @@ -548,55 +552,6 @@ def _fix_path(path):
return os.path.abspath(os.path.expanduser(path))


@attr.s(frozen=True, eq=False)
class Vcpkg(object):
"""Holds data related to the vcpkg tool used for managing dependent tools."""
installer = attr.ib()
binary = attr.ib()
triplet = attr.ib()
response_file = attr.ib()
toolchain_file = attr.ib()

@classmethod
def generate(cls, vcpkg_dir):
"""Generates the vcpkg data based on the given vcpkg submodule path."""
installer = os.path.join(vcpkg_dir, "bootstrap-vcpkg")
binary = os.path.join(vcpkg_dir, "vcpkg")
response_file_fmt = vcpkg_dir + "_%s_response_file.txt"
if platform.system() == "Windows":
triplet = "x64-windows-static"
installer += ".bat"
binary += ".exe"
elif platform.system() == "Darwin":
triplet = "x64-osx"
installer += ".sh"
elif platform.system() == "Linux":
triplet = "x64-linux"
installer += ".sh"
else:
raise ValueError("Unrecognized system: %s" % platform.system())
return cls(
installer=installer,
binary=binary,
triplet=triplet,
response_file=response_file_fmt % triplet,
toolchain_file=os.path.join(
vcpkg_dir, "scripts", "buildsystems", "vcpkg.cmake"))

def install_and_run(self):
"""Installs vcpkg (if needed) and runs it to install dependencies."""
if not os.path.exists(self.binary):
_run([self.installer])
_run([
self.binary, "install", "@" + self.response_file, "--disable-metrics"])

@property
def cmake_flags(self):
return [
"-DCMAKE_TOOLCHAIN_FILE=%s" % self.toolchain_file,
"-DVCPKG_TARGET_TRIPLET=%s" % self.triplet]


@attr.s(frozen=True, eq=False)
class Failure(object):
"""Holds context for the failure of a testapp to build/run."""
Expand Down
1 change: 0 additions & 1 deletion scripts/gha/integration_testing/build_testapps.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
"provision": "Google_Development.mobileprovision"
}
],
"vcpkg_dir": "external/vcpkg",
"apple_team_id": "REPLACE_ME_TEMP_INVALID_ID",
"compiler_dict": {
"gcc-4.8": [
Expand Down
2 changes: 0 additions & 2 deletions scripts/gha/integration_testing/config_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def read_config(path=None):
return Config(
apis=api_configs,
apple_team_id=config["apple_team_id"],
vcpkg_dir=config["vcpkg_dir"],
compilers=config["compiler_dict"])
except (KeyError, TypeError, IndexError):
# The error will be cryptic on its own, so we dump the JSON to
Expand All @@ -112,7 +111,6 @@ def read_config(path=None):
class Config(object):
apis = attr.ib() # Mapping of str: APIConfig
apple_team_id = attr.ib()
vcpkg_dir = attr.ib() # Relative location of the vcpkg submodule in the repo.
compilers = attr.ib()

def get_api(self, api):
Expand Down