From 2429562858125de4bd6b6c2894b5863d976ad034 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 4 Feb 2021 13:20:25 +0100 Subject: [PATCH 1/3] Fix some windows issues --- .../workflows/full_suite_integration_tests.yml | 2 ++ common/src/main/kotlin/flank/common/Files.kt | 2 ++ .../ios/xctest/common/InstallParseBinaries.kt | 17 +++++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/full_suite_integration_tests.yml b/.github/workflows/full_suite_integration_tests.yml index 72565755e2..05cb1aa682 100644 --- a/.github/workflows/full_suite_integration_tests.yml +++ b/.github/workflows/full_suite_integration_tests.yml @@ -99,7 +99,9 @@ jobs: - name: Prepare Google Service Account env: + GOOGLE_CLOUD_PROJECT: flank-open-source GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }} + run: | if [ "$RUNNER_OS" == "Windows" ]; then set GCLOUD_DIR="%HOMEPATH%/.config/gcloud/" diff --git a/common/src/main/kotlin/flank/common/Files.kt b/common/src/main/kotlin/flank/common/Files.kt index db771f53b7..1695d6502a 100644 --- a/common/src/main/kotlin/flank/common/Files.kt +++ b/common/src/main/kotlin/flank/common/Files.kt @@ -32,6 +32,8 @@ fun createCopy(sourceDirectoryLocation: String, destinationDirectoryLocation: St copyDirectory(sourceDirectoryLocation, destinationDirectoryLocation) } +fun createFileCopy(source: String, destination: String) = Files.copy(Paths.get(source), Paths.get(destination)) + fun copyDirectory(sourceDirectoryLocation: String, destinationDirectoryLocation: String) { Files.walk(Paths.get(sourceDirectoryLocation)) .forEach { source: Path -> diff --git a/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt b/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt index 595b0dc2e2..3c5d4cd863 100644 --- a/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt +++ b/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt @@ -3,6 +3,7 @@ package ftl.ios.xctest.common import flank.common.OutputLogLevel import flank.common.appDataDirectory import flank.common.createDirectoryIfNotExist +import flank.common.createFileCopy import flank.common.createSymbolicLinkToFile import flank.common.downloadFile import flank.common.hasAllFiles @@ -54,8 +55,16 @@ private fun downloadAndUnzip(osname: String) { it.setExecutable(true) } Files.delete(destinationFile) - createSymbolicLinkToFile( - link = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1"), - target = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1.2.0") - ) + + if (isWindows) { + createFileCopy( + "$flankBinariesDirectory\\libatomic.so.1.2.0", + "$flankBinariesDirectory\\libatomic.so.1" + ) + } else { + createSymbolicLinkToFile( + link = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1"), + target = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1.2.0") + ) + } } From ddba09f6e4f61e4c28268dab5ebfd142a731173d Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 4 Feb 2021 16:44:54 +0100 Subject: [PATCH 2/3] Renames and cleanup --- .../full_suite_integration_tests.yml | 2 +- common/src/main/kotlin/flank/common/Files.kt | 8 ++++---- .../src/test/kotlin/flank/common/FilesTest.kt | 2 +- .../ios/xctest/common/InstallParseBinaries.kt | 19 +++++-------------- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/full_suite_integration_tests.yml b/.github/workflows/full_suite_integration_tests.yml index 05cb1aa682..abd2003432 100644 --- a/.github/workflows/full_suite_integration_tests.yml +++ b/.github/workflows/full_suite_integration_tests.yml @@ -99,7 +99,7 @@ jobs: - name: Prepare Google Service Account env: - GOOGLE_CLOUD_PROJECT: flank-open-source + GOOGLE_CLOUD_PROJECT: flank-open-source #needs to be removed. GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }} run: | diff --git a/common/src/main/kotlin/flank/common/Files.kt b/common/src/main/kotlin/flank/common/Files.kt index 1695d6502a..3e88ad20c1 100644 --- a/common/src/main/kotlin/flank/common/Files.kt +++ b/common/src/main/kotlin/flank/common/Files.kt @@ -32,7 +32,7 @@ fun createCopy(sourceDirectoryLocation: String, destinationDirectoryLocation: St copyDirectory(sourceDirectoryLocation, destinationDirectoryLocation) } -fun createFileCopy(source: String, destination: String) = Files.copy(Paths.get(source), Paths.get(destination)) +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)) @@ -70,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(link.toString(), target.toString()) + else Files.createSymbolicLink(link, target.fileName) fun downloadFile(sourceUrl: String, destination: String) { Fuel.download(sourceUrl) diff --git a/common/src/test/kotlin/flank/common/FilesTest.kt b/common/src/test/kotlin/flank/common/FilesTest.kt index fc634bd8e2..d7493ad261 100644 --- a/common/src/test/kotlin/flank/common/FilesTest.kt +++ b/common/src/test/kotlin/flank/common/FilesTest.kt @@ -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)) diff --git a/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt b/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt index 3c5d4cd863..0fac5aecd4 100644 --- a/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt +++ b/test_runner/src/main/kotlin/ftl/ios/xctest/common/InstallParseBinaries.kt @@ -3,8 +3,7 @@ package ftl.ios.xctest.common import flank.common.OutputLogLevel import flank.common.appDataDirectory import flank.common.createDirectoryIfNotExist -import flank.common.createFileCopy -import flank.common.createSymbolicLinkToFile +import flank.common.createLinkToFile import flank.common.downloadFile import flank.common.hasAllFiles import flank.common.isMacOS @@ -55,16 +54,8 @@ private fun downloadAndUnzip(osname: String) { it.setExecutable(true) } Files.delete(destinationFile) - - if (isWindows) { - createFileCopy( - "$flankBinariesDirectory\\libatomic.so.1.2.0", - "$flankBinariesDirectory\\libatomic.so.1" - ) - } else { - createSymbolicLinkToFile( - link = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1"), - target = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1.2.0") - ) - } + createLinkToFile( + link = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1"), + target = Paths.get(flankBinariesDirectory.toString(), "libatomic.so.1.2.0") + ) } From 671d515a93d8ad4bafa20ec43b7297d62b1d8d61 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 4 Feb 2021 17:01:57 +0100 Subject: [PATCH 3/3] Swap copy file around --- common/src/main/kotlin/flank/common/Files.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/src/main/kotlin/flank/common/Files.kt b/common/src/main/kotlin/flank/common/Files.kt index 3e88ad20c1..245be9e610 100644 --- a/common/src/main/kotlin/flank/common/Files.kt +++ b/common/src/main/kotlin/flank/common/Files.kt @@ -71,7 +71,7 @@ fun createSymbolicLink( ) fun createLinkToFile(link: Path, target: Path): Path = - if (isWindows) createFileCopy(link.toString(), target.toString()) + if (isWindows) createFileCopy(target.toString(), link.toString()) else Files.createSymbolicLink(link, target.fileName) fun downloadFile(sourceUrl: String, destination: String) {