Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357503 - Support customizing product archive file names
Summary: Support customizing product archive file names
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jan Sievers CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-13 10:32 EDT by Markus Kuppe CLA
Modified: 2021-04-28 16:54 EDT (History)
8 users (show)

See Also:


Attachments
Adds zip file naming support (12.70 KB, text/plain)
2011-09-13 10:37 EDT, Markus Kuppe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Kuppe CLA 2011-09-13 10:32:25 EDT
Hi,

customizing the names of zip file that come out of a product build should be possible. The attached patch adds support for this feature by introducing String "zipFileName" and boolean "includeVersion" as configuration properties for the director bundle. 

Btw. this has also been requested on the mailinglist before.
Comment 1 Markus Kuppe CLA 2011-09-13 10:37:06 EDT
Created attachment 203251 [details]
Adds zip file naming support
Comment 2 Markus Kuppe CLA 2011-09-19 06:03:39 EDT
FWIW this patch can also be found on my Tycho Github fork: https://github.com/lemmy/sonatype-tycho/commit/f760594f60d91d75ea597fa6175955c21fbfbc6d
Comment 3 Markus Kuppe CLA 2011-12-02 16:30:28 EST
Any decision yet if this is going to be merged upstream?
Comment 4 Tobias Oberlies CLA 2011-12-05 08:52:11 EST
I haven't done a full review yet, but just one quick question ahead: Does the code prevent that the zips for different environments overwrite each other?
Comment 5 Markus Kuppe CLA 2011-12-05 14:21:27 EST
FWIW: I've update the code to master and filed a pull request at github [0].

[0] https://github.com/eclipse/tycho/pull/1
Comment 6 Markus Kuppe CLA 2011-12-05 15:01:30 EST
Hi Tobias,

the zip will still be prepended with the environment, e.g. "-linux.gtk.x86".

Btw. we successfully use this feature in our own build [0].

[0] https://tla.msr-inria.inria.fr/tlatoolbox/ci/products/
Comment 7 Markus Kuppe CLA 2012-01-11 11:27:58 EST
Hi Tobias,

anything I can do to help get this into master?

Thanks
Markus
Comment 8 Tobias Oberlies CLA 2012-01-12 06:53:48 EST
Sorry, this somehow dropped from my list.

I'm wondering if we really need three new parameters. IMHO, just one "archiveName" parameter should be enough (see also comments in github).

In order to contribute this, you'd need to answer some legal-related questions. [1] has the details.

[1] http://wiki.eclipse.org/Tycho/Contributor_Guide#Contributing_the_Patch
Comment 9 Markus Kuppe CLA 2012-01-12 22:49:59 EST
Did you author 100% of the content you are contributing?

Yes

Who owns the copyright of the contributed content? (This is typically your employer.)

Me (individual)

Is the contributed code licensed under the EPL? (You should answer this question by putting a copyright and license header into every new java file.)

Yes, EPL.

Do you have the right to contribute the content to Eclipse? (You need to confirm this with the copyright owner.) 

Yes
Comment 10 Markus Kuppe CLA 2012-01-12 22:53:47 EST
I'm fine with the name change (do you want me to refactor it?)

Not sure about the version though. How would it handle versions which are invalid for ${project.version}? E.g. marketing versions like "MyRCP-2012NTYaddaYadda"
Comment 11 Tobias Oberlies CLA 2012-01-13 04:53:44 EST
(In reply to comment #10)
> Not sure about the version though. How would it handle versions which are
> invalid for ${project.version}? E.g. marketing versions like
> "MyRCP-2012NTYaddaYadda"
Coun't you just specify <archiveName>MyRCP-2012NTYaddaYadda</archiveName> in this case? You don't need to use the variable ${project.name} if you don't want the technical version in the name.

Please don't get me wrong: I appreciate your contribution. But I also want to make sure that we introduce the right parameters (which are API) for the use case.
Comment 12 Markus Kuppe CLA 2012-01-13 11:36:44 EST
The actual value for version is taken from the .product file if includeVersion is set to true. How would I do this with ${...} substitution?

Btw. the code has been refactored to "archiveFileName".
Comment 13 Tobias Oberlies CLA 2012-01-13 12:12:36 EST
(In reply to comment #12)
> The actual value for version is taken from the .product file if includeVersion
> is set to true. How would I do this with ${...} substitution?
Good question! Today, these versions can be different, but we anyway plan to introduce a new packaging type eclipse-product (bug 348586) which will only allow one product per module and that will make sure that the POM and product versions match. Therefore I am unsure if we really need the proposed version-related switches. Still, I would say we could take them now, but remove them again in eclipse-product (which will be incompatible anyway). Either way would be fine with me.

For the contribution, we will also need an exact link to the patch as described in [1].

[1] http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions
Comment 14 Markus Kuppe CLA 2012-01-13 13:09:15 EST
(In reply to comment #13)
> (In reply to comment #12)
> > The actual value for version is taken from the .product file if includeVersion
> > is set to true. How would I do this with ${...} substitution?
> Good question! Today, these versions can be different, but we anyway plan to
> introduce a new packaging type eclipse-product (bug 348586) which will only
> allow one product per module and that will make sure that the POM and product
> versions match. Therefore I am unsure if we really need the proposed
> version-related switches. Still, I would say we could take them now, but remove
> them again in eclipse-product (which will be incompatible anyway). Either way
> would be fine with me.

+1
 
> For the contribution, we will also need an exact link to the patch as described
> in [1].
> 
> [1] http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions

Don't you create the commit to reference to by accepting my Github pull request? Otherwise, won't https://github.com/eclipse/tycho/pull/1/files#diff-0 do as I don't see how I can squash my 5 commits that span across multiple others (due to merge).
Comment 15 Anthony Dahanne CLA 2012-01-19 16:56:19 EST
hello,
I have applied your commits to my local tycho git repo, and installed it on my desktop.
It worked , thank you Markus !
As a n00b, it took me a while to find out what was needed in my pom to benefit from this addition, so here are my 2 cents :
<build>
	<plugins>
		[...]
		<plugin>
			<groupId>org.eclipse.tycho</groupId>
			<artifactId>tycho-p2-director-plugin</artifactId>
			<version>${tycho-version}</version>
			<executions>
				<execution>
					<id>materialize-products</id>
					<goals>
						<goal>materialize-products</goal>
					</goals>
				</execution>
				<execution>
					<id>archive-products</id>
					<goals>
						<goal>archive-products</goal>
					</goals>
				</execution>
			</executions>
			<configuration>
				<products>
					<product>
						<id>THE_UID_FOUND_IN_MY_PRODUCT</id>
						<includeVersion>true</includeVersion>
						<version>${project.version}</version>
						<!--archiveFileName>optional, will replace the product UID in the file name</archiveFileName-->
					</product>
				</products>
			</configuration>
		</plugin>
	</plugins>
</build>
Comment 16 Anthony Dahanne CLA 2012-01-19 17:30:29 EST
(In reply to comment #15)

>                     <product>
>                         <id>THE_UID_FOUND_IN_MY_PRODUCT</id>
>                         <includeVersion>true</includeVersion>
>                         <version>${project.version}</version>
>                         <!--archiveFileName>optional, will replace the product
> UID in the file name</archiveFileName-->
>                     </product>

Just another note about the version : if you use <version>${project.version}</version> and your pom.xml version is 1.0.0-SNAPSHOT, then even if you set the build qualifier, via -Dbuild.qualifier , the -SNAPSHOT will never get replaced.
So imagine I want to release M01, and I want the product zip to be named 1.0.0-M01, then I have to use <version>${buildQualifier}</version> and launch the build with mvn clean install -Dbuild.qualifier='M01'
Comment 17 Markus Kuppe CLA 2012-01-19 22:19:32 EST
Are we in a deadlock state here?

Thanks
Markus
Comment 18 Jan Sievers CLA 2012-01-20 02:55:39 EST
Tobias is currently out of office and will not be back before we release 0.14.0.

I haven't looked into the details yet but judging from the comments on this bug so far I will try to get this into 0.14.0.
Comment 19 Markus Kuppe CLA 2012-01-20 11:08:37 EST
(In reply to comment #18)
> Tobias is currently out of office and will not be back before we release
> 0.14.0.
> 
> I haven't looked into the details yet but judging from the comments on this bug
> so far I will try to get this into 0.14.0.

Terrific, just let me know what I can do to make it go into 0.14.
Comment 20 Jan Sievers CLA 2012-01-30 07:39:29 EST
Markus,
I took your commits from [1], squashed them into one, added an integration test and reworked it to remove the version handling, see [2].

We now have one additional product configuration parameter "archiveFileName"

<products>
  <product>
    <id>PRODUCT_UID</id>
    <archiveFileName>YOUR_ARCHIVE_PREFIX</archiveFileName>
  </product>
</products>

This is a prefix, i.e. the suffix <os>.<ws>.<arch>.<archiveExtension> will still  be appended to the archive file name to avoid name collision for different os/ws/arch's.
This should be enough to cover all use cases.
In particular, if you want to include the version used by tycho including qualifier in the archive name, you can use e.g.

<archiveFileName>CUSTOM_PREFIX-${unqualifiedVersion}.${buildQualifier}</archiveFileName>

[1] https://github.com/eclipse/tycho/pull/1/
[2] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=066a12dc3686f14c637f901fc413d6959830f682
Comment 21 Markus Kuppe CLA 2012-01-30 11:35:07 EST
(In reply to comment #20)
> Markus,
> I took your commits from [1], squashed them into one, added an integration test
> and reworked it to remove the version handling, see [2].

Why did you remove the version handling? Without it, the patch doesn't solve my use case of reusing the product file version by setting includeVersion=true any longer.
Comment 22 Jan Sievers CLA 2012-01-30 12:13:20 EST
(In reply to comment #21)
> (In reply to comment #20)
> > Markus,
> > I took your commits from [1], squashed them into one, added an integration test
> > and reworked it to remove the version handling, see [2].
> 
> Why did you remove the version handling? Without it, the patch doesn't solve my
> use case of reusing the product file version by setting includeVersion=true any
> longer.

version handling and configuring the archive name should not be mixed up IMHO.
In case of the version ending with ".qualifier", the qualifier was simply stripped.
The current patch allows to configure the product archive name.
If you are not happy with it and think you need more convenience for including a version in the archive name, open a new bug.
Comment 23 Markus Kuppe CLA 2012-01-30 12:39:42 EST
(In reply to comment #22)

> version handling and configuring the archive name should not be mixed up IMHO.
> In case of the version ending with ".qualifier", the qualifier was simply
> stripped.
> The current patch allows to configure the product archive name.
> If you are not happy with it and think you need more convenience for including
> a version in the archive name, open a new bug.

Well thanks, but I rather keep my own Tycho fork instead for now. The Tycho turnaround time wrt contributions just doesn't cut it for me and the fact that you have just removed the very same functionality doesn't make it look likely that it is going to be included any time soon.
Comment 24 Gunnar Wagenknecht CLA 2013-07-11 12:13:46 EDT
(In reply to comment #20)
> This is a prefix, i.e. the suffix <os>.<ws>.<arch>.<archiveExtension> will
> still  be appended to the archive file name to avoid name collision for
> different os/ws/arch's.

Anybody knows if it's possible to customize the complete name for a specific configuration? I'm producing a server build and only for 64bit. Thus, I don't need the <ws> part in the file name. I'd also like to replace <arch> and <os> with a complete custom file name.

Is that possible with Tycho 0.18 or should I open a new enhancement request?
Comment 25 Jan Sievers CLA 2013-07-12 03:35:42 EDT
only the prefix can be configured.

you will have to use maven antrun plugin or post-build steps if you want to rename the file.