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

Create example approach to Danger framework with module stability #579

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
663 changes: 663 additions & 0 deletions Projects/Danger/Danger.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"pins" : [
{
"identity" : "logger",
"kind" : "remoteSourceControl",
"location" : "https://github.com/shibapm/Logger",
"state" : {
"revision" : "53c3ecca5abe8cf46697e33901ee774236d94cce",
"version" : "0.2.3"
}
},
{
"identity" : "octokit.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nerdishbynature/octokit.swift",
"state" : {
"revision" : "f762f1566f7cd0e683b9329f169c28ab6ef993cc",
"version" : "0.12.0"
}
},
{
"identity" : "requestkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nerdishbynature/RequestKit.git",
"state" : {
"revision" : "8b0258ea2a4345cbcac90509b764faacea12efb0",
"version" : "3.2.1"
}
},
{
"identity" : "version",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mxcl/Version",
"state" : {
"revision" : "1fe824b80d89201652e7eca7c9252269a1d85e25",
"version" : "2.0.1"
}
}
],
"version" : 2
}
12 changes: 12 additions & 0 deletions Projects/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// swift-tools-version:5.5

// Leave blank. This is only here so that Xcode doesn't display this folder
// when using the Package.swift at the root of the repo.

import PackageDescription

let package = Package(
name: "empty",
products: [],
targets: []
)
2 changes: 1 addition & 1 deletion Sources/Danger/Danger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
#else
import Darwin.C
#endif
import Logger
@_implementationOnly import Logger

// MARK: - DangerRunner

Expand Down
2 changes: 1 addition & 1 deletion Sources/Danger/DangerDSL.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import OctoKit
@_implementationOnly import OctoKit

// http://danger.systems/js/reference.html

Expand Down
6 changes: 3 additions & 3 deletions Sources/Danger/DangerUtils.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DangerShellExecutor
@_implementationOnly import DangerShellExecutor
import Foundation
import OctoKit
import RequestKit
@_implementationOnly import OctoKit
@_implementationOnly import RequestKit

/// Utility functions that make Dangerfiles easier to write

Expand Down
6 changes: 4 additions & 2 deletions Sources/Danger/GitHubDSL.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Foundation
import OctoKit
@_implementationOnly import OctoKit

// swiftlint:disable nesting
// swiftlint:disable file_length
Expand All @@ -24,7 +24,9 @@ public struct GitHub: Decodable {

public let requestedReviewers: RequestedReviewers

public internal(set) var api: Octokit!
// Not currently solving for this -- it will probably require
// wrapping OctoKit.
public internal(set) var api: Any!
}

public extension GitHub {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Danger/Plugins/SwiftLint/SwiftLint.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import DangerShellExecutor
@_implementationOnly import DangerShellExecutor
import Foundation

/// The SwiftLint plugin has been embedded inside Danger, making
Expand Down
1 change: 1 addition & 0 deletions Sources/Runner/Commands/Runner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func runDanger(logger: Logger) throws {
exit(1)
}

libArgs += ["-F", libDangerPath] // Link to Danger.framework inside this folder
libArgs += ["-L", libDangerPath] // Link to libDanger inside this folder
libArgs += ["-I", libDangerPath] // Find libDanger inside this folder

Expand Down
1 change: 1 addition & 0 deletions Sources/RunnerLib/Runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public enum Runtime {
let libPaths = commandArgPath + potentialLibraryFolders + depManagerDangerLibPaths

func isTheDangerLibPath(path: String) -> Bool {
fileManager.fileExists(atPath: path + "/Danger.framework") || // OSX
fileManager.fileExists(atPath: path + "/libDanger.dylib") || // OSX
fileManager.fileExists(atPath: path + "/libDanger.so") // Linux
}
Expand Down
20 changes: 20 additions & 0 deletions build_runner_and_framework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

rm -rf .build

# Builds the runner and the framework that will be used by the Dangerfile.swift.
# Then copies both to the root of the repo.

swift build -c release --arch arm64 --arch x86_64

cp .build/apple/Products/Release/danger-swift .

cd Projects/Danger

xcodebuild archive -project Danger.xcodeproj -scheme Danger -sdk macosx -destination "generic/platform=macOS" -archivePath "archives/Danger.framework"

cd ../..

cp -r Projects/Danger/archives/Danger.framework.xcarchive/Products/Library/Frameworks/Danger.framework .

rm -rf Projects/Danger/archives