1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.eluder.coveralls.maven.plugin.service;
26
27 import java.util.Map;
28 import java.util.Properties;
29
30
31
32
33
34
35 public class Appveyor extends AbstractServiceSetup {
36
37
38 public static final String APPVEYOR_NAME = "Appveyor";
39
40
41 public static final String APPVEYOR = "APPVEYOR";
42
43
44 public static final String APPVEYOR_BUILD_NUMBER = "APPVEYOR_BUILD_NUMBER";
45
46
47 public static final String APPVEYOR_BUILD_ID = "APPVEYOR_BUILD_ID";
48
49
50 public static final String APPVEYOR_BRANCH = "APPVEYOR_REPO_BRANCH";
51
52
53 public static final String APPVEYOR_COMMIT = "APPVEYOR_REPO_COMMIT";
54
55
56 public static final String APPVEYOR_PULL_REQUEST = "APPVEYOR_PULL_REQUEST_NUMBER";
57
58
59 public static final String APPVEYOR_REPO_NAME = "APPVEYOR_REPO_NAME";
60
61
62
63
64
65
66
67 public Appveyor(final Map<String, String> env) {
68 super(env);
69 }
70
71 @Override
72 public boolean isSelected() {
73 return Boolean.parseBoolean(this.getProperty(Appveyor.APPVEYOR));
74 }
75
76 @Override
77 public String getName() {
78 return Appveyor.APPVEYOR_NAME;
79 }
80
81 @Override
82 public String getBuildNumber() {
83 return this.getProperty(Appveyor.APPVEYOR_BUILD_NUMBER);
84 }
85
86 @Override
87 public String getBuildUrl() {
88 return "https://ci.appveyor.com/project/" + this.getProperty(Appveyor.APPVEYOR_REPO_NAME) + "/build/"
89 + this.getProperty(Appveyor.APPVEYOR_BUILD_NUMBER);
90 }
91
92 @Override
93 public String getBranch() {
94 return this.getProperty(Appveyor.APPVEYOR_BRANCH);
95 }
96
97 @Override
98 public String getPullRequest() {
99 return this.getProperty(Appveyor.APPVEYOR_PULL_REQUEST);
100 }
101
102 @Override
103 public String getJobId() {
104 return this.getProperty(Appveyor.APPVEYOR_BUILD_ID);
105 }
106
107 @Override
108 public Properties getEnvironment() {
109 final var environment = new Properties();
110 this.addProperty(environment, "appveyor_build_id", this.getProperty(Appveyor.APPVEYOR_BUILD_ID));
111 this.addProperty(environment, "appveyor_build_number", this.getProperty(Appveyor.APPVEYOR_BUILD_NUMBER));
112 this.addProperty(environment, "appveyor_repo_name", this.getProperty(Appveyor.APPVEYOR_REPO_NAME));
113 this.addProperty(environment, "appveyor_branch", this.getProperty(Appveyor.APPVEYOR_BRANCH));
114 this.addProperty(environment, "appveyor_commit", this.getProperty(Appveyor.APPVEYOR_COMMIT));
115 this.addProperty(environment, "appveyor_pull_request", this.getProperty(Appveyor.APPVEYOR_PULL_REQUEST));
116 return environment;
117 }
118
119 }