Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support .settings folders as linked resources #1364

Closed
sthdev opened this issue Sep 19, 2022 · 13 comments · Fixed by #3487
Closed

Support .settings folders as linked resources #1364

sthdev opened this issue Sep 19, 2022 · 13 comments · Fixed by #3487

Comments

@sthdev
Copy link

sthdev commented Sep 19, 2022

It would be nice if Tycho would support .settings folders that are included as a linked resource in a project instead of a physical folder.

Background:

Our repositories are structured like this:

  • .settings
  • my.org.bundle
  • my.org.bundle.test
  • my.org.feature

The .settings folder is stored at the root of the repository in order to have on location for the settings of all projects. The individual projects do not have an own .settings folder but include the root .settings folder as a linked resource.

Linked resources are stored in the .project file of a project like this:

<projectDescription>
  <!-- other stuff -->
  <linkedResources>
    <link>
      <name>.settings</name>
      <type>2</type>
      <locationURI>$%7BPARENT-1-PROJECT_LOC%7D/.settings</locationURI>
    </link>
  </linkedResources>
</projectDescription>

This works fine in Eclipse but is not supported by Tycho. Tycho reports that no .settings\org.eclipse.jdt.core.prefs could be found in the individual project folders.

@laeubi
Copy link
Member

laeubi commented Sep 19, 2022

@sthdev have you considered using a symbolic link instead?

Beside that, you might be interested in my proposal here:

@sthdev
Copy link
Author

sthdev commented Sep 19, 2022

Thanks for the hint. I'll try it out.

@sthdev sthdev closed this as completed Sep 19, 2022
@sthdev sthdev reopened this Sep 20, 2022
@sthdev
Copy link
Author

sthdev commented Sep 20, 2022

Unfortunately, this does not work.

It is possible to create a directory junction (on Windows) named .settings in a project folder, which points to the .settings folder in the repository root. As expected, Eclipse treats it like a normal directory. However, EGit does that, too, i.e. it reports uncommitted files in each .settings folder of each project (i.e. the junctions). Moreover, EGit cannot commit the junction itself to the Git repository. Probably because Git does not support plain directories, only files. Therefore, when checking out the repository, the junction is lost.

@laeubi
Copy link
Member

laeubi commented Sep 20, 2022

Git supports symbolic links:

https://stackoverflow.com/questions/58814356/how-to-create-symlink-for-files-in-git-repository

I just don't know how well this is supported with (j)git under windows.

@sthdev
Copy link
Author

sthdev commented Sep 20, 2022

But only for files, not for folders.

@laeubi
Copy link
Member

laeubi commented Oct 27, 2022

@sthdev can you provide an integration-test to demonstrate the issue?

@Bananeweizen
Copy link
Contributor

A colleague of mine has each separate .prefs file as linked resource, and that seems to work fine both in PDE and Tycho.

@mickaelistria
Copy link
Contributor

"native" symbolic links should work fine; but .project (Eclipse) linked resources are not checked by Tycho so far.

@sthdev
Copy link
Author

sthdev commented Nov 4, 2022

@laeubi which component is responsible for resolving the project settings? I am setting up an integration test and wondering how to name it or whether there already is an integration test for that component.

@laeubi
Copy link
Member

laeubi commented Nov 4, 2022

@sthdev you can simply add a project in to the tycho-itest module and name it for example "linked-files":
https://github.com/eclipse-tycho/tycho/tree/master/tycho-its/projects

@sthdev
Copy link
Author

sthdev commented Nov 4, 2022

A colleague of mine has each separate .prefs file as linked resource, and that seems to work fine both in PDE and Tycho.

That would be too cumbersome. In our case, the *.pref files in the root .settings folder of each repository are defined in an Oomph setup model. When some settings change, the setup model is updated. As soon as someone, checks out a repository with that setup model, those new settings are rolled out to that repository, as well.

In case a new *.pref file is added, your suggestion would require to add it as a linked resource in all projects and all repositories. Doing that manually is too cumbersome and error-prone. I do not know if there is an automated way to do it but it would have to be triggered by the setup model.

@sthdev
Copy link
Author

sthdev commented Nov 4, 2022

Added PR #1626

@Bananeweizen
Copy link
Contributor

I do not know if there is an automated way to do it but it would have to be triggered by the setup model.

You can trigger any (checked in) launch config from Oomph. Instead of using Oomph for distributing project preferences, I have created a JUnit test to both copy the files from a template project and to also check some additional constraints for my setups at work. Has the added benefit of breaking the CI build if such constraints fail or if the template copy operation modifies the git working dir.

laeubi added a commit to laeubi/tycho that referenced this issue Feb 7, 2024
laeubi added a commit to laeubi/tycho that referenced this issue Feb 8, 2024
laeubi added a commit that referenced this issue Feb 8, 2024
github-actions bot pushed a commit that referenced this issue Feb 8, 2024
Fix #1364

(cherry picked from commit eb1f45e)
laeubi added a commit that referenced this issue Feb 8, 2024
Fix #1364

(cherry picked from commit eb1f45e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants