-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
Detect project path #4
Comments
Thanks for this, I’ve pushed as version of which works with Swift as well along with other changes and updated the binary d1edb9e |
I am not sure if you understand my question. The first Qusetion is the function |
findDerivedData should return the main project otherwise there will be no derived data. Do you need the path to be the main project or the subproject for things to compile? I’m using the following: # grep the log until there is a match
my $realPath;
while (defined (my $line = <GUNZIP>)) {
if ($line =~ /^\\s*cd /) {
$realPath = $line;
}
elsif ($line =~ m@\(regexp.escaping("\"$"))@o and $line =~ " \(arch)") {
# 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 = "/tmp/filelist.txt";
my $swift_sources = join "\n", keys %$json_map;
IO::File->new( "> $filelist" )->print( $swift_sources );
$line =~ s/( -filelist )(\\S+)( )/$1$filelist$3/;
last;
}
}
}
if ($realPath and (undef, $realPath) = $realPath =~ /cd (\\"?)(.*?)\\1\\r/) {
print "cd \\"$realPath\\" && ";
}
# stop search
print $line;
exit 0; |
There are two questions.What you said is the second question. |
What you say is true. Once you’ve built the subproject and it has derived data the logs will be taken from that directory. If it built that shouldn’t be a problem though particularly now the “cd” directory for the compile comes from the logs? It should use the most recently modified log directory perhaps. |
Because the subProject's activitylog may be out of date. So it will failed when rebuild the file. |
Something like the following? func findProject(for source: URL, derivedData: URL) -> (projectFile: URL, logsDir: URL)? {
let dir = source.deletingLastPathComponent()
if dir.path == "/" {
return nil
}
var candidate = findProject(for: dir, derivedData: derivedData)
if let files = try? FileManager.default.contentsOfDirectory(atPath: dir.path),
let project = file(withExt: "xcworkspace", in: files) ?? file(withExt: "xcodeproj", in: files),
let logsDir = logsDir(project: dir.appendingPathComponent(project), derivedData: derivedData),
mtime(logsDir.path) > candidate.flatMap({ mtime($0.logsDir.path) }) ?? 0 {
candidate = (dir.appendingPathComponent(project), logsDir)
}
return candidate
} |
When we start the app, the injection server will get the project root. Maybe transfer it to the client is better? |
Pushed a version that determines the full log directory at the server and passes it through. |
This release includes “Xprobe”, you’ll need to do a |
If I was changing a file in subProject, the path returned is subproject's path, not the main porject's path.
And If the subproject's
Header Search Path
was relative, it would not find the headers. I try to resolve this problem by chainge the code like below:The text was updated successfully, but these errors were encountered: