Any idea what is going wrong? I have updated all the relevant components to their latest version.
I am creating a default react-native project and trying to run the iOS simulator
npx react-native init {project_name}
cd {project_name}
npx react-native run-ios
I receive the following error:
/bin/sh -c {user}/Library/Developer/Xcode/DerivedData/{project_name}-epegcqhmisnuaeenegumkazvqqys/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-5F4C70EF7D90A5A5BDAEB404279F232A.sh
N/A: version "default -> N/A" is not yet installed.
You need to run "nvm install default" to install it before using it.
Command PhaseScriptExecution failed with a nonzero exit code
The script (self-generated) in question is below:
#!/bin/sh
set -o pipefail
set -e
RN_DIR=$(cd "${PODS_TARGET_SRCROOT}/../.." && pwd)
GENERATED_SRCS_DIR="${DERIVED_FILE_DIR}/generated/source/codegen"
GENERATED_SCHEMA_FILE="$GENERATED_SRCS_DIR/schema.json"
TEMP_OUTPUT_DIR="$GENERATED_SRCS_DIR/out"
LIBRARY_NAME="FBReactNativeSpec"
OUTPUT_DIR="${PODS_TARGET_SRCROOT}/../../React/FBReactNativeSpec/FBReactNativeSpec"
CODEGEN_REPO_PATH="$RN_DIR/packages/react-native-codegen"
CODEGEN_NPM_PATH="$RN_DIR/../react-native-codegen"
CODEGEN_CLI_PATH=""
# Determine path to react-native-codegen
if [ -d "$CODEGEN_REPO_PATH" ]; then
CODEGEN_CLI_PATH=$(cd "$CODEGEN_REPO_PATH" && pwd)
elif [ -d "$CODEGEN_NPM_PATH" ]; then
CODEGEN_CLI_PATH=$(cd "$CODEGEN_NPM_PATH" && pwd)
else
echo "error: Could not determine react-native-codegen location. Try running 'yarn install' or 'npm install' in your project root." >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
exit 1
fi
find_node () {
source "$RN_DIR/scripts/find-node.sh"
NODE_BINARY="${NODE_BINARY:-$(command -v node || true)}"
if [ -z "$NODE_BINARY" ]; then
echo "error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable." >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
exit 1
fi
}
setup_dirs () {
set +e
rm -rf "$GENERATED_SRCS_DIR"
set -e
mkdir -p "$GENERATED_SRCS_DIR" "$TEMP_OUTPUT_DIR"
# Clear output files
> "${SCRIPT_OUTPUT_FILE_0}"
}
describe () {
printf "\n\n>>>>> %s\n\n\n" "$1" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
}
buildCodegenCLI () {
if [ ! -d "$CODEGEN_CLI_PATH/lib" ]; then
describe "Building react-native-codegen package"
bash "$CODEGEN_CLI_PATH/scripts/oss/build.sh"
fi
}
generateCodegenSchemaFromJavaScript () {
describe "Generating codegen schema from JavaScript"
SRCS_PATTERN="Native*.js"
SRCS_DIR="../../Libraries"
if [ $SRCS_PATTERN ]; then
JS_SRCS=$(find "${PODS_TARGET_SRCROOT}"/$SRCS_DIR -type f -name "$SRCS_PATTERN" -print0 | xargs -0)
echo "["../../Libraries/ActionSheetIOS/NativeActionSheetManager.js", "../../Libraries/Alert/NativeAlertManager.js", "../../Libraries/Animated/NativeAnimatedHelper.js", "../../Libraries/Animated/NativeAnimatedModule.js", "../../Libraries/Animated/NativeAnimatedTurboModule.js", "../../Libraries/AppState/NativeAppState.js", "../../Libraries/BatchedBridge/NativeModules.js", "../../Libraries/Blob/NativeBlobModule.js", "../../Libraries/Blob/NativeFileReaderModule.js", "../../Libraries/BugReporting/NativeBugReporting.js", "../../Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js", "../../Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js", "../../Libraries/Components/Clipboard/NativeClipboard.js", "../../Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js", "../../Libraries/Components/Keyboard/NativeKeyboardObserver.js", "../../Libraries/Components/Sound/NativeSoundManager.js", "../../Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js", "../../Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js", "../../Libraries/Components/ToastAndroid/NativeToastAndroid.js", "../../Libraries/Core/NativeExceptionsManager.js", "../../Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js", "../../Libraries/Core/Timers/NativeTiming.js", "../../Libraries/EventEmitter/NativeEventEmitter.js", "../../Libraries/EventEmitter/__mocks__/NativeEventEmitter.js", "../../Libraries/HeapCapture/NativeJSCHeapCapture.js", "../../Libraries/Image/NativeImageEditor.js", "../../Libraries/Image/NativeImageLoaderAndroid.js", "../../Libraries/Image/NativeImageLoaderIOS.js", "../../Libraries/Image/NativeImagePickerIOS.js", "../../Libraries/Image/NativeImageStoreAndroid.js", "../../Libraries/Image/NativeImageStoreIOS.js", "../../Libraries/Interaction/NativeFrameRateLogger.js", "../../Libraries/Linking/NativeIntentAndroid.js", "../../Libraries/Linking/NativeLinkingManager.js", "../../Libraries/Modal/NativeModalManager.js", "../../Libraries/NativeComponent/NativeComponentRegistry.js", "../../Libraries/NativeModules/specs/NativeAnimationsDebugModule.js", "../../Libraries/NativeModules/specs/NativeDevMenu.js", "../../Libraries/NativeModules/specs/NativeDevSettings.js", "../../Libraries/NativeModules/specs/NativeDeviceEventManager.js", "../../Libraries/NativeModules/specs/NativeDialogManagerAndroid.js", "../../Libraries/NativeModules/specs/NativeLogBox.js", "../../Libraries/NativeModules/specs/NativeRedBox.js", "../../Libraries/NativeModules/specs/NativeSourceCode.js", "../../Libraries/Network/NativeNetworkingAndroid.js", "../../Libraries/Network/NativeNetworkingIOS.js", "../../Libraries/Performance/NativeJSCSamplingProfiler.js", "../../Libraries/PermissionsAndroid/NativePermissionsAndroid.js", "../../Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js", "../../Libraries/ReactNative/NativeHeadlessJsTaskSupport.js", "../../Libraries/ReactNative/NativeI18nManager.js", "../../Libraries/ReactNative/NativeUIManager.js", "../../Libraries/Settings/NativeSettingsManager.js", "../../Libraries/Share/NativeShareModule.js", "../../Libraries/Storage/NativeAsyncLocalStorage.js", "../../Libraries/Storage/NativeAsyncSQLiteDBStorage.js", "../../Libraries/TurboModule/samples/NativeSampleTurboModule.js", "../../Libraries/Utilities/NativeAppearance.js", "../../Libraries/Utilities/NativeDevLoadingView.js", "../../Libraries/Utilities/NativeDevSplitBundleLoader.js", "../../Libraries/Utilities/NativeDeviceInfo.js", "../../Libraries/Utilities/NativeJSDevSupport.js", "../../Libraries/Utilities/NativePlatformConstantsAndroid.js", "../../Libraries/Utilities/NativePlatformConstantsIOS.js", "../../Libraries/Vibration/NativeVibration.js", "../../Libraries/WebSocket/NativeWebSocketModule.js"]" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
else
JS_SRCS="${PODS_TARGET_SRCROOT}/$SRCS_DIR"
echo "../../Libraries" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
fi
"$NODE_BINARY" "$CODEGEN_CLI_PATH/lib/cli/combine/combine-js-to-schema-cli.js" "$GENERATED_SCHEMA_FILE" $JS_SRCS
}
generateCodegenArtifactsFromSchema () {
describe "Generating codegen artifacts from schema"
pushd "$RN_DIR" >/dev/null || exit 1
"$NODE_BINARY" "scripts/generate-specs-cli.js" ios "$GENERATED_SCHEMA_FILE" "$TEMP_OUTPUT_DIR" "$LIBRARY_NAME"
popd >/dev/null || exit 1
}
moveOutputs () {
mkdir -p "$OUTPUT_DIR"
# Copy all output to output_dir
cp -R "$TEMP_OUTPUT_DIR/" "$OUTPUT_DIR" || exit 1
echo "$LIBRARY_NAME output has been written to $OUTPUT_DIR:" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
ls -1 "$OUTPUT_DIR" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
}
main () {
setup_dirs
find_node
buildCodegenCLI
generateCodegenSchemaFromJavaScript
generateCodegenArtifactsFromSchema
moveOutputs
}
main "$#"
echo 'Done.' >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
Trying to run from Xcode yields in the same error.
Needless to say, I tried running
nvm install default
and received the following error:
Version 'default' not found - try `nvm ls-remote` to browse available versions.
I don't answer on Stackoverflow often but I had the same issue and used this post to solve it.
It basically revolves around the command
nvm alias default system
or swapping system to whatever version of NodeJS you would like.
I had the same issue when building the IOS app.
Open a terminal and type:
git clone https://github.com/nvm-sh/nvm.git ~/.nvm
source ~/.nvm/nvm.sh
nvm alias default system
Rather than modifying the system node, applying the commit that removes the find-node.sh script with patch-package fixed this issue for a dev on our team who was stuck with this issue.
The contents of our patch is simply
diff --git a/node_modules/react-native/scripts/find-node.sh b/node_modules/react-native/scripts/find-node.sh
deleted file mode 100755
index 5d6d2c4..0000000
--- a/node_modules/react-native/scripts/find-node.sh
+++ /dev/null
## -1,56 +0,0 ##
-#!/bin/bash
-# Copyright (c) Facebook, Inc. and its affiliates.
-#
-# This source code is licensed under the MIT license found in the
-# LICENSE file in the root directory of this source tree.
-
-set -e
-
-# remove global prefix if it's already set
-# the running shell process will choose a node binary and a global package directory breaks version managers
-unset PREFIX
-
-# Support Homebrew on M1
-HOMEBREW_M1_BIN=/opt/homebrew/bin
-if [[ -d $HOMEBREW_M1_BIN && ! $PATH =~ $HOMEBREW_M1_BIN ]]; then
- export PATH="$HOMEBREW_M1_BIN:$PATH"
-fi
-
-# Define NVM_DIR and source the nvm.sh setup script
-[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
-
-# Source nvm with '--no-use' and then `nvm use` to respect .nvmrc
-# See: https://github.com/nvm-sh/nvm/issues/2053
-if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
- # shellcheck source=/dev/null
- . "$HOME/.nvm/nvm.sh" --no-use
- nvm use 2> /dev/null || nvm use default
-elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
- # shellcheck source=/dev/null
- . "$(brew --prefix nvm)/nvm.sh" --no-use
- nvm use 2> /dev/null || nvm use default
-fi
-
-# Set up the nodenv node version manager if present
-if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
- eval "$("$HOME/.nodenv/bin/nodenv" init -)"
-elif [[ -x "$(command -v brew)" && -x "$(brew --prefix nodenv)/bin/nodenv" ]]; then
- eval "$("$(brew --prefix nodenv)/bin/nodenv" init -)"
-fi
-
-# Set up the ndenv of anyenv if preset
-if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then
- export PATH=${HOME}/.anyenv/bin:${PATH}
- if [[ "$(anyenv envs | grep -c ndenv )" -eq 1 ]]; then
- eval "$(anyenv init -)"
- fi
-fi
-
-# Set up asdf-vm if present
-if [[ -f "$HOME/.asdf/asdf.sh" ]]; then
- # shellcheck source=/dev/null
- . "$HOME/.asdf/asdf.sh"
-elif [[ -x "$(command -v brew)" && -f "$(brew --prefix asdf)/asdf.sh" ]]; then
- # shellcheck source=/dev/null
- . "$(brew --prefix asdf)/asdf.sh"
-fi
diff --git a/node_modules/react-native/scripts/react-native-xcode.sh b/node_modules/react-native/scripts/react-native-xcode.sh
index 3ef9a71..304a5dc 100755
--- a/node_modules/react-native/scripts/react-native-xcode.sh
+++ b/node_modules/react-native/scripts/react-native-xcode.sh
## -79,9 +79,7 ## if [[ $DEV != true && ! -f "$ENTRY_FILE" ]]; then
exit 2
fi
-# Find path to Node
-# shellcheck source=/dev/null
-source "$REACT_NATIVE_DIR/scripts/find-node.sh"
+NODE_BINARY="$(command -v node)"
# check and assign NODE_BINARY env
# shellcheck source=/dev/null
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index 1b8a078..d65c9ca 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
## -289,8 +289,6 ## else
fi
find_node () {
- source "$RN_DIR/scripts/find-node.sh"
-
NODE_BINARY="${NODE_BINARY:-$(command -v node || true)}"
if [ -z "$NODE_BINARY" ]; then
echo "error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable." >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
I am implementing the SonarQube to my project. SonarQube server is up but when i am try to run the run-sonar-swift.sh script i got console error and i can't see the project on the console. SonarQube and SonarScanner added under the Application folder.
Here is my run-sonar-swift.sh script:
#!/bin/bash
#
# backelite-sonar-swift-plugin - Enables analysis of Swift and Objective-C projects into SonarQube.
# Copyright © 2015 Backelite (${email})
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
## INSTALLATION: Copy this script somewhere in your PATH
## USAGE: ./run-sonar-swift.sh
## DEBUG: ./run-sonar-swift.sh -v
## WARNING: edit your project parameters in sonar-project.properties rather than modifying this script
#
# Global parameters
SLATHER_CMD=slather
SWIFTLINT_CMD=swiftlint
TAILOR_CMD=tailor
XCPRETTY_CMD=xcpretty
LIZARD_CMD=lizard
XCODEBUILD_CMD=xcodebuild
trap "echo 'Script interrupted by Ctrl+C'; stopProgress; exit 1" SIGHUP SIGINT SIGTERM
function startProgress() {
while true
do
echo -n "."
sleep 5
done
}
function stopProgress() {
if [ "$vflag" = "" -a "$nflag" = "" ]; then
kill $PROGRESS_PID &>/dev/null
fi
}
function testIsInstalled() {
hash $1 2>/dev/null
if [ $? -eq 1 ]; then
echo >&2 "ERROR - $1 is not installed or not in your PATH"; exit 1;
fi
}
function readParameter() {
variable=$1
shift
parameter=$1
shift
eval $variable="\"$(sed '/^\#/d' sonar-project.properties | grep $parameter | tail -n 1 | cut -d '=' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')\""
}
# Run a set of commands with logging and error handling
function runCommand() {
# 1st arg: redirect stdout
# 2nd arg: command to run
# 3rd..nth arg: args
redirect=$1
shift
command=$1
shift
if [ "$nflag" = "on" ]; then
# don't execute command, just echo it
echo
if [ "$redirect" = "/dev/stdout" ]; then
if [ "$vflag" = "on" ]; then
echo "+" $command "$#"
else
echo "+" $command "$#" "> /dev/null"
fi
elif [ "$redirect" != "no" ]; then
echo "+" $command "$#" "> $redirect"
else
echo "+" $command "$#"
fi
elif [ "$vflag" = "on" ]; then
echo
if [ "$redirect" = "/dev/stdout" ]; then
set -x #echo on
$command "$#"
returnValue=$?
set +x #echo off
elif [ "$redirect" != "no" ]; then
set -x #echo on
$command "$#" > $redirect
returnValue=$?
set +x #echo off
else
set -x #echo on
$command "$#"
returnValue=$?
set +x #echo off
fi
if [[ $returnValue != 0 && $returnValue != 5 ]] ; then
stopProgress
echo "ERROR - Command '$command $#' failed with error code: $returnValue"
exit $returnValue
fi
else
if [ "$redirect" = "/dev/stdout" ]; then
$command "$#" > /dev/null
elif [ "$redirect" != "no" ]; then
$command "$#" > $redirect
else
$command "$#"
fi
returnValue=$?
if [[ $returnValue != 0 && $returnValue != 5 ]] ; then
stopProgress
echo "ERROR - Command '$command $#' failed with error code: $returnValue"
exit $returnValue
fi
echo
fi
}
## COMMAND LINE OPTIONS
vflag=""
nflag=""
unittests="on"
swiftlint="on"
tailor="on"
lizard="on"
oclint="on"
fauxpas="on"
sonarscanner=""
while [ $# -gt 0 ]
do
case "$1" in
-v) vflag=on;;
-n) nflag=on;;
-nounittests) unittests="";;
-noswiftlint) swiftlint="";;
-notailor) tailor="";;
-usesonarscanner) sonarscanner="on";;
--) shift; break;;
-*)
echo >&2 "Usage: $0 [-v]"
exit 1;;
*) break;; # terminate while loop
esac
shift
done
# Usage OK
echo "Running run-sonar-swift.sh..."
## CHECK PREREQUISITES
# sonar-project.properties in current directory
if [ ! -f sonar-project.properties ]; then
echo >&2 "ERROR - No sonar-project.properties in current directory"; exit 1;
fi
## READ PARAMETERS from sonar-project.properties
#.xcodeproj filename
projectFile=''; readParameter projectFile 'sonar.swift.project'
workspaceFile=''; readParameter workspaceFile 'sonar.swift.workspace'
# Count projects
if [[ ! -z "$projectFile" ]]; then
projectCount=$(echo $projectFile | sed -n 1'p' | tr ',' '\n' | wc -l | tr -d '[[:space:]]')
if [ "$vflag" = "on" ]; then
echo "Project count is [$projectCount]"
fi
fi
# Source directories for .swift files
srcDirs=''; readParameter srcDirs 'sonar.sources'
# The name of your application scheme in Xcode
appScheme=''; readParameter appScheme 'sonar.swift.appScheme'
# The app configuration to use for the build
appConfiguration=''; readParameter appConfiguration 'sonar.swift.appConfiguration'
# The name of your test scheme in Xcode
testScheme=''; readParameter testScheme 'sonar.swift.testScheme'
# The name of your binary file (application)
binaryName=''; readParameter binaryName 'sonar.swift.appName'
# Get the path of plist file
plistFile=`xcodebuild -showBuildSettings -project "${projectFile}" | grep -i 'PRODUCT_SETTINGS_PATH' -m 1 | sed 's/[ ]*PRODUCT_SETTINGS_PATH = //'`
# Number version from plist if no sonar.projectVersion
numVerionFromPlist=`defaults read ${plistFile} CFBundleShortVersionString`
# Read destination simulator
destinationSimulator=''; readParameter destinationSimulator 'sonar.swift.simulator'
# Read tailor configuration
tailorConfiguration=''; readParameter tailorConfiguration 'sonar.swift.tailor.config'
# The file patterns to exclude from coverage report
excludedPathsFromCoverage=''; readParameter excludedPathsFromCoverage 'sonar.swift.excludedPathsFromCoverage'
# Check for mandatory parameters
if [ -z "$projectFile" -o "$projectFile" = " " ] && [ -z "$workspaceFile" -o "$workspaceFile" = " " ]; then
echo >&2 "ERROR - sonar.swift.project or/and sonar.swift.workspace parameter is missing in sonar-project.properties. You must specify which projects (comma-separated list) are application code or which workspace and project to use."
exit 1
elif [ ! -z "$workspaceFile" ] && [ -z "$projectFile" ]; then
echo >&2 "ERROR - sonar.swift.workspace parameter is present in sonar-project.properties but sonar.swift.project and is not. You must specify which projects (comma-separated list) are application code or which workspace and project to use."
exit 1
fi
if [ -z "$srcDirs" -o "$srcDirs" = " " ]; then
echo >&2 "ERROR - sonar.sources parameter is missing in sonar-project.properties. You must specify which directories contain your .swift source files (comma-separated list)."
exit 1
fi
if [ -z "$appScheme" -o "$appScheme" = " " ]; then
echo >&2 "ERROR - sonar.swift.appScheme parameter is missing in sonar-project.properties. You must specify which scheme is used to build your application."
exit 1
fi
if [ "$unittests" = "on" ]; then
if [ -z "$destinationSimulator" -o "$destinationSimulator" = " " ]; then
echo >&2 "ERROR - sonar.swift.simulator parameter is missing in sonar-project.properties. You must specify which simulator to use."
exit 1
fi
fi
# if the appConfiguration is not specified then set to Debug
if [ -z "$appConfiguration" -o "$appConfiguration" = " " ]; then
appConfiguration="Debug"
fi
if [ "$vflag" = "on" ]; then
echo "Xcode project file is: $projectFile"
echo "Xcode workspace file is: $workspaceFile"
echo "Xcode application scheme is: $appScheme"
echo "Number version from plist is: $numVerionFromPlist"
if [ -n "$unittests" ]; then
echo "Destination simulator is: $destinationSimulator"
echo "Excluded paths from coverage are: $excludedPathsFromCoverage"
else
echo "Unit surefire are disabled"
fi
fi
## SCRIPT
# Start progress indicator in the background
if [ "$vflag" = "" -a "$nflag" = "" ]; then
startProgress &
# Save PID
PROGRESS_PID=$!
fi
# Create sonar-reports/ for reports output
if [ "$vflag" = "on" ]; then
echo 'Creating directory sonar-reports/'
fi
rm -rf sonar-reports
mkdir sonar-reports
# Extracting project information needed later
echo -n 'Extracting Xcode project information'
if [[ "$workspaceFile" != "" ]] ; then
buildCmdPrefix="-workspace $workspaceFile"
else
buildCmdPrefix="-project $projectFile"
fi
buildCmd=($XCODEBUILD_CMD clean build $buildCmdPrefix -scheme $appScheme)
if [[ ! -z "$destinationSimulator" ]]; then
buildCmd+=(-destination "$destinationSimulator" -destination-timeout 360 COMPILER_INDEX_STORE_ENABLE=NO)
fi
runCommand xcodebuild.log "${buildCmd[#]}"
#oclint-xcodebuild # Transform the xcodebuild.log file into a compile_command.json file
cat xcodebuild.log | $XCPRETTY_CMD -r json-compilation-database -o compile_commands.json
# Objective-C code detection
hasObjC="no"
compileCmdFile=compile_commands.json
minimumSize=3
actualSize=$(stat -f%z "$compileCmdFile")
echo "actual = $actualSize, min = $minimumSize"
if [ $actualSize -ge $minimumSize ]; then
hasObjC="yes"
fi
# Unit surefire and coverage
if [ "$unittests" = "on" ]; then
# Put default xml files with no surefire and no coverage...
echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><testsuites name='AllTestUnits'></testsuites>" > sonar-reports/TEST-report.xml
echo "<?xml version='1.0' ?><!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'><coverage><sources></sources><packages></packages></coverage>" > sonar-reports/coverage-swift.xml
echo -n 'Running surefire'
buildCmd=($XCODEBUILD_CMD clean build test)
if [[ ! -z "$workspaceFile" ]]; then
buildCmd+=(-workspace "$workspaceFile")
elif [[ ! -z "$projectFile" ]]; then
buildCmd+=(-project "$projectFile")
fi
buildCmd+=( -scheme "$appScheme" -configuration "$appConfiguration" -enableCodeCoverage YES)
if [[ ! -z "$destinationSimulator" ]]; then
buildCmd+=(-destination "$destinationSimulator" -destination-timeout 60)
fi
runCommand sonar-reports/xcodebuild.log "${buildCmd[#]}"
cat sonar-reports/xcodebuild.log | $XCPRETTY_CMD -t --report junit
mv build/reports/junit.xml sonar-reports/TEST-report.xml
echo '\nComputing coverage report\n'
# Build the --exclude flags
excludedCommandLineFlags=""
if [ ! -z "$excludedPathsFromCoverage" -a "$excludedPathsFromCoverage" != " " ]; then
echo $excludedPathsFromCoverage | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh2
while read word; do
excludedCommandLineFlags+=" -i $word"
done < tmpFileRunSonarSh2
rm -rf tmpFileRunSonarSh2
fi
if [ "$vflag" = "on" ]; then
echo "Command line exclusion flags for slather is:$excludedCommandLineFlags"
fi
firstProject=$(echo $projectFile | sed -n 1'p' | tr ',' '\n' | head -n 1)
slatherCmd=($SLATHER_CMD coverage)
if [[ ! -z "$binaryName" ]]; then
slatherCmd+=( --binary-basename "$binaryName")
fi
slatherCmd+=( --input-format profdata $excludedCommandLineFlags --cobertura-xml --output-directory sonar-reports)
if [[ ! -z "$workspaceFile" ]]; then
slatherCmd+=( --workspace "$workspaceFile")
fi
slatherCmd+=( --scheme "$appScheme" "$firstProject")
echo "${slatherCmd[#]}"
runCommand /dev/stdout "${slatherCmd[#]}"
mv sonar-reports/cobertura.xml sonar-reports/coverage-swift.xml
fi
# SwiftLint
if [ "$swiftlint" = "on" ]; then
if hash $SWIFTLINT_CMD 2>/dev/null; then
echo -n 'Running SwiftLint...'
# Build the --include flags
currentDirectory=${PWD##*/}
echo "$srcDirs" | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh
while read word; do
# Run SwiftLint command
$SWIFTLINT_CMD lint --path "$word" > sonar-reports/"$appScheme"-swiftlint.txt
done < tmpFileRunSonarSh
rm -rf tmpFileRunSonarSh
else
echo "Skipping SwiftLint (not installed!)"
fi
else
echo 'Skipping SwiftLint (test purposes only!)'
fi
# Tailor
if [ "$tailor" = "on" ]; then
if hash $TAILOR_CMD 2>/dev/null; then
echo -n 'Running Tailor...'
# Build the --include flags
currentDirectory=${PWD##*/}
echo "$srcDirs" | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh
while read word; do
# Run tailor command
$TAILOR_CMD $tailorConfiguration "$word" > sonar-reports/"$appScheme"-tailor.txt
done < tmpFileRunSonarSh
rm -rf tmpFileRunSonarSh
else
echo "Skipping Tailor (not installed!)"
fi
else
echo 'Skipping Tailor!'
fi
if [ "$oclint" = "on" ] && [ "$hasObjC" = "yes" ]; then
echo -n 'Running OCLint...'
# Options
maxPriority=10000
longLineThreshold=250
# Build the --include flags
currentDirectory=${PWD##*/}
echo "$srcDirs" | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh
while read word; do
includedCommandLineFlags=" --include .*/${currentDirectory}/${word}/*"
if [ "$vflag" = "on" ]; then
echo
echo -n "Path included in oclint analysis is:$includedCommandLineFlags"
fi
# Run OCLint with the right set of compiler options
runCommand no oclint-json-compilation-database -v $includedCommandLineFlags -- -rc LONG_LINE=$longLineThreshold -max-priority-1 $maxPriority -max-priority-2 $maxPriority -max-priority-3 $maxPriority -report-type pmd -o sonar-reports/$appScheme-oclint.xml
done < tmpFileRunSonarSh
rm -rf tmpFileRunSonarSh
else
echo 'Skipping OCLint (test purposes only!)'
fi
#FauxPas
if [ "$fauxpas" = "on" ] && [ "$hasObjC" = "yes" ]; then
hash fauxpas 2>/dev/null
if [ $? -eq 0 ]; then
echo -n 'Running FauxPas...'
if [ "$projectCount" = "1" ]
then
fauxpas -o json check $projectFile --workspace $workspaceFile --scheme $appScheme > sonar-reports/fauxpas.json
else
echo $projectFile | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh
while read projectName; do
$XCODEBUILD_CMD -list -project $projectName | sed -n '/Schemes/,$p' | while read scheme
do
if [ "$scheme" = "" ]
then
exit
fi
if [ "$scheme" == "${scheme/Schemes/}" ]
then
if [ "$scheme" != "$testScheme" ]
then
projectBaseDir=$(dirname $projectName)
workspaceRelativePath=$(python -c "import os.path; print os.path.relpath('$workspaceFile', '$projectBaseDir')")
fauxpas -o json check $projectName --workspace $workspaceRelativePath --scheme $scheme > sonar-reports/$(basename $projectName .xcodeproj)-$scheme-fauxpas.json
fi
fi
done
done < tmpFileRunSonarSh
rm -rf tmpFileRunSonarSh
fi
else
echo 'Skipping FauxPas (not installed)'
fi
else
echo 'Skipping FauxPas'
fi
# Lizard Complexity
if [ "$lizard" = "on" ]; then
if hash $LIZARD_CMD 2>/dev/null; then
echo -n 'Running Lizard...'
$LIZARD_CMD --xml "$srcDirs" > sonar-reports/lizard-report.xml
else
echo 'Skipping Lizard (not installed!)'
fi
else
echo 'Skipping Lizard (test purposes only!)'
fi
# The project version from properties file
numVersionSonarRunner=''; readParameter numVersionSonarRunner 'sonar.projectVersion'
if [ -z "$numVersionSonarRunner" -o "$numVersionSonarRunner" = " " ]; then
numVersionSonarRunner=" --define sonar.projectVersion=$numVerionFromPlist"
else
#if we have version number in properties file, we don't overide numVersion for sonar-runner/sonar-scanner command
numVersionSonarRunner='';
fi
# SonarQube
if [ "$sonarscanner" = "on" ]; then
echo -n 'Running SonarQube using SonarQube Scanner'
if hash /dev/stdout sonar-scanner 2>/dev/null; then
runCommand /dev/stdout sonar-scanner $numVersionSonarRunner
else
echo 'Skipping sonar-scanner (not installed!)'
fi
else
echo -n 'Running SonarQube using SonarQube Runner'
if hash /dev/stdout sonar-runner 2>/dev/null; then
runCommand /dev/stdout sonar-runner $numVersionSonarRunner
else
runCommand /dev/stdout sonar-scanner $numVersionSonarRunner
fi
fi
# Kill progress indicator
stopProgress
exit 0
Here is the terminal output:
Running run-sonar-swift.sh...
Project count is [1]
2021-09-07 14:48:13.089 defaults[49259:620007]
The domain/default pair of (/Users/ebubekirsezer/Desktop/Projects/SonarDemo/SonarDemo/Info.plist, CFBundleShortVersionString) does not exist
Xcode project file is: SonarDemo.xcodeproj
Xcode workspace file is:
Xcode application scheme is: SonarDemo
Number version from plist is:
Destination simulator is: platform=iOS Simulator,name=iPhone 8,OS=14.5
Excluded paths from coverage are:
Creating directory sonar-reports/
Extracting Xcode project information
+ xcodebuild clean build -project SonarDemo.xcodeproj -scheme SonarDemo -destination 'platform=iOS Simulator,name=iPhone 8,OS=14.5' -destination-timeout 360 COMPILER_INDEX_STORE_ENABLE=NO
+ returnValue=0
+ set +x
./run-sonar-swift.sh: line 291: xcpretty: command not found
stat: compile_commands.json: stat: No such file or directory
actual = , min = 3
./run-sonar-swift.sh: line 299: [: -ge: unary operator expected
Running surefire
+ xcodebuild clean build test -project SonarDemo.xcodeproj -scheme SonarDemo -configuration Debug -enableCodeCoverage YES -destination 'platform=iOS Simulator,name=iPhone 8,OS=14.5' -destination-timeout 60
2021-09-07 14:48:26.363 xcodebuild[49322:621312] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-18212/IDEFoundation/Testing/IDETestRunSpecificationBuilder.m:678
Details: Failed to compute path to baseline file during test run spec construction: <XCTHTestRunSpecification: 0x7fced2696a60>
Object: <IDETestRunSpecificationBuilder>
Method: +testRunSpecificationsForTestingSpecifiers:scheme:buildables:withBuildParameters:additionalEnvironmentVariables:additionalCommandLineArguments:testRerunPolicy:includeClangProfileParameters:shouldDebugAppExtensions:error:
Thread: <NSThread: 0x7fcf0241a660>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2021-09-07 14:48:26.365 xcodebuild[49322:621312] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-18212/IDEFoundation/Testing/IDETestRunSpecificationBuilder.m:678
Details: Failed to compute path to baseline file during test run spec construction: <XCTHTestRunSpecification: 0x7fceb25809f0>
Object: <IDETestRunSpecificationBuilder>
Method: +testRunSpecificationsForTestingSpecifiers:scheme:buildables:withBuildParameters:additionalEnvironmentVariables:additionalCommandLineArguments:testRerunPolicy:includeClangProfileParameters:shouldDebugAppExtensions:error:
Thread: <NSThread: 0x7fcf0241a660>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
2021-09-07 14:50:17.771 xcodebuild[49322:621312] [MT] IDETestOperationsObserverDebug: 110.166 elapsed -- Testing started completed.
2021-09-07 14:50:17.772 xcodebuild[49322:621312] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2021-09-07 14:50:17.772 xcodebuild[49322:621312] [MT] IDETestOperationsObserverDebug: 110.166 sec, +110.166 sec -- end
+ returnValue=0
+ set +x
./run-sonar-swift.sh: line 323: xcpretty: command not found
mv: build/reports/junit.xml: No such file or directory
\nComputing coverage report\n
Command line exclusion flags for slather is:
slather coverage --binary-basename SonarDemo --input-format profdata --cobertura-xml --output-directory sonar-reports --scheme SonarDemo SonarDemo.xcodeproj
+ slather coverage --binary-basename SonarDemo --input-format profdata --cobertura-xml --output-directory sonar-reports --scheme SonarDemo SonarDemo.xcodeproj
./run-sonar-swift.sh: line 101: slather: command not found
+ returnValue=127
+ set +x
ERROR - Command 'slather coverage --binary-basename SonarDemo --input-format profdata --cobertura-xml --output-directory sonar-reports --scheme SonarDemo SonarDemo.xcodeproj' failed with error code: 127
The app I am working on is currently using a buildpack that is using ffmpegthumbnailer 2.0.8 and I need a feature that was added in version 2.1.2. I have forked the repo of the buildpack we are currently using https://github.com/akomic/heroku-buildpack-ffmpegthumbnailer and updated the bin/compile file to point the download_url to "https://github.com/dirkvdb/ffmpegthumbnailer/archive/2.2.0.tar.gz" but when I add my forked repo to the app and run heroku run "ffmpegthumbnailer -version" to verify that it worked I get a bash: ffmpegthumbnailer: command not found error.
Here is the original bin/compile:
#!/bin/sh
indent() {
sed -u 's/^/ /'
}
echo "-----> Install ffmpegthumbnailer"
BUILD_DIR=$1
VENDOR_DIR="vendor"
DOWNLOAD_URL="http://www.aksiom.net/stuff/ffmpegthumbnailer_2.0.8-2.bin.tar.gz"
echo "DOWNLOAD_URL = " $DOWNLOAD_URL | indent
cd $BUILD_DIR
mkdir -p $VENDOR_DIR
cd $VENDOR_DIR
curl -L --silent $DOWNLOAD_URL | tar zx
echo "exporting PATH and LIBRARY_PATH" | indent
PROFILE_PATH="$BUILD_DIR/.profile.d/ffmpeg.sh"
mkdir -p $(dirname $PROFILE_PATH)
echo 'export PATH="$PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/bin"' >> $PROFILE_PATH
echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/lib"' >> $PROFILE_PATH
Here is my updated bin/compile in the forked repo:
#!/bin/sh
indent() {
sed -u 's/^/ /'
}
echo "-----> Install ffmpegthumbnailer"
BUILD_DIR=$1
VENDOR_DIR="vendor"
DOWNLOAD_URL="https://github.com/dirkvdb/ffmpegthumbnailer/archive/2.2.0.tar.gz"
echo "DOWNLOAD_URL = " $DOWNLOAD_URL | indent
cd $BUILD_DIR
mkdir -p $VENDOR_DIR
cd $VENDOR_DIR
curl -L --silent $DOWNLOAD_URL | tar zx
echo "exporting PATH and LIBRARY_PATH" | indent
PROFILE_PATH="$BUILD_DIR/.profile.d/ffmpeg.sh"
mkdir -p $(dirname $PROFILE_PATH)
echo 'export PATH="$PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/bin"' >> $PROFILE_PATH
echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/lib"' >> $PROFILE_PATH
Other info: I add the buildpack using heroku buildpacks:add <link_to_forked_repo>
Thank you for any help!
This is because the original akomic tarball specified is not the source code, but rather a custom zip of compiled binaries and libraries. Notice that the compile script has no make step, for instance. There is no documentation for how this custom tarball created, but presumably if you go through the same process with a newer version of the source code, and then upload it to a place this script can access it, it will work again. I'm trying to figure this out now.
It took some time for me to compile LibiCal for arm64 and x86_64 architecture for iOS(device and simulator). Thought it may be useful for others. Here is the steps I followed to compile LibiCal-1.0. I have taken code from below link
Compiling libical
and modified a bit to suit for Xcode 5.1
1) download LibiCal from below URL
http://sourceforge.net/projects/freeassociation/
Untar and get into libCal-1.0 folder. Then run
./bootstrap
(Need to download make tools from http://www.jattcode.com/installing-autoconf-automake-libtool-on-mac-osx-mountain-lion/ )
Use below script
#!/bin/sh
# SEE: http://www.smallsharptools.com/downloads/libical/
PATH="`xcode-select -print-path`/usr/bin:/usr/bin:/bin"
# set the prefix
PREFIX=${HOME}/Library/libical
OUTPUTDIR=../libical-build
export ARCH=arm64
# Select the desired iPhone SDK
export SDKVER="7.1"
export DEVROOT=`xcode-select --print-path`
export SDKROOT=$DEVROOT/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk
export IOSROOT=$DEVROOT/Platforms/iPhoneOS.platform
# Includes
# find $DEVROOT -type d -name include|grep -i iphone|grep -i arm-apple-darwin|grep -vi install-tools|grep -vi simulator
# $SDKROOT/usr/include
# $DEVROOT/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include
if [ ! -d $DEVROOT ]
then
echo "Developer Root not found! - $DEVROOT"
exit
fi
echo "DEVROOT = $DEVROOT"
if [ ! -d $SDKROOT ]
then
echo "SDK Root not found! - $SDKROOT"
exit
fi
echo "SDKROOT = $SDKROOT"
if [ ! -d $IOSROOT ]
then
echo "iOS Root not found! - $IOSROOT"
exit
fi
echo "IOSROOT = $IOSROOT"
# finding ld
# find $DEVROOT -type f -name ld|grep -i iphone
# Set up relevant environment variables
export CPPFLAGS="-arch $ARCH -I$SDKROOT/usr/include -I$IOSROOT/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L$SDKROOT/usr/lib/ -arch $ARCH"
export CLANG=$DEVROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
#export CC=$IOSROOT/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
#export CXX=$IOSROOT/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2
export CC=$CLANG
export CXX=$CLANG
export LD=$IOSROOT/Developer/usr/bin/ld
export AR=$IOSROOT/Developer/usr/bin/ar
export AS=$IOSROOT/Developer/usr/bin/as
export LIBTOOL=$IOSROOT/usr/bin/libtool
export STRIP=$IOSROOT/Developer/usr/bin/strip
export RANLIB=$IOSROOT/Developer/usr/bin/ranlib
HOST=arm-apple-darwin10
if [ ! -f $CC ]
then
echo "C Compiler not found! - $CC"
exit
fi
if [ ! -f $CXX ]
then
echo "C++ Compiler not found! - $CXX"
exit
fi
if [ ! -f $LD ]
then
echo "Linker not found! - $LD"
exit
fi
if [ -d $OUTPUTDIR/$ARCH ]
then
rm -rf $OUTPUTDIR/$ARCH
fi
find . -name \*.a -exec rm {} \;
make clean
./configure --prefix=$PREFIX --disable-dependency-tracking --host $HOST CXX=$CXX CC=$CC LD=$LD AR=$AR AS=$AS LIBTOOL=$LIBTOOL STRIP=$STRIP RANLIB=$RANLIB
make -j4
# copy the files to the arch folder
mkdir -p $OUTPUTDIR
mkdir -p $OUTPUTDIR/$ARCH
cp `find . -name \*.a` $OUTPUTDIR/$ARCH/
xcrun -sdk iphoneos lipo -info $OUTPUTDIR/$ARCH/*.a
echo $ARCH DONE
echo "See $OUTPUTDIR"
modify the line:11 "export ARCH=arm64" to get desired architecture, i.e. arm64, armv7, armv7s.
This should create bins for desired architecture in ../libical-build folder.
Building for x86_64.
Use following commands to run get build for x86_64.
tar -xovf libical-1.0.tar
cd libical-1.0
./bootstrap
./configure
make
This should create libical.a in folder src/libical/.libs/libical.a.
Creating a fat library
Use below command to build the fat library. (Please use appropriate lipo command).
export DEVROT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lip
$DEVROOT/usr/bin/lipo
-arch arm64 $OUTPUTDIR/armv6/libical.a
-arch i386 $OUTPUTDIR/i386/libical_Simulator.a
-arch armv7 $OUTPUTDIR/x86_64/libical.a
-arch armv7s $OUTPUTDIR/x86_64/libical.a
-arch x86_64 $OUTPUTDIR/x86_64/libical.a
-create -output $OUTPUTDIR/libical_fat_universal.a
Please set appropriate OUTPUTDIR environment variable.
I hope above will help some one who wants to quickly build Libical for iOS.
I have found a fix for the issue. The main thing I did was add the following switch
-mios-simulator-version-min=7.0
Here is my current version of the script:
#!/bin/sh
set -o xtrace
# SEE: http://www.smallsharptools.com/downloads/libical/
PATH="`xcode-select -print-path`/usr/bin:/usr/bin:/bin"
if [ ! -n "$ARCH" ]; then
export ARCH=armv7
fi
# Select the desired iPhone SDK
export SDKVER="7.1"
export DEVROOT=`xcode-select --print-path`
if [ "i386" = $ARCH ] || [ "x86_64" = $ARCH ]; then
export SDKROOT=$DEVROOT/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDKVER}.sdk
export MIOS="-mios-simulator-version-min=7.0"
else
export SDKROOT=$DEVROOT/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVER}.sdk
export MIOS=""
fi;
export IOSROOT=$DEVROOT/Platforms/iPhoneOS.platform
if [ ! -d $DEVROOT ]
then
echo "Developer Root not found! - $DEVROOT"
exit 1
fi
echo "DEVROOT = $DEVROOT"
if [ ! -d $SDKROOT ]
then
echo "SDK Root not found! - $SDKROOT"
exit 1
fi
echo "SDKROOT = $SDKROOT"
if [ ! -d $IOSROOT ]
then
echo "iOS Root not found! - $IOSROOT"
exit 1
fi
echo "IOSROOT = $IOSROOT"
# Set up relevant environment variables
export CPPFLAGS="-arch $ARCH -I$SDKROOT/usr/include $MIOS --debug"
export CFLAGS="$CPPFLAGS -pipe -no-cpp-precomp -isysroot $SDKROOT "
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L$SDKROOT/usr/lib/ -arch $ARCH"
export CLANG=$DEVROOT/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
export CC=$CLANG
export CXX=$CLANG
export LD=$IOSROOT/Developer/usr/bin/ld
export AR=$IOSROOT/Developer/usr/bin/ar
export AS=$IOSROOT/Developer/usr/bin/as
export LIBTOOL=$IOSROOT/usr/bin/libtool
export STRIP=$IOSROOT/Developer/usr/bin/strip
export RANLIB=$IOSROOT/Developer/usr/bin/ranlib
export LIPO="xcrun -sdk iphoneos lipo"
export HOST=arm-apple-darwin10
if [ ! -f $CC ]
then
echo "C Compiler not found! - $CC"
exit
fi
if [ ! -f $CXX ]
then
echo "C++ Compiler not found! - $CXX"
exit
fi
if [ ! -f $LD ]
then
echo "Linker not found! - $LD"
exit
fi
if [ -d $OUTPUT_DIR/$ARCH ]
then
rm -rf $OUTPUT_DIR/$ARCH
fi
find ./src -name \*.a -exec rm {} \;
make clean
./configure --prefix="$OUTPUT_DIR" --disable-dependency-tracking --host $HOST CXX=$CXX CC=$CC LD=$LD AR=$AR AS=$AS LIBTOOL=$LIBTOOL STRIP=$STRIP RANLIB=$RANLIB
make -j4
# copy the files to the arch folder
mkdir -p $OUTPUT_DIR
mkdir -p $OUTPUT_DIR/$ARCH
cp `find . -name \*.a` $OUTPUT_DIR/$ARCH/
cp config.log $OUTPUT_DIR/$ARCH/config.log
$LIPO -info $OUTPUT_DIR/$ARCH/*.a
echo $ARCH DONE
echo "See $OUTPUT_DIR"
I've started building out a Objective C wrapper for this library and you can see the progress at
https://github.com/ahalls/XbICalendar I the project could use some eyeballs with suggestions and even some help.
Those looking to compile the latest version of libical using cmake (from github) for iOS, please checkout my answer here:
Compiling libical for armv7 and arm64 with cmake
I have a script which has to move uploaded files from the first directory to the second directory.
The problem is that the script already moves the files during upload.
Anyone who can help?
#!/bin/sh
lockfile=/home/mediaze111/cronjobs/zenon_move.lock
if ( set -o noclobber; echo "$$" > "$lockfile") 2> /dev/null; then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
if [ "$(ls -A /home/mediaze111/domains/optimaal.fm/ZenonImport/Import1/)" ]; then
ps faux | grep -E 'UPLOAD' | grep -v 'grep' > /dev/null || mv -f /home/mediaze111/domains/optimaal.fm/ZenonImport/Import1/*.* /home/mediaze111/domains/optimaal.fm/ZenonImport/Import2/
fi
rm -f "$lockfile"
trap - INT TERM EXIT
fi
u can get the file size before upload . then check the destination file size . if same move uploaded. pul all the script in a loop so when was the same break it an move files.