Skip to content

Commit

Permalink
Sync with main package
Browse files Browse the repository at this point in the history
Includes:
 - Updated API to match the new name of the CLI tool;
 - Dropped support for Swift 5.6;
 - Updated README.
  • Loading branch information
mgutski committed Apr 5, 2023
1 parent d961fc0 commit cee4ab0
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.6
// swift-tools-version: 5.7

import PackageDescription

Expand All @@ -15,14 +15,14 @@ let package = Package(
],
targets: [
.binaryTarget(
name: "confidential",
url: "https://github.com/securevale/swift-confidential/releases/download/0.1.0/ConfidentialBinary-macos.artifactbundle.zip",
checksum: "fd43375b35d57a6c36476b70f968b3cebf2f9fea28d9444addc21c9728ba935c"
name: "swift-confidential",
url: "https://github.com/securevale/swift-confidential/releases/download/0.2.0/SwiftConfidentialBinary-macos.artifactbundle.zip",
checksum: "303ce7c03eb27656cba908c48974dc656925c6dd605d2774b822ca6254bdfe91"
),
.plugin(
name: "Confidential",
capability: .buildTool(),
dependencies: ["confidential"]
dependencies: ["swift-confidential"]
)
],
swiftLanguageVersions: [.v5]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PackagePlugin

extension ConfidentialTool {
extension SwiftConfidentialTool {

struct ObfuscateCommand: Equatable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import PackagePlugin

enum ConfidentialTool {
enum SwiftConfidentialTool {

static func instance(for context: Context) throws -> ExecutableTool {
try context.tool(named: "confidential")
try context.tool(named: "swift-confidential")
}
}
4 changes: 2 additions & 2 deletions Plugins/Confidential/plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ extension Confidential: XcodeBuildToolPlugin {
private extension Confidential {

func createBuildCommands(context: Context, configurationFile: Path) throws -> [Command] {
let confidentialTool = try ConfidentialTool.instance(for: context)
let confidentialTool = try SwiftConfidentialTool.instance(for: context)
let outputDir = context.pluginWorkDirectory.appending(C.GeneratedSources.directoryName)
let outputFile = outputDir.appending(C.GeneratedSources.outputFileName)
let obfuscateCommand = ConfidentialTool.ObfuscateCommand(
let obfuscateCommand = SwiftConfidentialTool.ObfuscateCommand(
configuration: configurationFile,
output: outputFile
)
Expand Down
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
# Swift Confidential Plugin

[![CI](https://github.com/securevale/swift-confidential-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/securevale/swift-confidential-plugin/actions/workflows/ci.yml)
[![Swift](https://img.shields.io/badge/Swift-5.6-red)](https://www.swift.org/download)
[![Swift](https://img.shields.io/badge/Swift-5.8%20%7C%205.7-red)](https://www.swift.org/download)

A Swift Package Manager build tool plugin that supports obfuscating Swift literals embedded in SwiftPM libraries and executables.
A Swift Package Manager build tool plugin that supports obfuscating Swift literals embedded in libraries and executables.

## Usage

Please see [the Swift Confidential documentation](https://github.com/securevale/swift-confidential) for more detailed usage instructions.
Please see the [Swift Confidential documentation](https://github.com/securevale/swift-confidential) for more detailed usage instructions.

### Adding the plugin as a dependency

To use the Swift Confidential plugin with your package, add it to the package's dependencies and then to your target's plugins:
You can use this plugin with both SwiftPM and Xcode targets, depending on your needs. Please see the relevant section below for detailed installation instructions.

#### SwiftPM

To use the Swift Confidential plugin with your SwiftPM target, add it to the package's dependencies and then to your target's plugins:

```swift
// swift-tools-version: 5.6
// swift-tools-version: 5.7

import PackageDescription

let package = Package(
// name, platforms, products, etc.
dependencies: [
// other dependencies
.package(url: "https://github.com/securevale/swift-confidential-plugin.git", from: "0.1.0")
.package(url: "https://github.com/securevale/swift-confidential-plugin.git", .upToNextMinor(from: "0.2.0"))
],
targets: [
.target(
Expand All @@ -36,7 +40,14 @@ let package = Package(
)
```

> **NOTE:** Swift 5.6 is required in order to run the plugin.
#### Xcode

To use the Swift Confidential plugin directly with your Xcode target:

* Add `swift-confidential-plugin` package to your Xcode project. Please refer to the [official documentation](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app) for step-by-step instructions on how to add package dependencies.
* Then, navigate to your target’s `Build Phases` pane, and in the `Run Build Tool Plug-ins` section, click the `+` button, select the `Confidential` plugin, and click the `Add` button.

> **NOTE:** Due to the limitations of XcodeProjectPlugin API, the [`confidential.yml` configuration file](https://github.com/securevale/swift-confidential#configuration) must be located in the Xcode project's top-level directory, meaning that you cannot create distinct sets of secret literals for different Xcode targets. Hopefully, this behavior will be improved in the future.
## Versioning

Expand All @@ -45,4 +56,4 @@ This project follows [semantic versioning](https://semver.org/). The plugin's re
## License

This plugin is released under Apache License v2.0 with Runtime Library Exception.
Please see [LICENSE](LICENSE) for more information.
Please see [LICENSE](LICENSE) for more information.

0 comments on commit cee4ab0

Please sign in to comment.