21
21
import org .jfrog .build .extractor .nuget .types .NugetProjectAssets ;
22
22
import org .jfrog .build .extractor .packageManager .PackageManagerExtractor ;
23
23
24
- import java .io .BufferedWriter ;
25
- import java .io .PrintWriter ;
26
24
import java .io .File ;
27
- import java .io .FileWriter ;
28
25
import java .io .IOException ;
26
+ import java .io .PrintWriter ;
29
27
import java .nio .file .Files ;
30
28
import java .nio .file .Path ;
31
29
import java .nio .file .Paths ;
@@ -44,11 +42,6 @@ public class NugetRun extends PackageManagerExtractor {
44
42
private static final String PACKAGES_CONFIG = "packages.config" ;
45
43
private static final String PROJECT_ASSETS = "project.assets.json" ;
46
44
private static final String PROJECT_ASSETS_DIR = "obj" ;
47
- private static final String CONFIG_FILE_TEMPLATE = "<?xml version=\" 1.0\" encoding=\" utf-8\" ?>\n "
48
- + "<configuration>\n "
49
- + "\t <packageSources>\n \t </packageSources>\n "
50
- + "\t <packageSourceCredentials>\n \t </packageSourceCredentials>\n "
51
- + "</configuration>" ;
52
45
private static final String CONFIG_FILE_FORMAT = "<?xml version=\" 1.0\" encoding=\" utf-8\" ?>\n " +
53
46
"<configuration>\n " +
54
47
"\t <packageSources>\n " +
@@ -90,15 +83,15 @@ public class NugetRun extends PackageManagerExtractor {
90
83
*
91
84
* @param clientBuilder - Build Info client builder.
92
85
* @param resolutionRepo - The repository it'll resolve from.
93
- * @param useDotnetCli -
86
+ * @param useDotnetCli - Boolean indicates if .Net cli will be used.
94
87
* @param nugetCmdArgs - NuGet exec args.
95
88
* @param logger - The logger.
96
89
* @param path - Path to the directory containing the .sln file.
97
90
* @param env - Environment variables to use during npm execution.
98
- * @param module -
99
- * @param username - JFrog platfrom username.
100
- * @param password - JFrog platfrom password.
101
- * @param apiProtocol - A string indicates which NuGet protocol should be used (V2/V3).
91
+ * @param module - NuGet module
92
+ * @param username - JFrog platform username.
93
+ * @param password - JFrog platform password.
94
+ * @param apiProtocol - A string indicates which NuGet protocol should be used (V2/V3).
102
95
*/
103
96
104
97
public NugetRun (ArtifactoryDependenciesClientBuilder clientBuilder , String resolutionRepo , boolean useDotnetCli , String nugetCmdArgs , Log logger , Path path , Map <String , String > env , String module , String username , String password , String apiProtocol ) {
@@ -380,11 +373,12 @@ private void singleProjectHandler(String projectName, String csprojPath, String
380
373
* Iterate the dependencies sources list and look for the project's source
381
374
*/
382
375
private String getDependenciesSource (String projectName , String csprojPath ) {
383
- String projectRootPath = ( new File ( csprojPath )) .getParent ();
376
+ Path projectRootPath = Paths . get ( csprojPath ).getParent (). normalize ();
384
377
String projectNamePattern = File .separator + projectName + File .separator ;
385
378
String projectPathPattern = projectRootPath + File .separator + PROJECT_ASSETS_DIR + File .separator ;
386
379
for (String source : dependenciesSources ) {
387
- if ( (new File (source )).getParent ().equals (projectRootPath ) || source .contains (projectNamePattern ) || source .contains (projectPathPattern )) {
380
+ Path sourceRootPath = Paths .get (source ).getParent ().normalize ();
381
+ if (sourceRootPath .equals (projectRootPath ) || source .contains (projectNamePattern ) || source .contains (projectPathPattern )) {
388
382
return source ;
389
383
}
390
384
}
0 commit comments