-
Notifications
You must be signed in to change notification settings - Fork 999
GH-542 Adding Podspec for Cordova library #543
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
Changes from all commits
0996e39
78c8abf
9409ff1
73aeac6
c71841c
09e4ab7
debf555
d2db91d
6e29eef
a3445b9
1a8e899
78fbf78
6d1917e
6471136
dfb1b25
7b49ea6
d8cd2e4
fc3ebe6
0b4d9d6
9a7d45f
093ff91
f8b3a48
371fcf4
8b9399e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
erisu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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" | ||
erisu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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/Public/CDVPlugin+Resources.h', 'CordovaLib/Classes/Public/CDVPlugin.h', 'CordovaLib/Classes/Public/CDVPluginResult.h', 'CordovaLib/Classes/Public/CDVScreenOrientationDelegate.h', 'CordovaLib/Classes/Public/CDVTimer.h', 'CordovaLib/Classes/Public/CDVViewController.h', 'CordovaLib/Classes/Public/CDVWebViewEngineProtocol.h', 'CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewUIDelegate.h', 'CordovaLib/Classes/Public/CDVWhitelist.h', 'CordovaLib/Cordova/Cordova.h', 'CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.h', 'CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.h' | ||
| cordova.prefix_header_contents = '' | ||
| cordova.requires_arc = true | ||
erisu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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. | ||
| # | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the shell script that updates podspec every time the library project is built. No more manual steps required to update the list of public headers in the podspec. |
||
| }; | ||
| /* End PBXShellScriptBuildPhase section */ | ||
|
|
||
| /* Begin PBXSourcesBuildPhase section */ | ||
| C0C01EAD1E3911D50056E6CB /* Sources */ = { | ||
| isa = PBXSourcesBuildPhase; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| set -e | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Magic script to update podspec headers every time files are added/deleted in the library project. |
||
|
|
||
| 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}" | ||
Uh oh!
There was an error while loading. Please reload this page.