diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/BlackExtension.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/BlackExtension.java deleted file mode 100644 index 7f9c2054..00000000 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/BlackExtension.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2016 LinkedIn Corp. - * - * 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.linkedin.gradle.python.extension; - -import com.linkedin.gradle.python.extension.internal.DefaultExternalTool; - - -public class BlackExtension extends DefaultExternalTool { -} diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/IsortExtension.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/IsortExtension.java deleted file mode 100644 index 0de880f0..00000000 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/IsortExtension.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2016 LinkedIn Corp. - * - * 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.linkedin.gradle.python.extension; - -import com.linkedin.gradle.python.extension.internal.DefaultExternalTool; - - -public class IsortExtension extends DefaultExternalTool { -} diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/MypyExtension.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/MypyExtension.java index e3e30866..ca3ca085 100644 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/MypyExtension.java +++ b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/MypyExtension.java @@ -15,8 +15,24 @@ */ package com.linkedin.gradle.python.extension; -import com.linkedin.gradle.python.extension.internal.DefaultExternalTool; +public class MypyExtension { + private boolean run; + private String[] arguments = null; -public class MypyExtension extends DefaultExternalTool { + public boolean isRun() { + return run; + } + + public void setRun(boolean run) { + this.run = run; + } + + public void setArguments(String argumentString) { + arguments = argumentString.split("\\s+"); + } + + public String[] getArguments() { + return arguments; + } } diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/internal/DefaultExternalTool.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/internal/DefaultExternalTool.java deleted file mode 100644 index 273d6643..00000000 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/extension/internal/DefaultExternalTool.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2016 LinkedIn Corp. - * - * 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.linkedin.gradle.python.extension.internal; - - -public class DefaultExternalTool { - private boolean run; - private String[] arguments = null; - - public boolean isRun() { - return run; - } - - public void setRun(boolean run) { - this.run = run; - } - - public void setArguments(String argumentString) { - arguments = argumentString.split("\\s+"); - } - - public String[] getArguments() { - return arguments; - } -} diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/plugin/internal/ValidationPlugin.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/plugin/internal/ValidationPlugin.java index 6931831d..835ca98a 100644 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/plugin/internal/ValidationPlugin.java +++ b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/plugin/internal/ValidationPlugin.java @@ -16,17 +16,13 @@ package com.linkedin.gradle.python.plugin.internal; import com.linkedin.gradle.python.PythonExtension; -import com.linkedin.gradle.python.extension.BlackExtension; -import com.linkedin.gradle.python.extension.IsortExtension; import com.linkedin.gradle.python.extension.MypyExtension; import com.linkedin.gradle.python.extension.CoverageExtension; import com.linkedin.gradle.python.tasks.AbstractPythonMainSourceDefaultTask; import com.linkedin.gradle.python.tasks.AbstractPythonTestSourceDefaultTask; -import com.linkedin.gradle.python.tasks.BlackTask; import com.linkedin.gradle.python.tasks.CheckStyleGeneratorTask; import com.linkedin.gradle.python.tasks.Flake8Task; import com.linkedin.gradle.python.tasks.MypyTask; -import com.linkedin.gradle.python.tasks.IsortTask; import com.linkedin.gradle.python.tasks.PyCoverageTask; import com.linkedin.gradle.python.tasks.PyTestTask; import com.linkedin.gradle.python.util.ExtensionUtils; @@ -36,7 +32,6 @@ import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; -import static com.linkedin.gradle.python.util.StandardTextValues.TASK_BLACK; import static com.linkedin.gradle.python.util.StandardTextValues.TASK_CHECK; import static com.linkedin.gradle.python.util.StandardTextValues.TASK_CHECKSTYLE; import static com.linkedin.gradle.python.util.StandardTextValues.TASK_COVERAGE; @@ -44,7 +39,6 @@ import static com.linkedin.gradle.python.util.StandardTextValues.TASK_INSTALL_BUILD_REQS; import static com.linkedin.gradle.python.util.StandardTextValues.TASK_INSTALL_PROJECT; import static com.linkedin.gradle.python.util.StandardTextValues.TASK_MYPY; -import static com.linkedin.gradle.python.util.StandardTextValues.TASK_ISORT; import static com.linkedin.gradle.python.util.StandardTextValues.TASK_PYTEST; public class ValidationPlugin implements Plugin { @@ -118,7 +112,7 @@ public void apply(final Project project) { /* * Run mypy. * - * This uses the setup.cfg (or mypy.ini) file if present to configure mypy. + * This uses the mypy.ini file if present to configure mypy. */ MypyExtension mypy = ExtensionUtils.maybeCreate(project, "mypy", MypyExtension.class); project.getTasks().create(TASK_MYPY.getValue(), MypyTask.class, @@ -128,28 +122,6 @@ public void apply(final Project project) { project.getTasks().getByName(TASK_CHECK.getValue()) .dependsOn(project.getTasks().getByName(TASK_MYPY.getValue())); - /* - * Run isort. - */ - IsortExtension isort = ExtensionUtils.maybeCreate(project, "isort", IsortExtension.class); - project.getTasks().create(TASK_ISORT.getValue(), IsortTask.class, - task -> task.onlyIf(it -> project.file(settings.srcDir).exists() && isort.isRun())); - - // Make task "check" depend on isort task. - project.getTasks().getByName(TASK_CHECK.getValue()) - .dependsOn(project.getTasks().getByName(TASK_ISORT.getValue())); - - /* - * Run black. - */ - BlackExtension black = ExtensionUtils.maybeCreate(project, "black", BlackExtension.class); - project.getTasks().create(TASK_BLACK.getValue(), BlackTask.class, - task -> task.onlyIf(it -> project.file(settings.srcDir).exists() && black.isRun())); - - // Make task "check" depend on black task. - project.getTasks().getByName(TASK_CHECK.getValue()) - .dependsOn(project.getTasks().getByName(TASK_BLACK.getValue())); - /* * Create checkstyle styled report from flake */ diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/BlackTask.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/BlackTask.java deleted file mode 100644 index 754d19c1..00000000 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/BlackTask.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2016 LinkedIn Corp. - * - * 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.linkedin.gradle.python.tasks; - -import com.linkedin.gradle.python.extension.BlackExtension; -import com.linkedin.gradle.python.extension.PythonDetails; -import com.linkedin.gradle.python.util.ExtensionUtils; -import org.gradle.api.Project; -import org.gradle.process.ExecResult; - - -public class BlackTask extends AbstractPythonMainSourceDefaultTask { - - public void preExecution() { - PythonDetails blackDetails = getPythonDetails(); - args(blackDetails.getVirtualEnvironment().findExecutable("black").getAbsolutePath()); - - Project project = getProject(); - BlackExtension black = ExtensionUtils.getPythonComponentExtension(project, BlackExtension.class); - - String[] arguments = black.getArguments(); - - if (arguments == null) { - // Default to longer line length (160) than the default (88) - // Default to check only - arguments = new String[] {"--check", "-l", "160", getPythonExtension().srcDir, getPythonExtension().testDir}; - } - args(arguments); - } - - public void processResults(ExecResult results) { - } -} diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/IsortTask.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/IsortTask.java deleted file mode 100644 index ff8cbe34..00000000 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/IsortTask.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016 LinkedIn Corp. - * - * 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.linkedin.gradle.python.tasks; - -import com.linkedin.gradle.python.extension.IsortExtension; -import com.linkedin.gradle.python.extension.PythonDetails; -import com.linkedin.gradle.python.util.ExtensionUtils; -import org.gradle.api.Project; -import org.gradle.process.ExecResult; - - -public class IsortTask extends AbstractPythonMainSourceDefaultTask { - - public void preExecution() { - PythonDetails isortDetails = getPythonDetails(); - args(isortDetails.getVirtualEnvironment().findExecutable("isort").getAbsolutePath()); - - Project project = getProject(); - IsortExtension isort = ExtensionUtils.getPythonComponentExtension(project, IsortExtension.class); - - String[] arguments = isort.getArguments(); - - if (arguments == null) { - // Default to --check-only --recursive src/ test/ - arguments = new String[]{"--check-only", "--recursive", getPythonExtension().srcDir, getPythonExtension().testDir}; - } - args(arguments); - } - - public void processResults(ExecResult results) { - } -} diff --git a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/util/StandardTextValues.java b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/util/StandardTextValues.java index f35d8f69..a39617b3 100644 --- a/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/util/StandardTextValues.java +++ b/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/util/StandardTextValues.java @@ -31,7 +31,6 @@ public enum StandardTextValues { CONFIGURATION_VENV("venv"), CONFIGURATION_WHEEL("wheel"), CONFIGURATION_FLAKE8("flake8"), - TASK_BLACK("runBlack"), TASK_BUILD_DOCS("buildDocs"), TASK_CLEAN_SAVE_VENV("cleanSaveVenv"), TASK_CHECK("check"), @@ -43,7 +42,6 @@ public enum StandardTextValues { TASK_INSTALL_PROJECT("installProject"), TASK_INSTALL_PYTHON_REQS("installPythonRequirements"), TASK_INSTALL_TEST_REQS("installTestRequirements"), - TASK_ISORT("runIsort"), TASK_MYPY("runMypy"), TASK_PACKAGE_DOCS("packageDocs"), TASK_PACKAGE_JSON_DOCS("packageJsonDocs"),