diff --git a/cli/src/funTest/kotlin/OrtMainFunTest.kt b/cli/src/funTest/kotlin/OrtMainFunTest.kt index 782e80ee3eb48..a5d7e1c72bd24 100644 --- a/cli/src/funTest/kotlin/OrtMainFunTest.kt +++ b/cli/src/funTest/kotlin/OrtMainFunTest.kt @@ -39,11 +39,11 @@ import org.ossreviewtoolkit.model.OrtResult import org.ossreviewtoolkit.model.config.OrtConfiguration import org.ossreviewtoolkit.model.config.OrtConfigurationWrapper import org.ossreviewtoolkit.model.config.ProviderPluginConfiguration -import org.ossreviewtoolkit.model.config.REFERENCE_CONFIG_FILENAME import org.ossreviewtoolkit.model.readValue import org.ossreviewtoolkit.model.toYaml import org.ossreviewtoolkit.model.writeValue import org.ossreviewtoolkit.utils.common.EnvironmentVariableFilter +import org.ossreviewtoolkit.utils.ort.ORT_REFERENCE_CONFIG_FILENAME import org.ossreviewtoolkit.utils.test.getAssetFile import org.ossreviewtoolkit.utils.test.matchExpectedResult import org.ossreviewtoolkit.utils.test.patchActualResult @@ -228,7 +228,7 @@ class OrtMainFunTest : StringSpec() { } "EnvironmentVariableFilter is correctly initialized" { - val referenceConfigFile = File("../model/src/main/resources/$REFERENCE_CONFIG_FILENAME").absolutePath + val referenceConfigFile = File("../model/src/main/resources/$ORT_REFERENCE_CONFIG_FILENAME").absolutePath OrtMain().test( "-c", referenceConfigFile, diff --git a/model/src/main/kotlin/config/OrtConfiguration.kt b/model/src/main/kotlin/config/OrtConfiguration.kt index 7c8f97f7f9f27..f9113aac1bfcb 100644 --- a/model/src/main/kotlin/config/OrtConfiguration.kt +++ b/model/src/main/kotlin/config/OrtConfiguration.kt @@ -195,8 +195,3 @@ data class OrtConfiguration( data class OrtConfigurationWrapper( val ort: OrtConfiguration ) - -/** - * The filename of the reference configuration file. - */ -const val REFERENCE_CONFIG_FILENAME = "reference.yml" diff --git a/model/src/test/kotlin/JsonSchemaTest.kt b/model/src/test/kotlin/JsonSchemaTest.kt index c70f72809a783..ee65f1f4ce868 100644 --- a/model/src/test/kotlin/JsonSchemaTest.kt +++ b/model/src/test/kotlin/JsonSchemaTest.kt @@ -29,10 +29,10 @@ import io.kotest.matchers.should import java.io.File -import org.ossreviewtoolkit.model.config.REFERENCE_CONFIG_FILENAME import org.ossreviewtoolkit.utils.ort.ORT_LICENSE_CLASSIFICATIONS_FILENAME import org.ossreviewtoolkit.utils.ort.ORT_PACKAGE_CONFIGURATION_FILENAME import org.ossreviewtoolkit.utils.ort.ORT_PACKAGE_CURATIONS_FILENAME +import org.ossreviewtoolkit.utils.ort.ORT_REFERENCE_CONFIG_FILENAME import org.ossreviewtoolkit.utils.ort.ORT_REPO_CONFIG_FILENAME import org.ossreviewtoolkit.utils.ort.ORT_RESOLUTIONS_FILENAME @@ -88,7 +88,7 @@ class JsonSchemaTest : StringSpec({ "The embedded reference configuration validates successfully" { val ortConfigurationSchema = File("../integrations/schemas/ort-configuration-schema.json").toURI() - val referenceConfigFile = File("src/main/resources/$REFERENCE_CONFIG_FILENAME").toJsonNode() + val referenceConfigFile = File("src/main/resources/$ORT_REFERENCE_CONFIG_FILENAME").toJsonNode() val errors = schemaV7.getSchema(ortConfigurationSchema).validate(referenceConfigFile) diff --git a/model/src/test/kotlin/config/OrtConfigurationTest.kt b/model/src/test/kotlin/config/OrtConfigurationTest.kt index c5439b95cae05..89278f20a56c5 100644 --- a/model/src/test/kotlin/config/OrtConfigurationTest.kt +++ b/model/src/test/kotlin/config/OrtConfigurationTest.kt @@ -41,12 +41,13 @@ import java.lang.IllegalArgumentException import org.ossreviewtoolkit.model.Severity import org.ossreviewtoolkit.model.SourceCodeOrigin import org.ossreviewtoolkit.utils.common.EnvironmentVariableFilter +import org.ossreviewtoolkit.utils.ort.ORT_REFERENCE_CONFIG_FILENAME import org.ossreviewtoolkit.utils.test.shouldNotBeNull class OrtConfigurationTest : WordSpec({ "OrtConfiguration" should { "be deserializable from YAML" { - val refConfig = File("src/main/resources/$REFERENCE_CONFIG_FILENAME") + val refConfig = File("src/main/resources/$ORT_REFERENCE_CONFIG_FILENAME") val ortConfig = OrtConfiguration.load(file = refConfig) ortConfig.allowedProcessEnvironmentVariableNames should containExactlyInAnyOrder("PASSPORT", "USER_HOME") diff --git a/model/src/test/kotlin/config/ReporterConfigurationTest.kt b/model/src/test/kotlin/config/ReporterConfigurationTest.kt index f1a7d19b3e00a..526ea37e34edb 100644 --- a/model/src/test/kotlin/config/ReporterConfigurationTest.kt +++ b/model/src/test/kotlin/config/ReporterConfigurationTest.kt @@ -26,6 +26,7 @@ import java.io.File import org.ossreviewtoolkit.model.fromYaml import org.ossreviewtoolkit.model.toYaml +import org.ossreviewtoolkit.utils.ort.ORT_REFERENCE_CONFIG_FILENAME import org.ossreviewtoolkit.utils.test.shouldNotBeNull class ReporterConfigurationTest : WordSpec({ @@ -42,7 +43,7 @@ class ReporterConfigurationTest : WordSpec({ * Load the ORT reference configuration and extract the reporter configuration. */ private fun loadReporterConfig(): ReporterConfiguration = - OrtConfiguration.load(file = File("src/main/resources/$REFERENCE_CONFIG_FILENAME")).reporter + OrtConfiguration.load(file = File("src/main/resources/$ORT_REFERENCE_CONFIG_FILENAME")).reporter /** * Perform a serialization round-trip of the given reporter [config] and return the result. This is used to check diff --git a/model/src/test/kotlin/config/ScannerConfigurationTest.kt b/model/src/test/kotlin/config/ScannerConfigurationTest.kt index 864f8858ae220..cbffb4fa053e3 100644 --- a/model/src/test/kotlin/config/ScannerConfigurationTest.kt +++ b/model/src/test/kotlin/config/ScannerConfigurationTest.kt @@ -31,11 +31,12 @@ import java.io.File import org.ossreviewtoolkit.model.readValue import org.ossreviewtoolkit.model.writeValue +import org.ossreviewtoolkit.utils.ort.ORT_REFERENCE_CONFIG_FILENAME class ScannerConfigurationTest : WordSpec({ "ScannerConfiguration" should { "support a serialization round-trip via an ObjectMapper" { - val ortConfig = OrtConfiguration.load(file = File("src/main/resources/$REFERENCE_CONFIG_FILENAME")) + val ortConfig = OrtConfiguration.load(file = File("src/main/resources/$ORT_REFERENCE_CONFIG_FILENAME")) val rereadOrtConfig = tempfile(null, ".yml").run { writeValue(ortConfig) readValue() diff --git a/plugins/commands/config/src/main/kotlin/ConfigCommand.kt b/plugins/commands/config/src/main/kotlin/ConfigCommand.kt index eb7e05d47d36c..c8921e6f56e7d 100644 --- a/plugins/commands/config/src/main/kotlin/ConfigCommand.kt +++ b/plugins/commands/config/src/main/kotlin/ConfigCommand.kt @@ -30,10 +30,10 @@ import com.github.ajalt.clikt.parameters.types.file import org.ossreviewtoolkit.model.config.OrtConfiguration import org.ossreviewtoolkit.model.config.OrtConfigurationWrapper -import org.ossreviewtoolkit.model.config.REFERENCE_CONFIG_FILENAME import org.ossreviewtoolkit.plugins.commands.api.OrtCommand import org.ossreviewtoolkit.utils.common.collectMessages import org.ossreviewtoolkit.utils.common.expandTilde +import org.ossreviewtoolkit.utils.ort.ORT_REFERENCE_CONFIG_FILENAME class ConfigCommand : OrtCommand( name = "config", @@ -84,7 +84,7 @@ class ConfigCommand : OrtCommand( if (showReference) { echo("The reference configuration is:") echo() - echo(javaClass.getResource("/$REFERENCE_CONFIG_FILENAME").readText()) + echo(javaClass.getResource("/$ORT_REFERENCE_CONFIG_FILENAME").readText()) } checkSyntax?.run { diff --git a/utils/ort/src/main/kotlin/Constants.kt b/utils/ort/src/main/kotlin/Constants.kt index 756cf89902c2c..ee80e0bf7ba7f 100644 --- a/utils/ort/src/main/kotlin/Constants.kt +++ b/utils/ort/src/main/kotlin/Constants.kt @@ -49,6 +49,11 @@ const val ORT_DATA_DIR_ENV_NAME = "ORT_DATA_DIR" */ const val ORT_CONFIG_FILENAME = "config.yml" +/** + * The filename of the reference configuration file. + */ +const val ORT_REFERENCE_CONFIG_FILENAME = "reference.yml" + /** * The name of the ORT copyright garbage configuration file. */