Skip to content

Commit

Permalink
build(Gradle): Move advisors to individual plugin projects
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 3, 2023
1 parent ae37645 commit df5ede2
Show file tree
Hide file tree
Showing 39 changed files with 235 additions and 37 deletions.
11 changes: 2 additions & 9 deletions advisor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,11 @@ plugins {

dependencies {
api(project(":model"))
api(project(":utils:common-utils"))

implementation(project(":clients:github-graphql-client"))
implementation(project(":clients:nexus-iq-client"))
implementation(project(":clients:oss-index-client"))
implementation(project(":clients:osv-client"))
implementation(project(":clients:vulnerable-code-client"))
implementation(project(":utils:ort-utils"))

implementation(libs.cvssCalculator)
implementation(libs.bundles.kotlinxSerialization)
implementation(libs.kotlinxCoroutines)
implementation(libs.ktorClientOkHttp)

testImplementation(libs.mockk)
testImplementation(libs.wiremock)
}

This file was deleted.

23 changes: 23 additions & 0 deletions plugins/advisors/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")
}
37 changes: 37 additions & 0 deletions plugins/advisors/github/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2020 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(":advisor"))
api(project(":model"))

implementation(project(":clients:github-graphql-client"))
implementation(project(":utils:common-utils"))
implementation(project(":utils:ort-utils"))

implementation(libs.kotlinxCoroutines)
implementation(libs.ktorClientOkHttp)

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.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.github

import io.ktor.client.HttpClient
import io.ktor.client.engine.okhttp.OkHttp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.github

/**
* The configuration for the GitHub Defects advisor.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.ossreviewtoolkit.plugins.advisors.github.GitHubDefects$Factory
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.github

import io.kotest.core.spec.style.WordSpec
import io.kotest.matchers.collections.beEmpty
Expand Down
32 changes: 32 additions & 0 deletions plugins/advisors/nexus-iq/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2020 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(":advisor"))
api(project(":model"))

implementation(project(":clients:nexus-iq-client"))
implementation(project(":utils:common-utils"))
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.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.nexusiq

import java.net.URI
import java.time.Duration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.nexusiq

/**
* The configuration for Nexus IQ as a security vulnerability provider.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.ossreviewtoolkit.plugins.advisors.nexusiq.NexusIq$Factory
34 changes: 34 additions & 0 deletions plugins/advisors/oss-index/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2020 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(":advisor"))
api(project(":model"))

implementation(project(":clients:oss-index-client"))
implementation(project(":utils:common-utils"))
implementation(project(":utils:ort-utils"))

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

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.ossindex

import java.net.URI
import java.time.Instant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.ossindex

/**
* The configuration for the OSS Index provider.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.ossreviewtoolkit.plugins.advisors.ossindex.OssIndex$Factory
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.ossindex

import com.github.tomakehurst.wiremock.WireMockServer
import com.github.tomakehurst.wiremock.client.WireMock.aResponse
Expand Down Expand Up @@ -140,7 +140,6 @@ class OssIndexTest : WordSpec({
private const val ADVISOR_NAME = "OssIndexTest"

private const val TEST_FILES_ROOT = "src/test/assets"
private const val TEST_FILES_DIRECTORY = "oss-index"

private val ID_HAMCREST = Identifier("Maven:org.hamcrest:hamcrest-core:1.3")
private val ID_JUNIT = Identifier("Maven:junit:junit:4.12")
Expand All @@ -158,7 +157,7 @@ private fun WireMockServer.stubComponentsRequest(responseFile: String) {
.withHeader("Content-Type", equalTo("application/json; charset=UTF-8"))
.willReturn(
aResponse().withStatus(200)
.withBodyFile("$TEST_FILES_DIRECTORY/$responseFile")
.withBodyFile(responseFile)
)
)
}
47 changes: 47 additions & 0 deletions plugins/advisors/osv/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2020 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
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

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

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

implementation(project(":clients:osv-client"))
implementation(project(":utils:common-utils"))
implementation(project(":utils:ort-utils"))

implementation(libs.cvssCalculator)
implementation(libs.bundles.kotlinxSerialization)
}

tasks.withType<KotlinCompile>().configureEach {
val customCompilerArgs = listOf(
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi"
)

compilerOptions {
freeCompilerArgs.addAll(customCompilerArgs)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor
package org.ossreviewtoolkit.plugins.advisors.osv

import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
import io.kotest.matchers.shouldBe

import java.time.Instant

import org.ossreviewtoolkit.advisor.advisors.Osv
import org.ossreviewtoolkit.advisor.advisors.OsvConfiguration
import org.ossreviewtoolkit.model.AdvisorResult
import org.ossreviewtoolkit.model.Identifier
import org.ossreviewtoolkit.model.Package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.osv

import java.time.Instant

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

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.osv

/**
* The configuration for the Google OSV vulnerability provider.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.ossreviewtoolkit.plugins.advisors.osv.Osv$Factory
34 changes: 34 additions & 0 deletions plugins/advisors/vulnerable-code/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2020 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(":advisor"))
api(project(":model"))

implementation(project(":clients:vulnerable-code-client"))
implementation(project(":utils:common-utils"))
implementation(project(":utils:ort-utils"))

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

package org.ossreviewtoolkit.advisor
package org.ossreviewtoolkit.plugins.advisors.vulnerablecode

import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.collections.shouldContainAll
import io.kotest.matchers.shouldBe

import org.ossreviewtoolkit.advisor.advisors.VulnerableCode
import org.ossreviewtoolkit.advisor.advisors.VulnerableCodeConfiguration
import org.ossreviewtoolkit.model.Identifier
import org.ossreviewtoolkit.model.Package
import org.ossreviewtoolkit.model.utils.toPurl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.advisor.advisors
package org.ossreviewtoolkit.plugins.advisors.vulnerablecode

import java.net.URI
import java.time.Instant
Expand Down
Loading

0 comments on commit df5ede2

Please sign in to comment.