3
3
import com .fasterxml .jackson .annotation .JsonInclude ;
4
4
import com .fasterxml .jackson .core .type .TypeReference ;
5
5
import com .fasterxml .jackson .databind .ObjectMapper ;
6
- import com .fasterxml .jackson .databind .exc .MismatchedInputException ;
7
- import org .apache .commons .lang .StringUtils ;
8
6
import org .jfrog .build .client .DeployableArtifactDetail ;
9
7
10
8
import java .io .File ;
20
18
*/
21
19
public class DeployableArtifactsUtils {
22
20
23
- public static void saveDeployableArtifactsToFile (Map <String , Set <DeployDetails >> deployableArtifactsByModule , File toFile , boolean saveBackwardCompatible , String rtUrl ) throws IOException {
21
+ public static void saveDeployableArtifactsToFile (Map <String , Set <DeployDetails >> deployableArtifactsByModule , File toFile , boolean saveBackwardCompatible ) throws IOException {
24
22
if (saveBackwardCompatible ) {
25
23
saveBackwardCompatibleDeployableArtifacts (deployableArtifactsByModule , toFile );
26
24
return ;
27
25
}
28
- saveDeployableArtifactsByModule (deployableArtifactsByModule , toFile , rtUrl );
26
+ saveDeployableArtifactsByModule (deployableArtifactsByModule , toFile );
29
27
}
30
28
31
- private static void saveDeployableArtifactsByModule (Map <String , Set <DeployDetails >> deployableArtifactsByModule , File toFile , String rtUrl ) throws IOException {
29
+ private static void saveDeployableArtifactsByModule (Map <String , Set <DeployDetails >> deployableArtifactsByModule , File toFile ) throws IOException {
32
30
Map <String , List <DeployableArtifactDetail >> deployableArtifactsDetails = new HashMap <>();
33
31
deployableArtifactsByModule .forEach ((module , deployableArtifacts ) ->
34
- deployableArtifactsDetails .put (module , DeployableArtifactsUtils .getDeployableArtifactsPaths (deployableArtifacts , rtUrl )));
32
+ deployableArtifactsDetails .put (module , DeployableArtifactsUtils .getDeployableArtifactsPaths (deployableArtifacts )));
35
33
ObjectMapper mapper = new ObjectMapper ();
36
34
mapper .setSerializationInclusion (JsonInclude .Include .NON_NULL );
37
35
mapper .writeValue (toFile , deployableArtifactsDetails );
@@ -44,7 +42,7 @@ private static void saveDeployableArtifactsByModule(Map<String, Set<DeployDetail
44
42
private static void saveBackwardCompatibleDeployableArtifacts (Map <String , Set <DeployDetails >> deployableArtifactsByModule , File toFile ) throws IOException {
45
43
List <DeployableArtifactDetail > deployableArtifactsList = new ArrayList <DeployableArtifactDetail >();
46
44
deployableArtifactsByModule .forEach ((module , deployableArtifacts ) ->
47
- deployableArtifactsList .addAll (DeployableArtifactsUtils .getDeployableArtifactsPaths (deployableArtifacts , "" )));
45
+ deployableArtifactsList .addAll (DeployableArtifactsUtils .getDeployableArtifactsPaths (deployableArtifacts )));
48
46
ObjectMapper mapper = new ObjectMapper ();
49
47
mapper .writeValue (toFile , deployableArtifactsList );
50
48
}
@@ -84,15 +82,10 @@ private static Map<String, List<DeployableArtifactDetail>> loadBackwardCompatibl
84
82
return deployableArtifactMap ;
85
83
}
86
84
87
- private static List <DeployableArtifactDetail > getDeployableArtifactsPaths (Set <DeployDetails > deployDetails , String rtUrl ) {
88
- List <DeployableArtifactDetail > deployableArtifacts = new ArrayList <>();
85
+ private static List <DeployableArtifactDetail > getDeployableArtifactsPaths (Set <DeployDetails > deployDetails ) {
86
+ List <DeployableArtifactDetail > deployableArtifacts = new ArrayList <DeployableArtifactDetail >();
89
87
for (DeployDetails artifact : deployDetails ) {
90
- String artifactDest = artifact .getArtifactPath ();
91
- // In case we want artifact absolute path in Artifactory - add rtUrl and repository to destination.
92
- if (StringUtils .isBlank (rtUrl )){
93
- artifactDest = rtUrl + artifact .getTargetRepository () + "/" + artifactDest ;
94
- }
95
- deployableArtifacts .add (new DeployableArtifactDetail (artifact .getFile ().getAbsolutePath (), artifactDest , artifact .getSha1 (), artifact .getSha256 (), artifact .getDeploySucceeded ()));
88
+ deployableArtifacts .add (new DeployableArtifactDetail (artifact .getFile ().getAbsolutePath (), artifact .getArtifactPath (), artifact .getSha1 (), artifact .getSha256 (), artifact .getDeploySucceeded (), artifact .getTargetRepository ()));
96
89
}
97
90
return deployableArtifacts ;
98
91
}
0 commit comments