-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from Cyberbeni/sourcekit-fix
Export LINUX_SOURCEKIT_LIB_PATH on Linux
- Loading branch information
Showing
8 changed files
with
614 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as core from '@actions/core' | ||
import * as fs from 'fs' | ||
import * as os from 'os' | ||
import { env } from 'process' | ||
|
||
export class SwiftEnvironmentFixer { | ||
static async fixSourceKitPath () { | ||
const envVar = 'LINUX_SOURCEKIT_LIB_PATH' | ||
if(env[envVar] != undefined) { | ||
return | ||
} | ||
await core.group(`Setting ${envVar}`, async () => { | ||
let exported = false | ||
const libName = 'libsourcekitdInProc.so' | ||
const possiblePaths = ['/usr/share/swift/usr/lib', '/usr/lib'] | ||
for (const path of possiblePaths) { | ||
if (fs.existsSync(`${path}/${libName}`)) { | ||
core.info(`Setting to: '${path}'`) | ||
core.exportVariable(envVar, path) | ||
exported = true | ||
break | ||
} | ||
} | ||
if (!exported) { | ||
core.warning(`Failed to find suitable path for ${envVar}`) | ||
} | ||
}) | ||
} | ||
|
||
static async fixAll() { | ||
if (os.platform() == 'linux') { | ||
await this.fixSourceKitPath() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export declare class SwiftEnvironmentFixer { | ||
static fixSourceKitPath(): Promise<void>; | ||
static fixAll(): Promise<void>; | ||
} |
Oops, something went wrong.