Skip to content

Extract configure into its own subcommand (first of such extractions) #268

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

Merged
merged 5 commits into from
Jun 16, 2025

Conversation

ktoso
Copy link
Collaborator

@ktoso ktoso commented Jun 12, 2025

We're going towards a shape where swift-java has sub commands for the independent tasks it can perform: swift-java [configure|resolve|jextract|wrap-java???] and they have some common options but also some options that only make sense for some of the sub commands.

This is the first steps towards this world of a more cleaned-up swift-java command line tool.

@ktoso ktoso marked this pull request as draft June 12, 2025 09:29
@ktoso ktoso force-pushed the wip-make-configure-its-own-command branch 2 times, most recently from 76f99da to cf0ea10 Compare June 13, 2025 02:30
@ktoso ktoso changed the title WIP: Extract configure into its own subcommand (first of such extractions) Extract configure into its own subcommand (first of such extractions) Jun 13, 2025
@ktoso ktoso marked this pull request as ready for review June 13, 2025 02:51
@ktoso ktoso force-pushed the wip-make-configure-its-own-command branch from cf0ea10 to 9ab784f Compare June 13, 2025 02:51
@ktoso ktoso force-pushed the wip-make-configure-its-own-command branch from 9ab784f to df6e098 Compare June 13, 2025 02:51
Comment on lines +28 to +34
protocol HasCommonOptions {
var commonOptions: SwiftJava.CommonOptions { get set }
}

protocol HasCommonJVMOptions {
var commonJVMOptions: SwiftJava.CommonJVMOptions { get set }
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think these protocols are actually used at this point. Any plan to utilize these?

Maybe like this?

extension HasCommonOptions {
  var outputDirectory: String? { commonOptions.outputDirectory }
  var inputSwift: String? { commonOptions.inputSwift }
  var logLevel: Logger.Level { commonOptions.logLevel }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The primary reason was trying to rip out common functions like write... into extension where Self: HasCommonOptions but I didn't do that yet.

Your suggestion is also nice. I'll see how much use we get out of them and if none we could remove it

@ktoso ktoso force-pushed the wip-make-configure-its-own-command branch from 3b7268c to 231faca Compare June 16, 2025 02:03
@ktoso ktoso merged commit 2fb33d8 into swiftlang:main Jun 16, 2025
17 checks passed
@ktoso ktoso deleted the wip-make-configure-its-own-command branch June 16, 2025 02:13
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.

2 participants