PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/java/com/atlassian/maven/plugins/jgitflow/ReleaseContext.java

https://bitbucket.org/marcuslinke/maven-jgitflow-plugin
Java | 454 lines | 374 code | 74 blank | 6 comment | 4 complexity | 299b1e969d3caed1d4f0f5edad69c39d MD5 | raw file
  1. package com.atlassian.maven.plugins.jgitflow;
  2. import java.io.File;
  3. import com.atlassian.jgitflow.core.InitContext;
  4. import com.google.common.base.Strings;
  5. /**
  6. * @since version
  7. */
  8. public class ReleaseContext
  9. {
  10. private boolean allowSnapshots;
  11. private boolean interactive;
  12. private boolean autoVersionSubmodules;
  13. private boolean updateDependencies;
  14. private boolean pushFeatures;
  15. private boolean pushReleases;
  16. private boolean pushHotfixes;
  17. private boolean keepBranch;
  18. private boolean squash;
  19. private boolean noTag;
  20. private boolean noDeploy;
  21. private boolean noBuild;
  22. private boolean featureRebase;
  23. private boolean useReleaseProfile;
  24. private boolean enableFeatureVersions;
  25. private String args;
  26. private String tagMessage;
  27. private String defaultReleaseVersion;
  28. private String defaultDevelopmentVersion;
  29. private String defaultFeatureName;
  30. private String releaseBranchVersionSuffix;
  31. private InitContext flowInitContext;
  32. private final File baseDir;
  33. private boolean enableSshAgent;
  34. private boolean noReleaseMerge;
  35. private boolean noFeatureMerge;
  36. private boolean allowUntracked;
  37. private boolean allowRemote;
  38. private boolean pullMaster;
  39. private boolean pullDevelop;
  40. private String startCommit;
  41. private String defaultOriginUrl;
  42. private String scmCommentPrefix;
  43. public ReleaseContext(File baseDir)
  44. {
  45. this.baseDir = baseDir;
  46. this.allowSnapshots = false;
  47. this.defaultReleaseVersion = null;
  48. this.defaultDevelopmentVersion = null;
  49. this.interactive = true;
  50. this.autoVersionSubmodules = false;
  51. this.updateDependencies = true;
  52. this.pushFeatures = false;
  53. this.pushReleases = false;
  54. this.pushHotfixes = false;
  55. this.keepBranch = false;
  56. this.squash = false;
  57. this.noTag = false;
  58. this.noDeploy = false;
  59. this.noBuild = false;
  60. this.featureRebase = false;
  61. this.useReleaseProfile = true;
  62. this.args = "";
  63. this.startCommit = "";
  64. this.releaseBranchVersionSuffix = "release";
  65. this.enableFeatureVersions = false;
  66. this.tagMessage = "tagging release ${version}";
  67. this.flowInitContext = new InitContext();
  68. this.enableSshAgent = false;
  69. this.allowUntracked = false;
  70. this.noReleaseMerge = false;
  71. this.noFeatureMerge = false;
  72. this.allowRemote = true;
  73. this.defaultOriginUrl = "";
  74. this.scmCommentPrefix = "";
  75. this.pullMaster = false;
  76. this.pullDevelop = false;
  77. }
  78. public boolean isAllowSnapshots()
  79. {
  80. return allowSnapshots;
  81. }
  82. public ReleaseContext setAllowSnapshots(boolean allowSnapshots)
  83. {
  84. this.allowSnapshots = allowSnapshots;
  85. return this;
  86. }
  87. public String getDefaultReleaseVersion()
  88. {
  89. return defaultReleaseVersion;
  90. }
  91. public ReleaseContext setDefaultReleaseVersion(String defaultReleaseVersion)
  92. {
  93. this.defaultReleaseVersion = defaultReleaseVersion;
  94. return this;
  95. }
  96. public String getDefaultDevelopmentVersion()
  97. {
  98. return defaultDevelopmentVersion;
  99. }
  100. public ReleaseContext setDefaultDevelopmentVersion(String version)
  101. {
  102. this.defaultDevelopmentVersion = version;
  103. return this;
  104. }
  105. public boolean isInteractive()
  106. {
  107. return interactive;
  108. }
  109. public ReleaseContext setInteractive(boolean interactive)
  110. {
  111. this.interactive = interactive;
  112. return this;
  113. }
  114. public boolean isAutoVersionSubmodules()
  115. {
  116. return autoVersionSubmodules;
  117. }
  118. public ReleaseContext setAutoVersionSubmodules(boolean autoVersionSubmodules)
  119. {
  120. this.autoVersionSubmodules = autoVersionSubmodules;
  121. return this;
  122. }
  123. public InitContext getFlowInitContext()
  124. {
  125. return flowInitContext;
  126. }
  127. public ReleaseContext setFlowInitContext(InitContext flowInitContext)
  128. {
  129. this.flowInitContext = flowInitContext;
  130. return this;
  131. }
  132. public boolean isUpdateDependencies()
  133. {
  134. return updateDependencies;
  135. }
  136. public ReleaseContext setUpdateDependencies(boolean updateDependencies)
  137. {
  138. this.updateDependencies = updateDependencies;
  139. return this;
  140. }
  141. public File getBaseDir()
  142. {
  143. return baseDir;
  144. }
  145. public boolean isPushFeatures()
  146. {
  147. return pushFeatures;
  148. }
  149. public ReleaseContext setPushFeatures(boolean push)
  150. {
  151. this.pushFeatures = push;
  152. return this;
  153. }
  154. public boolean isPushReleases()
  155. {
  156. return pushReleases;
  157. }
  158. public ReleaseContext setPushReleases(boolean push)
  159. {
  160. this.pushReleases = push;
  161. return this;
  162. }
  163. public boolean isPushHotfixes()
  164. {
  165. return pushHotfixes;
  166. }
  167. public ReleaseContext setPushHotfixes(boolean push)
  168. {
  169. this.pushHotfixes = push;
  170. return this;
  171. }
  172. public boolean isKeepBranch()
  173. {
  174. return keepBranch;
  175. }
  176. public ReleaseContext setKeepBranch(boolean keepBranch)
  177. {
  178. this.keepBranch = keepBranch;
  179. return this;
  180. }
  181. public boolean isSquash()
  182. {
  183. return squash;
  184. }
  185. public ReleaseContext setSquash(boolean squash)
  186. {
  187. this.squash = squash;
  188. return this;
  189. }
  190. public boolean isNoTag()
  191. {
  192. return noTag;
  193. }
  194. public ReleaseContext setNoTag(boolean noTag)
  195. {
  196. this.noTag = noTag;
  197. return this;
  198. }
  199. public boolean isNoDeploy()
  200. {
  201. return noDeploy;
  202. }
  203. public ReleaseContext setNoDeploy(boolean deploy)
  204. {
  205. this.noDeploy = deploy;
  206. return this;
  207. }
  208. public boolean isNoBuild()
  209. {
  210. return noBuild;
  211. }
  212. /*
  213. * NOTE: This should only be used for testing!!!
  214. */
  215. public ReleaseContext setNoBuild(boolean nobuild)
  216. {
  217. this.noBuild = nobuild;
  218. return this;
  219. }
  220. public boolean isFeatureRebase()
  221. {
  222. return featureRebase;
  223. }
  224. public ReleaseContext setFeatureRebase(boolean rebase)
  225. {
  226. this.featureRebase = rebase;
  227. return this;
  228. }
  229. public String getTagMessage()
  230. {
  231. return tagMessage;
  232. }
  233. public ReleaseContext setTagMessage(String msg)
  234. {
  235. if(!Strings.isNullOrEmpty(msg))
  236. {
  237. this.tagMessage = msg;
  238. }
  239. return this;
  240. }
  241. public boolean isUseReleaseProfile()
  242. {
  243. return useReleaseProfile;
  244. }
  245. public ReleaseContext setUseReleaseProfile(boolean useReleaseProfile)
  246. {
  247. this.useReleaseProfile = useReleaseProfile;
  248. return this;
  249. }
  250. public String getArgs()
  251. {
  252. return args;
  253. }
  254. public ReleaseContext setArgs(String args)
  255. {
  256. this.args = args;
  257. return this;
  258. }
  259. public String getStartCommit()
  260. {
  261. return startCommit;
  262. }
  263. public ReleaseContext setStartCommit(String commit)
  264. {
  265. this.startCommit = commit;
  266. return this;
  267. }
  268. public ReleaseContext setDefaultFeatureName(String defaultFeatureName)
  269. {
  270. this.defaultFeatureName = defaultFeatureName;
  271. return this;
  272. }
  273. public String getDefaultFeatureName()
  274. {
  275. return defaultFeatureName;
  276. }
  277. public ReleaseContext setReleaseBranchVersionSuffix(String suffix)
  278. {
  279. this.releaseBranchVersionSuffix = suffix;
  280. return this;
  281. }
  282. public String getReleaseBranchVersionSuffix()
  283. {
  284. return releaseBranchVersionSuffix;
  285. }
  286. public boolean isEnableFeatureVersions()
  287. {
  288. return enableFeatureVersions;
  289. }
  290. public ReleaseContext setEnableFeatureVersions(boolean enable)
  291. {
  292. this.enableFeatureVersions = enable;
  293. return this;
  294. }
  295. public boolean isEnableSshAgent()
  296. {
  297. return enableSshAgent;
  298. }
  299. public ReleaseContext setEnableSshAgent(boolean enableSshAgent)
  300. {
  301. this.enableSshAgent = enableSshAgent;
  302. return this;
  303. }
  304. public boolean isAllowUntracked()
  305. {
  306. return allowUntracked;
  307. }
  308. public ReleaseContext setAllowUntracked(boolean allow)
  309. {
  310. this.allowUntracked = allow;
  311. return this;
  312. }
  313. public boolean isNoReleaseMerge()
  314. {
  315. return noReleaseMerge;
  316. }
  317. public boolean isNoFeatureMerge()
  318. {
  319. return noFeatureMerge;
  320. }
  321. public ReleaseContext setNoReleaseMerge(boolean merge)
  322. {
  323. this.noReleaseMerge = merge;
  324. return this;
  325. }
  326. public ReleaseContext setNoFeatureMerge(boolean merge)
  327. {
  328. this.noFeatureMerge = merge;
  329. return this;
  330. }
  331. public boolean isRemoteAllowed()
  332. {
  333. return allowRemote;
  334. }
  335. public ReleaseContext setAllowRemote(boolean allow)
  336. {
  337. this.allowRemote = allow;
  338. return this;
  339. }
  340. public String getDefaultOriginUrl()
  341. {
  342. return defaultOriginUrl;
  343. }
  344. public ReleaseContext setDefaultOriginUrl(String defaultOriginUrl)
  345. {
  346. this.defaultOriginUrl = defaultOriginUrl;
  347. return this;
  348. }
  349. public String getScmCommentPrefix()
  350. {
  351. if(null == scmCommentPrefix || scmCommentPrefix.equalsIgnoreCase("null"))
  352. {
  353. this.scmCommentPrefix = "";
  354. }
  355. return scmCommentPrefix;
  356. }
  357. public ReleaseContext setScmCommentPrefix(String scmCommentPrefix)
  358. {
  359. this.scmCommentPrefix = scmCommentPrefix;
  360. return this;
  361. }
  362. public boolean isPullMaster()
  363. {
  364. return pullMaster;
  365. }
  366. public ReleaseContext setPullMaster(boolean pullMaster)
  367. {
  368. this.pullMaster = pullMaster;
  369. return this;
  370. }
  371. public ReleaseContext setPullDevelop(boolean pullDevelop)
  372. {
  373. this.pullDevelop = pullDevelop;
  374. return this;
  375. }
  376. public boolean isPullDevelop()
  377. {
  378. return pullDevelop;
  379. }
  380. }