Skip to content

Commit

Permalink
fix checking supported build options
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedek Kozma committed Mar 22, 2022
1 parent 2e890e2 commit 3a7583b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

12 changes: 0 additions & 12 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,3 @@ export function logError(error: unknown): void {
core.info(`Unexpected error type: '${typeof error}'`)
}
}

export async function supportedBuildOptions(argsToTest: string[]): Promise<string[]> {
const helpText = await exec('swift', ['build', '--help'])
const validArgs: string[] = []
for (const arg of argsToTest) {
const regex = RegExp(`(${arg})\\s`)
if (regex.test(helpText)) {
validArgs.push(arg)
}
}
return validArgs
}
5 changes: 2 additions & 3 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs'
import * as os from 'os'
import * as semver from 'semver'

import { exec, getUuid, logError, supportedBuildOptions } from './helpers'
import { exec, getUuid, logError } from './helpers'

export class SwiftToolInstaller {
// Input
Expand Down Expand Up @@ -97,8 +97,7 @@ export class SwiftToolInstaller {
// They didn't make any difference when building SwiftLint
// '--disable-automatic-resolution' caused build error on Linux for realm/[email protected]:
// 'cannot update Package.resolved file because automatic resolution is disabled'
const additionalOptions = await supportedBuildOptions(['--disable-sandbox'])
await exec('swift', ['build', '--package-path', this.workingDirectory, '--configuration', 'release'].concat(additionalOptions))
await exec('swift', ['build', '--package-path', this.workingDirectory, '--configuration', 'release', '--disable-sandbox'])
})
}

Expand Down

0 comments on commit 3a7583b

Please sign in to comment.