From d3f655942ee265e8f0ccde33ca9dc11ffb46137b Mon Sep 17 00:00:00 2001 From: Oleg Golberg Date: Sun, 25 Feb 2024 16:46:19 -0500 Subject: [PATCH] Clean up duplicated root selector code --- .../gradle/config/RootSelectorSpec.kt | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/plugin/src/main/kotlin/com/toasttab/expediter/gradle/config/RootSelectorSpec.kt b/plugin/src/main/kotlin/com/toasttab/expediter/gradle/config/RootSelectorSpec.kt index a060f62..7f3976e 100644 --- a/plugin/src/main/kotlin/com/toasttab/expediter/gradle/config/RootSelectorSpec.kt +++ b/plugin/src/main/kotlin/com/toasttab/expediter/gradle/config/RootSelectorSpec.kt @@ -1,8 +1,21 @@ +/* + * Copyright (c) 2024 Toast Inc. + * + * 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.toasttab.expediter.gradle.config import com.toasttab.expediter.roots.RootSelector -import com.toasttab.expediter.types.ApplicationType -import com.toasttab.expediter.types.ClassfileSourceType open class RootSelectorSpec { var type: RootType = RootType.PROJECT_CLASSES @@ -18,7 +31,5 @@ open class RootSelectorSpec { enum class RootType(val selector: RootSelector) { ALL(RootSelector.All), - PROJECT_CLASSES(object : RootSelector { - override fun isRoot(type: ApplicationType) = type.source.type == ClassfileSourceType.SOURCE_SET || type.source.type == ClassfileSourceType.SUBPROJECT_DEPENDENCY - }) + PROJECT_CLASSES(RootSelector.ProjectClasses) }