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 adding build tool plugins to targets #1374

Merged
merged 11 commits into from
Aug 16, 2023

Conversation

BarredEwe
Copy link
Contributor

@BarredEwe BarredEwe commented Jul 16, 2023

Short description 📝

Support for Build Tool Plugins has been added here. A detailed discussion can be read here: #1290

Screenshot 2023-07-16 at 13 18 29

Details ⚙️

API

To use plugins, you need to specify in your target which plugin you want to connect.

targets:
  App:
    buildToolPlugins:
      - plugin: PrefirePlaybookPlugin
        package: Prefire

And don't forget to connect the package.

packages:
  Prefire:
    url: https://github.com/BarredEwe/Prefire
    from: 1.3.0

What is generated

  1. Added PBXTargetDependency:
E157C6348B8AD6A28C706801 /* PBXTargetDependency */ = {
	isa = PBXTargetDependency;
	productRef = DC47EF1BFBBD751E3C1C95E3 /* PrefirePlaybookPlugin */;
};
  1. Added Plugin information. An additional prefix (plugin:) is added:
DC47EF1BFBBD751E3C1C95E3 /* PrefirePlaybookPlugin */ = {
	isa = XCSwiftPackageProductDependency;
	package = 41BBDD09D038D66F59D14D11 /* XCRemoteSwiftPackageReference "Prefire" */;
	productName = "plugin:PrefirePlaybookPlugin";
};

What is being validated

If you add a plugin that references a package that is not in the project:

packages:
  Prefire:
    url: https://github.com/BarredEwe/Prefire
    from: 1.3.0
targets:
  App:
    buildToolPlugins:
      - plugin: PrefirePlaybookPlugin
        package: SomeName # Must be `Prefire`

There will be an error:

Spec validation error: Plugin PrefirePlaybookPlugin has invalide package reference SomeName

Package.swift Outdated Show resolved Hide resolved
@BarredEwe BarredEwe force-pushed the feature/xcode-build-tool-plugin branch 2 times, most recently from 575ec5e to 7ca1234 Compare July 16, 2023 14:54
@BarredEwe BarredEwe marked this pull request as draft July 16, 2023 14:55
@BarredEwe BarredEwe force-pushed the feature/xcode-build-tool-plugin branch 23 times, most recently from 1f02625 to c93a406 Compare July 17, 2023 19:08
@BarredEwe BarredEwe marked this pull request as ready for review July 17, 2023 19:47
Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

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

.gitignore Outdated Show resolved Hide resolved
[email protected] Outdated Show resolved Hide resolved
Sources/ProjectSpec/BuildToolPlugin.swift Show resolved Hide resolved
Sources/XcodeGenKit/PBXProjGenerator.swift Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@giginet giginet self-requested a review July 28, 2023 08:50
@BarredEwe BarredEwe force-pushed the feature/xcode-build-tool-plugin branch 3 times, most recently from 6eef473 to 96130d1 Compare August 1, 2023 09:10
Copy link
Collaborator

@freddi-kit freddi-kit left a comment

Choose a reason for hiding this comment

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

Great job! Let's wait @yonaskolb 's final review and XcodeProj's release

.gitignore Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Docs/ProjectSpec.md Outdated Show resolved Hide resolved
@BarredEwe BarredEwe force-pushed the feature/xcode-build-tool-plugin branch from a676871 to d4ce70f Compare August 1, 2023 11:49
@yanniks
Copy link

yanniks commented Aug 14, 2023

Hi @yonaskolb and @freddi-kit !
Do you already have an update when this is about to be merged? We're eagerly waiting for this feature 😊 .

Cheers,
Yannik

@yonaskolb
Copy link
Owner

@yanniks this feature is good to go, we're just waiting on a release of XcodeProj (And the recent merge conflicts to be resolved)

Package.swift Outdated Show resolved Hide resolved
@BarredEwe BarredEwe force-pushed the feature/xcode-build-tool-plugin branch from 616e666 to b9d7d2a Compare August 16, 2023 08:29
Copy link
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

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

Thank you for all your great work on this @BarredEwe! 🙏

@yonaskolb yonaskolb merged commit d8d5457 into yonaskolb:master Aug 16, 2023
2 checks passed
@OmranK
Copy link

OmranK commented Aug 28, 2023

Was there a dependency on Xcode version for this to work? Works fine on my machine with Xcode 14.3.1 but seems to not link it up correctly on my colleague's machine which is on Xcode 14.2

@BarredEwe
Copy link
Contributor Author

BarredEwe commented Aug 28, 2023

@OmranK Can you add an Xcode error?

PS: If you add a plugin without XcodeGen in Xcode 14.2, does it work correctly?

@OmranK
Copy link

OmranK commented Aug 28, 2023

@BarredEwe There is no error. It simply shows "Run Build Tool Plug-ins (0 items)". If he manually clicks + and adds in SwiftLintPlugin, it works.

@BarredEwe
Copy link
Contributor Author

@OmranK I can't reproduce this on Xcode 14.2 and the project Fixtures/SPM.

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.

5 participants