Skip to content

Commit

Permalink
LLVM now installs compiler_packages (#55)
Browse files Browse the repository at this point in the history
* LLVM now installs compiler_packages

* Do std compat sanity test

* Ensure compiler_packages are always installed

* Ensure MSVC installs packages, fixed linter warning about exceptions
  • Loading branch information
Justin Boswell authored Sep 25, 2020
1 parent cf63584 commit f0f56f4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/sanity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,29 @@ jobs:
- name: Build aws-c-common
run: python3 builder.pyz build --project aws-c-common --compiler=${{ matrix.compiler }} run_tests=false

# Make sure linux compilers + stdlibs are installing properly
std-compat:
needs: [package, sanity_test]
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [gcc-8, clang-9]
std: [c++11, c++14, c++17, c++2a]
steps:
- name: Checkout Source
uses: actions/checkout@v1

- name: Install builder
uses: actions/download-artifact@v1
with:
name: builder
path: .

- name: Build aws-crt-cpp with ${{ matrix.compiler }}/${{ matrix.std }}
run: |
export CXXFLAGS=-std=${{ matrix.std }}
python3 builder.pyz build -p aws-crt-cpp --compiler=${{ matrix.compiler }}
release_notes:
strategy:
fail-fast: false
Expand Down
10 changes: 7 additions & 3 deletions builder/imports/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ def install(self, env):
if self.installed:
return

sh = env.shell
config = env.config

# Ensure additional compiler packages are installed
packages = UniqueList(config.get('compiler_packages', []))
packages = [p for p in packages if not p.startswith('gcc')]
Script([InstallPackages(packages)],
name='Install compiler prereqs').run(env)

installed_path, installed_version = Toolchain.find_compiler(
env.spec.compiler, env.spec.compiler_version)
if installed_path:
Expand All @@ -37,9 +42,8 @@ def install(self, env):
self.installed = True
return

# It's ok to attempt to install packages redundantly, they won't hurt anything
packages = UniqueList(config.get('compiler_packages', []))
compiler = env.spec.compiler
version = env.spec.compiler_version

Script([InstallPackages(packages)], name='install gcc').run(env)

Expand Down
10 changes: 10 additions & 0 deletions builder/imports/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
from host import current_os
from project import Import
from toolchain import Toolchain
from util import UniqueList
from actions.install import InstallPackages
from actions.script import Script

import os
import stat
Expand Down Expand Up @@ -99,6 +102,12 @@ def install(self, env):
return

sh = env.shell
config = env.config

# Ensure compiler packages are installed
packages = UniqueList(config.get('compiler_packages', []))
Script([InstallPackages(packages)],
name='Install compiler prereqs').run(env)

installed_path, installed_version = Toolchain.find_compiler(
env.spec.compiler, env.spec.compiler_version)
Expand All @@ -111,6 +120,7 @@ def install(self, env):
sudo = env.config.get('sudo', current_os() == 'linux')
sudo = ['sudo'] if sudo else []

# Strip minor version info
version = env.toolchain.compiler_version.replace('\..+', '')

script = tempfile.NamedTemporaryFile(delete=False)
Expand Down
13 changes: 10 additions & 3 deletions builder/imports/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
from host import current_os
from project import Import
from toolchain import Toolchain
from util import UniqueList
from actions.install import InstallPackages
from actions.script import Script


class MSVC(Import):
Expand All @@ -23,8 +26,12 @@ def install(self, env):
if self.installed:
return

sh = env.shell
toolchain = env.toolchain
config = env.config

# Ensure compiler packages are installed
packages = UniqueList(config.get('compiler_packages', []))
Script([InstallPackages(packages)],
name='Install compiler prereqs').run(env)

installed_path, installed_version = Toolchain.find_compiler(
env.spec.compiler, env.spec.compiler_version)
Expand All @@ -34,5 +41,5 @@ def install(self, env):
self.installed = True
return

raise Exception('MSVC does not support dynamic install, and {} {} could not be found'.format(
raise EnvironmentError('MSVC does not support dynamic install, and {} {} could not be found'.format(
env.spec.compiler, env.spec.compiler_version))

0 comments on commit f0f56f4

Please sign in to comment.