Skip to content

Commit

Permalink
4.5.1 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnno1962 committed Nov 15, 2022
1 parent 20a162c commit 6d6a26b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions BAZEL.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Experimental Bazel build system support.

The [binary GitHub releases](https://github.com/johnno1962/InjectionIII/releases), version 4.5.* or above contain an initial implementation of injecting larger apps which have switched to using the [bazel](https://bazel.build/) build system.
The [binary GitHub releases](https://github.com/johnno1962/InjectionIII/releases), version 4.5.* or above contain an initial implementation of injecting larger apps which have elected to use the [bazel build system](https://bazel.build/).

In fact there are two implementations available. The default, more conservative implementation, searches the Xcode build logs for a line starting `Running "` where `bazel` is invoked and calls this command when a source file is modified. It then looks for object files that have been modified by the build and "injects" then in the way the InjectionIII has up until now. To use this version download one of the binary 4.5+ releases of the InjectionIII app, run it and add the following bundle load code somewhere in your app's initialisation:
In fact, there are two implementations available. A more conservative implementation, searches the Xcode build logs for a line starting `Running "` where `bazel` is invoked and calls this command when a source file is modified. It then looks for object files that have been modified by the build and "injects" then in the way the InjectionIII has up until now. To use this version download one of the binary 4.5+ releases of the InjectionIII app, run it and add the following bundle load code somewhere in your app's initialisation:

```
#if DEBUG
Expand All @@ -11,6 +11,8 @@ Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bun
```
When your app starts a file open panel will appear asking you to select the project's root directory which will be used to start a "file watcher" watching for modifications to Swift source files. In theory, if you have used [tulsi](https://github.com/bazelbuild/tulsi) to create your Xcode project, when you save a file, the InjectionIII app will see the `bazel` invocation in the build logs and use it to recompile the project sources and inject the object files that were updated. Note: it's important to the `--linkopt="-Wl,interposable"` either in your Xcode project's build phase that invokes `bazel` or in the relevant BUILD file.

There is a second less conservative implementation that you should find injects code modifications more quickly. To use this version, quit the InjectionIII app and restart your app. When you save a file, this version (if it finds a WORKSPACE file in a directory somewhere above the source file changed) will only recompile the module of Swift file modified rather than a do full `bazel` rebuild. It then injects object files modified as before. To do this, this version very slightly patches your `bazel` installation to make a link available in /tmp/bazel_ModuleName.params to preserve the parameters file `bazel` passed directly to `swiftc` to incrementally recompile the module in the last build.
There is a second less conservative implementation that you should find injects code modifications more quickly. To use this version, quit the InjectionIII app and restart your app to use "standalone" injection. When you save a file, this version (if it finds a WORKSPACE file in a directory somewhere above the source file changed) will only recompile the module of Swift file modified rather than a do full `bazel` rebuild. It then injects object files modified as before. To do this, this version very slightly patches your `bazel` installation to make a link available in /tmp/bazel_ModuleName.params to preserve the parameters file `bazel` passed directly to `swiftc` to incrementally recompile the module in the last build.

InjectionIII, using the version with or without the app running works best if you don't use "Whole module optimization" otherwise, all object files are regenerated and injection has to resort to heuristics to determine which other objects will be included to cover "shared hidden symbols" resulting in slower iteration times. For more details on the evolution of this feature consult the original [github issue](https://github.com/johnno1962/InjectionIII/issues/388).

$Date: 2022/11/15 $
2 changes: 1 addition & 1 deletion HotReloading
2 changes: 2 additions & 0 deletions InjectionIII.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
BB80B3B426B573BE0055FAAE /* README_Chinese.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README_Chinese.md; sourceTree = "<group>"; };
BB9642A527E339BC00C61CB7 /* ObjcInjection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ObjcInjection.swift; path = HotReloading/Sources/HotReloading/ObjcInjection.swift; sourceTree = SOURCE_ROOT; };
BB9642A727E33C8F00C61CB7 /* DeviceInjection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DeviceInjection.swift; path = HotReloading/Sources/HotReloading/DeviceInjection.swift; sourceTree = SOURCE_ROOT; };
BB9DE2302923C3B000926B1B /* BAZEL.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = BAZEL.md; sourceTree = "<group>"; };
BBA7BE0223473D660067124D /* build_bundles.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = build_bundles.sh; sourceTree = "<group>"; };
BBAD6A2B290915DB00DEB1A5 /* InjectionStats.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InjectionStats.swift; path = HotReloading/Sources/HotReloading/InjectionStats.swift; sourceTree = SOURCE_ROOT; };
BBB040631FB1798A007DDD0A /* ScriptingBridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScriptingBridge.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/ScriptingBridge.framework; sourceTree = DEVELOPER_DIR; };
Expand Down Expand Up @@ -394,6 +395,7 @@
BB037DF31FAD808B004B267C /* README.md */,
BB80B3B426B573BE0055FAAE /* README_Chinese.md */,
BB596EE127AAC5A6009B6241 /* ROADMAP.md */,
BB9DE2302923C3B000926B1B /* BAZEL.md */,
BB6125D224EA882000A7C230 /* Injection.jar */,
BBCA01FF1FB0F10300E45F0F /* InjectionIII */,
BBCA02461FB1065D00E45F0F /* InjectionBundle */,
Expand Down
2 changes: 1 addition & 1 deletion InjectionIII/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>7580</string>
<string>7581</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 6d6a26b

Please sign in to comment.