Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Commit

Permalink
Allow users to skip clang proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulTaykalo committed May 27, 2015
1 parent bd29772 commit 9f15cb0
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 45 deletions.
92 changes: 48 additions & 44 deletions Install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

# ============= Logging support ======================
_V=0
_SKIP_CLANG_PROXY=0

while getopts "v" OPTION
while getopts "v:s" OPTION
do
case $OPTION in
v) _V=1
;;
s) _SKIP_CLANG_PROXY=1
;;
esac
done

Expand All @@ -34,50 +37,51 @@ CLANG_REAL_LOCATION=$CLANG_LOCATION-real
CLANG_REAL_LOCATION_PP="$CLANG_LOCATION-real++"

echo
echo -n "== Backing up clang : "

if [[ ! -f ${CLANG_BACKUP_LOCATION} ]]; then
# Checking, if it isn't our script laying in clang
echo grep -Fq "== CLANG_PROXY ==" "$CLANG_LOCATION"
if grep -Fq "== CLANG_PROXY ==" "$CLANG_LOCATION"
then
# code if found
# This is bad....
echo "Original clang compiler was already proxied via dyci and no backup can be found."
echo "This can be because of Xcode update without dyci uninstallation."
echo "In case, if you see this, clang is little broken now, and you need to update it manually."
echo "By running next command in your terminal : "
echo "echo ""${CLANG_LOCATION}"" ""${CLANG_BACKUP_LOCATION}"" | xargs -n 1 sudo cp /usr/bin/clang"
exit 1
if [[ $_SKIP_CLANG_PROXY -eq 0 ]]; then
echo -n "== Backing up clang : "
if [[ ! -f ${CLANG_BACKUP_LOCATION} ]]; then
# Checking, if it isn't our script laying in clang
echo grep -Fq "== CLANG_PROXY ==" "$CLANG_LOCATION"
if grep -Fq "== CLANG_PROXY ==" "$CLANG_LOCATION"
then
# code if found
# This is bad....
echo "Original clang compiler was already proxied via dyci and no backup can be found."
echo "This can be because of Xcode update without dyci uninstallation."
echo "In case, if you see this, clang is little broken now, and you need to update it manually."
echo "By running next command in your terminal : "
echo "echo ""${CLANG_LOCATION}"" ""${CLANG_BACKUP_LOCATION}"" | xargs -n 1 cp /usr/bin/clang"
exit 1
fi
# We should backup clang ONLY if it is an binary file only
log " cp ${CLANG_LOCATION} ${CLANG_BACKUP_LOCATION}"
cp "${CLANG_LOCATION}" "${CLANG_BACKUP_LOCATION}"
log "echo Backup is at : ${CLANG_BACKUP_LOCATION}"
echo "Done."
else
echo "Skipped."
echo " Seems dyci-clang has already been installed"
log "Backup is at : ${CLANG_BACKUP_LOCATION}"
fi
# We should backup clang ONLY if it is an binary file only
log "sudo cp ${CLANG_LOCATION} ${CLANG_BACKUP_LOCATION}"
sudo cp "${CLANG_LOCATION}" "${CLANG_BACKUP_LOCATION}"
log "echo Backup is at : ${CLANG_BACKUP_LOCATION}"
echo "Done."
else
echo "Skipped."
echo " Seems dyci-clang has already been installed"
log "Backup is at : ${CLANG_BACKUP_LOCATION}"
fi

echo -n "== Faking up clang : "
echo -n "== Faking up clang : "

log "sudo cp ${CLANG_BACKUP_LOCATION} ${CLANG_REAL_LOCATION}"
sudo cp "${CLANG_BACKUP_LOCATION}" "${CLANG_REAL_LOCATION}"
log "cp ${CLANG_BACKUP_LOCATION} ${CLANG_REAL_LOCATION}"
cp "${CLANG_BACKUP_LOCATION}" "${CLANG_REAL_LOCATION}"

log "sudo cp ${CLANG_BACKUP_LOCATION} ${CLANG_REAL_LOCATION_PP}"
sudo cp "${CLANG_BACKUP_LOCATION}" "${CLANG_REAL_LOCATION_PP}"
log " cp ${CLANG_BACKUP_LOCATION} ${CLANG_REAL_LOCATION_PP}"
cp "${CLANG_BACKUP_LOCATION}" "${CLANG_REAL_LOCATION_PP}"
fi

#DYCI-CLANG RIGHTS
sudo chmod +x Scripts/dyci-clang.py
sudo chmod +x Scripts/dyci-recompile.py
chmod +x Scripts/dyci-clang.py
chmod +x Scripts/dyci-recompile.py

log "sudo cp Scripts/dyci-clang.py ${CLANG_LOCATION}"
log "sudo cp Scripts/clangParams.py ${CLANG_USR_BIN}"
log "cp Scripts/dyci-clang.py ${CLANG_LOCATION}"
log "cp Scripts/clangParams.py ${CLANG_USR_BIN}"

sudo cp Scripts/dyci-clang.py "${CLANG_LOCATION}"
sudo cp Scripts/clangParams.py "${CLANG_USR_BIN}"
cp Scripts/dyci-clang.py "${CLANG_LOCATION}"
cp Scripts/clangParams.py "${CLANG_USR_BIN}"

echo "Done."

Expand All @@ -91,13 +95,13 @@ echo -n "== Preparing dyci-recompile directories: "
log "if [[ ! -d ${DYCI_ROOT_DIR}/index ]]; then"
if [[ ! -d "${DYCI_ROOT_DIR}/index" ]]; then

sudo mkdir -p "${DYCI_ROOT_DIR}/index"
sudo mkdir -p "${DYCI_ROOT_DIR}/scripts"
mkdir -p "${DYCI_ROOT_DIR}/index"
mkdir -p "${DYCI_ROOT_DIR}/scripts"

# not sure about this really
sudo chmod 777 "${DYCI_ROOT_DIR}"
sudo chmod 777 "${DYCI_ROOT_DIR}/index"
sudo chmod 777 "${DYCI_ROOT_DIR}/scripts"
chmod 777 "${DYCI_ROOT_DIR}"
chmod 777 "${DYCI_ROOT_DIR}/index"
chmod 777 "${DYCI_ROOT_DIR}/scripts"
echo "Done."
else
echo "Skipped. (Already prepared)."
Expand All @@ -106,8 +110,8 @@ fi
#Copying scripts
echo -n "== Copying scripts : "

sudo cp Scripts/dyci-recompile.py "${DYCI_ROOT_DIR}/scripts/"
sudo cp Scripts/clangParams.py "${DYCI_ROOT_DIR}/scripts/"
cp Scripts/dyci-recompile.py "${DYCI_ROOT_DIR}/scripts/"
cp Scripts/clangParams.py "${DYCI_ROOT_DIR}/scripts/"

echo "Done."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<string>9F75337B-21B4-4ADC-B558-F9CADF7073A7</string>
</array>
<key>NSPrincipalClass</key>
<string>SFDYCIHelper</string>
<string>SFDYCIPlugin</string>
<key>XC4Compatible</key>
<true/>
<key>XCGCReady</key>
Expand Down
Binary file not shown.
2 changes: 2 additions & 0 deletions Support/Xcode/Source/Classes/Plugin/SFDYCIPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ - (void)useVerboseRecompilationAction:(NSMenuItem *)useVerboseRecompilationItem
if (useVerboseRecompilationItem.state == NSOffState) {
useVerboseRecompilationItem.state = NSOnState;
[console log:@"DYCI verbose recompilation turned ON"];
console.shouldShowDebugInfo = YES;
} else {
useVerboseRecompilationItem.state = NSOffState;
console.shouldShowDebugInfo = NO;
[console log:@"DYCI verbose recompilation turned OFF"];
}
}
Expand Down

0 comments on commit 9f15cb0

Please sign in to comment.