Closed chandrapol closed 1 year ago
Hi, what is the version number of the InjectionII app you're using? Have you tried downloading one of the binary releases on this repo? Have you looked at running the script it mentions to investigate what the problem is?
If you look at the script it redirects all output into files so you wouldn't see anything happening. Is there anything in the .err file that captures stderr. Can you post the .pl file here so I can have a look?
Hello @johnno1962 : Here are the details that you asked for.
# search through build logs, most recent first
cd "/Users/USER/Library/Developer/Xcode/DerivedData/TicketApp-aaapbleqojdykabvnkbnyvyskwoy/Logs/Build" &&
for log in `ls -t *.xcactivitylog`; do
#echo "Scanning $log"
/usr/bin/env perl "/var/folders/_1/97p229zj2r94py8s8tp21h280000gn/T/com.johnholdsworth.InjectionIII/eval101.pl" "$log" >"/var/folders/_1/97p229zj2r94py8s8tp21h280000gn/T/com.johnholdsworth.InjectionIII/eval101.sh" 2>"/var/folders/_1/97p229zj2r94py8s8tp21h280000gn/T/com.johnholdsworth.InjectionIII/eval101.err" && exit 0
done
exit 1;
No contents. The file is empty.
use JSON::PP;
use English;
use strict;
# line separator in Xcode logs
$INPUT_RECORD_SEPARATOR = "\r";
# format is gzip
open GUNZIP, "/usr/bin/gunzip <\"$ARGV[0]\" 2>/dev/null |" or die "gnozip";
# grep the log until there is a match
my ($realPath, $command);
while (defined (my $line = <GUNZIP>)) {
if ($line =~ /^\s*cd /) {
$realPath = $line;
}
elsif ($line =~ m@ -(?:primary-file|c(?<!-frontend -c)) (?:\\?\"(\Q/Users/USER/Projects/test-TicketApp/Universe/UserInformation/Categories/Controller/CategoriesVC.swift\E)\\?\"|(\Q/Users/USER/Projects/test-TicketApp/Universe/UserInformation/Categories/Controller/CategoriesVC.swift\E)) @oi and $line =~ " x86_64") {
# found compile command
# may need to extract file list
if ($line =~ / -filelist /) {
while (defined (my $line2 = <GUNZIP>)) {
if (my($filemap) = $line2 =~ / -output-file-map ([^ \\]+(?:\\.[^ \\]+)*) / ) {
$filemap =~ s/\\//g;
my $file_handle = IO::File->new( "< $filemap" )
or die "Could not open filemap '$filemap'";
my $json_text = join'', $file_handle->getlines();
my $json_map = decode_json( $json_text, { utf8 => 1 } );
my $filelist = '/var/folders/_1/97p229zj2r94py8s8tp21h280000gn/T/com.johnholdsworth.InjectionIII//filelist.txt';
my $swift_sources = join "\n", keys %$json_map;
my $listfile = IO::File->new( "> $filelist" )
or die "Could not open list file '$filelist'";
binmode $listfile, ':utf8';
$listfile->print( $swift_sources );
$listfile->close();
$line =~ s/( -filelist )([^\s\\]*(?:\\.[^\s\\]*)*)( )/$1$filelist$3/;
last;
}
}
}
if ($realPath and (undef, $realPath) = $realPath =~ /cd (\"?)(.*?)\1\r/) {
# print "cd \"$realPath\" && ";
}
# find last
$command = $line
#exit 0;
}
elsif (my ($bazel, $dir) = $line =~ /^Running "([^"]+)".* (?:patching output for workspace root|with project path) at ("[^"]+")/) {
$command = "cd $dir && $bazel";
last;
}
}
if ($command) {
print $command;
exit 0;
}
# class/file not found
exit 1;
Are you able to send through to GitHub at johnholdsworh.com, one of the compressed .xcactivity build logs in /Users/USER/Library/Developer/Xcode/DerivedData/TicketApp-aaapbleqojdykabvnkbnyvyskwoy/Logs/Build?
Are you able to send through to GitHub at johnholdsworh.com, one of the compressed .xcactivity build logs in /Users/USER/Library/Developer/Xcode/DerivedData/TicketApp-aaapbleqojdykabvnkbnyvyskwoy/Logs/Build?
Sent. Thank you.
Very sorry, I gave you the wrong email address there.. GitHub at johnholdsworth.com. If should have bounced, can you send it again please?
Very sorry, I gave you the wrong email address there.. GitHub at johnholdsworth.com. If should have bounced, can you send it again please?
Sent again. Thank you for your prompt response.
Great, thanks for sending it through. I don't know why but the file you're injecting isn't mentioned in the logs you sent through and if how to compile a file is logged it won't be possible to inject it. Is this to do with CocoaPods?
... but the file you're injecting isn't mentioned in the logs you sent through
This is happening for all the files including AppDelegate.swift
or any other file.
If you see any .swift
file or .m
file on the log, I see the same output on the Xcode terminal.
💉 ⚠️ Could not locate compile command for /Users/kbc/Projects/TicketBook/Universe/UserInformation/UserInfoEditMultiSelectionCell.swift.
This could be due to one of the following:
...
...
As I said UserInfoEditMultiSelectionCell.swift is not mentioned in your log at all. With AppDelegate.swift it's in a directory that contains a space and there are some paths with & which is very difficult to support which is probably the problem there. There is much that is unusual about the log you sent which I can't quite work out. I can't spend too much time on this but I suggest you start with a simpler example and work your way up to what seems to be a very complex and unusual project, built in an unusual way. Are you sure you're not using whole module optimisation? By spending more time looking at what the scripts do, it should be possible to work out why you're not getting a match. Injection delegates to scripts so people can support themselves a little more.
As I said UserInfoEditMultiSelectionCell.swift is not mentioned in your log at all. With AppDelegate.swift it's in a directory that contains a space and there are some paths with & which is very difficult to support which is probably the problem there. There is much that is unusual about the log you sent which I can't quite work out. I can't spend too much time on this but I suggest you start with a simpler example and work your way up to what seems to be a very complex and unusual project, built in an unusual way. Are you sure you're not using whole module optimisation?
I totally understand. Very much appreciated your time to make this tool and spent time supporting it. I will look a little more into the setup and other things you mentioned.
Godspeed.
I am getting this error on M1 Mac (mentioned at the end of the post).