Skip to content

Commit

Permalink
Merge pull request #119 from blackducksoftware/individualFileMatchPro…
Browse files Browse the repository at this point in the history
…perty

Individual file match property
  • Loading branch information
crowleySynopsys committed Feb 24, 2020
2 parents 11ba50e + 6f5697c commit ca3bf79
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 98,931 deletions.
98,913 changes: 0 additions & 98,913 deletions go-pear.phar

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ open class DetectConfigurationFactory(private val detectConfiguration: PropertyC
val dryRun = PropertyConfigUtils.getFirstProvidedValueOrDefault(detectConfiguration, DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_DRY_RUN, DetectProperties.DETECT_HUB_SIGNATURE_SCANNER_DRY_RUN)
val uploadSource = detectConfiguration.getValue(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_UPLOAD_SOURCE_MODE)
val licenseSearch = detectConfiguration.getValue(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_LICENSE_SEARCH);
val individualFileMatching = detectConfiguration.getValue(DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_INDIVIDUAL_FILE_MATCHING)
val codeLocationPrefix = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_CODELOCATION_PREFIX).orElse(null)
val codeLocationSuffix = detectConfiguration.getValue(DetectProperties.DETECT_PROJECT_CODELOCATION_SUFFIX).orElse(null)
val additionalArguments = PropertyConfigUtils.getFirstProvidedValueOrEmpty(detectConfiguration, DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_ARGUMENTS, DetectProperties.DETECT_HUB_SIGNATURE_SCANNER_ARGUMENTS).orElse(null)
Expand Down Expand Up @@ -347,7 +348,8 @@ open class DetectConfigurationFactory(private val detectConfiguration: PropertyC
codeLocationSuffix = codeLocationSuffix,
additionalArguments = additionalArguments,
maxDepth = maxDepth,
licenseSearch = licenseSearch
licenseSearch = licenseSearch,
individualFileMatching = individualFileMatching
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ import com.synopsys.integration.configuration.property.types.string.StringListPr
import com.synopsys.integration.configuration.property.types.string.StringProperty
import com.synopsys.integration.detect.DetectMajorVersion
import com.synopsys.integration.detect.DetectTool
import com.synopsys.integration.detect.configuration.enums.DefaultVersionNameScheme
import com.synopsys.integration.detect.configuration.enums.IndividualFileMatchMode
import com.synopsys.integration.detect.tool.signaturescanner.enums.ExtendedSnippetMode
import com.synopsys.integration.detect.workflow.bdio.AggregateMode
import com.synopsys.integration.detectable.detectables.bazel.WorkspaceRule
import com.synopsys.integration.detector.base.DetectorType
Expand All @@ -54,19 +57,6 @@ import kotlin.reflect.full.companionObject
import kotlin.reflect.full.companionObjectInstance
import kotlin.reflect.full.memberProperties

enum class DefaultVersionNameScheme {
TIMESTAMP,
DEFAULT
}

enum class ExtendedPolicySeverityType {
NONE
}

enum class ExtendedSnippetMode {
NONE
}

class DetectProperties {
companion object {
//#region Active Properties
Expand Down Expand Up @@ -246,6 +236,11 @@ class DetectProperties {
setHelp("A comma-separated list of values to be used with the Signature Scanner --exclude flag.", "Each pattern provided is passed to the signature scanner (Black Duck scan CLI) as a value for an --exclude option. The signature scanner requires that these exclusion patterns start and end with a forward slash (/) and may not contain double asterisks (**). These patterns will be added to the paths created from detect.blackduck.signature.scanner.exclusion.name.patterns and passed as --exclude values. Use this property to pass patterns directly to the signature scanner as-is. For example: suppose you are running in bash on Linux, and have a subdirectory named blackduck-common that you want to exclude from signature scanning. Any of the following would exclude it: --detect.blackduck.signature.scanner.exclusion.patterns=/blackduck-common/, --detect.blackduck.signature.scanner.exclusion.patterns='/blackduck-common/', --detect.blackduck.signature.scanner.exclusion.patterns='/blackduck-*/'. Use detect.blackduck.signature.scanner.exclusion.name.patterns when you want Detect to convert the given patterns to actual paths.")
setGroups(DetectGroup.SignatureScanner, DetectGroup.SourceScan)
}
val DETECT_BLACKDUCK_SIGNATURE_SCANNER_INDIVIDUAL_FILE_MATCHING = EnumProperty("detect.blackduck.signature.scanner.individual.file.matching", IndividualFileMatchMode.NONE, IndividualFileMatchMode::class.java).apply {
setInfo("Individual File Matching", "6.2.0")
setHelp("Users may set this property to indicate what types of files they want to match")
setGroups(DetectGroup.SignatureScanner)
}
val DETECT_BLACKDUCK_SIGNATURE_SCANNER_HOST_URL = NullableStringProperty("detect.blackduck.signature.scanner.host.url").apply {
setInfo("Signature Scanner Host URL", "4.2.0")
setHelp("If this url is set, an attempt will be made to use it to download the signature scanner. The server url provided must respect the Black Duck's urls for different operating systems.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* synopsys-detect
*
* Copyright (c) 2020 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.synopsys.integration.detect.configuration.enums

enum class DefaultVersionNameScheme {
TIMESTAMP,
DEFAULT
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* synopsys-detect
*
* Copyright (c) 2020 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.synopsys.integration.detect.configuration.enums

enum class ExtendedPolicySeverityType {
NONE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* synopsys-detect
*
* Copyright (c) 2020 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.synopsys.integration.detect.configuration.enums

enum class IndividualFileMatchMode {
NONE,
ALL,
BINARY,
SOURCE
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class BlackDuckSignatureScanner(
scanJobBuilder.dryRun(signatureScannerOptions.dryRun)
scanJobBuilder.cleanupOutput(false)

if (signatureScannerOptions.uploadSource && signatureScannerOptions.snippetMatching == null && signatureScannerOptions.licenseSearch == null) {
if (signatureScannerOptions.uploadSource && signatureScannerOptions.snippetMatching == null && !signatureScannerOptions.licenseSearch) {
throw DetectUserFriendlyException("You must enable snippet matching using " + DetectProperties.DETECT_BLACKDUCK_SIGNATURE_SCANNER_SNIPPET_MATCHING.key + " in order to use upload source.",
ExitCodeType.FAILURE_CONFIGURATION)
}
Expand All @@ -207,6 +207,9 @@ class BlackDuckSignatureScanner(
val licenseSearch = signatureScannerOptions.licenseSearch
scanJobBuilder.licenseSearch(licenseSearch)

val individualFileMatching = signatureScannerOptions.individualFileMatching
scanJobBuilder.individualFileMatching(individualFileMatching?.name)

val sourcePath = directoryManager.sourceDirectory
val prefix = signatureScannerOptions.codeLocationPrefix
val suffix = signatureScannerOptions.codeLocationSuffix
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package com.synopsys.integration.detect.tool.signaturescanner

import com.synopsys.integration.blackduck.codelocation.signaturescanner.command.SnippetMatching
import com.synopsys.integration.detect.configuration.enums.IndividualFileMatchMode
import java.nio.file.Path

class BlackDuckSignatureScannerOptions(
Expand All @@ -41,5 +42,6 @@ class BlackDuckSignatureScannerOptions(
val codeLocationSuffix: String?,
val additionalArguments: String?,
val maxDepth: Int,
val individualFileMatching: IndividualFileMatchMode?,
val licenseSearch: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* synopsys-detect
*
* Copyright (c) 2020 Synopsys, Inc.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.synopsys.integration.detect.tool.signaturescanner.enums

enum class ExtendedSnippetMode {
NONE
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.slf4j.LoggerFactory;

import com.synopsys.integration.detect.DetectTool;
import com.synopsys.integration.detect.configuration.DefaultVersionNameScheme;
import com.synopsys.integration.detect.configuration.enums.DefaultVersionNameScheme;
import com.synopsys.integration.detect.exception.DetectUserFriendlyException;
import com.synopsys.integration.util.NameVersion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
package com.synopsys.integration.detect.workflow.project;

import com.synopsys.integration.detect.configuration.DefaultVersionNameScheme;
import com.synopsys.integration.detect.configuration.enums.DefaultVersionNameScheme;

public class ProjectNameVersionOptions {
public final String sourcePathName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class ProductDeciderTest {
)
)
whenever(detectConfigurationFactory.createBlackDuckSignatureScannerOptions()).thenReturn(
BlackDuckSignatureScannerOptions(listOf(), listOf(), listOf(), null, null, null, 1024, 1, false, null, false, null, null, null, 1, false)
BlackDuckSignatureScannerOptions(listOf(), listOf(), listOf(), null, null, null, 1024, 1, false, null, false, null, null, null, 1, null, false)
)
}

Expand Down

0 comments on commit ca3bf79

Please sign in to comment.