Skip to content

Instantly share code, notes, and snippets.

buck2 is very explicit re: the interactions dep files have w/caching:

  • dep files can (after execution) narrow the set of inputs for an action
  • the input set of the action as known to your buck2 daemon will have this narrowed set but...
    • the actual action cache key (as is given to disk/remote caches, etc.) will still have the full set of inputs
  • ultimately this means that as far as remote caching for cold builds is concerned, the action at hand is still keyed on all of its inputs — including the ones that are pruned
    • this means that — for cold builds — if there have been any changes to any of the "pruned out" files since the last run of the action (+ cache population), the action will not hit in the cache
  • additionally, in the event that there are analysis-level changes that result in the starlark action being reconstructed (i.e. BUILD file is edited), we also lose the narrowed set of inputs
  • for changes that materially affect t
@pudquick
pudquick / 00-reproducible-mach-o.md
Last active March 18, 2025 04:15
Reproducible Builds for macOS

Reproducible Builds for macOS

There's a neat writeup I stumbled across recently titled "Reproducible codesigning on Apple Silicon" from Keith Smiley about some gotchas when it comes to compiling a binary in a way that's repeatable and always generates the exact same byte output (which would then checksum to the exact same hash) - even if compiled on a different Mac.

In applying the suggestions I found in the blog post, I found a few other corner cases that I just wanted to get documented more explicitly somewhere.

Tools Matter

Footnote 2 from that blog post is important:

@insidegui
insidegui / lsremovearchives.sh
Created December 21, 2021 18:28
Remove Xcode app archives from macOS LaunchServices database
#!/bin/bash
# Recursivelly removes all apps from your Xcode archives from the LaunchServices database, preventing them from being used for widgets, launch at login, etc.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -R -f -u $HOME/Library/Developer/Xcode/Archives
@dsabanin
dsabanin / enable-xcode-debug-menu.sh
Last active November 7, 2022 16:17
Enable internal Xcode debug menu in Xcode 11
defaults write com.apple.dt.Xcode ShowDVTDebugMenu -bool YES
sudo mkdir -p /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode
sudo touch /Applications/Xcode.app/Contents/Developer/AppleInternal/Library/Xcode/AppleInternal.plist
# Don't forget to restart Xcode
@steventroughtonsmith
steventroughtonsmith / UIView+Tooltips.h
Last active December 23, 2023 11:05
WIP tooltips for Mac Catalyst
//
// UIView+Tooltips.h
// Crossword
//
// Created by Steven Troughton-Smith on 13/09/2019.
// Copyright © 2019 Steven Troughton-Smith. All rights reserved.
//
#import <UIKit/UIKit.h>
@bbl
bbl / make_variable_check.md
Created July 13, 2019 12:10
Makefile check if variable is defined

Check if variable is defined in a Makefile

Using ifndef

ifndef MY_FLAG
$(error MY_FLAG is not set)
endif
@steventroughtonsmith
steventroughtonsmith / bitcode2intel
Created May 18, 2019 15:31
Converts an ARM64 iOS app with Bitcode into an X86_64 variant
#!/bin/bash
TARGET="$( cd "$(dirname "$1")" ; pwd -P )/$1"
SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
TARGET_ARCH=x86_64
export IPHONEOS_DEPLOYMENT_TARGET=12.2
rm -r /tmp/bitcode2intel
mkdir -p /tmp/bitcode2intel
pushd /tmp/bitcode2intel
#import "fishhook.h" // from https://github.com/facebook/fishhook
// Replace write and writev, the two "chokepoint" functions that writes to stderr and stdout will probably pass through
static int (*originalWritev)(int fd, const struct iovec *v, int n);
static int (*originalWrite)(int fd, const void *buf, size_t size);
void checkForBadConstraintsMessage(int fd, const char *string, size_t size) {
if (strnstr(string, "UIViewAlertForUnsatisfiableConstraints", size)) {
// Write it to the console anyways before crashing
originalWrite(fd, string, size);
@DerekSelander
DerekSelander / LLDB_command_search.mm
Created November 6, 2018 21:08
A cleaned up and commented file of the dynamically generated code from the LLDB search.py command
//
// LLDB_command_search.mm
// Code Challenge
//
// Created by Derek Selander on 11/6/18.
// Copyright © 2018 Selander. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
@a-voronov
a-voronov / Monokai.xccolortheme
Last active October 27, 2023 06:16
Xcode 11 Monokai Theme 🎨
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>1 1 1 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>SFMono-Medium - 12.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>