Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-2010.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Disable errorprone in intellij
links:
- https://github.com/palantir/gradle-baseline/pull/2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* (c) Copyright 2021 Palantir Technologies Inc. All rights reserved.
*
* 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.palantir.baseline;

public final class IntellijSupport {
private static final String INTELLIJ_ACTIVE = "idea.active";

public static boolean isRunningInIntellij() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind consolidating the idea.active checks from BaselineIdea as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course! done

return System.getProperties().getProperty(INTELLIJ_ACTIVE) != null;
}

private IntellijSupport() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.MoreCollectors;
import com.palantir.baseline.IntellijSupport;
import com.palantir.baseline.extensions.BaselineErrorProneExtension;
import com.palantir.baseline.extensions.BaselineJavaVersionExtension;
import com.palantir.baseline.tasks.CompileRefasterTask;
Expand Down Expand Up @@ -208,7 +209,7 @@ private static void configureErrorProneOptions(
JavaCompile javaCompile,
ErrorProneOptions errorProneOptions) {

if (project.hasProperty(DISABLE_PROPERTY)) {
if (project.hasProperty(DISABLE_PROPERTY) || IntellijSupport.isRunningInIntellij()) {
log.info("Disabling baseline-error-prone for {} due to {}", project, DISABLE_PROPERTY);
errorProneOptions.getEnabled().set(false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.palantir.baseline.plugins

import com.google.common.collect.ImmutableMap
import com.palantir.baseline.IntellijSupport
import com.palantir.baseline.util.GitUtils
import groovy.transform.CompileStatic
import groovy.xml.XmlUtil
Expand Down Expand Up @@ -124,7 +125,7 @@ class BaselineIdea extends AbstractBaselinePlugin {
}

private void configureProjectForIntellijImport(Project project) {
if (Boolean.getBoolean("idea.active")) {
if (IntellijSupport.isRunningInIntellij()) {
addCodeStyleIntellijImport()
addCheckstyleIntellijImport(project)
addCopyrightIntellijImport()
Expand Down Expand Up @@ -447,7 +448,7 @@ class BaselineIdea extends AbstractBaselinePlugin {
}

private static void configureSaveActionsForIntellijImport(Project project) {
if (!Boolean.getBoolean("idea.active")) {
if (!IntellijSupport.isRunningInIntellij()) {
return
}
XmlUtils.createOrUpdateXmlFile(
Expand Down