Skip to content

Commit

Permalink
build: Move all VCS plugins to separate Gradle projects
Browse files Browse the repository at this point in the history
This resolves #6602.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Nov 9, 2023
1 parent 5f845ca commit 24853b4
Show file tree
Hide file tree
Showing 35 changed files with 172 additions and 39 deletions.
1 change: 1 addition & 0 deletions cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ dependencies {
"pluginClasspath"(platform(project(":plugins:package-managers")))
"pluginClasspath"(platform(project(":plugins:reporters")))
"pluginClasspath"(platform(project(":plugins:scanners")))
"pluginClasspath"(platform(project(":plugins:version-control-systems")))

funTestImplementation(platform(project(":plugins:commands")))
funTestImplementation(platform(project(":plugins:package-managers")))
Expand Down
2 changes: 1 addition & 1 deletion cli/src/funTest/kotlin/AnalyzerFunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ import java.util.concurrent.TimeUnit
import org.ossreviewtoolkit.analyzer.Analyzer
import org.ossreviewtoolkit.analyzer.PackageManager
import org.ossreviewtoolkit.analyzer.managers.analyze
import org.ossreviewtoolkit.downloader.vcs.GitRepo
import org.ossreviewtoolkit.model.Package
import org.ossreviewtoolkit.model.VcsInfo
import org.ossreviewtoolkit.model.VcsType
import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
import org.ossreviewtoolkit.model.config.PackageManagerConfiguration
import org.ossreviewtoolkit.model.config.RepositoryConfiguration
import org.ossreviewtoolkit.model.toYaml
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.GitRepo
import org.ossreviewtoolkit.utils.test.getAssetFile
import org.ossreviewtoolkit.utils.test.matchExpectedResult
import org.ossreviewtoolkit.utils.test.patchActualResult
Expand Down
12 changes: 0 additions & 12 deletions downloader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,5 @@ dependencies {

implementation(project(":utils:ort-utils"))

implementation(libs.jgit)
implementation(libs.jgitSshApacheAgent) {
exclude(group = "org.apache.sshd", module = "sshd-sftp")
.because("it is not required for cloning via SSH and causes issues with GraalVM native images")
}
implementation(libs.svnkit) {
exclude(group = "org.apache.sshd", module = "sshd-core")
.because("it is included in JGit's sshd-osgi dependency")
exclude(group = "org.apache.sshd", module = "sshd-common")
.because("it is included in JGit's sshd-osgi dependency")
}

testImplementation(libs.mockk)
}
2 changes: 1 addition & 1 deletion downloader/src/main/kotlin/VersionControlSystem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ abstract class VersionControlSystem(
/**
* Return glob patterns for files that should be checkout out in addition to explicit sparse checkout paths.
*/
internal fun getSparseCheckoutGlobPatterns(): List<String> {
fun getSparseCheckoutGlobPatterns(): List<String> {
val globPatterns = mutableListOf("*$ORT_REPO_CONFIG_FILENAME")
val licensePatterns = LicenseFilePatterns.getInstance()
return licensePatterns.allLicenseFilenames.generateCapitalizationVariants().mapTo(globPatterns) { "**/$it" }
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion downloader/src/test/kotlin/VersionControlSystemTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import java.io.File
import java.io.IOException
import java.lang.UnsupportedOperationException

import org.ossreviewtoolkit.downloader.vcs.Git
import org.ossreviewtoolkit.model.Package
import org.ossreviewtoolkit.model.VcsInfo
import org.ossreviewtoolkit.model.VcsType
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
import org.ossreviewtoolkit.utils.common.CommandLineTool

class VersionControlSystemTest : WordSpec({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import io.kotest.matchers.should

import org.ossreviewtoolkit.analyzer.managers.create
import org.ossreviewtoolkit.analyzer.managers.resolveSingleProject
import org.ossreviewtoolkit.downloader.vcs.Git
import org.ossreviewtoolkit.model.toYaml
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
import org.ossreviewtoolkit.utils.common.Os
import org.ossreviewtoolkit.utils.common.ProcessCapture
import org.ossreviewtoolkit.utils.test.ExpensiveTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import io.kotest.matchers.should

import org.ossreviewtoolkit.analyzer.managers.create
import org.ossreviewtoolkit.analyzer.managers.resolveSingleProject
import org.ossreviewtoolkit.downloader.vcs.Git
import org.ossreviewtoolkit.model.toYaml
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
import org.ossreviewtoolkit.utils.common.Os
import org.ossreviewtoolkit.utils.common.ProcessCapture
import org.ossreviewtoolkit.utils.test.ExpensiveTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.shouldBe

import org.ossreviewtoolkit.analyzer.managers.analyze
import org.ossreviewtoolkit.downloader.vcs.Git
import org.ossreviewtoolkit.model.toYaml
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
import org.ossreviewtoolkit.utils.test.getAssetFile
import org.ossreviewtoolkit.utils.test.matchExpectedResult
import org.ossreviewtoolkit.utils.test.patchActualResult
Expand Down
23 changes: 23 additions & 0 deletions plugins/version-control-systems/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
*
* 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
*
* https://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.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

plugins {
// Apply precompiled plugins.
id("ort-plugins-conventions")
}
45 changes: 45 additions & 0 deletions plugins/version-control-systems/git/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
*
* 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
*
* https://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.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

plugins {
// Apply precompiled plugins.
id("ort-library-conventions")
}

dependencies {
api(project(":downloader"))
api(project(":model"))
api(project(":utils:common-utils")) {
because("This is a CommandLineTool.")
}

api(libs.semver4j) {
because("This is a CommandLineTool.")
}

implementation(project(":utils:ort-utils"))

implementation(libs.jgit)
implementation(libs.jgitSshApacheAgent) {
exclude(group = "org.apache.sshd", module = "sshd-sftp")
.because("it is not required for cloning via SSH and causes issues with GraalVM native images")
}

testImplementation(libs.mockk)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.StringSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import io.kotest.core.spec.style.WordSpec
import io.kotest.engine.spec.tempdir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import io.kotest.core.spec.Spec
import io.kotest.core.spec.style.StringSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import io.kotest.core.spec.style.StringSpec
import io.kotest.engine.spec.tempdir
Expand Down Expand Up @@ -86,7 +86,7 @@ class GitWorkingTreeFunTest : StringSpec({
"plugins/package-managers/python/src/funTest/assets/projects/external/spdx-tools-python",
"plugins/package-managers/sbt/src/funTest/assets/projects/external/sbt-multi-project-example",
"plugins/package-managers/stack/src/funTest/assets/projects/external/quickcheck-state-machine"
).associateWith { VersionControlSystem.getPathInfo(File("../$it")) }
).associateWith { VersionControlSystem.getPathInfo(File("../../../$it")) }

git.getWorkingTree(File("..")).getNested() shouldBe expectedSubmodules
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import java.io.File
import java.io.IOException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import java.io.File
import java.io.IOException
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
org.ossreviewtoolkit.plugins.versioncontrolsystems.git.GitRepo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git

import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.WordSpec
Expand Down
37 changes: 37 additions & 0 deletions plugins/version-control-systems/mercurial/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
*
* 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
*
* https://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.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

plugins {
// Apply precompiled plugins.
id("ort-library-conventions")
}

dependencies {
api(project(":downloader"))
api(project(":model"))
api(project(":utils:common-utils")) {
because("This is a CommandLineTool.")
}

api(libs.semver4j) {
because("This is a CommandLineTool.")
}

implementation(project(":utils:ort-utils"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial

import io.kotest.core.spec.style.StringSpec
import io.kotest.core.test.TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial

import io.kotest.core.spec.style.StringSpec
import io.kotest.engine.spec.tempdir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial

import java.io.File

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial

import java.io.File

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial.Mercurial
38 changes: 38 additions & 0 deletions plugins/version-control-systems/subversion/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
*
* 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
*
* https://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.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

plugins {
// Apply precompiled plugins.
id("ort-library-conventions")
}

dependencies {
api(project(":downloader"))
api(project(":model"))

implementation(project(":utils:common-utils"))
implementation(project(":utils:ort-utils"))

implementation(libs.svnkit) {
exclude(group = "org.apache.sshd", module = "sshd-core")
.because("it is included in JGit's sshd-osgi dependency")
exclude(group = "org.apache.sshd", module = "sshd-common")
.because("it is included in JGit's sshd-osgi dependency")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.subversion

import io.kotest.core.spec.style.StringSpec
import io.kotest.core.test.TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.subversion

import io.kotest.core.spec.style.StringSpec
import io.kotest.engine.spec.tempdir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.downloader.vcs
package org.ossreviewtoolkit.plugins.versioncontrolsystems.subversion

import java.io.File
import java.net.InetSocketAddress
Expand Down
Loading

0 comments on commit 24853b4

Please sign in to comment.