Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351487 - tycho-p2-director-plugin should consider p2 metaRequirements
Summary: tycho-p2-director-plugin should consider p2 metaRequirements
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Tobias Oberlies CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-07 15:43 EDT by Anthony Dahanne CLA
Modified: 2021-04-28 16:54 EDT (History)
13 users (show)

See Also:


Attachments
This is a set of maven tycho modules to reproduce the issue (144.65 KB, application/empty)
2011-07-07 15:44 EDT, Anthony Dahanne CLA
no flags Details
maven plugin to add the needed touchpoint to the tycho p2 runtime (5.55 KB, application/zip)
2011-11-11 23:17 EST, Anthony Dahanne CLA
no flags Details
makes tycho-p2-runtime p2 updatable (8.73 KB, patch)
2011-11-15 16:59 EST, Anthony Dahanne CLA
no flags Details | Diff
makes tycho-p2-runtime p2 updatable Integration test (260.25 KB, patch)
2011-11-15 17:00 EST, Anthony Dahanne CLA
no flags Details | Diff
tycho-bundles-external-dynamic : p2 updatable equinox runtime product definition (5.34 KB, text/plain)
2011-12-15 18:19 EST, Anthony Dahanne CLA
no flags Details
refactoring to expose common methods for director mojos (6.20 KB, patch)
2012-01-05 18:28 EST, Anthony Dahanne CLA
no flags Details | Diff
providing a new goal, materialize-products-metarequirements allowing the user to materialize a product depending on metarequirements (such as custom touchpoint actions) (22.53 KB, patch)
2012-01-05 18:33 EST, Anthony Dahanne CLA
no flags Details | Diff
providing a new goal, materialize-products-metarequirements allowing the user to materialize a product depending on metarequirements (such as custom touchpoint actions) (148.75 KB, patch)
2012-01-06 13:10 EST, Anthony Dahanne CLA
no flags Details | Diff
merged patch (154.56 KB, application/octet-stream)
2012-05-22 11:08 EDT, Jon Hubbard CLA
no flags Details
merged patch (158.42 KB, patch)
2012-05-22 16:01 EDT, Jon Hubbard CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Dahanne CLA 2011-07-07 15:43:35 EDT
Build Identifier: 0.12.0

When trying to build a product that includes a plugin that relies on a custom touchpoint action (a plugin with a p2.inf with : instructions.configure=com.compuware.touchpoint.touchpoint(); for example); the build of the product will fail.

The reason is because Tycho's tycho-director-plugin relies on a static p2 runtime : tycho-p2-runtime-0.12.0.zip

This runtime does not use a p2 profile when running p2 director, and then can not execute the p2 metaRequirement (http://wiki.eclipse.org/Equinox/p2/Customizing_Metadata#Capability_Advice:)
So the runtime used for launching p2 director (tycho-p2-runtime-0.12.0.zip unzipped in M2_REPO\org\eclipse\tycho\tycho-p2-runtime\0.12.0\eclipse) is not able to "evolve" ; that's why you can not install in a product a plugin relying on custom touchpoint actions

Today, p2 director is launched by tycho-p2-director-plugin (DirectorMojo.java) in an embedded equinox launcher (DefaultEquinoxEmbedder) that loads the plugins located in M2_REPO\org\eclipse\tycho\tycho-p2-runtime\0.12.0\eclipse\plugins

To solve this problem, the runtime used for launching p2 director should be run in a way that would allow it to evolve (with a p2 profile for example)

A workaround would be to allow the user to specify its own runtime used for launching p2 director (that would contain all the necessary plugins and associated custom touchpoints)



Reproducible: Always

Steps to Reproduce:
1. try to build a product including a plugin that has a custom p2 touchpoint action to execute (take the attached zip example as a reference and mvn clean install the parent)
2. tycho's p2 director runtime will not be able to find the required touchpoint action
3. the product creation will fail because p2 director will not succeed
Comment 1 Anthony Dahanne CLA 2011-07-07 15:44:50 EDT
Created attachment 199289 [details]
This is a set of maven tycho modules to reproduce the issue
Comment 2 Igor Fedorenko CLA 2011-07-13 08:40:07 EDT
It should be possible to add custom bundles to p2 runtime used by tycho already. To do this you need to implement org.eclipse.tycho.p2.facade.internal.TychoP2RuntimeMetadata component interface to return GAV of additional bundles you need, package the component into a maven plugin and add the plugin with <extensions>true</extensions> to pom.xml. See org.eclipse.tycho.p2.facade.internal.DefaultTychoP2RuntimeMetadata for default implementation of TychoP2RuntimeMetadata. We'll be happy to answer further questions on tycho-dev mailing list.
Comment 3 Anthony Dahanne CLA 2011-11-11 23:17:00 EST
Created attachment 206887 [details]
maven plugin to add the needed touchpoint to the tycho p2 runtime

Igor,
thank you for your answer.
Following your suggestion, I created a new maven plugin that I added to my parent pom build section :
         <build>
		<plugins>
			...
			<plugin>
				<groupId>sample.plugin</groupId>
				<artifactId>hello-maven-plugin</artifactId>
				<version>1.0-SNAPSHOT</version>
				<executions>
					<execution>
						<phase>compile</phase>
						<goals>
							<goal>touch</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

I am pretty new to developing plexus components, so I am not sure I did the right thing (see attached maven plugin); am I doing something wrong ? if so could you please tell me what ?

On another side, I also redefined the tycho-p2-runtime so that the equinox runtime used by tycho is based on p2 : and I could build my project (first zip).
I think this approach (make the tycho p2 runtime p2 aware) is the best approach since it does not urge the user to create a maven plugin each time a new meta requirement is needed in the tycho p2 runtime. (I'll create a BZ enhancement request + a patch + integration test next week)
thanks again for your help
Comment 4 Igor Fedorenko CLA 2011-11-12 05:29:12 EST
(In reply to comment #3)
> Created attachment 206887 [details]
> maven plugin to add the needed touchpoint to the tycho p2 runtime
> 

Couple comments

You don't need to define any goals in this plugin... unless, of course, you need to touch a timestamp file during your build.

Since your plugin requires maven 3.0, it's better to explicitly state this as <prerequisites> in plugin's pom.xml and also use 3.0 version of maven-plugin-api.

You MUST NOT use "hint = TychoP2RuntimeMetadata.HINT_FRAMEWORK". It is not possible to replace p2 runtime used by tycho, only to add additional bundles to it. Use of "hint = TychoP2RuntimeMetadata.HINT_FRAMEWORK" will result in unpredictable runtime behaviour.

> Igor,
> thank you for your answer.
> Following your suggestion, I created a new maven plugin that I added to my
> parent pom build section :
>          <build>
>         <plugins>
>             ...
>             <plugin>
>                 <groupId>sample.plugin</groupId>
>                 <artifactId>hello-maven-plugin</artifactId>
>                 <version>1.0-SNAPSHOT</version>
>                 <executions>
>                     <execution>
>                         <phase>compile</phase>
>                         <goals>
>                             <goal>touch</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>         </plugins>
>     </build>
> 

You need to specify <extensions>true</extensions>, components defined in the plugin will be ignored without it.


> I am pretty new to developing plexus components, so I am not sure I did the
> right thing (see attached maven plugin); am I doing something wrong ? if so
> could you please tell me what ?
> 
> On another side, I also redefined the tycho-p2-runtime so that the equinox
> runtime used by tycho is based on p2 : and I could build my project (first
> zip).
> I think this approach (make the tycho p2 runtime p2 aware) is the best approach
> since it does not urge the user to create a maven plugin each time a new meta
> requirement is needed in the tycho p2 runtime. (I'll create a BZ enhancement
> request + a patch + integration test next week)
> thanks again for your help

I am not sure what you mean by "tycho p2 runtime p2 aware". In any case, bugzilla is not the right place for tycho development discussions, so please use tycho-dev mailing list if you have any further questions or comments.
Comment 5 Anthony Dahanne CLA 2011-11-15 16:59:32 EST
Created attachment 207061 [details]
makes tycho-p2-runtime p2 updatable
Comment 6 Anthony Dahanne CLA 2011-11-15 17:00:02 EST
Created attachment 207063 [details]
makes tycho-p2-runtime p2 updatable Integration test
Comment 7 Anthony Dahanne CLA 2011-11-15 17:13:13 EST
Hello, I provided 2 patches (the implementation of the solution and its integration test).
Igor I used your advice to correct my maven plugin, but it is still not working (even though now I could see in debug that it was considered), the code is there : https://github.com/anthonydahanne/tycho-Bug-351487/tree/master/hello-maven-plugin

But as I stated on tycho-dev  (http://dev.eclipse.org/mhonarc/lists/tycho-dev/msg00344.html) , I do not think this is the right approach to solve this problem, the tycho p2 runtime should be able to provision itself to extend its capabilities (without saying that it would be additional work to create a maven plugin each time I want to execute a custom touchpoint action)
Comment 8 Igor Fedorenko CLA 2011-11-15 17:25:49 EST
Maven extensions plugins that contribute TychoP2RuntimeMetadata implementation is the only way to extend tycho p2 runtime we plan to support. This approach allows different project built with the same version of tycho contribute different additional bundles (or different versions of the same bundle) to tycho p2 runtime, which I believe will not be the case with "self-provisioning" approach.
Comment 9 Anthony Dahanne CLA 2011-11-15 17:32:33 EST
> This approach allows different project built with the same version of tycho 
> contribute different additional bundles (or different versions of the same 
> bundle) to tycho p2 runtime, which I believe will not be the case with "self-
> provisioning" approach.

that is exactly why I extended the mechanism to delete the runtime if a "pollution" (ie a touchpoint action got installed) of the runtime is detected.
I do believe this approach is the most natural and easy to understand one.

Could you please provide an example of a working maven plugin contributing TychoP2RuntimeMetadata  ? or can you tell me why my attempt (https://github.com/anthonydahanne/tycho-Bug-351487/tree/master/hello-maven-plugin) fail ?
thank you
Comment 10 Tobias Oberlies CLA 2011-11-16 09:04:57 EST
This is really an enhancement request, and therefore can't just be closed as "wontfix". The use case is valid, and just because there is one extension mechanism doesn't mean that there can't be a second one. (Tycho is an open source project after all...)

@Anthony: There are a couple of other patches waiting, so it unfortunately still take a while until I get round to reviewing your patch.
Comment 11 Anthony Dahanne CLA 2011-11-16 09:18:51 EST
@Tobias : thank you very much for reopening this enhancement (I was afraid of patching tycho for my company for every release *sigh*)
Whenever you start trying to merge it, feel free to ask me any questions!
thanks again !
Comment 12 Igor Fedorenko CLA 2011-11-16 10:24:14 EST
(In reply to comment #10)
> This is really an enhancement request, and therefore can't just be closed as
> "wontfix". The use case is valid, and just because there is one extension
> mechanism doesn't mean that there can't be a second one. (Tycho is an open
> source project after all...)
> 
> @Anthony: There are a couple of other patches waiting, so it unfortunately
> still take a while until I get round to reviewing your patch.

Hmm, okay, here are the "quality patch" requirements

1. Changes to the tycho p2 runtime MUST be local to the project. In other words, absolutely no "leakage" of p2 runtime extensions between different builds.
2. Set of p2 runtime extensions used for a project MUST be predictable and stable. Specifically, set of p2 runtime extensions used for a module project MUST NOT depend on reactor build order. Ideally, the same set of extensions SHOULD be used when a module project is built standalone and as part of a reactor build.
3. Implementation MUST support running multiple builds using the same maven local repository in parallel.

I am quite certain attached patch fails on requirement #3 and I am fairly certain getting all three right will require significant amount of code. 

In my opinion the underlying usecase does not justify the development and maintenance effort required to manage the added complexity, especially given other solution is already available. But, of course, this is my opinion and you are welcome to work on this enhancement request.
Comment 13 Anthony Dahanne CLA 2011-11-16 10:41:42 EST
> I am quite certain attached patch fails on requirement #3 and I am fairly
> certain getting all three right will require significant amount of code.

did you apply the patch to your local repo ? if so, could you experience this problem ? 

> In my opinion the underlying usecase does not justify the development and
> maintenance effort required to manage the added complexity, especially given
> other solution is already available. 

AFAIK, the given other solution does not have any working examples (and I could not make it work, if you can, then I'd be glad to know how you did).
Could you make this other solution work for the examples set I provided ?
https://github.com/anthonydahanne/tycho-Bug-351487/

There is another reason why anyway this solution (the maven plugin to extend TychoP2RuntimeMetadata) would not be satisfying (even if we could make the example work) : take the case of a plugin providing a custom touchpoint action, a plugin that would itself depend on other plugins.
Correct me if I'm wrong, but with your solution, I would have to know in advance statically what are the needed dependencies, and I would have to set them manually in the maven plugin.
The plugin dependencies change ? Then I'm stuck, I have to change the maven plugin... this is what statically defining the dependencies implies; and this is not acceptable.
What's the problem with letting p2 deal with the p2 stuff ?
Comment 14 Igor Fedorenko CLA 2011-11-16 13:32:08 EST
(In reply to comment #13)
> > I am quite certain attached patch fails on requirement #3 and I am fairly
> > certain getting all three right will require significant amount of code.
> 
> did you apply the patch to your local repo ? if so, could you experience this
> problem ? 
> 

The same p2Directory is shared by all builds that use the same maven local repository. When two builds overlap in time, one build can remove p2Directory, while the other is running. Likewise, if two builds try to simultaniosly install different additional bundles the result is pretty much unpredictable... not to mention that p2 was not very good at serializing access to a profile from multiple processes last time I checked.
Comment 15 Tobias Oberlies CLA 2011-11-18 05:09:46 EST
(In reply to comment #12)
> 1. Changes to the tycho p2 runtime MUST be local to the project. In other words,
> absolutely no "leakage" of p2 runtime extensions between different builds.
> 2. Set of p2 runtime extensions used for a project MUST be predictable and
> stable. Specifically, set of p2 runtime extensions used for a module project
> MUST NOT depend on reactor build order. Ideally, the same set of extensions
> SHOULD be used when a module project is built standalone and as part of a
> reactor build.
> 3. Implementation MUST support running multiple builds using the same maven
> local repository in parallel.

The solution to all these requirements is to create a p2 director installation in the target folder of the project calling "materialize-product", and to use that director to install the actual product to be built. Then, it doesn't matter if the director installation is changed through meta-requirements.

The director installation in the target folder can be created with the director in the tycho p2 runtime. We would just need a source p2 repository for that operation - I guess just building an extra zipped p2 repository for this in the build of Tycho, and unzipping that repository in the local Maven repository when running Tycho could work.
Comment 16 Anthony Dahanne CLA 2011-11-18 10:05:05 EST
(In reply to comment #15)
Agreed, having a tycho-p2-runtime local to the project materializing a product is the solution to not deal with pollution of the base tycho-p2-runtime.
The patches proposed still make sense for creating a tycho-p2-runtime p2 updatable + for the integration tests.
Now what is missing is the creation of a local tycho-p2-runtime in the target folder of a project calling materialize-product.
I'm not sure to understannd why we need an extra p2 repository Tobias, since if the runtime running p2 director can access the target platform definition + the reactor's projects it has everything it needs ?
DirectorMojo.java :
RepositoryReferences sources = RepositoryReferenceTool.getVisibleRepositories(getProject(),
                        getSession(), flags);
Isn't it already enough ?
Then, just a matter of creating a new runtime + wrap it
final DirectorApplicationWrapper director = new LocalDirectorApplicationWrapperImpl();

and we're good to go ?
Comment 17 Tobias Oberlies CLA 2011-11-18 11:12:08 EST
(In reply to comment #16)
> The patches proposed still make sense for creating a tycho-p2-runtime p2
> updatable + for the integration tests.
Why would we want this? AFAIK, the current tycho-p2-runtime prevents p2 updates through missing p2 metadata, and therefore is safe from metaRequirements.

> Now what is missing is the creation of a local tycho-p2-runtime in the target
> folder of a project calling materialize-product.
Yes, except that I would call this a "p2 director installation"

> I'm not sure to understannd why we need an extra p2 repository Tobias, since if
> the runtime running p2 director can access the target platform definition + the
> reactor's projects it has everything it needs ?
The target platform doesn't need to include p2. Plus we don't want different versions of the director to be running but always the one that matches the p2 version embedded in Tycho.
Comment 18 Anthony Dahanne CLA 2011-11-18 11:20:29 EST
(In reply to comment #17)
> Why would we want this? AFAIK, the current tycho-p2-runtime prevents p2 updates
> through missing p2 metadata, and therefore is safe from metaRequirements.
OK, then we need a new product definition (having the simple configurator activated) defined somewhere else...
However, the integration tests can be kept (I still think)

> The target platform doesn't need to include p2. Plus we don't want different
> versions of the director to be running but always the one that matches the p2
> version embedded in Tycho.

I'm confused a bit.
According to you, what are the (high level) steps to create (in the target folder) and run this "p2 director installation" when the goal materialize-product is executed ?
thank you !
Comment 19 Tobias Oberlies CLA 2011-11-18 11:58:07 EST
Okay, then let me summarize again:
1. In the Tycho build, create a p2 repository with the content needed to install a director application. AFAIK, the features org.eclipse.equinox.p2.core.feature and the org.eclipse.rcp should contain at least most of what we need. This new eclipse-repository module should use the tycho-bundles POM as parent so that it inherits the right target platform configuration.
2. When running materialize-product,
2a. Tycho should first create a p2 director in target/director. This can be done with the current DirectorApplicationWrapper. As source repository, use a  "jar:file:"-URL pointing to the artifact from 1 in the local maven repository. Add a POM dependency from tycho-p2-director-plugin to the artifact from 1 to make sure that Maven downloads it automatically.
2b. Launch the p2 director in target/director to install the thing to be built. For launching, you don't need an eclipse.exe - a java call with the launcher on the class-path also works. Then, meta-requirements should work.
Comment 20 Igor Fedorenko CLA 2011-11-29 16:42:15 EST
Beware of Tycho embedded runtime synchronization work done as part of bug 365012.
Comment 21 Tobias Oberlies CLA 2011-11-30 04:51:46 EST
(In reply to comment #20)
> Beware of Tycho embedded runtime synchronization work done as part of bug
> 365012.
I don't see any side-effects of this: The embedded OSGi runtime would only be used in step 2a, and that step is no different to what is being done with the director today. The modifiable director application will reside in target/director
Comment 22 Anthony Dahanne CLA 2011-12-15 18:17:55 EST
(In reply to comment #19)
well, unfortunately, it is not as easy as the steps you described Tobias...
I created a product (attached) built with a eclipse-repository packaging, and I used, as you described, the DirectorMojo to unzip in target/director this "p2 updatable" equinox runtime, using -application o.e.e.p2.director to launch it.
At first, I did not notice that in tycho, you are providing IArtifactRepository to handle special artifact repositories : file:/resolution-context-artifacts@C:%5Cworkspaces%5Cproduct,file:/C:/m2-repo/
Once I understood that my equinox "p2 updatable" runtime needed org.eclipse.tycho.p2.resolver.impl , most particularly the OSGi services it provides (LocalRepositoryP2Indices for example) , I added it in my product.
Well, now I'm stuck since LocalRepositoryP2Indices depends on other OSGi services such as FileLockService (see https://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-bundles/org.eclipse.tycho.p2.resolver.impl/OSGI-INF/localRepoP2Indices.xml) that apparently never published on the OSGi registry ...
I understand that, today, since DirectorMojo uses directly the DirectorApplication, some kind of maven/equinox magic can happen to inject the services... 
But do you still think it is possible to create a runtime with all the needed services to consider special artifact repositories (file:/resolution-context-artifacts@C:%5Cworkspaces%5Cproduct,file:/C:/m2-repo/) ?
thanks
Comment 23 Anthony Dahanne CLA 2011-12-15 18:19:31 EST
Created attachment 208474 [details]
tycho-bundles-external-dynamic : p2 updatable equinox runtime product definition
Comment 24 Tobias Oberlies CLA 2011-12-19 05:58:12 EST
(In reply to comment #22)
> At first, I did not notice that in tycho, you are providing IArtifactRepository
> to handle special artifact repositories :
> file:/resolution-context-artifacts@C:%5Cworkspaces%5Cproduct,file:/C:/m2-repo/
> Once I understood that my equinox "p2 updatable" runtime needed
> org.eclipse.tycho.p2.resolver.impl , most particularly the OSGi services it
> provides (LocalRepositoryP2Indices for example) , I added it in my product.
Sorry for not seeing this before: It won't be possible to call the standalone director installation in the same way as the director in Tycho's own OSGi runtime. The reasons are (as you already found out):

1. The built-in version reads from non-standard p2 repository locations, like the local Maven repository. The implementation for this (currently) doesn't work outside of Tycho's OSGi runtime because they rely on services coming from Maven.

2. The built-in version reads p2 repositories only stored in memory (from Tycho's target platform computation/dependency resolution). These will never be accessible in a separate process. However launching the p2 director in a separate process is what protects Tycho's OSGi runtime from side-effects, so this is a blocker.

The only solution I see from this is to install from the build result of eclipse-repository (target/repository) instead of the target platform, for this particular use case. The normal materialize-product goal still needs to install from the target platform, but we could add a separate goal which installs from the eclipse-repository build result, and that implementation can use the standalone director which supports metaRequirements.

Sorry for all the detours - I am impressed that you still don't give up :-)
If this helps we could also do a phone conference with screen sharing to talk about the details. If you want to do this, just propose it on tycho-dev.
Comment 25 Anthony Dahanne CLA 2011-12-19 19:28:44 EST
(In reply to comment #24)

> The only solution I see from this is to install from the build result of
> eclipse-repository (target/repository) instead of the target platform, for this
> particular use case. The normal materialize-product goal still needs to install
> from the target platform, but we could add a separate goal which installs from
> the eclipse-repository build result, and that implementation can use the
> standalone director which supports metaRequirements.

Quite interestingly, this is what I emplemented before leaving for vacations : a new goal (matareialize-product-metarequirements, that copies in target/director a p2 runtime updatable,then launches it, and use the .target locations (using the tp api) + target/repository repo : I made my old example work with 0.14.0-SNAPSHOT and this patch

 
> Sorry for all the detours - I am impressed that you still don't give up :-)

never let tycho down : this is our moto ;-) but also business requirements for our products make us hold it strong ;-)

> If this helps we could also do a phone conference with screen sharing to talk
> about the details. If you want to do this, just propose it on tycho-dev.

Excellent, I'd like to, the week of the January 3rd I 'll be able to send the patch and demo it to you.
Comment 26 Anthony Dahanne CLA 2012-01-05 18:28:00 EST
Created attachment 209113 [details]
refactoring to expose common methods for director mojos

as discussed during the webex demo, a first patch with a refactoring of the director mojo to expose common methods (getArgsForDirectorCall and toCommaSeparatedList)
Comment 27 Anthony Dahanne CLA 2012-01-05 18:33:04 EST
Created attachment 209114 [details]
providing a new goal, materialize-products-metarequirements allowing the user to materialize a product depending on metarequirements (such as custom touchpoint actions)

as discussed during the webex demo, the implementation of a new dynamic director product and a mojo to launch it (DynamicDirectorMojo)
Notes : I have been able to change the code so that the product is generated in target/director when needed (so no troubles with the target platform environments); unfortunately I could not find a way to use the includeAllDependencies of the tycho repository plugin; using  repositoryReferenceTool.getVisibleRepositories simply won't work to define metadata and artficat repositories for this director product (it is not aware of special tycho p2 repositories layout)
Comment 28 Anthony Dahanne CLA 2012-01-06 13:10:14 EST
Created attachment 209141 [details]
providing a new goal, materialize-products-metarequirements allowing the user to materialize a product depending on metarequirements (such as custom touchpoint actions)

just found out a tiny bug in the previous patch; forget to mention that the dependency 
<dependency>
			<groupId>org.eclipse.tycho</groupId>
			<artifactId>tycho-bundles-external-dynamic</artifactId>
			<version>${project.version}</version>
			<type>zip</type>
		</dependency>

was a zip type
Comment 29 Tobias Oberlies CLA 2012-01-09 11:20:36 EST
(In reply to comment #27)
> unfortunately I could not find a way to use the
> includeAllDependencies of the tycho repository plugin; using
> repositoryReferenceTool.getVisibleRepositories simply won't work to define
> metadata and artficat repositories for this director product (it is not aware of
> special tycho p2 repositories layout)
I thought we already clarified this: this won't work. The proposal was install exclusively from target/repository. When includeAllDependencies is set to true, this should work.

Could you please also upload the proposed changes to github? There are a couple of small things that still need to be changed, e.g. so that the contribution can pass the legal review, and discussing them here without the code is a bit tedious.
Comment 30 Anthony Dahanne CLA 2012-01-09 17:00:23 EST
(In reply to comment #29)

> I thought we already clarified this: this won't work. The proposal was install
> exclusively from target/repository. When includeAllDependencies is set to true,
> this should work.

yes, we did talk about this; and we did agree it was the right solution instead of re parsing the tp...
So I gave it another try today and it worked, I guess my brain was shut down last time I tried...
 
> Could you please also upload the proposed changes to github? There are a couple
> of small things that still need to be changed, e.g. so that the contribution
> can pass the legal review, and discussing them here without the code is a bit
> tedious.

here it is : 
https://github.com/anthonydahanne/org.eclipse.tycho/commits/master/

So, in a nutshell :
c9ebff3a03db005a3c334398db008d1f8745b51b : refactoring
14c8d19c6a8cc63f0b61b52cc90bdd4cbeaa3fdb : first attempt using target/repository + parsing the project target platform
2a1df9799599e41bdde15198ba0fc8ed3c209d7e : second attempt only using target/repository, provided the product to build specifies the includeAllDependencies option in its pom

thanks for reviewing those commits.
Comment 31 Anthony Dahanne CLA 2012-01-18 18:37:20 EST
I just added a new commit to support different envs.
so the previous commits are still good + you have to add this one :

https://github.com/anthonydahanne/org.eclipse.tycho/commit/aa709a4c420bd9c9e28049842a4bf6b1c16057d3

I also synced with master, no problems merging.
should be ready for prime time now ;-)
Comment 32 Tomas Znamenacek CLA 2012-03-20 17:17:21 EDT
I'm running into the same problem with Tycho 0.13 so I'd like to ask if there is any outlook on which version of Tycho might be fixing the issue.
Comment 33 Tobias Oberlies CLA 2012-05-04 10:22:12 EDT
(In reply to comment #32)
> I'm running into the same problem with Tycho 0.13 so I'd like to ask if there
> is any outlook on which version of Tycho might be fixing the issue.
Sorry, this won't make it into 0.15.0, but I'm planning to integrate it in the following release.
Comment 34 Jon Hubbard CLA 2012-05-22 11:08:07 EDT
Created attachment 216043 [details]
merged patch

Applied both previous patches to master (0.15.0) and created one patch
Comment 35 Jon Hubbard CLA 2012-05-22 16:01:38 EDT
Created attachment 216074 [details]
merged patch

needed to update previous patch
Comment 36 Jon Hubbard CLA 2012-05-23 16:57:25 EDT
I went ahead and posted the commit[1] as well as another commit[2] which implements Bug 361722 on top of these changes

the commits are:
1. https://github.com/JonHubbard/tycho/commit/d1d4abd9f5c22808830b4c2b19fd810e4ec382f4

2. https://github.com/JonHubbard/tycho/commit/bcbf0c7362a06940196158c52c6b5dee504583a3
Comment 37 Tobias Oberlies CLA 2012-07-17 08:24:23 EDT
As a preparation step, I have refactored [1] the existing DirectorMojo and introduced the new interface DirectorRuntime, which encapsulates the director application calls.

Next, I have used that new interface in order to implement a standalone, p2-updatable director runtime, which supports meta-requirements. This change is currently proposed in Gerrit [2].

The change also includes a significantly more concise integration test for the new functionality, but I also checked the originally proposed test setup and that also works (with minor modifications due to different goal&parameter names).

[1] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/commit/?id=4f0b07ef69ba99fc8a35d8234133820c62635822
[2] https://git.eclipse.org/r/#/c/6808/1
Comment 38 Tobias Oberlies CLA 2012-07-25 11:08:48 EDT
This is finally implemented :-)

There is an integration test [1] that shows how to build a product which includes a custom touchpoint action. Not entirely trivial, but I don't expect everyone to have custom touchpoints anyway.

After the 0.16.0 release, there also will be documentation for the new switches in the tycho-p2-director-plugin on Tycho's site [2]. Sorry, nothing to see now, we don't have a site CI build.

[1] http://git.eclipse.org/c/tycho/org.eclipse.tycho.git/tree/tycho-its/projects/product.metaRequirements
[2] http://www.eclipse.org/tycho/sitedocs/index.html
Comment 39 Anthony Dahanne CLA 2012-10-17 13:12:56 EDT
Thanks a lot Tobias !
Comment 40 Natalia Bartol CLA 2014-04-04 19:31:20 EDT
I followed instructions form [1] and was able to create custom touchpoint and execute an action on install using standalone p2 director. Thanks, Tobias!
However I bumped into timeout exception:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-director-plugin:0.18.1:materialize-products (materialize-products) on project studio-product: Execution materialize-products of goal org.eclipse.tycho:tycho-p2-director-plugin:0.18.1:materialize-products failed: org.codehaus.plexus.util.cli.CommandLineTimeOutException: Error while executing external command, process killed. Process timeout out after 60 seconds

Any ideas how to increase this 60 seconds timeout?
Comment 41 Natalia Bartol CLA 2014-04-04 19:31:50 EDT
I followed instructions from [1] and was able to create custom touchpoint and execute an action on install using standalone p2 director. Thanks, Tobias!
However I bumped into timeout exception:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-p2-director-plugin:0.18.1:materialize-products (materialize-products) on project studio-product: Execution materialize-products of goal org.eclipse.tycho:tycho-p2-director-plugin:0.18.1:materialize-products failed: org.codehaus.plexus.util.cli.CommandLineTimeOutException: Error while executing external command, process killed. Process timeout out after 60 seconds

Any ideas how to increase this 60 seconds timeout?
Comment 42 Tobias Oberlies CLA 2014-04-07 03:30:43 EDT
(In reply to comment #40)
> Any ideas how to increase this 60 seconds timeout?
The 60s timeout is currently hard-coded in /tycho-p2-director-plugin/src/main/java/org/eclipse/tycho/plugins/p2/director/runtime/StandaloneDirectorRuntime.java, line 56

Open a new bug if you need this configurable.