com.android.tools.idea.gradle.output.parser.androidPlugin.AndroidPluginOutputParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-common Show documentation
Show all versions of android-common Show documentation
A packaging of the IntelliJ Community Edition android-common library.
This is release number 1 of trunk branch 142.
The newest version!
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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.
*/
package com.android.tools.idea.gradle.output.parser.androidPlugin;
import com.android.ide.common.blame.output.GradleMessage;
import com.android.ide.common.blame.parser.ParsingFailedException;
import com.android.ide.common.blame.parser.PatternAwareOutputParser;
import com.android.ide.common.blame.parser.util.OutputLineReader;
import com.android.tools.idea.gradle.output.GradleProjectAwareMessage;
import com.android.utils.ILogger;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class AndroidPluginOutputParser implements PatternAwareOutputParser {
private static final int SEGMENT_COUNT = 3;
@Override
public boolean parse(@NotNull String line, @NotNull OutputLineReader reader, @NotNull List messages, @NotNull ILogger logger)
throws ParsingFailedException {
// pattern is type|path|message
String[] segments = line.split("\\|", SEGMENT_COUNT);
if (segments.length == SEGMENT_COUNT) {
GradleMessage.Kind kind = GradleMessage.Kind.findIgnoringCase(segments[0]);
if (kind == null) {
kind = GradleMessage.Kind.ERROR;
}
String path = segments[1];
if (StringUtil.isEmpty(path)) {
return false;
}
String msg = StringUtil.notNullize(segments[2]);
messages.add(new GradleProjectAwareMessage(kind, msg.trim(), path.trim()));
return true;
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy