diff --git a/docs/flank-scripts/README.md b/docs/flank-scripts/README.md index 2de8b10c41..b74053866d 100644 --- a/docs/flank-scripts/README.md +++ b/docs/flank-scripts/README.md @@ -205,7 +205,6 @@ Properties are skipped by git and should not be attached to a commit. Note, the │ ├── assemble │ │ ├── BuildFlank.kt │ │ ├── BuildGo.kt -│ │ ├── GradleCommand.kt │ │ ├── android │ │ │ ├── BuildBaseAndroidApk.kt │ │ │ ├── BuildBaseAndroidTests.kt @@ -224,101 +223,77 @@ Properties are skipped by git and should not be attached to a commit. Note, the │ │ ├── BuildIosTestArtifacts.kt │ │ ├── BuildTestPlansExample.kt │ │ ├── IosBuildCommand.kt -│ │ ├── LipoHelper.kt │ │ ├── RunFtlLocal.kt │ │ └── UniversalFramework.kt -│ ├── ci │ ├── common -│ │ ├── ConventionalCommitFormatter.kt +│ │ ├── DownloadSoftware.kt │ │ ├── EarlGreyExampleConsts.kt │ │ ├── GenerateChangeLog.kt │ │ └── ReleaseNotesWithType.kt -│ ├── contribution │ ├── dependencies -│ │ ├── DependenciesResultCheck.kt -│ │ ├── DependencyExtensions.kt -│ │ ├── DependencyUpdate.kt -│ │ ├── DownloadSoftware.kt -│ │ ├── FindOutdatedDependencies.kt -│ │ ├── FindVersionInLines.kt -│ │ ├── GradleDependency.kt │ │ ├── InstallXcPretty.kt │ │ ├── SetupIosEnv.kt │ │ ├── UpdateAllDependencies.kt -│ │ ├── UpdateDependencies.kt -│ │ ├── UpdateGradle.kt -│ │ ├── UpdatePlugins.kt -│ │ ├── UpdateVersionsInFile.kt -│ │ └── updatebinaries -│ │ ├── UpdateAtomic.kt -│ │ ├── UpdateBinaries.kt -│ │ ├── UpdateLlvm.kt -│ │ └── UpdateSwift.kt +│ │ └── common +│ │ ├── DependenciesResultCheck.kt +│ │ ├── DependencyExtensions.kt +│ │ ├── DependencyUpdate.kt +│ │ ├── FindOutdatedDependencies.kt +│ │ ├── GradleDependency.kt +│ │ ├── UpdateDependencies.kt +│ │ ├── UpdateGradle.kt +│ │ ├── UpdatePlugins.kt +│ │ └── UpdateVersionsInFile.kt │ ├── firebase -│ │ ├── CheckForSDKUpdateCommand.kt +│ │ ├── CheckForSDKUpdate.kt │ │ ├── CommitList.kt -│ │ ├── Extensions.kt │ │ ├── GenerateJavaClient.kt -│ │ ├── LastSDKUpdateRun.kt -│ │ ├── OpenedUpdates.kt │ │ ├── SDKUpdateContext.kt -│ │ └── UpdateApiJson.kt +│ │ ├── UpdateApiJson.kt +│ │ └── common +│ │ └── Extensions.kt │ ├── github │ │ ├── CopyGitHubProperties.kt │ │ ├── DeleteOldRelease.kt │ │ ├── DeleteOldTag.kt -│ │ ├── FindReferenceIssue.kt -│ │ ├── ReleaseFlank.kt -│ │ ├── SetAssignees.kt -│ │ └── SetLabels.kt -│ ├── integration +│ │ └── ReleaseFlank.kt │ ├── integrationtests -│ │ ├── CommitList.kt -│ │ ├── Extensions.kt -│ │ ├── IntegrationContext.kt -│ │ ├── IssueList.kt -│ │ ├── PrepareMessage.kt │ │ ├── ProcessIntegrationTestsResult.kt -│ │ └── WorkflowSummary.kt +│ │ └── common +│ │ ├── ITResults.kt +│ │ ├── IntegrationContext.kt +│ │ └── PrepareMessage.kt +│ ├── jfrog +│ │ ├── DeleteOldSnapshot.kt +│ │ ├── JFrogCommandHelper.kt +│ │ └── SyncMaven.kt │ ├── linter │ │ ├── ApplyKtlintToIdea.kt │ │ └── LinkGitHooks.kt -│ ├── pullrequest │ ├── release -│ │ ├── AppendReleaseNotes.kt │ │ ├── CreateReleaseNotes.kt -│ │ ├── NextReleaseTag.kt -│ │ ├── hub -│ │ └── jfrog -│ │ ├── DeleteOldSnapshot.kt -│ │ ├── JFrogCommandHelper.kt -│ │ └── SyncMaven.kt -│ ├── shell -│ │ ├── buildexample -│ │ │ ├── android -│ │ │ ├── go -│ │ │ └── ios -│ │ ├── firebase -│ │ │ ├── apiclient -│ │ │ └── sdk -│ │ └── updatebinaries -│ └── testartifacts -│ ├── ArtifactsArchive.kt -│ ├── Constants.kt -│ ├── Context.kt -│ ├── DownloadFixtures.kt -│ ├── IsNewVersionAvailable.kt -│ ├── LinkArtifacts.kt -│ ├── PrepareTestArtifacts.kt -│ ├── RemoveRemoteCopy.kt -│ ├── ResolveArtifacts.kt -│ ├── TestArtifactsRepo.kt -│ ├── UploadFixtures.kt -│ └── ZipArtifacts.kt +│ │ └── NextReleaseTag.kt +│ ├── testartifacts +│ │ ├── ArtifactsArchive.kt +│ │ ├── Context.kt +│ │ ├── DownloadFixtures.kt +│ │ ├── Helpers.kt +│ │ ├── LinkArtifacts.kt +│ │ ├── PrepareTestArtifacts.kt +│ │ ├── RemoveRemoteCopy.kt +│ │ ├── ResolveArtifacts.kt +│ │ ├── UploadFixtures.kt +│ │ └── ZipArtifacts.kt +│ └── updatebinaries +│ ├── UpdateAtomic.kt +│ ├── UpdateBinaries.kt +│ ├── UpdateLlvm.kt +│ └── UpdateSwift.kt └── utils ├── Env.kt ├── FastFailForWindows.kt ├── Git.kt + ├── GradleCommand.kt ├── MarkdownFormatter.kt ├── Path.kt ├── Serialization.kt diff --git a/flank-scripts/build.gradle.kts b/flank-scripts/build.gradle.kts index 9c5eb58bdd..c599052f16 100644 --- a/flank-scripts/build.gradle.kts +++ b/flank-scripts/build.gradle.kts @@ -28,7 +28,7 @@ shadowJar.apply { } } // .. -version = "1.6.1" +version = "1.6.2" group = "com.github.flank" application { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/cli/dependencies/UpdateBinariesCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/cli/dependencies/UpdateBinariesCommand.kt index a9b8258ae0..cea7f87c07 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/cli/dependencies/UpdateBinariesCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/cli/dependencies/UpdateBinariesCommand.kt @@ -1,7 +1,7 @@ package flank.scripts.cli.dependencies import com.github.ajalt.clikt.core.CliktCommand -import flank.scripts.ops.dependencies.updatebinaries.updateBinaries +import flank.scripts.ops.updatebinaries.updateBinaries object UpdateBinariesCommand : CliktCommand( name = "update_binaries", diff --git a/flank-scripts/src/main/kotlin/flank/scripts/cli/integrationtests/ProcessResultCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/cli/integrationtests/ProcessResultCommand.kt index c9b059bfc7..2140f3a8d2 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/cli/integrationtests/ProcessResultCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/cli/integrationtests/ProcessResultCommand.kt @@ -5,7 +5,7 @@ import com.github.ajalt.clikt.parameters.options.default import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.required import com.github.ajalt.clikt.parameters.types.enum -import flank.scripts.ops.integrationtests.ITResults +import flank.scripts.ops.integrationtests.common.ITResults import flank.scripts.ops.integrationtests.processIntegrationTestsResult object ProcessResultCommand : CliktCommand( diff --git a/flank-scripts/src/main/kotlin/flank/scripts/cli/release/DeleteSnapshotCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/cli/release/DeleteSnapshotCommand.kt index 7f7ff93491..f81a235f41 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/cli/release/DeleteSnapshotCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/cli/release/DeleteSnapshotCommand.kt @@ -3,7 +3,7 @@ package flank.scripts.cli.release import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.required -import flank.scripts.ops.release.jfrog.jFrogDeleteOldSnapshot +import flank.scripts.ops.jfrog.jFrogDeleteOldSnapshot object DeleteSnapshotCommand : CliktCommand( name = "delete_snapshot", diff --git a/flank-scripts/src/main/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommand.kt index 0245387d22..493db680b3 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommand.kt @@ -3,7 +3,7 @@ package flank.scripts.cli.release import com.github.ajalt.clikt.core.CliktCommand import com.github.ajalt.clikt.parameters.options.option import com.github.ajalt.clikt.parameters.options.required -import flank.scripts.ops.release.jfrog.jFrogSync +import flank.scripts.ops.jfrog.jFrogSync import kotlin.system.exitProcess object SyncWithMavenCentralCommand : CliktCommand( diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildExample.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildExample.kt index f11903ef75..11cd63fd78 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildExample.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildExample.kt @@ -3,8 +3,8 @@ package flank.scripts.ops.assemble.ios import flank.common.archive import flank.common.currentPath import flank.common.iOSTestProjectsPath -import flank.scripts.ops.dependencies.downloadXcPrettyIfNeeded -import flank.scripts.ops.dependencies.installPodsIfNeeded +import flank.scripts.ops.common.downloadXcPrettyIfNeeded +import flank.scripts.ops.common.installPodsIfNeeded import flank.scripts.utils.failIfWindows import flank.scripts.utils.pipe import java.nio.file.Files diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildFtl.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildFtl.kt index 0d0f2947f0..5bdd293383 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildFtl.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildFtl.kt @@ -1,7 +1,7 @@ package flank.scripts.ops.assemble.ios import flank.common.archive -import flank.scripts.ops.dependencies.downloadXcPrettyIfNeeded +import flank.scripts.ops.common.downloadXcPrettyIfNeeded import flank.scripts.utils.failIfWindows import flank.scripts.utils.pipe import java.nio.file.Files diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosIPA.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosIPA.kt index 86866c12c0..fd6f1de15b 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosIPA.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosIPA.kt @@ -1,9 +1,9 @@ package flank.scripts.ops.assemble.ios import flank.common.flankFixturesIosTmpPath -import flank.scripts.ops.dependencies.downloadCocoaPodsIfNeeded -import flank.scripts.ops.dependencies.downloadXcPrettyIfNeeded -import flank.scripts.ops.dependencies.installPodsIfNeeded +import flank.scripts.ops.common.downloadCocoaPodsIfNeeded +import flank.scripts.ops.common.downloadXcPrettyIfNeeded +import flank.scripts.ops.common.installPodsIfNeeded import flank.scripts.utils.pipe import java.nio.file.Path import java.nio.file.Paths diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosTestArtifacts.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosTestArtifacts.kt index 1d1b9e9adb..590144ed84 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosTestArtifacts.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/BuildIosTestArtifacts.kt @@ -2,9 +2,9 @@ package flank.scripts.ops.assemble.ios import flank.common.archive import flank.common.flankFixturesIosTmpPath -import flank.scripts.ops.dependencies.downloadCocoaPodsIfNeeded -import flank.scripts.ops.dependencies.downloadXcPrettyIfNeeded -import flank.scripts.ops.dependencies.installPodsIfNeeded +import flank.scripts.ops.common.downloadCocoaPodsIfNeeded +import flank.scripts.ops.common.downloadXcPrettyIfNeeded +import flank.scripts.ops.common.installPodsIfNeeded import flank.scripts.utils.pipe import java.io.File import java.nio.file.Path diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/LipoHelper.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/LipoHelper.kt deleted file mode 100644 index c11ea8465a..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/LipoHelper.kt +++ /dev/null @@ -1,6 +0,0 @@ -package flank.scripts.ops.assemble.ios - -fun createLipoCommand( - outputPath: String, - vararg files: String -) = "lipo -create ${files.joinToString(" ")} -output $outputPath" diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/UniversalFramework.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/UniversalFramework.kt index 3a3471addb..3d29967272 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/UniversalFramework.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/ios/UniversalFramework.kt @@ -39,6 +39,11 @@ fun createUniversalFrameworkFiles() { ) } +fun createLipoCommand( + outputPath: String, + vararg files: String +) = "lipo -create ${files.joinToString(" ")} -output $outputPath" + private fun copyAppFrameworkFiles(fromPath: String, toPath: String) { Paths.get(fromPath, APP_FRAMEWORK_FRAMEWORK).toFile() .copyRecursively(Paths.get(toPath, APP_FRAMEWORK_FRAMEWORK).toFile(), overwrite = true) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/common/ConventionalCommitFormatter.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/common/ConventionalCommitFormatter.kt deleted file mode 100644 index 89d9be6682..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/common/ConventionalCommitFormatter.kt +++ /dev/null @@ -1,14 +0,0 @@ -package flank.scripts.ops.common - -fun String.mapPrTitleWithType() = when { - startsWith("feat") -> "Features" to skipConventionalCommitPrefix().capitalize() - startsWith("fix") -> "Bug Fixes" to skipConventionalCommitPrefix().capitalize() - startsWith("docs") -> "Documentation" to skipConventionalCommitPrefix().capitalize() - startsWith("refactor") -> "Refactor" to skipConventionalCommitPrefix().capitalize() - startsWith("ci") -> "CI Changes" to skipConventionalCommitPrefix().capitalize() - startsWith("test") -> "Tests update" to skipConventionalCommitPrefix().capitalize() - startsWith("perf") -> "Performance upgrade" to skipConventionalCommitPrefix().capitalize() - else -> null // we do not accept other prefix to have update in release notes -} - -private fun String.skipConventionalCommitPrefix() = substring(indexOf(':') + 2) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DownloadSoftware.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/common/DownloadSoftware.kt similarity index 51% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DownloadSoftware.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/common/DownloadSoftware.kt index 9453d13d55..5fae6d15e3 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DownloadSoftware.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/common/DownloadSoftware.kt @@ -1,7 +1,6 @@ -package flank.scripts.ops.dependencies +package flank.scripts.ops.common import flank.scripts.utils.checkAndInstallIfNeed -import flank.scripts.utils.commandInstalledOr import flank.scripts.utils.runCommand import java.nio.file.Path @@ -17,17 +16,3 @@ fun installPodsIfNeeded(path: Path) { if (path.toFile().listFiles().map { it.name }.contains("Podfile")) "pod install --project-directory=$path --verbose".runCommand() } - -fun checkIfPipInstalled() { - "pip".commandInstalledOr { - println("You need pip fot this script. To install it follow https://pip.pypa.io/en/stable/installing/") - } -} - -fun downloadSortJsonIfNeeded() { - "sort-json".checkAndInstallIfNeed("npm -g install sort-json") -} - -fun installClientGeneratorIfNeeded() { - "generate_library".checkAndInstallIfNeed("pip install google-apis-client-generator") -} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/common/GenerateChangeLog.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/common/GenerateChangeLog.kt index c28744465d..6fc5a0d2e4 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/common/GenerateChangeLog.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/common/GenerateChangeLog.kt @@ -57,4 +57,17 @@ private fun GithubPullRequest.toReleaseNoteMessage() = type to "- ${markdownLink("#$number", htmlUrl)} $title ${assignees.format()}" } +internal fun String.mapPrTitleWithType() = when { + startsWith("feat") -> "Features" to skipConventionalCommitPrefix().capitalize() + startsWith("fix") -> "Bug Fixes" to skipConventionalCommitPrefix().capitalize() + startsWith("docs") -> "Documentation" to skipConventionalCommitPrefix().capitalize() + startsWith("refactor") -> "Refactor" to skipConventionalCommitPrefix().capitalize() + startsWith("ci") -> "CI Changes" to skipConventionalCommitPrefix().capitalize() + startsWith("test") -> "Tests update" to skipConventionalCommitPrefix().capitalize() + startsWith("perf") -> "Performance upgrade" to skipConventionalCommitPrefix().capitalize() + else -> null // we do not accept other prefix to have update in release notes +} + +private fun String.skipConventionalCommitPrefix() = substring(indexOf(':') + 2) + private fun List.format() = "(${joinToString { (login, url) -> markdownLink(login, url) }})" diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/FindVersionInLines.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/FindVersionInLines.kt deleted file mode 100644 index 2e4343a96b..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/FindVersionInLines.kt +++ /dev/null @@ -1,14 +0,0 @@ -package flank.scripts.ops.dependencies - -fun List.matchingVersionVal(name: String) = - find { it.contains(name) }?.findValName() ?: NOT_FOUND_VERSION - -private fun String.findValName() = versionRegex.find(this) - ?.value - ?.split('.') - ?.last() - ?.replace("}\"", "") - ?: NOT_FOUND_VERSION - -private val versionRegex = "(\\$\\{Versions\\.).*}\"".toRegex() -private const val NOT_FOUND_VERSION = "!versionNotFound" diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/InstallXcPretty.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/InstallXcPretty.kt index 9497ac0737..ad5f29ea31 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/InstallXcPretty.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/InstallXcPretty.kt @@ -1,5 +1,6 @@ package flank.scripts.ops.dependencies +import flank.scripts.ops.common.downloadXcPrettyIfNeeded import flank.scripts.utils.failIfWindows fun installXcPretty() { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/SetupIosEnv.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/SetupIosEnv.kt index 79ad33046f..d204c26e49 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/SetupIosEnv.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/SetupIosEnv.kt @@ -2,6 +2,8 @@ package flank.scripts.ops.dependencies import flank.common.iOSTestProjectsPath import flank.scripts.ops.common.EARL_GREY_EXAMPLE +import flank.scripts.ops.common.downloadCocoaPodsIfNeeded +import flank.scripts.ops.common.installPodsIfNeeded import flank.scripts.utils.failIfWindows import java.nio.file.Paths diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependenciesResultCheck.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependenciesResultCheck.kt similarity index 93% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependenciesResultCheck.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependenciesResultCheck.kt index 2b987649e0..4b8426079c 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependenciesResultCheck.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependenciesResultCheck.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.dependencies +package flank.scripts.ops.dependencies.common import flank.scripts.utils.Version import kotlinx.serialization.SerialName diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependencyExtensions.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependencyExtensions.kt similarity index 55% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependencyExtensions.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependencyExtensions.kt index 9acef7ca49..0f3a1aaee9 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependencyExtensions.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependencyExtensions.kt @@ -1,11 +1,9 @@ package flank.scripts.ops.dependencies -val Dependency.groupWithName get() = "$group:$name:" +import flank.scripts.ops.dependencies.common.Dependency val Dependency.versionToUpdate get() = availableVersion?.release ?: availableVersion?.milestone ?: availableVersion?.integration ?: version - -fun GradleDependency.needsUpdate() = running.version < current.version || running.version < releaseCandidate.version diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependencyUpdate.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependencyUpdate.kt similarity index 78% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependencyUpdate.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependencyUpdate.kt index b36d048271..b1d955b713 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/DependencyUpdate.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/DependencyUpdate.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.dependencies +package flank.scripts.ops.dependencies.common import flank.scripts.utils.Version diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/FindOutdatedDependencies.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/FindOutdatedDependencies.kt similarity index 56% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/FindOutdatedDependencies.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/FindOutdatedDependencies.kt index 6c21177996..835b472a91 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/FindOutdatedDependencies.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/FindOutdatedDependencies.kt @@ -1,8 +1,6 @@ -package flank.scripts.ops.dependencies +package flank.scripts.ops.dependencies.common import flank.scripts.utils.toObject import java.io.File fun File.outDatedDependencies() = readText().toObject().outdated.dependencies - -fun File.gradleDependency() = readText().toObject().gradle diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/GradleDependency.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/GradleDependency.kt similarity index 90% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/GradleDependency.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/GradleDependency.kt index 5e82cefd6b..1f18d50386 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/GradleDependency.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/GradleDependency.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.dependencies +package flank.scripts.ops.dependencies.common import flank.scripts.utils.Version import kotlinx.serialization.Serializable diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateDependencies.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateDependencies.kt similarity index 60% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateDependencies.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateDependencies.kt index b66108a251..41637edc49 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateDependencies.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateDependencies.kt @@ -1,5 +1,8 @@ package flank.scripts.ops.dependencies +import flank.scripts.ops.dependencies.common.Dependency +import flank.scripts.ops.dependencies.common.DependencyUpdate +import flank.scripts.ops.dependencies.common.outDatedDependencies import java.io.File internal fun File.updateDependencies(dependenciesFile: File, versionsFile: File) { @@ -22,6 +25,21 @@ private fun List.getDependenciesToUpdate(dependenciesFile: File): Li } } +internal val Dependency.groupWithName get() = "$group:$name:" + +internal fun List.matchingVersionVal(name: String) = + find { it.contains(name) }?.findValName() ?: NOT_FOUND_VERSION + +private fun String.findValName() = versionRegex.find(this) + ?.value + ?.split('.') + ?.last() + ?.replace("}\"", "") + ?: NOT_FOUND_VERSION + +private const val NOT_FOUND_VERSION = "!versionNotFound" +private val versionRegex = "(\\$\\{Versions\\.).*}\"".toRegex() + private fun File.getOutdatedDependenciesFileLines( outdatedDependenciesNames: List ) = readLines().filter { line -> outdatedDependenciesNames.any { line.contains(it) } } diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateGradle.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateGradle.kt similarity index 77% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateGradle.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateGradle.kt index fd86c4cf73..6db80527b1 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateGradle.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateGradle.kt @@ -1,5 +1,8 @@ package flank.scripts.ops.dependencies +import flank.scripts.ops.dependencies.common.DependenciesResultCheck +import flank.scripts.ops.dependencies.common.GradleDependency +import flank.scripts.utils.toObject import java.io.File import java.nio.file.Files import java.nio.file.Paths @@ -10,6 +13,10 @@ internal fun File.updateGradle(gradleWrapperPropertiesPath: String = "") { ?.let { gradleDependency -> updateGradleWrapper(gradleDependency, gradleWrapperPropertiesPath) } } +private fun File.gradleDependency() = readText().toObject().gradle + +internal fun GradleDependency.needsUpdate() = running.version < current.version || running.version < releaseCandidate.version + private fun updateGradleWrapper(gradleDependency: GradleDependency, gradleWrapperPropertiesPath: String) { findAllGradleWrapperPropertiesFiles(gradleWrapperPropertiesPath) .forEach { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdatePlugins.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdatePlugins.kt similarity index 93% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdatePlugins.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdatePlugins.kt index 860199ff39..116967e11e 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdatePlugins.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdatePlugins.kt @@ -1,5 +1,8 @@ package flank.scripts.ops.dependencies +import flank.scripts.ops.dependencies.common.Dependency +import flank.scripts.ops.dependencies.common.DependencyUpdate +import flank.scripts.ops.dependencies.common.outDatedDependencies import java.io.File import java.nio.file.Files import java.nio.file.Paths diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateVersionsInFile.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateVersionsInFile.kt similarity index 93% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateVersionsInFile.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateVersionsInFile.kt index efff7122b3..6b31044499 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/UpdateVersionsInFile.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/common/UpdateVersionsInFile.kt @@ -1,6 +1,7 @@ package flank.scripts.ops.dependencies import flank.common.withNewLineAtTheEnd +import flank.scripts.ops.dependencies.common.DependencyUpdate import java.io.File fun File.updateVersions(dependencies: List) = diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/CheckForSDKUpdateCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/CheckForSDKUpdate.kt similarity index 69% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/CheckForSDKUpdateCommand.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/CheckForSDKUpdate.kt index 845815952a..e21c968837 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/CheckForSDKUpdateCommand.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/CheckForSDKUpdate.kt @@ -1,10 +1,18 @@ package flank.scripts.ops.firebase import com.github.kittinunf.fuel.Fuel +import com.github.kittinunf.result.getOrElse +import com.github.kittinunf.result.onError import flank.common.config.flankGcloudCLIRepository +import flank.common.config.updateDependenciesWorkflowFilename +import flank.common.config.updatesOpenedUser import flank.common.currentPath import flank.common.downloadFile +import flank.scripts.data.github.commons.getLastWorkflowRunDate +import flank.scripts.data.github.getGitHubIssueList import flank.scripts.data.github.objects.GithubPullRequest +import flank.scripts.ops.firebase.common.createEpicIssue +import flank.scripts.ops.firebase.common.updateOpenedEpic import flank.scripts.utils.parseToVersion import kotlinx.coroutines.runBlocking import java.nio.file.Paths @@ -43,6 +51,27 @@ fun checkForSDKUpdate(githubToken: String, zenhubToken: String) = runBlocking { } } +private suspend fun getLastSDKUpdateRunDate(token: String) = getLastWorkflowRunDate( + token = token, + workflowFileName = updateDependenciesWorkflowFilename +) + +private suspend fun checkForOpenedUpdates(token: String) = getGitHubIssueList( + githubToken = token, + parameters = listOf( + "creator" to updatesOpenedUser, + "state" to "open", + "labels" to "gcloud SDK" + ) +) + .onError { println(it.message) } + .getOrElse { emptyList() } + .firstOrNull() + .also { + if (it != null) println("** Issue found: ${it.htmlUrl}") + else println("** No opened issue") + } + private fun createContext(sha: String, githubToken: String, zenhubToken: String, openedUpdates: GithubPullRequest?) = SDKUpdateContext( oldVersion = getVersionBySHA(sha), diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/GenerateJavaClient.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/GenerateJavaClient.kt index 377b1865e1..6f8a61e94a 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/GenerateJavaClient.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/GenerateJavaClient.kt @@ -1,7 +1,7 @@ package flank.scripts.ops.firebase -import flank.scripts.ops.dependencies.checkIfPipInstalled -import flank.scripts.ops.dependencies.installClientGeneratorIfNeeded +import flank.scripts.utils.checkAndInstallIfNeed +import flank.scripts.utils.commandInstalledOr import flank.scripts.utils.exceptions.ShellCommandException import flank.scripts.utils.runCommand import java.nio.file.Files @@ -31,3 +31,13 @@ fun generateJavaClient() { StandardCopyOption.REPLACE_EXISTING ) } + +private fun checkIfPipInstalled() { + "pip".commandInstalledOr { + println("You need pip fot this script. To install it follow https://pip.pypa.io/en/stable/installing/") + } +} + +private fun installClientGeneratorIfNeeded() { + "generate_library".checkAndInstallIfNeed("pip install google-apis-client-generator") +} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/LastSDKUpdateRun.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/LastSDKUpdateRun.kt deleted file mode 100644 index 1eae52fed2..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/LastSDKUpdateRun.kt +++ /dev/null @@ -1,9 +0,0 @@ -package flank.scripts.ops.firebase - -import flank.common.config.updateDependenciesWorkflowFilename -import flank.scripts.data.github.commons.getLastWorkflowRunDate - -suspend fun getLastSDKUpdateRunDate(token: String) = getLastWorkflowRunDate( - token = token, - workflowFileName = updateDependenciesWorkflowFilename -) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/OpenedUpdates.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/OpenedUpdates.kt deleted file mode 100644 index 6a429ab6c9..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/OpenedUpdates.kt +++ /dev/null @@ -1,22 +0,0 @@ -package flank.scripts.ops.firebase - -import com.github.kittinunf.result.getOrElse -import com.github.kittinunf.result.onError -import flank.common.config.updatesOpenedUser -import flank.scripts.data.github.getGitHubIssueList - -suspend fun checkForOpenedUpdates(token: String) = getGitHubIssueList( - githubToken = token, - parameters = listOf( - "creator" to updatesOpenedUser, - "state" to "open", - "labels" to "gcloud SDK" - ) -) - .onError { println(it.message) } - .getOrElse { emptyList() } - .firstOrNull() - .also { - if (it != null) println("** Issue found: ${it.htmlUrl}") - else println("** No opened issue") - } diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/UpdateApiJson.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/UpdateApiJson.kt index 2888b97b5e..e7602f7799 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/UpdateApiJson.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/UpdateApiJson.kt @@ -3,7 +3,7 @@ package flank.scripts.ops.firebase import flank.common.config.flankGcloudCLIRepository import flank.common.currentPath import flank.common.downloadFile -import flank.scripts.ops.dependencies.downloadSortJsonIfNeeded +import flank.scripts.utils.checkAndInstallIfNeed import flank.scripts.utils.runCommand import java.nio.file.Paths @@ -28,3 +28,7 @@ fun updateApiJson() { "sort-json $testingV1Path".runCommand() "sort-json $testingV1Beta3Path".runCommand() } + +private fun downloadSortJsonIfNeeded() { + "sort-json".checkAndInstallIfNeed("npm -g install sort-json") +} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/Extensions.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/common/Extensions.kt similarity index 97% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/Extensions.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/common/Extensions.kt index 664c6af834..ad01ffdfcc 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/Extensions.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/firebase/common/Extensions.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.firebase +package flank.scripts.ops.firebase.common import com.github.kittinunf.result.Result import com.github.kittinunf.result.onError @@ -14,10 +14,10 @@ import flank.scripts.data.zenhub.objects.ConvertToEpicRequest import flank.scripts.data.zenhub.objects.Issue import flank.scripts.data.zenhub.objects.UpdateEpicRequest import flank.scripts.data.zenhub.updateEpic +import flank.scripts.ops.firebase.SDKUpdateContext import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope -import java.lang.Exception import kotlin.system.exitProcess internal suspend fun SDKUpdateContext.createEpicIssue() = coroutineScope { diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/CopyGitHubProperties.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/github/CopyGitHubProperties.kt index 59275c88f5..750c760780 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/CopyGitHubProperties.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/github/CopyGitHubProperties.kt @@ -1,8 +1,15 @@ package flank.scripts.ops.github +import com.github.kittinunf.result.getOrNull +import com.github.kittinunf.result.map import com.github.kittinunf.result.onError import com.github.kittinunf.result.success +import flank.scripts.data.github.getGitHubIssue import flank.scripts.data.github.getGitHubPullRequest +import flank.scripts.data.github.getLabelsFromIssue +import flank.scripts.data.github.objects.GithubPullRequest +import flank.scripts.data.github.setAssigneesToPullRequest +import flank.scripts.data.github.setLabelsToPullRequest import flank.scripts.data.zenhub.copyEstimation import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.coroutineScope @@ -34,6 +41,19 @@ fun copyGitHubProperties(githubToken: String, zenhubToken: String, prNumber: Int } } +internal fun GithubPullRequest.findReferenceNumber() = + (tryGetReferenceNumberFromBody() ?: tryGetReferenceNumberFromBranch()) + ?.trim() + ?.replace("#", "") + ?.toInt() + +private fun GithubPullRequest.tryGetReferenceNumberFromBody() = bodyReferenceRegex.find(body)?.value + +private fun GithubPullRequest.tryGetReferenceNumberFromBranch() = branchReferenceRegex.find(head?.ref.orEmpty())?.value + +private val bodyReferenceRegex = "#\\d+\\s".toRegex() +private val branchReferenceRegex = "#\\d+".toRegex() + private suspend fun copyGitHubProperties( githubToken: String, baseIssueNumber: Int, @@ -45,6 +65,22 @@ private suspend fun copyGitHubProperties( ).joinAll() } +internal suspend fun copyAssignees(githubToken: String, baseIssueNumber: Int, pullRequestNumber: Int) { + getGitHubIssue(githubToken, baseIssueNumber) + .onError { println("Could not copy assignees because of ${it.message}") } + .map { githubIssue -> githubIssue.assignees.map { it.login } } + .getOrNull() + ?.let { setAssigneesToPullRequest(githubToken, pullRequestNumber, it) } +} + +internal suspend fun copyLabels(githubToken: String, issueNumber: Int, pullRequestNumber: Int) { + getLabelsFromIssue(githubToken, issueNumber) + .onError { println("Could not copy labels because of ${it.message}") } + .map { it.map { label -> label.name } } + .getOrNull() + ?.run { setLabelsToPullRequest(githubToken, pullRequestNumber, this) } +} + private suspend fun copyZenhubProperties( zenhubToken: String, baseIssueNumber: Int, diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/DeleteOldTag.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/github/DeleteOldTag.kt index 0a54b86285..f057598f7c 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/DeleteOldTag.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/github/DeleteOldTag.kt @@ -4,27 +4,13 @@ import com.github.kittinunf.result.Result import flank.common.logLn import flank.scripts.data.github.deleteOldTag -fun tryDeleteOldTag( - gitTag: String, - username: String, - token: String -) = tryDeleteOldTag( - gitTag = gitTag, - username = username, - token = token, - success = { logLn("Tag $gitTag was deleted") }, - error = { logLn(it.error) } -) - fun tryDeleteOldTag( gitTag: String, username: String, token: String, - success: (response: Result.Success) -> Unit, - error: (response: Result.Failure) -> Unit -) { - when (val response = deleteOldTag(gitTag, username, token)) { - is Result.Success -> success(response) - is Result.Failure -> error(response) - } + success: (response: Result.Success) -> Unit = { logLn("Tag $gitTag was deleted") }, + error: (response: Result.Failure) -> Unit = { logLn(it.error) } +) = when (val response = deleteOldTag(gitTag, username, token)) { + is Result.Success -> success(response) + is Result.Failure -> error(response) } diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/FindReferenceIssue.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/github/FindReferenceIssue.kt deleted file mode 100644 index 1a1796fd40..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/FindReferenceIssue.kt +++ /dev/null @@ -1,16 +0,0 @@ -package flank.scripts.ops.github - -import flank.scripts.data.github.objects.GithubPullRequest - -internal fun GithubPullRequest.findReferenceNumber() = - (tryGetReferenceNumberFromBody() ?: tryGetReferenceNumberFromBranch()) - ?.trim() - ?.replace("#", "") - ?.toInt() - -private fun GithubPullRequest.tryGetReferenceNumberFromBody() = bodyReferenceRegex.find(body)?.value - -private fun GithubPullRequest.tryGetReferenceNumberFromBranch() = branchReferenceRegex.find(head?.ref.orEmpty())?.value - -private val bodyReferenceRegex = "#\\d+\\s".toRegex() -private val branchReferenceRegex = "#\\d+".toRegex() diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/SetAssignees.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/github/SetAssignees.kt deleted file mode 100644 index 8a8a340299..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/SetAssignees.kt +++ /dev/null @@ -1,15 +0,0 @@ -package flank.scripts.ops.github - -import com.github.kittinunf.result.getOrNull -import com.github.kittinunf.result.map -import com.github.kittinunf.result.onError -import flank.scripts.data.github.getGitHubIssue -import flank.scripts.data.github.setAssigneesToPullRequest - -internal suspend fun copyAssignees(githubToken: String, baseIssueNumber: Int, pullRequestNumber: Int) { - getGitHubIssue(githubToken, baseIssueNumber) - .onError { println("Could not copy assignees because of ${it.message}") } - .map { githubIssue -> githubIssue.assignees.map { it.login } } - .getOrNull() - ?.let { setAssigneesToPullRequest(githubToken, pullRequestNumber, it) } -} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/SetLabels.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/github/SetLabels.kt deleted file mode 100644 index f9d428a5b2..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/github/SetLabels.kt +++ /dev/null @@ -1,15 +0,0 @@ -package flank.scripts.ops.github - -import com.github.kittinunf.result.getOrNull -import com.github.kittinunf.result.map -import com.github.kittinunf.result.onError -import flank.scripts.data.github.getLabelsFromIssue -import flank.scripts.data.github.setLabelsToPullRequest - -internal suspend fun copyLabels(githubToken: String, issueNumber: Int, pullRequestNumber: Int) { - getLabelsFromIssue(githubToken, issueNumber) - .onError { println("Could not copy labels because of ${it.message}") } - .map { it.map { label -> label.name } } - .getOrNull() - ?.run { setLabelsToPullRequest(githubToken, pullRequestNumber, this) } -} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/CommitList.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/CommitList.kt deleted file mode 100644 index 15b7ff856f..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/CommitList.kt +++ /dev/null @@ -1,30 +0,0 @@ -package flank.scripts.ops.integrationtests - -import com.github.kittinunf.result.getOrElse -import com.github.kittinunf.result.onError -import flank.scripts.data.github.getGitHubCommitList -import flank.scripts.data.github.getPrDetailsByCommit -import flank.scripts.data.github.objects.GithubPullRequest -import kotlinx.coroutines.async -import kotlinx.coroutines.awaitAll -import kotlinx.coroutines.coroutineScope - -internal suspend fun getCommitListSinceDate( - token: String, - since: String -): List> = coroutineScope { - getGitHubCommitList(token, listOf("since" to since)) - .onError { println(it.message) } - .getOrElse { emptyList() } - .map { - async { - it.sha to getPrDetailsByCommit(it.sha, token).getOrElse { emptyList() } - } - } - .awaitAll() - .flatMap { (commit, prs) -> - if (prs.isEmpty()) listOf(commit to null) - else prs.map { commit to it } - } - .toList() -} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/IntegrationContext.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/IntegrationContext.kt deleted file mode 100644 index 488e06ecb4..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/IntegrationContext.kt +++ /dev/null @@ -1,13 +0,0 @@ -package flank.scripts.ops.integrationtests - -data class IntegrationContext( - val result: ITResults, - val token: String, - val url: String, - val runID: String, - val lastRun: String, - val openedIssue: Int?, -) { - val issueNumber: Int - get() = requireNotNull(openedIssue) -} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/IssueList.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/IssueList.kt deleted file mode 100644 index 6f1502a2c5..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/IssueList.kt +++ /dev/null @@ -1,22 +0,0 @@ -package flank.scripts.ops.integrationtests - -import com.github.kittinunf.result.getOrElse -import com.github.kittinunf.result.onError -import flank.common.config.integrationOpenedIssueUser -import flank.scripts.data.github.getGitHubIssueList - -internal suspend fun checkForOpenedITIssues(token: String): Int? = getGitHubIssueList( - githubToken = token, - parameters = listOf( - "creator" to integrationOpenedIssueUser, - "state" to "open", - "labels" to "IT_Failed" - ) -) - .onError { println(it.message) } - .getOrElse { emptyList() } - .firstOrNull() - .also { - if (it != null) println("** Issue found: ${it.htmlUrl}") - else println("** No opened issue") - }?.number diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/ProcessIntegrationTestsResult.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/ProcessIntegrationTestsResult.kt index f6dd7b1c26..c142e9d457 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/ProcessIntegrationTestsResult.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/ProcessIntegrationTestsResult.kt @@ -1,11 +1,18 @@ package flank.scripts.ops.integrationtests +import com.github.kittinunf.result.getOrElse +import com.github.kittinunf.result.onError +import flank.common.config.fullSuiteWorkflowFilename +import flank.common.config.integrationOpenedIssueUser +import flank.scripts.data.github.commons.getLastWorkflowRunDate +import flank.scripts.data.github.getGitHubIssueList +import flank.scripts.ops.integrationtests.common.ITResults +import flank.scripts.ops.integrationtests.common.IntegrationContext +import flank.scripts.ops.integrationtests.common.closeIssue +import flank.scripts.ops.integrationtests.common.createNewIssue +import flank.scripts.ops.integrationtests.common.postComment import kotlinx.coroutines.runBlocking -enum class ITResults { - SUCCESS, FAILURE -} - fun processIntegrationTestsResult( result: ITResults, githubToken: String, @@ -43,6 +50,11 @@ private fun createContext( openedIssue = runBlocking { checkForOpenedITIssues(githubToken) } ) +internal suspend fun getLastITWorkflowRunDate(token: String) = getLastWorkflowRunDate( + token = token, + workflowFileName = fullSuiteWorkflowFilename +) + private fun IntegrationContext.processIntegrationTestsResult() = runBlocking { with(this) { when { @@ -53,3 +65,19 @@ private fun IntegrationContext.processIntegrationTestsResult() = runBlocking { } } } + +internal suspend fun checkForOpenedITIssues(token: String): Int? = getGitHubIssueList( + githubToken = token, + parameters = listOf( + "creator" to integrationOpenedIssueUser, + "state" to "open", + "labels" to "IT_Failed" + ) +) + .onError { println(it.message) } + .getOrElse { emptyList() } + .firstOrNull() + .also { + if (it != null) println("** Issue found: ${it.htmlUrl}") + else println("** No opened issue") + }?.number diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/WorkflowSummary.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/WorkflowSummary.kt deleted file mode 100644 index 82720f99a6..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/WorkflowSummary.kt +++ /dev/null @@ -1,9 +0,0 @@ -package flank.scripts.ops.integrationtests - -import flank.common.config.fullSuiteWorkflowFilename -import flank.scripts.data.github.commons.getLastWorkflowRunDate - -internal suspend fun getLastITWorkflowRunDate(token: String) = getLastWorkflowRunDate( - token = token, - workflowFileName = fullSuiteWorkflowFilename -) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/ITResults.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/ITResults.kt new file mode 100644 index 0000000000..45019da8a0 --- /dev/null +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/ITResults.kt @@ -0,0 +1,5 @@ +package flank.scripts.ops.integrationtests.common + +enum class ITResults { + SUCCESS, FAILURE +} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/Extensions.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/IntegrationContext.kt similarity index 68% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/Extensions.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/IntegrationContext.kt index 5ab6c2a8d4..2acc9f1d27 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/Extensions.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/IntegrationContext.kt @@ -1,15 +1,21 @@ -package flank.scripts.ops.integrationtests +package flank.scripts.ops.integrationtests.common +import com.github.kittinunf.result.getOrElse import com.github.kittinunf.result.onError +import flank.scripts.data.github.getGitHubCommitList +import flank.scripts.data.github.getPrDetailsByCommit import flank.scripts.data.github.objects.GitHubCreateIssueCommentRequest import flank.scripts.data.github.objects.GitHubCreateIssueRequest import flank.scripts.data.github.objects.GitHubCreateIssueResponse import flank.scripts.data.github.objects.GitHubUpdateIssueRequest +import flank.scripts.data.github.objects.GithubPullRequest import flank.scripts.data.github.objects.IssueState import flank.scripts.data.github.patchIssue import flank.scripts.data.github.postNewIssue import flank.scripts.data.github.postNewIssueComment import flank.scripts.utils.toJson +import kotlinx.coroutines.async +import kotlinx.coroutines.awaitAll import kotlinx.coroutines.coroutineScope import kotlin.system.exitProcess @@ -63,6 +69,26 @@ private suspend fun IntegrationContext.createCommentPayload() = coroutineScope { GitHubCreateIssueCommentRequest(message) } +internal suspend fun getCommitListSinceDate( + token: String, + since: String +): List> = coroutineScope { + getGitHubCommitList(token, listOf("since" to since)) + .onError { println(it.message) } + .getOrElse { emptyList() } + .map { + async { + it.sha to getPrDetailsByCommit(it.sha, token).getOrElse { emptyList() } + } + } + .awaitAll() + .flatMap { (commit, prs) -> + if (prs.isEmpty()) listOf(commit to null) + else prs.map { commit to it } + } + .toList() +} + private fun logIssueCreated(issue: GitHubCreateIssueResponse) = println( """ ** Issue created: @@ -70,3 +96,15 @@ private fun logIssueCreated(issue: GitHubCreateIssueResponse) = println( number: ${issue.number} """.trimIndent() ) + +data class IntegrationContext( + val result: ITResults, + val token: String, + val url: String, + val runID: String, + val lastRun: String, + val openedIssue: Int?, +) { + val issueNumber: Int + get() = requireNotNull(openedIssue) +} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/PrepareMessage.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/PrepareMessage.kt similarity index 97% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/PrepareMessage.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/PrepareMessage.kt index 629e15e79e..bf4824ba7c 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/PrepareMessage.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/integrationtests/common/PrepareMessage.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.integrationtests +package flank.scripts.ops.integrationtests.common import flank.common.config.flankRepository import flank.scripts.data.github.objects.GithubPullRequest diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/DeleteOldSnapshot.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/DeleteOldSnapshot.kt similarity index 80% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/DeleteOldSnapshot.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/DeleteOldSnapshot.kt index 4b19abdcec..ddfab4735e 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/DeleteOldSnapshot.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/DeleteOldSnapshot.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.release.jfrog +package flank.scripts.ops.jfrog import flank.scripts.utils.runCommand diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/JFrogCommandHelper.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/JFrogCommandHelper.kt similarity index 67% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/JFrogCommandHelper.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/JFrogCommandHelper.kt index 1fee10c5db..e7e40ce071 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/JFrogCommandHelper.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/JFrogCommandHelper.kt @@ -1,3 +1,3 @@ -package flank.scripts.ops.release.jfrog +package flank.scripts.ops.jfrog val flankMaven: (String) -> String = { version -> "flank/maven/flank/$version" } diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/SyncMaven.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/SyncMaven.kt similarity index 77% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/SyncMaven.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/SyncMaven.kt index 79317373af..d24ff1f7c4 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/jfrog/SyncMaven.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/jfrog/SyncMaven.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.release.jfrog +package flank.scripts.ops.jfrog import flank.scripts.utils.runCommand diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/linter/ApplyKtlintToIdea.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/linter/ApplyKtlintToIdea.kt index 3479f42417..3ec2271480 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/linter/ApplyKtlintToIdea.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/linter/ApplyKtlintToIdea.kt @@ -15,7 +15,7 @@ suspend fun applyKtlintToIdea() { tryCleanupKtlint() } -internal suspend fun retrieveKtlintResolveCommand() = +private suspend fun retrieveKtlintResolveCommand() = "https://github.com/pinterest/ktlint/releases/download/0.40.0/ktlint".downloadFile(getKtlintFilePath()) private fun applyKtlintToIdeaCommand() = diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/AppendReleaseNotes.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/release/AppendReleaseNotes.kt deleted file mode 100644 index 5eea5f0cc9..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/AppendReleaseNotes.kt +++ /dev/null @@ -1,20 +0,0 @@ -package flank.scripts.ops.release - -import flank.common.withNewLineAtTheEnd -import flank.scripts.ops.common.ReleaseNotesWithType -import flank.scripts.ops.common.asString -import java.io.File - -fun File.appendReleaseNotes(releaseNotesWithType: ReleaseNotesWithType, releaseTag: String) { - appendToReleaseNotes( - releaseNotesWithType = releaseNotesWithType, - releaseTag = releaseTag - ) -} - -private fun File.appendToReleaseNotes(releaseNotesWithType: ReleaseNotesWithType, releaseTag: String) { - writeText( - releaseNotesWithType.asString(releaseTag).withNewLineAtTheEnd() + - readLines().joinToString(System.lineSeparator()).withNewLineAtTheEnd() - ) -} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/CreateReleaseNotes.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/release/CreateReleaseNotes.kt index f797ecf04f..cb0c896166 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/release/CreateReleaseNotes.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/release/CreateReleaseNotes.kt @@ -2,7 +2,10 @@ package flank.scripts.ops.release import com.github.kittinunf.result.map import com.github.kittinunf.result.success +import flank.common.withNewLineAtTheEnd import flank.scripts.data.github.getLatestReleaseTag +import flank.scripts.ops.common.ReleaseNotesWithType +import flank.scripts.ops.common.asString import flank.scripts.ops.common.generateReleaseNotes import kotlinx.coroutines.runBlocking import java.io.File @@ -17,3 +20,17 @@ fun createReleaseNotes(token: String, releaseNotesFilePath: String) = runBlockin ) } } + +internal fun File.appendReleaseNotes(releaseNotesWithType: ReleaseNotesWithType, releaseTag: String) { + appendToReleaseNotes( + releaseNotesWithType = releaseNotesWithType, + releaseTag = releaseTag + ) +} + +private fun File.appendToReleaseNotes(releaseNotesWithType: ReleaseNotesWithType, releaseTag: String) { + writeText( + releaseNotesWithType.asString(releaseTag).withNewLineAtTheEnd() + + readLines().joinToString(System.lineSeparator()).withNewLineAtTheEnd() + ) +} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/Constants.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/Helpers.kt similarity index 67% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/Constants.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/Helpers.kt index c4fe8b23ad..5115d399f0 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/Constants.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/Helpers.kt @@ -1,6 +1,10 @@ package flank.scripts.ops.testartifacts +import com.jcabi.github.Repo +import flank.common.config.flankTestArtifactsRepository +import flank.scripts.data.github.githubRepo import flank.scripts.utils.currentGitBranch +import flank.scripts.utils.getEnv import java.io.File const val GITHUB_TOKEN_ENV_KEY = "GITHUB_TOKEN" @@ -12,3 +16,5 @@ fun flankRoot() = File(System.getenv("FLANK_ROOT") ?: "../").absoluteFile.normal val File.testArtifacts: File get() = resolve(TEST_ARTIFACTS_PATH).apply { if (!exists()) mkdir() } fun File.testArtifacts(branch: String = currentGitBranch()): File = testArtifacts.resolve(branch) + +internal fun testArtifactsRepo(): Repo = githubRepo(getEnv(GITHUB_TOKEN_ENV_KEY), flankTestArtifactsRepository) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/IsNewVersionAvailable.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/IsNewVersionAvailable.kt deleted file mode 100644 index 6faab73706..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/IsNewVersionAvailable.kt +++ /dev/null @@ -1,18 +0,0 @@ -package flank.scripts.ops.testartifacts - -import com.jcabi.github.Repo -import flank.scripts.data.github.getRelease - -internal fun Context.isNewVersionAvailable( - repo: Repo = testArtifactsRepo() -): Boolean { - val remote = repo.getRelease(branch) - ?.body()?.toLong() - ?: return false - - val local = latestArtifactsArchive() - ?.name?.parseArtifactsArchive()?.timestamp - ?: return true - - return remote > local -} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/ResolveArtifacts.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/ResolveArtifacts.kt index 833df6abff..27460a6e24 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/ResolveArtifacts.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/ResolveArtifacts.kt @@ -1,6 +1,7 @@ package flank.scripts.ops.testartifacts import com.jcabi.github.Repo +import flank.scripts.data.github.getRelease fun Context.resolveArtifacts( repo: Repo = testArtifactsRepo() @@ -23,3 +24,17 @@ fun Context.resolveArtifacts( } } } + +private fun Context.isNewVersionAvailable( + repo: Repo = testArtifactsRepo() +): Boolean { + val remote = repo.getRelease(branch) + ?.body()?.toLong() + ?: return false + + val local = latestArtifactsArchive() + ?.name?.parseArtifactsArchive()?.timestamp + ?: return true + + return remote > local +} diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/TestArtifactsRepo.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/TestArtifactsRepo.kt deleted file mode 100644 index ed80effc05..0000000000 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/testartifacts/TestArtifactsRepo.kt +++ /dev/null @@ -1,8 +0,0 @@ -package flank.scripts.ops.testartifacts - -import com.jcabi.github.Repo -import flank.common.config.flankTestArtifactsRepository -import flank.scripts.data.github.githubRepo -import flank.scripts.utils.getEnv - -internal fun testArtifactsRepo(): Repo = githubRepo(getEnv(GITHUB_TOKEN_ENV_KEY), flankTestArtifactsRepository) diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateAtomic.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateAtomic.kt similarity index 96% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateAtomic.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateAtomic.kt index e2363f7583..60b8c6edd1 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateAtomic.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateAtomic.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.dependencies.updatebinaries +package flank.scripts.ops.updatebinaries import flank.common.downloadFile import flank.common.extract diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateBinaries.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateBinaries.kt similarity index 85% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateBinaries.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateBinaries.kt index 4f68c31644..7d37cfc196 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateBinaries.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateBinaries.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.dependencies.updatebinaries +package flank.scripts.ops.updatebinaries import kotlinx.coroutines.joinAll import kotlinx.coroutines.launch diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateLlvm.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateLlvm.kt similarity index 97% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateLlvm.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateLlvm.kt index c0814723db..7bbfa956ff 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateLlvm.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateLlvm.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.dependencies.updatebinaries +package flank.scripts.ops.updatebinaries import flank.common.downloadFile import flank.common.extract diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateSwift.kt b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateSwift.kt similarity index 98% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateSwift.kt rename to flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateSwift.kt index a6b7f3ec0d..8efc5852c5 100644 --- a/flank-scripts/src/main/kotlin/flank/scripts/ops/dependencies/updatebinaries/UpdateSwift.kt +++ b/flank-scripts/src/main/kotlin/flank/scripts/ops/updatebinaries/UpdateSwift.kt @@ -1,4 +1,4 @@ -package flank.scripts.ops.dependencies.updatebinaries +package flank.scripts.ops.updatebinaries import flank.common.downloadFile import flank.common.extract diff --git a/flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/GradleCommand.kt b/flank-scripts/src/main/kotlin/flank/scripts/utils/GradleCommand.kt similarity index 100% rename from flank-scripts/src/main/kotlin/flank/scripts/ops/assemble/GradleCommand.kt rename to flank-scripts/src/main/kotlin/flank/scripts/utils/GradleCommand.kt diff --git a/flank-scripts/src/test/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommandTest.kt b/flank-scripts/src/test/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommandTest.kt index e735b951ad..7d4e73b579 100644 --- a/flank-scripts/src/test/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommandTest.kt +++ b/flank-scripts/src/test/kotlin/flank/scripts/cli/release/SyncWithMavenCentralCommandTest.kt @@ -1,6 +1,6 @@ package flank.scripts.cli.release -import flank.scripts.ops.release.jfrog.jFrogSync +import flank.scripts.ops.jfrog.jFrogSync import io.mockk.every import io.mockk.mockkStatic import io.mockk.verify diff --git a/flank-scripts/src/test/kotlin/flank/scripts/ops/dependencies/DependencyExtensionsTest.kt b/flank-scripts/src/test/kotlin/flank/scripts/ops/dependencies/DependencyExtensionsTest.kt index 88de3020e2..1afad6901d 100644 --- a/flank-scripts/src/test/kotlin/flank/scripts/ops/dependencies/DependencyExtensionsTest.kt +++ b/flank-scripts/src/test/kotlin/flank/scripts/ops/dependencies/DependencyExtensionsTest.kt @@ -1,5 +1,6 @@ package flank.scripts.ops.dependencies +import flank.scripts.ops.dependencies.common.GradleDependency import flank.scripts.utils.toAvailableVersion import flank.scripts.utils.toDependency import flank.scripts.utils.toGradleReleaseChannel diff --git a/flank-scripts/src/test/kotlin/flank/scripts/ops/firebase/SDKUpdateTest.kt b/flank-scripts/src/test/kotlin/flank/scripts/ops/firebase/SDKUpdateTest.kt index eacc64bf6e..e587f6fce6 100644 --- a/flank-scripts/src/test/kotlin/flank/scripts/ops/firebase/SDKUpdateTest.kt +++ b/flank-scripts/src/test/kotlin/flank/scripts/ops/firebase/SDKUpdateTest.kt @@ -4,6 +4,8 @@ import com.google.common.truth.Truth.assertThat import flank.common.normalizeLineEnding import flank.scripts.FuelTestRunner import flank.scripts.data.github.objects.GithubPullRequest +import flank.scripts.ops.firebase.common.createEpicIssue +import flank.scripts.ops.firebase.common.updateOpenedEpic import flank.scripts.utils.parseToVersion import kotlinx.coroutines.runBlocking import org.junit.Rule diff --git a/flank-scripts/src/test/kotlin/flank/scripts/ops/integrationtests/ProcessResultTest.kt b/flank-scripts/src/test/kotlin/flank/scripts/ops/integrationtests/ProcessResultTest.kt index db945d6775..8ae21bccb4 100644 --- a/flank-scripts/src/test/kotlin/flank/scripts/ops/integrationtests/ProcessResultTest.kt +++ b/flank-scripts/src/test/kotlin/flank/scripts/ops/integrationtests/ProcessResultTest.kt @@ -4,6 +4,11 @@ import com.google.common.truth.Truth.assertThat import flank.common.normalizeLineEnding import flank.scripts.FuelTestRunner import flank.scripts.cli.integrationtests.ProcessResultCommand +import flank.scripts.ops.integrationtests.common.ITResults +import flank.scripts.ops.integrationtests.common.IntegrationContext +import flank.scripts.ops.integrationtests.common.closeIssue +import flank.scripts.ops.integrationtests.common.createNewIssue +import flank.scripts.ops.integrationtests.common.postComment import kotlinx.coroutines.runBlocking import org.junit.Rule import org.junit.Test diff --git a/flank-scripts/src/test/kotlin/flank/scripts/utils/TestParsers.kt b/flank-scripts/src/test/kotlin/flank/scripts/utils/TestParsers.kt index 2404af0d18..c703d6ad55 100644 --- a/flank-scripts/src/test/kotlin/flank/scripts/utils/TestParsers.kt +++ b/flank-scripts/src/test/kotlin/flank/scripts/utils/TestParsers.kt @@ -1,9 +1,9 @@ package flank.scripts.utils -import flank.scripts.ops.dependencies.AvailableVersion -import flank.scripts.ops.dependencies.Dependency -import flank.scripts.ops.dependencies.DependencyUpdate -import flank.scripts.ops.dependencies.GradleReleaseChannel +import flank.scripts.ops.dependencies.common.AvailableVersion +import flank.scripts.ops.dependencies.common.Dependency +import flank.scripts.ops.dependencies.common.DependencyUpdate +import flank.scripts.ops.dependencies.common.GradleReleaseChannel fun toGradleReleaseChannel( version: String,