PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/ronsmits/maven-jgitflow-plugin
Java | 291 lines | 238 code | 47 blank | 6 comment | 1 complexity | 81d6fe3b6e00162996f0bd53d4a25369 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 push;
  15. private boolean keepBranch;
  16. private boolean squash;
  17. private boolean noTag;
  18. private boolean noDeploy;
  19. private boolean noBuild;
  20. private boolean featureRebase;
  21. private boolean useReleaseProfile;
  22. private boolean enableFeatureVersions;
  23. private String args;
  24. private String tagMessage;
  25. private String defaultReleaseVersion;
  26. private String defaultDevelopmentVersion;
  27. private String defaultFeatureName;
  28. private String releaseBranchVersionSuffix;
  29. private InitContext flowInitContext;
  30. private final File baseDir;
  31. public ReleaseContext(File baseDir)
  32. {
  33. this.baseDir = baseDir;
  34. this.allowSnapshots = false;
  35. this.defaultReleaseVersion = null;
  36. this.defaultDevelopmentVersion = null;
  37. this.interactive = true;
  38. this.autoVersionSubmodules = false;
  39. this.updateDependencies = true;
  40. this.push = true;
  41. this.keepBranch = false;
  42. this.squash = false;
  43. this.noTag = false;
  44. this.noDeploy = false;
  45. this.noBuild = false;
  46. this.featureRebase = false;
  47. this.useReleaseProfile = true;
  48. this.args = "";
  49. this.releaseBranchVersionSuffix = "release";
  50. this.enableFeatureVersions = true;
  51. this.tagMessage = "tagging release ${version}";
  52. this.flowInitContext = new InitContext();
  53. }
  54. public boolean isAllowSnapshots()
  55. {
  56. return allowSnapshots;
  57. }
  58. public ReleaseContext setAllowSnapshots(boolean allowSnapshots)
  59. {
  60. this.allowSnapshots = allowSnapshots;
  61. return this;
  62. }
  63. public String getDefaultReleaseVersion()
  64. {
  65. return defaultReleaseVersion;
  66. }
  67. public ReleaseContext setDefaultReleaseVersion(String defaultReleaseVersion)
  68. {
  69. this.defaultReleaseVersion = defaultReleaseVersion;
  70. return this;
  71. }
  72. public String getDefaultDevelopmentVersion()
  73. {
  74. return defaultDevelopmentVersion;
  75. }
  76. public ReleaseContext setDefaultDevelopmentVersion(String version)
  77. {
  78. this.defaultDevelopmentVersion = version;
  79. return this;
  80. }
  81. public boolean isInteractive()
  82. {
  83. return interactive;
  84. }
  85. public ReleaseContext setInteractive(boolean interactive)
  86. {
  87. this.interactive = interactive;
  88. return this;
  89. }
  90. public boolean isAutoVersionSubmodules()
  91. {
  92. return autoVersionSubmodules;
  93. }
  94. public ReleaseContext setAutoVersionSubmodules(boolean autoVersionSubmodules)
  95. {
  96. this.autoVersionSubmodules = autoVersionSubmodules;
  97. return this;
  98. }
  99. public InitContext getFlowInitContext()
  100. {
  101. return flowInitContext;
  102. }
  103. public ReleaseContext setFlowInitContext(InitContext flowInitContext)
  104. {
  105. this.flowInitContext = flowInitContext;
  106. return this;
  107. }
  108. public boolean isUpdateDependencies()
  109. {
  110. return updateDependencies;
  111. }
  112. public ReleaseContext setUpdateDependencies(boolean updateDependencies)
  113. {
  114. this.updateDependencies = updateDependencies;
  115. return this;
  116. }
  117. public File getBaseDir()
  118. {
  119. return baseDir;
  120. }
  121. public boolean isPush()
  122. {
  123. return push;
  124. }
  125. public ReleaseContext setPush(boolean push)
  126. {
  127. this.push = push;
  128. return this;
  129. }
  130. public boolean isKeepBranch()
  131. {
  132. return keepBranch;
  133. }
  134. public ReleaseContext setKeepBranch(boolean keepBranch)
  135. {
  136. this.keepBranch = keepBranch;
  137. return this;
  138. }
  139. public boolean isSquash()
  140. {
  141. return squash;
  142. }
  143. public ReleaseContext setSquash(boolean squash)
  144. {
  145. this.squash = squash;
  146. return this;
  147. }
  148. public boolean isNoTag()
  149. {
  150. return noTag;
  151. }
  152. public ReleaseContext setNoTag(boolean noTag)
  153. {
  154. this.noTag = noTag;
  155. return this;
  156. }
  157. public boolean isNoDeploy()
  158. {
  159. return noDeploy;
  160. }
  161. public ReleaseContext setNoDeploy(boolean deploy)
  162. {
  163. this.noDeploy = deploy;
  164. return this;
  165. }
  166. public boolean isNoBuild()
  167. {
  168. return noBuild;
  169. }
  170. /*
  171. * NOTE: This should only be used for testing!!!
  172. */
  173. public ReleaseContext setNoBuild(boolean nobuild)
  174. {
  175. this.noBuild = nobuild;
  176. return this;
  177. }
  178. public boolean isFeatureRebase()
  179. {
  180. return featureRebase;
  181. }
  182. public ReleaseContext setFeatureRebase(boolean rebase)
  183. {
  184. this.featureRebase = rebase;
  185. return this;
  186. }
  187. public String getTagMessage()
  188. {
  189. return tagMessage;
  190. }
  191. public ReleaseContext setTagMessage(String msg)
  192. {
  193. if(!Strings.isNullOrEmpty(msg))
  194. {
  195. this.tagMessage = msg;
  196. }
  197. return this;
  198. }
  199. public boolean isUseReleaseProfile()
  200. {
  201. return useReleaseProfile;
  202. }
  203. public ReleaseContext setUseReleaseProfile(boolean useReleaseProfile)
  204. {
  205. this.useReleaseProfile = useReleaseProfile;
  206. return this;
  207. }
  208. public String getArgs()
  209. {
  210. return args;
  211. }
  212. public ReleaseContext setArgs(String args)
  213. {
  214. this.args = args;
  215. return this;
  216. }
  217. public ReleaseContext setDefaultFeatureName(String defaultFeatureName)
  218. {
  219. this.defaultFeatureName = defaultFeatureName;
  220. return this;
  221. }
  222. public String getDefaultFeatureName()
  223. {
  224. return defaultFeatureName;
  225. }
  226. public ReleaseContext setReleaseBranchVersionSuffix(String suffix)
  227. {
  228. this.releaseBranchVersionSuffix = suffix;
  229. return this;
  230. }
  231. public String getReleaseBranchVersionSuffix()
  232. {
  233. return releaseBranchVersionSuffix;
  234. }
  235. public boolean isEnableFeatureVersions()
  236. {
  237. return enableFeatureVersions;
  238. }
  239. public ReleaseContext setEnableFeatureVersions(boolean enable)
  240. {
  241. this.enableFeatureVersions = enable;
  242. return this;
  243. }
  244. }