-
Notifications
You must be signed in to change notification settings - Fork 903
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
fix(apple): include check if Podfile
and Podfile.lock
changed when deciding to install Cocoapods
#2443
base: main
Are you sure you want to change the base?
fix(apple): include check if Podfile
and Podfile.lock
changed when deciding to install Cocoapods
#2443
Conversation
Podfile
and Podfile.lock
when deciding to install Cocoapods Podfile
and Podfile.lock
changed when deciding to install Cocoapods
cc @tido64, I know that you had some concerns related to this topic. I'd really appreciate your input here what else should we improve to solve your case. |
Can you include some tests please? |
f76df9f
to
5d83cde
Compare
Could you check if it'd be faster to use checksum that is auto-generated inside |
It turns out that hashing file is faster 👀 I've created two simple scripts that checks that: Hashing file script
const fs = require('fs');
const { createHash } = require('crypto');
function generateMd5Hash(text) {
return createHash('md5').update(text).digest('hex');
}
async function main() {
const hash = generateMd5Hash(
fs.readFileSync('_/ios/Podfile.lock', 'utf8'),
);
console.log(hash);
}
main(); Reading file and checking checksum
const fs = require('fs');
const readline = require('readline')
async function main() {
const fileStream = fs.createReadStream('_/ios/Podfile.lock');
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity,
});
let lines = [];
for await (const line of rl) {
lines.push(line);
}
lines = lines.reverse();
for (const line of lines) {
if (line.includes('PODFILE CHECKSUM')) {
console.log(line.split(': ')[1]);
}
}
}
main(); On fresh project when
but I've created an example scenario when
|
Rather than speed, I think in this case I'd would much prefer that we are consistent with CocoaPods. If it thinks that the manifest needs to be updated, so should we, and vice versa. And I think the only way to ensure that is to reuse the checksum or CocoaPods directly. |
Yeah, so I've added reading checksum after installing Cocoapods, so that new checksum is saved. Together with @TMisiukiewicz we did some investigations and it turns out that there are 3 scenarios with current implementation where we'll run
For 1), 2) I think we could add phase of updating cache values e.g. in post-install hook in For 3) I think it's really edge case-y and supporting this would solve very small amount of cases, or maybe even 0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nits, the logic sounds good to me!
…o install Cocoapods
Co-authored-by: Riccardo Cipolleschi <[email protected]>
c829229
to
5abea6e
Compare
Summary:
Comparing only
dependencies
field fromconfig
's command output takes into account only autolinked dependencies, however users can add manually Pods insidePodfile
, in this Pull Request I added validating hash forPodfile
andPodfile.lock
.Test Plan:
react-native.config.js
and enable automaticPodsInstallationPodfile
orPodfile.lock
content changes installation of Cocoapods should be triggeredChecklist