From ae844ba9e3a5ab12307f2e351478efd5a23dd4ec Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Fri, 19 Jan 2018 20:24:10 +0300 Subject: [PATCH] use buildStatus in build scripts --- .../intellij/build/BuildMessages.groovy | 16 ++-------- .../intellij/build/LogMessage.groovy | 16 ++-------- .../build/impl/BuildMessagesImpl.groovy | 19 ++++-------- .../impl/TeamCityBuildMessageLogger.groovy | 29 +++++++------------ .../intellij/build/MockBuildMessages.kt | 3 ++ .../testFramework/TestClassesFilterTest.java | 10 +++++++ 6 files changed, 34 insertions(+), 59 deletions(-) diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/BuildMessages.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/BuildMessages.groovy index 6cd3bad7e4d9..d73e53707e8c 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/BuildMessages.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/BuildMessages.groovy @@ -1,17 +1,5 @@ /* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.intellij.build @@ -42,6 +30,8 @@ interface BuildMessages { void progress(String message) + void buildStatus(String message) + def V block(String blockName, Closure body) void artifactBuilt(String relativeArtifactPath) diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/LogMessage.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/LogMessage.groovy index acf7603932a4..d0ab7c9864a5 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/LogMessage.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/LogMessage.groovy @@ -1,17 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.intellij.build @@ -22,7 +10,7 @@ import groovy.transform.CompileStatic @CompileStatic class LogMessage { enum Kind { - ERROR, WARNING, INFO, PROGRESS, BLOCK_STARTED, BLOCK_FINISHED, ARTIFACT_BUILT, @Deprecated COMPILATION_ERROR, COMPILATION_ERRORS, STATISTICS + ERROR, WARNING, INFO, PROGRESS, BLOCK_STARTED, BLOCK_FINISHED, ARTIFACT_BUILT, @Deprecated COMPILATION_ERROR, COMPILATION_ERRORS, STATISTICS, BUILD_STATUS } final Kind kind final String text diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildMessagesImpl.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildMessagesImpl.groovy index 7a7c67dde7ce..ae0f4b406a99 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildMessagesImpl.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildMessagesImpl.groovy @@ -1,17 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.intellij.build.impl @@ -115,6 +103,11 @@ class BuildMessagesImpl implements BuildMessages { } } + @Override + void buildStatus(String message) { + processMessage(new LogMessage(LogMessage.Kind.BUILD_STATUS, message)) + } + @Override V block(String blockName, Closure body) { try { diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TeamCityBuildMessageLogger.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TeamCityBuildMessageLogger.groovy index 91ab76deb4fc..871b870f8427 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TeamCityBuildMessageLogger.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TeamCityBuildMessageLogger.groovy @@ -1,17 +1,5 @@ /* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.intellij.build.impl @@ -64,6 +52,9 @@ class TeamCityBuildMessageLogger extends BuildMessageLogger { case LogMessage.Kind.ARTIFACT_BUILT: printTeamCityMessage("publishArtifacts", false, "'${escape(message.text)}'") break + case LogMessage.Kind.BUILD_STATUS: + printTeamCityMessage("buildStatus", false, "text='${escape(message.text)}'") + break case LogMessage.Kind.STATISTICS: int index = message.text.indexOf('=') String key = escape(message.text.substring(0, index)) @@ -134,21 +125,21 @@ class TeamCityBuildMessageLogger extends BuildMessageLogger { case ']': return ']' as char } - return 0; + return 0 } private static String escape(String text) { - StringBuilder escaped = new StringBuilder(); + StringBuilder escaped = new StringBuilder() for (char c : text.toCharArray()) { - char escChar = escapeChar(c); + char escChar = escapeChar(c) if (escChar == 0 as char) { - escaped.append(c); + escaped.append(c) } else { - escaped.append('|').append(escChar); + escaped.append('|').append(escChar) } } - return escaped.toString(); + return escaped.toString() } } diff --git a/platform/build-scripts/tests/testSrc/org/jetbrains/intellij/build/MockBuildMessages.kt b/platform/build-scripts/tests/testSrc/org/jetbrains/intellij/build/MockBuildMessages.kt index 5c8fc530a0fb..d4cf50bea608 100644 --- a/platform/build-scripts/tests/testSrc/org/jetbrains/intellij/build/MockBuildMessages.kt +++ b/platform/build-scripts/tests/testSrc/org/jetbrains/intellij/build/MockBuildMessages.kt @@ -30,6 +30,9 @@ class MockBuildMessages : BuildMessages { override fun progress(message: String?) { } + override fun buildStatus(message: String?) { + } + override fun block(blockName: String, body: Closure): V { return body.call() } diff --git a/platform/testFramework/testSrc/com/intellij/testFramework/TestClassesFilterTest.java b/platform/testFramework/testSrc/com/intellij/testFramework/TestClassesFilterTest.java index 1ab831a83a90..22bf545d8224 100644 --- a/platform/testFramework/testSrc/com/intellij/testFramework/TestClassesFilterTest.java +++ b/platform/testFramework/testSrc/com/intellij/testFramework/TestClassesFilterTest.java @@ -4,7 +4,9 @@ package com.intellij.testFramework; import com.intellij.GroupBasedTestClassFilter; +import com.intellij.PatternListTestClassFilter; import com.intellij.TestClassesFilter; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; import org.junit.Test; @@ -86,6 +88,14 @@ public class TestClassesFilterTest { Collections.singletonList(GroupBasedTestClassFilter.ALL_EXCLUDE_DEFINED))); } + @Test + public void justClassName() { + PatternListTestClassFilter myTestClassesFilter = + new PatternListTestClassFilter(StringUtil.split("com.intellij.database.DatabaseParametrizedTestSuite", ";")); + + assertTrue(myTestClassesFilter.matches("com.intellij.database.DatabaseParametrizedTestSuite", null)); + } + @Test public void group2() throws Exception { TestClassesFilter classesFilter = createOn(getReader(FILTER_TEXT), Collections.singletonList("Group2"));