Skip to content

Commit b982c73

Browse files
authored
feat(archetype): new versioning scheme support and build profiles for kura-addon-archetype (#5795)
1 parent 65a1a8e commit b982c73

2 files changed

Lines changed: 126 additions & 11 deletions

File tree

  • kura/tools/kura-addon-archetype/src/main/resources/archetype-resources/distrib

kura/tools/kura-addon-archetype/src/main/resources/archetype-resources/distrib/deb/control/control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: [[package.name]]
2-
Version: [[project.version]]
2+
Version: [[version]]-[[package.revision]]
33
Section: admin
44
Priority: optional
5-
Depends: kura
5+
Depends: kura-core (>= 6.0.0~), kura-core(<< 7.0.0~)
66
Architecture: [[deb.architecture]]
77
Maintainer: Eclipse Kura Developers <kura-dev@eclipse.org>
88
Description: [[summary]]

kura/tools/kura-addon-archetype/src/main/resources/archetype-resources/distrib/pom.xml

Lines changed: 124 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,119 @@
5959
<!-- final name of the generated debian and rpm package -->
6060
<package.name>${artifactId}</package.name>
6161

62+
<!-- properties used for artifact upload on artifactory repository -->
63+
<kura.repo.distribution>CHANGEME</kura.repo.distribution>
64+
<kura.repo.module>CHANGEME</kura.repo.module>
65+
6266
<!-- edit following fields and file deb/control/control -->
6367
<summary>Summary line (do not end this line with a dot, max 60 chars)</summary>
6468
<long.description>Here goes the long description of the packages, in this case this is an example addon for the Eclipse Kura Framework.</long.description>
6569
</properties>
6670

71+
<profiles>
72+
<!-- Internal profile: FOR INTERNAL USE ONLY - active if -DreleaseBuild is *not* specified. -->
73+
<profile>
74+
<id>debugBuild</id>
75+
<activation>
76+
<property>
77+
<name>!releaseBuild</name>
78+
</property>
79+
</activation>
80+
<properties>
81+
<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
82+
<package.snapshot>git${maven.build.timestamp}.${git.commit.id.abbrev}</package.snapshot>
83+
84+
<package.version>${release.version}~${package.snapshot}</package.version>
85+
<package.revision>1</package.revision>
86+
</properties>
87+
</profile>
88+
<!-- Internal profile: FOR INTERNAL USE ONLY - active if -DreleaseBuild *is* specified. -->
89+
<profile>
90+
<id>releaseBuild</id>
91+
<activation>
92+
<property>
93+
<name>releaseBuild</name>
94+
</property>
95+
</activation>
96+
<properties>
97+
<package.version>${release.version}</package.version>
98+
<package.revision>1</package.revision>
99+
</properties>
100+
<build>
101+
<plugins>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-enforcer-plugin</artifactId>
105+
<version>3.5.0</version>
106+
<executions>
107+
<execution>
108+
<id>enforce-no-snapshots</id>
109+
<goals>
110+
<goal>enforce</goal>
111+
</goals>
112+
<configuration>
113+
<rules>
114+
<requireReleaseVersion>
115+
<message>No snapshots allowed for release builds!</message>
116+
</requireReleaseVersion>
117+
</rules>
118+
<fail>true</fail>
119+
</configuration>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
</plugins>
124+
</build>
125+
</profile>
126+
</profiles>
127+
67128
<build>
68129
<plugins>
130+
<!-- Responsible for removing the "-SNAPSHOT" from the project.version -->
131+
<plugin>
132+
<groupId>org.codehaus.mojo</groupId>
133+
<artifactId>build-helper-maven-plugin</artifactId>
134+
<version>3.6.0</version>
135+
<executions>
136+
<execution>
137+
<id>regex-property</id>
138+
<goals>
139+
<goal>regex-property</goal>
140+
</goals>
141+
<configuration>
142+
<name>release.version</name>
143+
<value>${project.version}</value>
144+
<regex>-SNAPSHOT</regex>
145+
<replacement></replacement>
146+
<failIfNoMatch>false</failIfNoMatch>
147+
</configuration>
148+
</execution>
149+
</executions>
150+
</plugin>
151+
152+
<!-- Responsible for retrieving the short git commit (defaults to length 7)-->
153+
<plugin>
154+
<groupId>io.github.git-commit-id</groupId>
155+
<artifactId>git-commit-id-maven-plugin</artifactId>
156+
<version>9.0.1</version>
157+
<executions>
158+
<execution>
159+
<id>get-the-git-infos</id>
160+
<goals>
161+
<goal>revision</goal>
162+
</goals>
163+
<phase>initialize</phase>
164+
</execution>
165+
</executions>
166+
<configuration>
167+
<injectAllReactorProjects>true</injectAllReactorProjects>
168+
<generateGitPropertiesFile>false</generateGitPropertiesFile>
169+
<skipPoms>false</skipPoms>
170+
<includeOnlyProperties>
171+
<includeOnlyProperty>^git.commit.id.abbrev$</includeOnlyProperty>
172+
</includeOnlyProperties>
173+
</configuration>
174+
</plugin>
69175
<plugin>
70176
<groupId>com.coderplus.maven.plugins</groupId>
71177
<artifactId>copy-rename-maven-plugin</artifactId>
@@ -98,7 +204,9 @@
98204
</goals>
99205
<configuration>
100206
<verbose>true</verbose>
101-
<deb>${basedir}/target/deb/${package.name}_${project.version}_${deb.architecture}.deb</deb>
207+
<deb>${basedir}/target/deb/${package.name}_${package.version}-${package.revision}_${deb.architecture}.deb</deb>
208+
<snapshotExpand>true</snapshotExpand>
209+
<snapshotTemplate>${package.snapshot}</snapshotTemplate>
102210
<controlDir>${project.basedir}/deb/control</controlDir>
103211
<skipPOMs>false</skipPOMs>
104212
<dataSet>
@@ -119,12 +227,12 @@
119227
</mapper>
120228
</data>
121229

122-
<!--
123-
230+
<!--
231+
124232
If all the source file are managed in the same way, it is also
125233
possible to specify a 'directory' data type to include all the files
126234
present in the specify path
127-
235+
128236
<data>
129237
<src>${basedir}/target/input_files</src>
130238
<dst>${jar.name}_${project.version}.jar</dst>
@@ -137,7 +245,7 @@
137245
<filemode>600</filemode>
138246
</mapper>
139247
</data>
140-
248+
141249
-->
142250
</dataSet>
143251
</configuration>
@@ -166,6 +274,13 @@
166274
<description>${long.description}</description>
167275
<license>EPL 2.0 (https://www.eclipse.org/legal/epl-2.0/)</license>
168276

277+
<projversion>${package.version}</projversion>
278+
<release>${package.revision}</release>
279+
280+
<requires>
281+
<require>kura-core &gt;= 6.0.0~, kura-core &lt; 7.0.0~</require>
282+
</requires>
283+
169284
<mappings>
170285
<!-- Repeate the 'mapping' schema multiple time if you want to
171286
manage different files indipendentely, specifying for each one the
@@ -188,11 +303,11 @@
188303
</sources>
189304
</mapping>
190305

191-
<!--
192-
306+
<!--
307+
193308
If all the source file are managed in the same way, it is also possible to specify the path to a
194309
directory to include all the files present in that
195-
310+
196311
<mapping>
197312
<directory>${addon.installation.dir}</directory>
198313
<filemode>600</filemode>
@@ -205,7 +320,7 @@
205320
</source>
206321
</sources>
207322
</mapping>
208-
323+
209324
-->
210325
</mappings>
211326

0 commit comments

Comments
 (0)