Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #77 from victor-sarda/feature/vs/update-just-tweak…
Browse files Browse the repository at this point in the history
…-for-spm

Fix JustTweak SPM support
  • Loading branch information
albertodebortoli authored Jun 28, 2022
2 parents dc34bc7 + 51943e0 commit 745d916
Show file tree
Hide file tree
Showing 62 changed files with 31 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Example/JustTweak.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
name = "[CP-User] TweakAccessorGenerator";
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "$SRCROOT/../JustTweak/Assets/TweakAccessorGenerator.bundle/TweakAccessorGenerator \\\n -l $SRCROOT/JustTweak/TweakProviders/LocalTweaks_example.json \\\n -o $SRCROOT/JustTweak/Accessors/ \\\n -c $SRCROOT/JustTweak/CodeGeneration/";
shellScript = "$SRCROOT/../TweakAccessorGenerator \\\n -l $SRCROOT/JustTweak/TweakProviders/LocalTweaks_example.json \\\n -o $SRCROOT/JustTweak/Accessors/ \\\n -c $SRCROOT/JustTweak/CodeGeneration/\n";
};
D2F894A2A9B802CCF5D931F9 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
Expand Down
2 changes: 1 addition & 1 deletion Example/JustTweak.xcworkspace/contents.xcworkspacedata

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
Expand Up @@ -13,4 +13,4 @@
]
},
"version": 1
}
}
4 changes: 2 additions & 2 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use_frameworks!
target 'JustTweak_Example' do
pod 'JustTweak', :path => '../'
script_phase :name => 'TweakAccessorGenerator',
:script => '$SRCROOT/../JustTweak/Assets/TweakAccessorGenerator.bundle/TweakAccessorGenerator \
:script => '$SRCROOT/../TweakAccessorGenerator \
-l $SRCROOT/JustTweak/TweakProviders/LocalTweaks_example.json \
-o $SRCROOT/JustTweak/Accessors/ \
-c $SRCROOT/JustTweak/CodeGeneration/',
:execution_position => :before_compile

# pod 'Firebase/RemoteConfig'
# pod 'OptimizelySDKiOS'

Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- JustTweak (10.0.2)
- JustTweak (10.0.3)

DEPENDENCIES:
- JustTweak (from `../`)
Expand All @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
JustTweak: 0143c5fc233c1e2a0d1a8eacadab26fc48b4cb5a
JustTweak: 57e7c41add4d1ec30d3b18d50be2403125f47e29

PODFILE CHECKSUM: a68b671e421f174879203bb91286c82eecc0444f
PODFILE CHECKSUM: 60571fcd23f115b554ccbb8c325e342cef52d624

COCOAPODS: 1.10.2
File renamed without changes.
13 changes: 13 additions & 0 deletions Framework/Sources/Extensions/Bundle+JustTweak.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Bundle+JustTweak.swift

import Foundation

public extension Bundle {
class var justTweak: Bundle {
#if SWIFT_PACKAGE
Bundle.module
#else
Bundle(identifier: "org.cocoapods.JustTweak")!
#endif
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public class TweakViewController: UITableViewController {
private let tweakManager: TweakManager

private class func justTweakResourcesBundle() -> Bundle {
let podBundle = Bundle(for: TweakViewController.self)
let resourcesBundleURL = podBundle.url(forResource: "JustTweak", withExtension: "bundle")!
let resourcesBundleURL = Bundle.justTweak.url(forResource: "Localizations", withExtension: "bundle")!
let justTweakResourcesBundle = Bundle(url: resourcesBundleURL)!
return justTweakResourcesBundle
}
Expand Down
12 changes: 3 additions & 9 deletions JustTweak.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@ JustTweak is a framework for feature flagging, locally and remotely configure an
s.ios.deployment_target = '11.0'
s.swift_version = '5.1'

s.source_files = 'JustTweak/Classes/**/*.swift'
s.resource_bundle = { 'JustTweak' => 'JustTweak/Assets/en.lproj/*' }
s.source_files = 'Framework/Sources/**/*.swift'
s.resources = 'Framework/Sources/Resources/**/*'

s.preserve_paths = [
'_TweakAccessorGenerator',
'TweakAccessorGenerator',
]

# Ensure the generator script are callable via
# ${PODS_ROOT}/<name>
s.prepare_command = <<-PREPARE_COMMAND_END
cp -f ./JustTweak/Assets/TweakAccessorGenerator.bundle/TweakAccessorGenerator ./_TweakAccessorGenerator
PREPARE_COMMAND_END

end
Empty file removed JustTweak/Assets/.gitkeep
Empty file.
Binary file not shown.
Empty file removed JustTweak/Classes/.gitkeep
Empty file.
Empty file removed JustTweak/Classes/UI/.gitkeep
Empty file.
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// swift-tools-version:5.1
// swift-tools-version:5.5

import PackageDescription

let package = Package(
name: "JustTweak",
defaultLocalization: "en",
platforms: [
.iOS(.v11)
],
Expand All @@ -15,7 +16,8 @@ let package = Package(
targets: [
.target(
name: "JustTweak",
path: "JustTweak/"
path: "Framework/Sources",
resources: [.process("Resources")]
)
]
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ the only currently supported value is `accessorName` that defines the name of th

```sh
script_phase :name => 'TweakAccessorGenerator',
:script => '$PODS_ROOT/JustTweak/_TweakAccessorGenerator \
:script => '$SRCROOT/../TweakAccessorGenerator \
-l $SRCROOT/<path_to_the_local_tweaks_json_file> \
-o $SRCROOT/<path_to_the_output_folder_for_the_generated_code> \
-c $SRCROOT/<path_to_the_folder_containing_config.json>',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "cp $SYMROOT/Release/TweakAccessorGenerator \&#10;$SRCROOT/../JustTweak/Assets/TweakAccessorGenerator.bundle&#10;">
scriptText = "cp $SYMROOT/Release/TweakAccessorGenerator \&#10;$SRCROOT/../../TweakAccessorGenerator&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down

0 comments on commit 745d916

Please sign in to comment.