Skip to content
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

perf: improved for macos with pre-installed xcode #8

Merged
merged 1 commit into from
Aug 28, 2023
Merged
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: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:

- name: Verify Swift version in macos
if: runner.os == 'macOS'
run: xcrun --toolchain ${{ env.TOOLCHAINS }} swift --version | grep ${{ steps.setup-swift.outputs.swift-version }} || exit 1
run: xcrun --toolchain ${{ env.TOOLCHAINS || '""' }} swift --version | grep ${{ steps.setup-swift.outputs.swift-version }} || exit 1

- name: Verify Swift version
run: swift --version | grep ${{ steps.setup-swift.outputs.swift-version }} || exit 1
Expand Down Expand Up @@ -306,7 +306,7 @@ jobs:

- name: Verify Swift version in macos
if: runner.os == 'macOS'
run: xcrun --toolchain ${{ env.TOOLCHAINS }} swift --version | grep ${{ steps.setup-swift.outputs.swift-version }} || exit 1
run: xcrun --toolchain ${{ env.TOOLCHAINS || '""' }} swift --version | grep ${{ steps.setup-swift.outputs.swift-version }} || exit 1

- name: Verify Swift version
run: swift --version | grep ${{ steps.setup-swift.outputs.swift-version }} || exit 1
Expand Down
10 changes: 5 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions src/installer/xcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class XcodeToolchainInstaller extends ToolchainInstaller<XcodeToolchainSn
const command = this.swiftVersionCommand('')
const version = await this.installedSwiftVersion(command)
core.debug(`Found toolchain "${version}" bundled with Xcode ${xcode}`)
return this.data.dir === `swift-${version}-RELEASE`
return this.data.dir !== `swift-${version}-RELEASE`
}

protected async download() {
Expand Down Expand Up @@ -75,10 +75,11 @@ export class XcodeToolchainInstaller extends ToolchainInstaller<XcodeToolchainSn
const xctoolchain = path.join(xctoolchains, `${this.data.dir}.xctoolchain`)
try {
await fs.access(xctoolchain)
} catch (error) {
core.debug(`Removing xctoolchain "${xctoolchain}" for "${error}"`)
core.debug(`Removing existing xctoolchain "${xctoolchain}"`)
await exec('sudo', ['rm', '-rf', xctoolchain])
// await fs.unlink(xctoolchain)
} catch (error) {
core.debug(`No existing xctoolchain "${xctoolchain}", got "${error}"`)
}
core.debug(`Linking "${xctoolchain}" to "${toolchain}"`)
await exec('sudo', ['ln', '-s', toolchain, xctoolchain])
Expand All @@ -96,9 +97,6 @@ export class XcodeToolchainInstaller extends ToolchainInstaller<XcodeToolchainSn
`Setting Swift toolchain identifier to "${info.CFBundleIdentifier}"`
)
core.exportVariable('TOOLCHAINS', info.CFBundleIdentifier)
core.addPath(
'%ProgramFiles(x86)%\\Microsoft Visual Studio\\Shared\\Python37_64'
)
}
}

Expand Down
Loading