Skip to content

Commit

Permalink
Change gradle file
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelpasterz committed Jan 6, 2021
1 parent 74b0399 commit 4258850
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 46 deletions.
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ tasks {

subprojects {
apply(plugin = Plugins.KTLINT_GRADLE_PLUGIN)
afterEvaluate {
if (tasks.findByName("test") != null) {
tasks.test {
systemProperty("useDefaultProperties", "")
}
}
}
}

repositories {
Expand Down
29 changes: 19 additions & 10 deletions common/src/main/kotlin/flank/common/config/FlankProperties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import flank.common.isCI
import java.nio.file.Paths
import java.util.Properties

const val ZENHUB_REPO_ID = "zenhub.repo-id"
const val FLANK_REPO = "repo.flank"
const val GCLOUD_REPO = "repo.gcloud_cli"
const val ARTIFACTS_REPO = "repo.test-artifacts"
const val IT_WORKFLOW_FILE = "integration.workflow-filename"
const val IT_USER = "integration.issue-poster"
const val SDK_WORKFLOW = "sdk-check.workflow-filename"
const val SDK_USER = "sdk-check.issue-poster"
private const val ZENHUB_REPO_ID = "zenhub.repo-id"
private const val FLANK_REPO = "repo.flank"
private const val GCLOUD_REPO = "repo.gcloud_cli"
private const val ARTIFACTS_REPO = "repo.test-artifacts"
private const val IT_WORKFLOW_FILE = "integration.workflow-filename"
private const val IT_USER = "integration.issue-poster"
private const val SDK_WORKFLOW = "sdk-check.workflow-filename"
private const val SDK_USER = "sdk-check.issue-poster"

private val defaults = Properties().apply {
setProperty(ZENHUB_REPO_ID, "84221974")
Expand All @@ -34,10 +34,19 @@ class SafeProperties(defaults: Properties) : Properties(defaults) {
// default properties should be used in CI and during tests
private fun shouldUseDefaults() = isCI() || isTest()

private fun isTest() = System.getProperty("testScript") != null
private fun isTest() = System.getProperty("useDefaultProperties") != null

val flankProjectProperties = SafeProperties(defaults).also { prop ->
private val props = SafeProperties(defaults).also { prop ->
with(Paths.get("$flankCommonRootPathString/flank-debug.properties").toFile()) {
if (exists()) prop.load(inputStream())
}
}

val zenhubRepositoryID = Integer.parseInt(props[ZENHUB_REPO_ID])
val flankRepository = props[FLANK_REPO]
val flankGcloudCLIRepository = props[GCLOUD_REPO]
val flankTestArtifactsRepository = props[ARTIFACTS_REPO]
val integrationOpenedIssueUser = props[IT_USER]
val updatesOpenedUser = props[SDK_USER]
val fullSuiteWorkflowFilename = props[IT_WORKFLOW_FILE]
val updateDependenciesWorkflowFilename = props[SDK_WORKFLOW]
1 change: 0 additions & 1 deletion flank-scripts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ publishing {
tasks.test {
maxHeapSize = "2048m"
minHeapSize = "512m"
systemProperty("testScript", "")
}

repositories {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import com.jcabi.github.Release
import com.jcabi.github.Releases
import com.jcabi.github.Repo
import com.jcabi.github.RtGithub
import flank.common.config.flankRepository
import flank.scripts.ci.releasenotes.GitHubRelease
import flank.scripts.ci.releasenotes.GithubReleaseDeserializable
import flank.scripts.config.flankRepository
import flank.scripts.exceptions.mapClientErrorToGithubException
import flank.scripts.github.objects.GitHubCommit
import flank.scripts.github.objects.GitHubCommitListDeserializer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package flank.scripts.integration

import com.github.kittinunf.result.getOrElse
import com.github.kittinunf.result.onError
import flank.scripts.config.integrationOpenedIssueUser
import flank.common.config.integrationOpenedIssueUser
import flank.scripts.github.getGitHubIssueList

suspend fun checkForOpenedITIssues(token: String): Int? = getGitHubIssueList(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flank.scripts.integration

import flank.scripts.config.flankRepository
import flank.common.config.flankRepository
import flank.scripts.github.objects.GithubPullRequest
import java.time.Instant
import java.time.LocalDateTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flank.scripts.integration

import flank.scripts.config.fullSuiteWorkflowFilename
import flank.common.config.fullSuiteWorkflowFilename
import flank.scripts.github.commons.getLastWorkflowRunDate

suspend fun getLastITWorkflowRunDate(token: String) = getLastWorkflowRunDate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package flank.scripts.release.updatebugsnag
import com.github.kittinunf.fuel.Fuel
import com.github.kittinunf.fuel.core.extensions.jsonBody
import com.github.kittinunf.fuel.coroutines.awaitResult
import flank.scripts.config.flankRepository
import flank.common.config.flankRepository
import flank.scripts.exceptions.mapClientError
import flank.scripts.exceptions.toBugsnagException
import flank.scripts.utils.toJson
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package flank.scripts.shell.firebase.apiclient

import com.github.ajalt.clikt.core.CliktCommand
import flank.common.config.flankGcloudCLIRepository
import flank.common.currentPath
import flank.common.downloadFile
import flank.scripts.config.flankGcloudCLIRepository
import flank.scripts.utils.downloadSortJsonIfNeeded
import flank.scripts.utils.runCommand
import java.nio.file.Paths
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.kittinunf.fuel.Fuel
import flank.common.config.flankGcloudCLIRepository
import flank.common.currentPath
import flank.common.downloadFile
import flank.scripts.config.flankGcloudCLIRepository
import flank.scripts.utils.parseToVersion
import kotlinx.coroutines.runBlocking
import java.nio.file.Paths
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flank.scripts.shell.firebase.sdk

import flank.scripts.config.flankGcloudCLIRepository
import flank.common.config.flankGcloudCLIRepository
import flank.scripts.github.getGitHubCommitList
import flank.scripts.github.objects.GitHubCommit
import java.time.Instant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package flank.scripts.shell.firebase.sdk

import com.github.kittinunf.result.Result
import com.github.kittinunf.result.onError
import flank.common.config.zenhubRepositoryID
import flank.common.newLine
import flank.scripts.config.zenhubRepositoryID
import flank.scripts.github.objects.GitHubCreateIssueRequest
import flank.scripts.github.objects.GitHubCreateIssueResponse
import flank.scripts.github.objects.GitHubUpdateIssueRequest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flank.scripts.shell.firebase.sdk

import flank.scripts.config.updateDependenciesWorkflowFilename
import flank.common.config.updateDependenciesWorkflowFilename
import flank.scripts.github.commons.getLastWorkflowRunDate

suspend fun getLastSDKUpdateRunDate(token: String) = getLastWorkflowRunDate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package flank.scripts.shell.firebase.sdk

import com.github.kittinunf.result.getOrElse
import com.github.kittinunf.result.onError
import flank.scripts.config.updatesOpenedUser
import flank.common.config.updatesOpenedUser
import flank.scripts.github.getGitHubIssueList

suspend fun checkForOpenedUpdates(token: String) = getGitHubIssueList(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package flank.scripts.testartifacts.core

import com.jcabi.github.Repo
import flank.scripts.config.flankTestArtifactsRepository
import flank.common.config.flankTestArtifactsRepository
import flank.scripts.github.githubRepo
import flank.scripts.utils.getEnv

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.github.kittinunf.fuel.coroutines.awaitStringResult
import com.github.kittinunf.result.getOrNull
import com.github.kittinunf.result.onError
import com.github.kittinunf.result.success
import flank.scripts.config.zenhubRepositoryID
import flank.common.config.zenhubRepositoryID
import flank.scripts.utils.toJson
import flank.scripts.zenhub.objects.ConvertToEpicRequest
import flank.scripts.zenhub.objects.UpdateEpicRequest
Expand Down

0 comments on commit 4258850

Please sign in to comment.