Skip to content

Commit 11d9abd

Browse files
committed
build: Move all VCS plugins to separate Gradle projects
This resolves #6602. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 8119706 commit 11d9abd

36 files changed

+174
-38
lines changed

cli/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies {
4747
"pluginClasspath"(platform(project(":plugins:package-managers")))
4848
"pluginClasspath"(platform(project(":plugins:reporters")))
4949
"pluginClasspath"(platform(project(":plugins:scanners")))
50+
"pluginClasspath"(platform(project(":plugins:version-control-systems")))
5051

5152
funTestImplementation(platform(project(":plugins:commands")))
5253
funTestImplementation(platform(project(":plugins:package-managers")))

cli/src/funTest/kotlin/AnalyzerFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ import java.util.concurrent.TimeUnit
2929
import org.ossreviewtoolkit.analyzer.Analyzer
3030
import org.ossreviewtoolkit.analyzer.PackageManager
3131
import org.ossreviewtoolkit.analyzer.managers.analyze
32-
import org.ossreviewtoolkit.downloader.vcs.GitRepo
3332
import org.ossreviewtoolkit.model.Package
3433
import org.ossreviewtoolkit.model.VcsInfo
3534
import org.ossreviewtoolkit.model.VcsType
3635
import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
3736
import org.ossreviewtoolkit.model.config.PackageManagerConfiguration
3837
import org.ossreviewtoolkit.model.config.RepositoryConfiguration
3938
import org.ossreviewtoolkit.model.toYaml
39+
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.GitRepo
4040
import org.ossreviewtoolkit.utils.test.getAssetFile
4141
import org.ossreviewtoolkit.utils.test.matchExpectedResult
4242
import org.ossreviewtoolkit.utils.test.patchActualResult

downloader/build.gradle.kts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,7 @@ dependencies {
2727

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

30-
implementation(libs.jgit)
31-
implementation(libs.jgitSshApacheAgent) {
32-
exclude(group = "org.apache.sshd", module = "sshd-sftp")
33-
.because("it is not required for cloning via SSH and causes issues with GraalVM native images")
34-
}
35-
implementation(libs.svnkit) {
36-
exclude(group = "org.apache.sshd", module = "sshd-core")
37-
.because("it is included in JGit's sshd-osgi dependency")
38-
exclude(group = "org.apache.sshd", module = "sshd-common")
39-
.because("it is included in JGit's sshd-osgi dependency")
40-
}
30+
funTestImplementation(platform(project(":plugins:version-control-systems")))
4131

4232
testImplementation(libs.mockk)
4333
}

downloader/src/main/kotlin/VersionControlSystem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ abstract class VersionControlSystem(
156156
/**
157157
* Return glob patterns for files that should be checkout out in addition to explicit sparse checkout paths.
158158
*/
159-
internal fun getSparseCheckoutGlobPatterns(): List<String> {
159+
fun getSparseCheckoutGlobPatterns(): List<String> {
160160
val globPatterns = mutableListOf("*$ORT_REPO_CONFIG_FILENAME")
161161
val licensePatterns = LicenseFilePatterns.getInstance()
162162
return licensePatterns.allLicenseFilenames.generateCapitalizationVariants().mapTo(globPatterns) { "**/$it" }

downloader/src/main/resources/META-INF/services/org.ossreviewtoolkit.downloader.VersionControlSystem

Lines changed: 0 additions & 4 deletions
This file was deleted.

downloader/src/test/kotlin/VersionControlSystemTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ import java.io.File
3030
import java.io.IOException
3131
import java.lang.UnsupportedOperationException
3232

33-
import org.ossreviewtoolkit.downloader.vcs.Git
3433
import org.ossreviewtoolkit.model.Package
3534
import org.ossreviewtoolkit.model.VcsInfo
3635
import org.ossreviewtoolkit.model.VcsType
36+
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
3737
import org.ossreviewtoolkit.utils.common.CommandLineTool
3838

3939
class VersionControlSystemTest : WordSpec({

plugins/package-managers/gradle-inspector/src/funTest/kotlin/GradleFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import io.kotest.matchers.should
2929

3030
import org.ossreviewtoolkit.analyzer.managers.create
3131
import org.ossreviewtoolkit.analyzer.managers.resolveSingleProject
32-
import org.ossreviewtoolkit.downloader.vcs.Git
3332
import org.ossreviewtoolkit.model.toYaml
33+
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
3434
import org.ossreviewtoolkit.utils.common.Os
3535
import org.ossreviewtoolkit.utils.common.ProcessCapture
3636
import org.ossreviewtoolkit.utils.test.ExpensiveTag

plugins/package-managers/gradle/src/funTest/kotlin/GradleFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import io.kotest.matchers.should
2929

3030
import org.ossreviewtoolkit.analyzer.managers.create
3131
import org.ossreviewtoolkit.analyzer.managers.resolveSingleProject
32-
import org.ossreviewtoolkit.downloader.vcs.Git
3332
import org.ossreviewtoolkit.model.toYaml
33+
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
3434
import org.ossreviewtoolkit.utils.common.Os
3535
import org.ossreviewtoolkit.utils.common.ProcessCapture
3636
import org.ossreviewtoolkit.utils.test.ExpensiveTag

plugins/package-managers/sbt/src/funTest/kotlin/SbtFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import io.kotest.core.spec.style.StringSpec
2323
import io.kotest.matchers.shouldBe
2424

2525
import org.ossreviewtoolkit.analyzer.managers.analyze
26-
import org.ossreviewtoolkit.downloader.vcs.Git
2726
import org.ossreviewtoolkit.model.toYaml
27+
import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
2828
import org.ossreviewtoolkit.utils.test.getAssetFile
2929
import org.ossreviewtoolkit.utils.test.matchExpectedResult
3030
import org.ossreviewtoolkit.utils.test.patchActualResult
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
plugins {
21+
// Apply precompiled plugins.
22+
id("ort-plugins-conventions")
23+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
plugins {
21+
// Apply precompiled plugins.
22+
id("ort-library-conventions")
23+
}
24+
25+
dependencies {
26+
api(project(":downloader"))
27+
api(project(":model"))
28+
api(project(":utils:common-utils")) {
29+
because("This is a CommandLineTool.")
30+
}
31+
32+
api(libs.semver4j) {
33+
because("This is a CommandLineTool.")
34+
}
35+
36+
implementation(project(":utils:ort-utils"))
37+
38+
implementation(libs.jgit)
39+
implementation(libs.jgitSshApacheAgent) {
40+
exclude(group = "org.apache.sshd", module = "sshd-sftp")
41+
.because("it is not required for cloning via SSH and causes issues with GraalVM native images")
42+
}
43+
44+
testImplementation(libs.mockk)
45+
}

downloader/src/funTest/kotlin/vcs/GitDownloadFunTest.kt renamed to plugins/version-control-systems/git/src/funTest/kotlin/GitDownloadFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

2222
import io.kotest.assertions.throwables.shouldThrow
2323
import io.kotest.core.spec.style.StringSpec

downloader/src/funTest/kotlin/vcs/GitFunTest.kt renamed to plugins/version-control-systems/git/src/funTest/kotlin/GitFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

2222
import io.kotest.core.spec.style.WordSpec
2323
import io.kotest.engine.spec.tempdir

downloader/src/funTest/kotlin/vcs/GitRepoDownloadFunTest.kt renamed to plugins/version-control-systems/git/src/funTest/kotlin/GitRepoDownloadFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

2222
import io.kotest.core.spec.Spec
2323
import io.kotest.core.spec.style.StringSpec

downloader/src/funTest/kotlin/vcs/GitWorkingTreeFunTest.kt renamed to plugins/version-control-systems/git/src/funTest/kotlin/GitWorkingTreeFunTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

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

9191
git.getWorkingTree(File("..")).getNested() shouldBe expectedSubmodules
9292
}

downloader/src/main/kotlin/vcs/Git.kt renamed to plugins/version-control-systems/git/src/main/kotlin/Git.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

2222
import java.io.File
2323
import java.io.IOException

downloader/src/main/kotlin/vcs/GitRepo.kt renamed to plugins/version-control-systems/git/src/main/kotlin/GitRepo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

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

downloader/src/main/kotlin/vcs/GitWorkingTree.kt renamed to plugins/version-control-systems/git/src/main/kotlin/GitWorkingTree.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

2222
import java.io.File
2323
import java.io.IOException
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git
2+
org.ossreviewtoolkit.plugins.versioncontrolsystems.git.GitRepo

downloader/src/test/kotlin/vcs/GitTest.kt renamed to plugins/version-control-systems/git/src/test/kotlin/GitTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.git
2121

2222
import io.kotest.assertions.throwables.shouldThrow
2323
import io.kotest.core.spec.style.WordSpec
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
plugins {
21+
// Apply precompiled plugins.
22+
id("ort-library-conventions")
23+
}
24+
25+
dependencies {
26+
api(project(":downloader"))
27+
api(project(":model"))
28+
api(project(":utils:common-utils")) {
29+
because("This is a CommandLineTool.")
30+
}
31+
32+
api(libs.semver4j) {
33+
because("This is a CommandLineTool.")
34+
}
35+
36+
implementation(project(":utils:ort-utils"))
37+
}

downloader/src/funTest/kotlin/vcs/MercurialDownloadFunTest.kt renamed to plugins/version-control-systems/mercurial/src/funTest/kotlin/MercurialDownloadFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial
2121

2222
import io.kotest.core.spec.style.StringSpec
2323
import io.kotest.core.test.TestCase

downloader/src/funTest/kotlin/vcs/MercurialWorkingTreeFunTest.kt renamed to plugins/version-control-systems/mercurial/src/funTest/kotlin/MercurialWorkingTreeFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial
2121

2222
import io.kotest.core.spec.style.StringSpec
2323
import io.kotest.engine.spec.tempdir

downloader/src/main/kotlin/vcs/Mercurial.kt renamed to plugins/version-control-systems/mercurial/src/main/kotlin/Mercurial.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial
2121

2222
import java.io.File
2323

downloader/src/main/kotlin/vcs/MercurialWorkingTree.kt renamed to plugins/version-control-systems/mercurial/src/main/kotlin/MercurialWorkingTree.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial
2121

2222
import java.io.File
2323

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.ossreviewtoolkit.plugins.versioncontrolsystems.mercurial.Mercurial
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
plugins {
21+
// Apply precompiled plugins.
22+
id("ort-library-conventions")
23+
}
24+
25+
dependencies {
26+
api(project(":downloader"))
27+
api(project(":model"))
28+
29+
implementation(project(":utils:common-utils"))
30+
implementation(project(":utils:ort-utils"))
31+
32+
implementation(libs.svnkit) {
33+
exclude(group = "org.apache.sshd", module = "sshd-core")
34+
.because("it is included in JGit's sshd-osgi dependency")
35+
exclude(group = "org.apache.sshd", module = "sshd-common")
36+
.because("it is included in JGit's sshd-osgi dependency")
37+
}
38+
}

downloader/src/funTest/kotlin/vcs/SubversionDownloadFunTest.kt renamed to plugins/version-control-systems/subversion/src/funTest/kotlin/SubversionDownloadFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.subversion
2121

2222
import io.kotest.core.spec.style.StringSpec
2323
import io.kotest.core.test.TestCase

downloader/src/funTest/kotlin/vcs/SubversionWorkingTreeFunTest.kt renamed to plugins/version-control-systems/subversion/src/funTest/kotlin/SubversionWorkingTreeFunTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.subversion
2121

2222
import io.kotest.core.spec.style.StringSpec
2323
import io.kotest.engine.spec.tempdir

downloader/src/main/kotlin/vcs/Subversion.kt renamed to plugins/version-control-systems/subversion/src/main/kotlin/Subversion.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* License-Filename: LICENSE
1818
*/
1919

20-
package org.ossreviewtoolkit.downloader.vcs
20+
package org.ossreviewtoolkit.plugins.versioncontrolsystems.subversion
2121

2222
import java.io.File
2323
import java.net.InetSocketAddress

0 commit comments

Comments
 (0)