use buildStatus in build scripts

This commit is contained in:
Sergey Ignatov
2018-01-19 20:24:45 +03:00
parent fd00aaa588
commit ae844ba9e3
6 changed files with 34 additions and 59 deletions
@@ -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> V block(String blockName, Closure<V> body)
void artifactBuilt(String relativeArtifactPath)
@@ -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
@@ -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> V block(String blockName, Closure<V> body) {
try {
@@ -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()
}
}
@@ -30,6 +30,9 @@ class MockBuildMessages : BuildMessages {
override fun progress(message: String?) {
}
override fun buildStatus(message: String?) {
}
override fun <V : Any?> block(blockName: String, body: Closure<V>): V {
return body.call()
}
@@ -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"));