This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git
The following commit(s) were added to refs/heads/master by this push:
new d8f4b62 feat: Add Podspec for Cordova library (#543)
d8f4b62 is described below
commit d8f4b62d4da8eca8226de8bb79fbc91a949f9850
Author: Bharath Hariharan <[email protected]>
AuthorDate: Sun Mar 15 02:58:11 2020 -0700
feat: Add Podspec for Cordova library (#543)
* Add Podspec for Cordova library
* Add logic to auto-parse and set release version in Podspec
* Add auto-update script for public headers
* Bump iOS version to 11.0
---
Cordova.podspec | 37 +++++++++++++
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 21 ++++++++
update_podspec.sh | 70 +++++++++++++++++++++++++
3 files changed, 128 insertions(+)
diff --git a/Cordova.podspec b/Cordova.podspec
new file mode 100644
index 0000000..ab72d41
--- /dev/null
+++ b/Cordova.podspec
@@ -0,0 +1,37 @@
+require "json"
+
+packageJson = JSON.parse(File.read(File.join(__dir__, "package.json")))
+relVersion = package['version']
+relSource = { :git => "https://github.com/apache/cordova-ios.git",
+ :tag => "rel/{relVersion}",
+ :submodules => true }
+
+Pod::Spec.new do |s|
+ s.name = "Cordova"
+ s.version = relVersion
+ s.summary = "Apache Cordova for iOS"
+ s.homepage = "https://github.com/apache/cordova-ios"
+ s.license = { :type => "Apache 2.0", :file => "LICENSE" }
+ s.author = { "Apache Software Foundation" }
+ s.platform = :ios, "11.0"
+ s.source = relSource
+ s.requires_arc = true
+ s.preserve_paths = 'CordovaLib/cordova.js', 'CordovaLib/VERSION'
+ s.frameworks = 'AssetsLibrary', 'MobileCoreServices', 'AVFoundation',
'CoreLocation'
+ s.default_subspec = 'Cordova'
+ s.subspec 'Cordova' do |cordova|
+ cordova.source_files = 'CordovaLib/Classes/**/*.{h,m}',
'CordovaLib/Cordova/Cordova.h'
+ cordova.public_header_files = 'CordovaLib/Classes/Public/CDV.h',
'CordovaLib/Classes/Public/CDVAppDelegate.h',
'CordovaLib/Classes/Public/CDVAvailability.h',
'CordovaLib/Classes/Public/CDVAvailabilityDeprecated.h',
'CordovaLib/Classes/Public/CDVCommandDelegate.h',
'CordovaLib/Classes/Public/CDVCommandDelegateImpl.h',
'CordovaLib/Classes/Public/CDVCommandQueue.h',
'CordovaLib/Classes/Public/CDVConfigParser.h',
'CordovaLib/Classes/Public/CDVInvokedUrlCommand.h', 'CordovaLib/Classes/P [...]
+ cordova.prefix_header_contents = ''
+ cordova.requires_arc = true
+ end
+end
+
+#
+# ATTENTION:
+#
+# This file needs to be updated manually whenever a Cordova upgrade that bumps
up min version of iOS is performed.
+# The release version number and the list of public headers are automatically
updated through scipts.
+# Sections that need to be updated:
+# 1. {s.platform} should be updated if the minimum version of iOS has
changed.
+#
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index f19717e..c5be5c1 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -415,6 +415,7 @@
C0C01EAD1E3911D50056E6CB /* Sources */,
C0C01EAE1E3911D50056E6CB /* Frameworks */,
C0C01EAF1E3911D50056E6CB /* Headers */,
+ CEDDBB5523948D4C00506451 /* ShellScript */,
);
buildRules = (
);
@@ -478,6 +479,26 @@
};
/* End PBXProject section */
+/* Begin PBXShellScriptBuildPhase section */
+ CEDDBB5523948D4C00506451 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ );
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PROJECT_DIR}/../update_podspec.sh\"
-s cordova\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
/* Begin PBXSourcesBuildPhase section */
C0C01EAD1E3911D50056E6CB /* Sources */ = {
isa = PBXSourcesBuildPhase;
diff --git a/update_podspec.sh b/update_podspec.sh
new file mode 100755
index 0000000..a270335
--- /dev/null
+++ b/update_podspec.sh
@@ -0,0 +1,70 @@
+set -e
+
+SUBSPEC_NAME=""
+
+function usage()
+{
+ local appName=`basename $0`
+ echo "Usage:"
+ echo "$appName -s <Subspec Name>"
+}
+
+function parseOpts()
+{
+ while getopts :s: commandLineOpt; do
+ case ${commandLineOpt} in
+ s)
+ SUBSPEC_NAME=${OPTARG};;
+ ?)
+ echo "Unknown option '-${OPTARG}'."
+ usage
+ exit 1
+ esac
+ done
+
+ # Validate that we got the required command line arg(s).
+ if [ "${SUBSPEC_NAME}" == "" ]; then
+ echo "No option specified for Subspec Name."
+ usage
+ exit 2
+ fi
+}
+
+parseOpts "$@"
+
+repoDir=$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)
+publicHeaderDirectory="${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}"
+podSpecFile="${repoDir}/Cordova.podspec"
+projectDir=`echo "${PROJECT_DIR}" | sed "s#${repoDir}/##g"`
+
+cd "$repoDir"
+
+# Create the public header file list out of the public headers in the build
folder.
+publicHeaderFileList=""
+isFirstFile=1
+for headerFile in `ls -1 "${publicHeaderDirectory}"`; do
+ repoHeaderFile=`find ${projectDir} -name $headerFile`
+ if [ "$repoHeaderFile" != "" ]; then
+ if [ $isFirstFile -eq 1 ]; then
+ publicHeaderFileList="'$repoHeaderFile'"
+ isFirstFile=0
+ else
+ publicHeaderFileList=`echo "${publicHeaderFileList},
'$repoHeaderFile'"`
+ fi
+ fi
+done
+
+# Make sure none of the public header files are in the exclude files list
+if grep -q "${SUBSPEC_NAME}.exclude_files" ${podSpecFile}
+then
+ echo "${publicHeaderFileList}" | sed 's/ *//g' | tr , '\n' | sort >
"${podSpecFile}.public_header_files_list"
+ cat "${podSpecFile}" | grep "${SUBSPEC_NAME}.exclude_files" | sed
's/.*=//' | sed 's/ *//g' | tr , '\n' | sort >
"${podSpecFile}.exclude_files_list"
+ publicHeaderFileList=`comm -23 ${podSpecFile}.public_header_files_list
${podSpecFile}.exclude_files_list | tr '\n' , | sed 's/,$//'`
+ rm "${podSpecFile}.public_header_files_list"
"${podSpecFile}.exclude_files_list"
+fi
+
+# Replace the old headers with the new ones.
+searchPattern='^( *'"${SUBSPEC_NAME}"'\.public_header_files = ).*$'
+replacementPattern='\1'"${publicHeaderFileList}"
+sed -E "s#$searchPattern#$replacementPattern#g" "$podSpecFile" >
"${podSpecFile}.new"
+mv "${podSpecFile}.new" "${podSpecFile}"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]