forked from jamesmontemagno/vsts-mobile-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created Entitlements folder to contain new build task
- Loading branch information
Andrew Hoefling
committed
May 17, 2018
1 parent
8f3cd3a
commit 4df30a1
Showing
8 changed files
with
416 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "iosbumpversion", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"vsts-task-lib": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^8.5.1", | ||
"@types/q": "^1.0.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"id": "42284b34-be85-4034-890f-8755ad9f6249", | ||
"name": "ios-bundle-version", | ||
"friendlyName": "iOS Bundle Version Numbers", | ||
"description": "Bump the version of your iOS info.plist file at build time.", | ||
"helpMarkDown": "", | ||
"category": "Utility", | ||
"author": "James Montemagno", | ||
"visibility": [ | ||
"Build", | ||
"Release" | ||
], | ||
"version": { | ||
"Major": 0, | ||
"Minor": 6, | ||
"Patch": 0 | ||
}, | ||
"instanceNameFormat": "Bump iOS Versions in $(sourcePath)", | ||
"groups": [ | ||
{ | ||
"name": "advanced", | ||
"displayName": "Advanced", | ||
"isExpanded": false | ||
} | ||
], | ||
"inputs": [ | ||
{ | ||
"name": "sourcePath", | ||
"type": "filePath", | ||
"label": "iOS info.plist File Path", | ||
"defaultValue": "", | ||
"required": true, | ||
"helpMarkDown": "Full path to iOS info.plist file." | ||
}, | ||
{ | ||
"name": "versionCode", | ||
"type": "string", | ||
"label": "Version Code (CFBundleVersion)", | ||
"defaultValue": "$(Build.BuildId)", | ||
"required": true, | ||
"helpMarkDown": "Number to set the version code to, must be an integer to use offset, else can be anything." | ||
}, | ||
{ | ||
"name": "versionCodeOffset", | ||
"type": "string", | ||
"label": "Version Code Offset", | ||
"defaultValue": "", | ||
"required": false, | ||
"helpMarkDown": "A number to offset the version code below, must be an integer." | ||
}, | ||
{ | ||
"name": "versionName", | ||
"type": "string", | ||
"label": "Version Name (CFBundleShortVersionString)", | ||
"defaultValue": "1.0.$(Build.BuildId)", | ||
"required": false, | ||
"helpMarkDown": "The version number shown to users (leave blank to use existing value in info.plist)." | ||
}, | ||
{ | ||
"name": "printFile", | ||
"type": "boolean", | ||
"label": "Print File", | ||
"defaultValue": true, | ||
"required": true, | ||
"helpMarkDown": "If you would like to print the file contents before and after changing variables." | ||
} | ||
], | ||
"execution": { | ||
"Node": { | ||
"target": "built/task.js", | ||
"workingDirectory": "$(currentDirectory)" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
Param( | ||
[string]$sourcePath, | ||
[string]$versionCodeOffset, | ||
[string]$versionCode, | ||
[string]$versionName, | ||
[bool]$printFile | ||
) | ||
|
||
# requies parameters | ||
if(!$sourcePath) | ||
{ | ||
write-host " [!] Missing required input: sourcePath" | ||
exit 1 | ||
} | ||
|
||
if(!(Test-Path $sourcePath)) | ||
{ | ||
Write-Host " [!] File doesn't exist at specified Info.plist path: $sourcePath" | ||
exit 1 | ||
} | ||
|
||
if(!$versionCode) | ||
{ | ||
Write-Host " [!] No versionCode specified!" | ||
exit 1 | ||
} | ||
|
||
# --------------------- | ||
# --- Configs: | ||
Write-Host " (i) Provided Info.plist path: $sourcePath" | ||
|
||
if($versionName) | ||
{ | ||
Write-Host " (i) Version name (shortcode): $versionName" | ||
} | ||
|
||
if($versionCodeOffset) | ||
{ | ||
Write-Host " (i) Build number versionCodeOffset: $versionCodeOffset" | ||
|
||
$versionCode = $versionCode/1 + $versionCodeOffset/1 | ||
} | ||
|
||
Write-Host " (i) Build number: $versionCode" | ||
|
||
# --------------------- | ||
# --- Main: | ||
|
||
# ---- Current Bundle Version: | ||
|
||
if($printFile) | ||
{ | ||
Write-Host "Original info.Plist:" | ||
Get-Content $sourcePath | Write-Host | ||
} | ||
|
||
& /usr/libexec/PlistBuddy -c "Print CFBundleVersion" $sourcePath | ||
|
||
# ---- Set Bundle Version: | ||
& /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $versionCode" $sourcePath | ||
|
||
if($versionName) | ||
{ | ||
# ---- Current Bundle Short Version String: | ||
& /usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $sourcePath | ||
|
||
# ---- Set Bundle Short Version String: | ||
& /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $versionName" $sourcePath | ||
} | ||
|
||
if($printFile) | ||
{ | ||
Write-Host "Final info.Plist:" | ||
Get-Content $sourcePath | Write-Host | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
|
||
# 1 = plist_path | ||
# 2 = offset 0 | ||
# 3 = version number 1 | ||
# 4 = short code 1.1.1 | ||
|
||
# exit if a command fails | ||
set -e | ||
|
||
# | ||
# Required parameters | ||
if [ -z "${1}" ] ; then | ||
echo " [!] Missing required input: plist_path" | ||
exit 1 | ||
fi | ||
if [ ! -f "${1}" ] ; then | ||
echo " [!] File doesn't exist at specified Info.plist path: ${plist_path}" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${3}" ] ; then | ||
echo " [!] No build_version specified!" | ||
exit 1 | ||
fi | ||
|
||
# --------------------- | ||
# --- Configs: | ||
|
||
CONFIG_project_info_plist_path="${1}" | ||
CONFIG_new_build_short_version_string="${4}" | ||
CONFIG_new_bundle_version="${3}" | ||
|
||
echo " (i) Provided Info.plist path: ${CONFIG_project_info_plist_path}" | ||
|
||
if [ ! -z "${CONFIG_new_build_short_version_string}" ] ; then | ||
echo " (i) Version number: ${CONFIG_new_build_short_version_string}" | ||
fi | ||
|
||
if [ ! -z "${2}" ] ; then | ||
echo " (i) Build number offset: ${2}" | ||
|
||
CONFIG_new_bundle_version=$((${3} + ${2})) | ||
|
||
echo " (i) Build number: ${CONFIG_new_bundle_version}" | ||
else | ||
echo " (i) Build number: ${CONFIG_new_bundle_version}" | ||
fi | ||
|
||
|
||
# --------------------- | ||
# --- Main: | ||
|
||
# verbose / debug print commands | ||
set -v | ||
|
||
# ---- Current Bundle Version: | ||
/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${CONFIG_project_info_plist_path}" | ||
|
||
# ---- Set Bundle Version: | ||
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${CONFIG_new_bundle_version}" "${CONFIG_project_info_plist_path}" | ||
|
||
|
||
if [ ! -z "${CONFIG_new_build_short_version_string}" ] ; then | ||
# ---- Current Bundle Short Version String: | ||
/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${CONFIG_project_info_plist_path}" | ||
|
||
# ---- Set Bundle Short Version String: | ||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${CONFIG_new_build_short_version_string}" "${CONFIG_project_info_plist_path}" | ||
fi | ||
|
||
# ==> Bundle Version and Short Version changed |
Oops, something went wrong.