|
32 | 32 | <property name="lib.dir" value="lib" dynamic="true" />
|
33 | 33 | <property name="lib.family.dir" value="${path::combine(lib.dir, framework::get-family(framework::get-target-framework()))}" dynamic="true" />
|
34 | 34 | <property name="lib.framework.dir" value="${path::combine(lib.family.dir, version::to-string(framework::get-version()))}" dynamic="true" />
|
35 |
| - |
36 |
| - <!-- |
37 |
| - These are used to set the correct attributes in AssemblyInfo.cs. |
38 |
| - --> |
39 |
| - <property name="project.company" value="NHibernate.org" /> |
40 |
| - |
41 |
| - <!-- |
42 |
| - Version number computation |
43 |
| - |
44 |
| - JBoss product versioning guidelines (http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossProductVersioning) |
45 |
| - say we are supposed to use version numbers formatted like major.minor.patch.qualifier, where |
46 |
| - qualifier is alphanumeric (Alpha#, Beta#, CR#, GA, SP#), and the numeric part may be anything, e.g. |
47 |
| - a time/date stamp, a SVN revision number and so on. |
48 |
| - |
49 |
| - I'm only going to use simple sequential numbers for now and the script below is used to translate |
50 |
| - the alphanumeric version into a numeric assembly version: x.y.z.qN is translated into x.y.z.(base+N) |
51 |
| - where base is 1000 for Alpha, 2000 for Beta, 3000 for CR, and 4000 for both GA and SP (so GA is |
52 |
| - effectively SP0). |
53 |
| - --> |
54 |
| - |
55 |
| - <property name="project.version" value="5.0.0.Alpha1" overwrite="false" /> |
56 |
| - |
57 |
| - <!-- This version number should be changed if, but only if, there are incompatible |
58 |
| - changes compared to the previous version. --> |
59 |
| - <property name="project.default-assembly-version" value="5.0.0.1001" overwrite="false" /> |
60 |
| - |
61 |
| - <!-- Compute short project version (major.minor) using a regex --> |
62 |
| - <regex input="${project.version}" pattern="^(?'shortversion'\d+\.\d+)" /> |
63 |
| - |
64 |
| - <property name="project.version.short" value="${shortversion}" /> |
65 |
| - |
66 |
| - <!-- Compute and set project.version.numeric and project.version.nuget from project.version if it hasn't been set already --> |
67 |
| - <if test="${not property::exists('project.version.numeric')}"> |
68 |
| - |
69 |
| - <script language="C#"> |
70 |
| - <references> |
71 |
| - <include name="System.dll" /> |
72 |
| - </references> |
73 |
| - <imports> |
74 |
| - <import namespace="System.Text.RegularExpressions" /> |
75 |
| - </imports> |
76 |
| - <code><![CDATA[ |
77 |
| - public const string VersionRegex = @"^(?<major>.+)\.{1}(?<minor>.+)\.{1}(?<build>.+)\.{1}(?<qualifier>Alpha|Beta|CR|GA|SP*)(?<qualifierNumber>\d*)$"; |
78 |
| - |
79 |
| - public static void ScriptMain(Project project) |
80 |
| - { |
81 |
| - string version = project.Properties["project.version"]; |
82 |
| - project.Properties["project.version.numeric"] = ToNumericVersion(version); |
83 |
| - project.Properties["project.version.nuget"] = ToNuGetVersion(version); |
84 |
| - } |
85 |
| -
|
86 |
| - public static string ToNuGetVersion(string version) |
87 |
| - { |
88 |
| - Match matches = Regex.Match(version, VersionRegex, RegexOptions.Singleline); |
89 |
| - if (matches.Success == false) throw new BuildException("Unrecognised version number."); |
90 |
| - if (matches.Groups.Count < 4) throw new BuildException("Unrecognised version number."); |
91 |
| - |
92 |
| - string qualifier = matches.Groups["qualifier"].Value; |
93 |
| - |
94 |
| - // For official releases we must use a completely numeric version. |
95 |
| - // For pre-releases, the alphanumerics should be retained, to make Nuget |
96 |
| - // understand it's a pre-release. |
97 |
| - if (qualifier == "GA") return ToNumericVersion(version); |
98 |
| - if (qualifier == "SP") return ToNumericVersion(version); |
99 |
| - |
100 |
| - return String.Concat( |
101 |
| - String.Join(".", new string[] { matches.Groups["major"].Value, matches.Groups["minor"].Value, matches.Groups["build"].Value }), |
102 |
| - "-", |
103 |
| - matches.Groups["qualifier"].Value, |
104 |
| - matches.Groups["qualifierNumber"].Value); |
105 |
| - } |
106 |
| -
|
107 |
| - public static string ToNumericVersion(string version) |
108 |
| - { |
109 |
| - const int BaseAlpha = 1000; |
110 |
| - const int BaseBeta = 2000; |
111 |
| - const int BaseCR = 3000; |
112 |
| - const int BaseGA = 4000; |
113 |
| - const int BaseSP = 4000; // SP is same as GA because GA has no number and SP's start with 1. |
114 |
| -
|
115 |
| - Match matches = Regex.Match(version, VersionRegex); |
116 |
| - if (matches.Success == false) throw new BuildException("Unrecognised version number."); |
117 |
| - if (matches.Groups.Count < 4) throw new BuildException("Unrecognised version number."); |
118 |
| -
|
119 |
| - string qualifier = matches.Groups["qualifier"].Value; |
120 |
| - int qualifierNumber; |
121 |
| - Int32.TryParse(matches.Groups["qualifierNumber"].Value, out qualifierNumber); |
122 |
| - int revisionBase; |
123 |
| - |
124 |
| - switch (qualifier) |
125 |
| - { |
126 |
| - case "Alpha": revisionBase = BaseAlpha; break; |
127 |
| - case "Beta": revisionBase = BaseBeta; break; |
128 |
| - case "CR": revisionBase = BaseCR; break; |
129 |
| - case "GA": revisionBase = BaseGA; break; |
130 |
| - case "SP": revisionBase = BaseSP; break; |
131 |
| - default: throw new BuildException("Unknown version qualifier " + qualifier); |
132 |
| - } |
133 |
| -
|
134 |
| - int revisionNumber = revisionBase + qualifierNumber; |
135 | 35 |
|
136 |
| - return String.Join(".", new string[] { |
137 |
| - matches.Groups["major"].Value, |
138 |
| - matches.Groups["minor"].Value, |
139 |
| - matches.Groups["build"].Value, |
140 |
| - revisionNumber.ToString() }); |
141 |
| - } |
142 |
| - ]]></code> |
143 |
| - </script> |
144 |
| - </if> |
| 36 | + <!-- This is used only for build folder --> |
| 37 | + <!-- TODO: Either remove or refactor to use NHibernate.props --> |
| 38 | + <property name="project.version" value="5.0.0-Alpha1" overwrite="false" /> |
145 | 39 |
|
146 | 40 | <!-- debug|release -->
|
147 | 41 | <property name="build.defines" value="" />
|
|
0 commit comments