diff --git a/src/main/java/com/fortify/plugin/jenkins/steps/CloudScanStart.java b/src/main/java/com/fortify/plugin/jenkins/steps/CloudScanStart.java index e53d4a4..c166081 100644 --- a/src/main/java/com/fortify/plugin/jenkins/steps/CloudScanStart.java +++ b/src/main/java/com/fortify/plugin/jenkins/steps/CloudScanStart.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Set; +import com.fortify.plugin.jenkins.steps.remote.*; import hudson.model.Item; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.tuple.Pair; @@ -38,12 +39,6 @@ import org.kohsuke.stapler.verb.POST; import com.fortify.plugin.jenkins.FortifyPlugin; -import com.fortify.plugin.jenkins.steps.remote.GradleProjectType; -import com.fortify.plugin.jenkins.steps.remote.MSBuildProjectType; -import com.fortify.plugin.jenkins.steps.remote.MavenProjectType; -import com.fortify.plugin.jenkins.steps.remote.PhpProjectType; -import com.fortify.plugin.jenkins.steps.remote.PythonProjectType; -import com.fortify.plugin.jenkins.steps.remote.RemoteAnalysisProjectType; import com.google.common.collect.ImmutableSet; import hudson.AbortException; @@ -96,6 +91,8 @@ public String getBuildTool() { return "mvn"; } else if (getRemoteAnalysisProjectType() instanceof MSBuildProjectType) { return "msbuild"; + } else if (getRemoteAnalysisProjectType() instanceof DotNetProjectType) { + return "dotnet"; } else { return "none"; } @@ -108,6 +105,8 @@ public String getBuildFile() { return ((MavenProjectType)remoteAnalysisProjectType).getBuildFile(); } else if (getRemoteAnalysisProjectType() instanceof MSBuildProjectType) { return ((MSBuildProjectType)remoteAnalysisProjectType).getDotnetProject(); + } else if (getRemoteAnalysisProjectType() instanceof DotNetProjectType) { + return ((DotNetProjectType)remoteAnalysisProjectType).getDotnetProject(); } else { return ""; } diff --git a/src/main/java/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType.java b/src/main/java/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType.java new file mode 100644 index 0000000..e9a584c --- /dev/null +++ b/src/main/java/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright 2019-2023 Open Text. + * + * Licensed under the MIT License (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://opensource.org/licenses/MIT + * + * 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.fortify.plugin.jenkins.steps.remote; + +import com.fortify.plugin.jenkins.steps.Validators; +import hudson.Extension; +import hudson.util.FormValidation; +import org.jenkinsci.Symbol; +import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.DataBoundSetter; +import org.kohsuke.stapler.QueryParameter; +import org.apache.commons.lang.StringUtils; + +public class DotNetProjectType extends RemoteAnalysisProjectType { + + private String dotnetProject; + private boolean excludeDisabledProjects; + + @DataBoundConstructor + public DotNetProjectType() { + } + + public String getDotnetProject() { + return dotnetProject; + } + + public boolean isExcludeDisabledProjects() { + return excludeDisabledProjects; + } + + @DataBoundSetter + public void setDotnetProject(String dotnetProject) { + this.dotnetProject = StringUtils.isBlank(dotnetProject) ? null : dotnetProject; + } + + @DataBoundSetter + public void setExcludeDisabledProjects(boolean excludeDisabledProjects) { + this.excludeDisabledProjects = excludeDisabledProjects; + } + + @Extension + @Symbol("fortifyDotNet") + public static final class DescriptorImpl extends RemoteAnalysisProjectTypeDescriptor { + public DescriptorImpl() { + super(DotNetProjectType.class); + } + + @Override + public String getDisplayName() { + return "dotnet"; + } + + } + + public static final RemoteAnalysisProjectTypeDescriptor DESCRIPTOR = new DotNetProjectType.DescriptorImpl(); +} \ No newline at end of file diff --git a/src/main/java/com/fortify/plugin/jenkins/steps/remote/MSBuildProjectType.java b/src/main/java/com/fortify/plugin/jenkins/steps/remote/MSBuildProjectType.java index 4bba8de..3e0a902 100644 --- a/src/main/java/com/fortify/plugin/jenkins/steps/remote/MSBuildProjectType.java +++ b/src/main/java/com/fortify/plugin/jenkins/steps/remote/MSBuildProjectType.java @@ -59,7 +59,7 @@ public DescriptorImpl() { @Override public String getDisplayName() { - return ".NET MSBuild"; + return ".NET MSBuild (Windows only)"; } public FormValidation doCheckDotnetProject(@QueryParameter String value) { diff --git a/src/main/resources/com/fortify/plugin/jenkins/FortifyPlugin/config.jelly b/src/main/resources/com/fortify/plugin/jenkins/FortifyPlugin/config.jelly index 585a962..06c55e6 100644 --- a/src/main/resources/com/fortify/plugin/jenkins/FortifyPlugin/config.jelly +++ b/src/main/resources/com/fortify/plugin/jenkins/FortifyPlugin/config.jelly @@ -49,7 +49,7 @@ + checked="${instance.isRemote()}" help="/plugin/fortify/help-remoteSCATranslationAndScan.html"> @@ -59,12 +59,12 @@ - + - + - + @@ -75,7 +75,7 @@ - + diff --git a/src/main/resources/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType/config.jelly b/src/main/resources/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType/config.jelly new file mode 100644 index 0000000..ac5e03e --- /dev/null +++ b/src/main/resources/com/fortify/plugin/jenkins/steps/remote/DotNetProjectType/config.jelly @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/help-dotnetProjects.html b/src/main/webapp/help-dotnetProjects.html new file mode 100644 index 0000000..b36f37a --- /dev/null +++ b/src/main/webapp/help-dotnetProjects.html @@ -0,0 +1,20 @@ + +
+

+ (Optional) Project or solution file for Fortify SCA analysis. If a project or solution file isn't specified, the dotnet build command searches the current working directory for a file that has a file extension that ends in either proj or sln and uses that file. +

+