Skip to content

Use swift-sdk-generator from update-checkout instead of submodule #592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ updates:
directory: '/'
schedule:
interval: 'weekly'
- package-ecosystem: 'gitsubmodule'
directory: '/'
schedule:
interval: 'daily'
1 change: 0 additions & 1 deletion .github/scripts/build-matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def affected_schemes(changes, schemes)
prefixes = [
"schemes/#{scheme}/",
"tools/build/",
"tools/swift-sdk-generator",
"tools/git-swift-workspace",
]
changes.any? do |change|
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ jobs:
changed:
- "schemes/**"
- "tools/build/**"
- "tools/swift-sdk-generator"
- "tools/git-swift-workspace"

- name: Generate entries
Expand Down Expand Up @@ -129,7 +128,7 @@ jobs:
run: |
rm -rf ${{ github.workspace }}/build \
${{ github.workspace }}/swift \
${{ github.workspace }}/swiftwasm-build/tools/swift-sdk-generator/Bundles \
${{ github.workspace }}/swift-sdk-generator/Bundles \
${{ github.workspace }}/build-cache \
${{ github.workspace }}/build-sdk

Expand Down Expand Up @@ -274,7 +273,7 @@ jobs:
docker exec swiftwasm-ci-buildbot /bin/bash -lc \
"./llvm-project/llvm/utils/lit/lit.py \
--param swift-sdk=wasm32-unknown-wasi \
--param swift-sdks-path=./swiftwasm-build/tools/swift-sdk-generator/Bundles \
--param swift-sdks-path=./swift-sdk-generator/Bundles \
--param scheme=${{ matrix.scheme }} ./swiftwasm-build/test -vv"

- name: Cleanup docker volume
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

17 changes: 12 additions & 5 deletions tools/build/build_support/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,25 @@ def system(self, *args):
raise Exception('Command failed: {}'.format(' '.join(args)))

class CloneAction(Action):
def __init__(self, options, repo: str, branch: str):
super().__init__(options)
self.repo = repo
self.repo_basename = repo.split('/')[-1]
self.branch = branch

def run(self):
if os.path.exists("../swift/.git"):
repo_dir = os.path.join('..', self.repo_basename)
if os.path.exists(os.path.join(repo_dir, '.git')):
return
print('=====> Cloning Swift repository')
git_options = []
if self.options.skip_history:
git_options += ['--depth', '1', '--branch', self.options.tag]
git_options += ['--depth', '1', '--branch', self.branch]

args = ['git', 'clone'] + git_options + ['https://github.com/apple/swift.git', '../swift']
args = ['git', 'clone'] + git_options + [f'https://github.com/{self.repo}.git', repo_dir]
self.system(*args)
print('=====> Checking out Swift tag {}'.format(self.options.tag))
self.system('git', '-C', '../swift', 'checkout', self.options.tag)
print('=====> Checking out Swift tag {}'.format(self.branch))
self.system('git', '-C', repo_dir, 'checkout', self.branch)

class UpdateCheckoutAction(Action):
def run(self):
Expand Down
2 changes: 1 addition & 1 deletion tools/build/package-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class PackageSwiftSDKAction(Action):
:param wasi_sysroot_path: The path to the WASI sysroot.
"""
sdk_generator_pkg_path = os.path.join(
os.path.dirname(__file__), "..", "swift-sdk-generator")
os.path.dirname(__file__), "..", "..", "..", "swift-sdk-generator")
sdk_generator_args = [
"swift",
"run", "--package-path", sdk_generator_pkg_path,
Expand Down
10 changes: 9 additions & 1 deletion tools/git-swift-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@ def main():
default=[])
options = derive_options_from_args(sys.argv[1:], parser)
actions = [
CloneAction(options), UpdateCheckoutAction(options),
CloneAction(options, 'swiftlang/swift', options.tag),
UpdateCheckoutAction(options),
]
if options.scheme == 'release-6.0':
# release/6.0 doesn't have swift-sdk-generator configuration in update-checkout
# so we need to clone it manually
actions.append(CloneAction(options, 'swiftlang/swift-sdk-generator', 'swift-6.1-RELEASE'))

actions = actions + [
ApplyPatchesAction(options, 'swift'),
CheckoutCorelibsAction(options),
ApplyPatchesAction(options, 'swift-corelibs-foundation'),
Expand Down
1 change: 0 additions & 1 deletion tools/swift-sdk-generator
Submodule swift-sdk-generator deleted from 44ea35
Loading