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

Add support for bundle URL types in macOS launcher in product files #533

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

sratz
Copy link
Contributor

@sratz sratz commented Jul 9, 2024

Adds CFBundleURLTypes entries to the Info.plist dictionary.

Contributes to
eclipse-platform/eclipse.platform.ui#1901.


import org.eclipse.equinox.p2.publisher.eclipse.IMacOsBundleUrlType;

public class MacOsBundleUrlType implements IMacOsBundleUrlType {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a Java Record here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought about that, but I opted for consistency with the other interfaces / minimal implementations in the package

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also in favor of using records. Sorry I just read this remark after assembling my other commit and suggested it there already.
In order to be consistent with other code in this plugin I suggest to use records wherever suitable.

In PDE I recently submitted a change where I even moved the record from a separate file into the only caller of the constructor, because having an (effectively) one-line in a separate file does not make sense to me.

Copy link

github-actions bot commented Jul 9, 2024

Test Results

  375 files  ±0    375 suites  ±0   41m 30s ⏱️ -31s
1 895 tests +2  1 892 ✅ +2  3 💤 ±0  0 ❌ ±0 
6 685 runs  +6  6 676 ✅ +6  9 💤 ±0  0 ❌ ±0 

Results for commit 32e5deb. ± Comparison against base commit e1b554d.

♻️ This comment has been updated with latest results.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sratz also for your patience on this one.

This also looks fine to me, but I couldn't test it in action. I assume you are confident that this is the right general way. At least to me it looks sane.

I have pushed a few clean-ups/some streamlining to your branch. Here also the remark from PDE: I don't think it is necessary to be consistent with old styles, especially for internals (I'm actually in favor of the opposite: modernize the code at every occasion).

If you are fine with the additions, I'll squash and submit them tomorrow.

@sratz
Copy link
Contributor Author

sratz commented Aug 12, 2024

Thanks @sratz also for your patience on this one.

Thanks for the review!

I have pushed a few clean-ups/some streamlining to your branch. Here also the remark from PDE: I don't think it is necessary to be consistent with old styles, especially for internals (I'm actually in favor of the opposite: modernize the code at every occasion).

If you are fine with the additions, I'll squash and submit them tomorrow.

Thanks for taking the time to improve the code. Looks good!

This also looks fine to me, but I couldn't test it in action. I assume you are confident that this is the right general way. At least to me it looks sane.

We also ran an end-to-end test on this part of the functionality:

  • Installed a snapshot of org.eclipse.equinox.p2.publisher.eclipse:1.6.200-SNAPSHOT to local maven repo
  • Consumed this version in a Tycho 5.0.0-SNAPSHOT build (*)
  • Created a .product file with the new PDE code
  • Ran publish-products using Tycho

--> The resulting macOS package contains the correct Info.plist file with the correct syntax and the URI schemes in the package are correctly recognized by Apple's launch services.

So this can also be merged 👍


(*) Tycho needs a small adjustment as well: It wraps IProductDescriptor, so needs to adopt the new functionality:

diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/ExpandedProduct.java b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/ExpandedProduct.java
index 734d5b4dc..2d7a5137c 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/ExpandedProduct.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/p2/tools/publisher/ExpandedProduct.java
@@ -28,6 +28,7 @@ import org.eclipse.equinox.internal.p2.publisher.eclipse.ProductContentType;
 import org.eclipse.equinox.p2.metadata.IInstallableUnit;
 import org.eclipse.equinox.p2.metadata.IVersionedId;
 import org.eclipse.equinox.p2.repository.IRepositoryReference;
+import org.eclipse.equinox.p2.publisher.eclipse.IMacOsBundleUrlType;
 import org.eclipse.tycho.ArtifactType;
 import org.eclipse.tycho.Interpolator;
 import org.eclipse.tycho.core.VersioningHelper;
@@ -291,4 +292,9 @@ class ExpandedProduct implements IProductDescriptor {
         return defaults.getVM(os);
     }

+    @Override
+    public List<IMacOsBundleUrlType> getMacOsBundleUrlTypes() {
+               return defaults.getMacOsBundleUrlTypes();
+       }
+
 }

But we will take care of the Tycho part as soon as Tycho consumes Eclipse 2024-09 P2.

Adds CFBundleURLTypes entries to the Info.plist dictionary.

Contributes to
eclipse-platform/eclipse.platform.ui#1901.
@HannesWell
Copy link
Member

This also looks fine to me, but I couldn't test it in action. I assume you are confident that this is the right general way. At least to me it looks sane.

We also ran an end-to-end test on this part of the functionality:

* Installed a snapshot of `org.eclipse.equinox.p2.publisher.eclipse:1.6.200-SNAPSHOT` to local maven repo

* Consumed this version in a Tycho 5.0.0-SNAPSHOT build (*)

* Created a `.product` file with the new PDE code

* Ran `publish-products` using Tycho

--> The resulting macOS package contains the correct Info.plist file with the correct syntax and the URI schemes in the package are correctly recognized by Apple's launch services.

So this can also be merged 👍

Great! Then, lets have this one in. I just squashed the commits and will submit it once the build passed again.

@HannesWell HannesWell merged commit 7d87cd1 into eclipse-equinox:master Aug 12, 2024
11 checks passed
sratz added a commit to sratz/tycho that referenced this pull request Sep 10, 2024
After eclipse-tycho#4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
sratz added a commit to sratz/tycho that referenced this pull request Sep 10, 2024
After eclipse-tycho#4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
@sratz sratz deleted the linkhandlers branch September 10, 2024 13:08
sratz added a commit to sratz/tycho that referenced this pull request Sep 10, 2024
…om 1.6.0 to 1.6.200

This is a precondition to use the new API provided with
eclipse-equinox/p2#533
and to properly support link handler registrations in macOS
product launchers.

More details:
eclipse-platform/eclipse.platform.ui#1901
sratz added a commit to sratz/tycho that referenced this pull request Sep 10, 2024
After eclipse-tycho#4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
sratz added a commit to eclipse-tycho/tycho that referenced this pull request Sep 10, 2024
After #4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
akurtakov pushed a commit to sratz/tycho that referenced this pull request Sep 11, 2024
…om 1.6.0 to 1.6.200

This is a precondition to use the new API provided with
eclipse-equinox/p2#533
and to properly support link handler registrations in macOS
product launchers.

More details:
eclipse-platform/eclipse.platform.ui#1901
akurtakov pushed a commit to sratz/tycho that referenced this pull request Sep 11, 2024
After eclipse-tycho#4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
sratz added a commit to sratz/tycho that referenced this pull request Sep 11, 2024
This is a precondition to use the new API provided with
eclipse-equinox/p2#533
and to properly support link handler registrations in macOS
product launchers.

More details:
eclipse-platform/eclipse.platform.ui#1901
sratz added a commit to sratz/tycho that referenced this pull request Sep 11, 2024
After eclipse-tycho#4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
laeubi pushed a commit to sratz/tycho that referenced this pull request Sep 11, 2024
This is a precondition to use the new API provided with
eclipse-equinox/p2#533
and to properly support link handler registrations in macOS
product launchers.

More details:
eclipse-platform/eclipse.platform.ui#1901
laeubi pushed a commit to sratz/tycho that referenced this pull request Sep 11, 2024
After eclipse-tycho#4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
laeubi pushed a commit to eclipse-tycho/tycho that referenced this pull request Sep 11, 2024
This is a precondition to use the new API provided with
eclipse-equinox/p2#533
and to properly support link handler registrations in macOS
product launchers.

More details:
eclipse-platform/eclipse.platform.ui#1901
laeubi pushed a commit to eclipse-tycho/tycho that referenced this pull request Sep 11, 2024
After #4246, we can now consume the new

org.eclipse.equinox.internal.p2.publisher.eclipse.IProductDescriptor.getMacOsBundleUrlTypes()

API in the Tycho wrapper
org.eclipse.tycho.p2.tools.publisher.ExpandedProduct.

This is necessary to properly support link handler registrations in
product's launchers.

See
eclipse-platform/eclipse.platform.ui#1901
eclipse-equinox/p2#533
for more information.
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 this pull request may close these issues.

3 participants