mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJI-9: fix success if no changes are found
This commit is contained in:
+20
-8
@@ -33,17 +33,29 @@ internal fun checkIcons(context: Context = Context(), loggerImpl: Consumer<Strin
|
||||
context.devIcons = readDevRepo(context, devRepoVcsRoots)
|
||||
callWithTimer("Searching for changed icons..") {
|
||||
when {
|
||||
context.iconsCommitHashesToSync.isNotEmpty() -> searchForChangedIconsByDesigners(context, devRepoVcsRoots)
|
||||
context.iconsCommitHashesToSync.isNotEmpty() -> searchForChangedIconsByDesigners(context)
|
||||
context.devIconsCommitHashesToSync.isNotEmpty() -> searchForChangedIconsByDev(context, devRepoVcsRoots)
|
||||
else -> searchForAllChangedIcons(context, devRepoVcsRoots)
|
||||
}
|
||||
}
|
||||
if (context.devChanges().isEmpty() && context.iconsChanges().isEmpty()) {
|
||||
log("No changes are found")
|
||||
}
|
||||
else {
|
||||
syncIcons(context)
|
||||
report(context, skippedDirs.size)
|
||||
when {
|
||||
!context.iconsSyncRequired() && !context.devSyncRequired() -> {
|
||||
if (isUnderTeamCity() && isPreviousBuildFailed()) {
|
||||
context.doFail("No changes are found")
|
||||
}
|
||||
else {
|
||||
log("No changes are found")
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
syncIcons(context)
|
||||
val report = report(context, skippedDirs.size)
|
||||
if (isUnderTeamCity() && context.isFail()) {
|
||||
context.doFail(report)
|
||||
} else {
|
||||
log(report)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +106,7 @@ private fun asIcon(files: Collection<String>, repo: File, root: File) = files
|
||||
.filter { ImageExtension.fromName(it) != null }
|
||||
.map { repo.resolve(it).toRelativeString(root) }
|
||||
|
||||
private fun searchForChangedIconsByDesigners(context: Context, devRepoVcsRoots: List<File>) {
|
||||
private fun searchForChangedIconsByDesigners(context: Context) {
|
||||
val iterator = context.iconsCommitHashesToSync.iterator()
|
||||
while (iterator.hasNext()) {
|
||||
val commit = iterator.next()
|
||||
|
||||
+2
-3
@@ -6,7 +6,7 @@ import java.util.*
|
||||
import java.util.stream.Stream
|
||||
import kotlin.streams.toList
|
||||
|
||||
internal fun report(context: Context, skipped: Int) {
|
||||
internal fun report(context: Context, skipped: Int) : String {
|
||||
val (devIcons, icons) = context.devIcons.size to context.icons.size
|
||||
if (isUnderTeamCity()) {
|
||||
findCommitsToSync(context)
|
||||
@@ -48,8 +48,7 @@ internal fun report(context: Context, skipped: Int) {
|
||||
if (context.createdReviews.isNotEmpty()) {
|
||||
report += "\nCreated reviews: ${context.createdReviews.joinToString { it.url }}"
|
||||
}
|
||||
log(report)
|
||||
if (isUnderTeamCity() && context.isFail()) context.doFail(report)
|
||||
return report
|
||||
}
|
||||
|
||||
private fun findCommitsToSync(context: Context) {
|
||||
|
||||
+4
-3
@@ -32,8 +32,7 @@ internal fun isNotificationRequired(context: Context) =
|
||||
// remind of failure every day
|
||||
(context.isFail() ||
|
||||
// or check previous build and notify on fail -> success
|
||||
teamCityGet("builds?locator=buildType:$BUILD_CONF,count:1")
|
||||
.contains("status=\"FAILURE\""))
|
||||
isPreviousBuildFailed())
|
||||
|
||||
internal val DEFAULT_INVESTIGATOR by lazy {
|
||||
System.getProperty("intellij.icons.sync.default.investigator")?.takeIf { it.isNotBlank() } ?: error("Specify default investigator")
|
||||
@@ -105,4 +104,6 @@ internal fun triggeredBy() = System.getProperty("teamcity.build.triggeredBy.user
|
||||
?.let { teamCityGet("users/username:$it/email") }
|
||||
?.removeSuffix(System.lineSeparator())
|
||||
|
||||
internal fun isScheduled() = System.getProperty("teamcity.build.triggeredBy")?.contains("Schedule") == true
|
||||
internal fun isScheduled() = System.getProperty("teamcity.build.triggeredBy")?.contains("Schedule") == true
|
||||
|
||||
internal fun isPreviousBuildFailed() = teamCityGet("builds?locator=buildType:$BUILD_CONF,count:1").contains("status=\"FAILURE\"")
|
||||
Reference in New Issue
Block a user