Skip to content

Commit

Permalink
fix: windows issues (#1564)
Browse files Browse the repository at this point in the history
fix: windows issues
  • Loading branch information
Sloox authored Feb 4, 2021
1 parent 2e49d14 commit e978c98
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/full_suite_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ jobs:
- name: Prepare Google Service Account
env:
GOOGLE_CLOUD_PROJECT: flank-open-source #needs to be removed.
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}

run: |
if [ "$RUNNER_OS" == "Windows" ]; then
set GCLOUD_DIR="%HOMEPATH%/.config/gcloud/"
Expand Down
8 changes: 5 additions & 3 deletions common/src/main/kotlin/flank/common/Files.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ fun createCopy(sourceDirectoryLocation: String, destinationDirectoryLocation: St
copyDirectory(sourceDirectoryLocation, destinationDirectoryLocation)
}

fun createFileCopy(source: String, destination: String): Path = Files.copy(Paths.get(source), Paths.get(destination))

fun copyDirectory(sourceDirectoryLocation: String, destinationDirectoryLocation: String) {
Files.walk(Paths.get(sourceDirectoryLocation))
.forEach { source: Path ->
Expand Down Expand Up @@ -68,9 +70,9 @@ fun createSymbolicLink(
Paths.get(target).toAbsolutePath().normalize()
)

fun createSymbolicLinkToFile(link: Path, target: Path) {
Files.createSymbolicLink(link, target.fileName)
}
fun createLinkToFile(link: Path, target: Path): Path =
if (isWindows) createFileCopy(target.toString(), link.toString())
else Files.createSymbolicLink(link, target.fileName)

fun downloadFile(sourceUrl: String, destination: String) {
Fuel.download(sourceUrl)
Expand Down
2 changes: 1 addition & 1 deletion common/src/test/kotlin/flank/common/FilesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class FilesTest {
val expectedDestination = Paths.get(root.newFolder("temp").toString(), "test.link")

// when
createSymbolicLinkToFile(expectedDestination, testFile)
createLinkToFile(expectedDestination, testFile)

// then
assertTrue(Files.isSymbolicLink(expectedDestination))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ftl.ios.xctest.common
import flank.common.OutputLogLevel
import flank.common.appDataDirectory
import flank.common.createDirectoryIfNotExist
import flank.common.createSymbolicLinkToFile
import flank.common.createLinkToFile
import flank.common.downloadFile
import flank.common.hasAllFiles
import flank.common.isMacOS
Expand Down Expand Up @@ -54,7 +54,7 @@ private fun downloadAndUnzip(osname: String) {
it.setExecutable(true)
}
Files.delete(destinationFile)
createSymbolicLinkToFile(
createLinkToFile(
link = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1"),
target = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1.2.0")
)
Expand Down

0 comments on commit e978c98

Please sign in to comment.