nixenvironment 0.0.59 → 0.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +14 -14
  4. data/bin/Config +2 -2
  5. data/bin/nixenvironment +420 -842
  6. data/legacy/CleanWorkingCopy.sh +69 -0
  7. data/legacy/Deploy.sh +44 -0
  8. data/legacy/DeployAPK.py +58 -0
  9. data/legacy/DeployIPA.sh +125 -0
  10. data/legacy/DetectSCM.sh +11 -0
  11. data/legacy/GenerateCodeCoverageForXCTests.sh +134 -0
  12. data/legacy/GenerateCodeDuplicationReport.sh +24 -0
  13. data/legacy/IncrementBuildNumber.py +129 -0
  14. data/legacy/LoadBuildEnvVars.sh +116 -0
  15. data/legacy/MakeTag.sh +94 -0
  16. data/legacy/RemoveTemporaryFiles.sh +9 -0
  17. data/legacy/SaveRevision.sh +122 -0
  18. data/legacy/UnityBuildAndroid.py +84 -0
  19. data/legacy/UnityBuildAutomationScripts/CommandLineReader.cs +130 -0
  20. data/legacy/UnityBuildAutomationScripts/NIXBuilder.cs +105 -0
  21. data/legacy/UnityBuildEnvVars.py +41 -0
  22. data/legacy/VerifyBinarySigning.py +80 -0
  23. data/legacy/svn-clean.pl +246 -0
  24. data/legacy/svncopy.pl +1134 -0
  25. data/lib/nixenvironment.rb +5 -0
  26. data/lib/nixenvironment/archiver.rb +690 -0
  27. data/lib/nixenvironment/build_env_vars_loader.rb +24 -0
  28. data/lib/nixenvironment/cmd_executor.rb +33 -0
  29. data/lib/nixenvironment/config.rb +127 -14
  30. data/lib/nixenvironment/git.rb +107 -0
  31. data/lib/nixenvironment/plist.rb +52 -0
  32. data/lib/nixenvironment/version.rb +1 -1
  33. data/lib/nixenvironment/xcodebuild.rb +167 -0
  34. data/nixenvironment.gemspec +6 -0
  35. data/utils/XcodeIconTagger/IconTagger +0 -0
  36. data/utils/XcodeIconTagger/masks/OneLineMask.png +0 -0
  37. data/utils/XcodeIconTagger/masks/TwoLineMask.png +0 -0
  38. data/utils/aapt +0 -0
  39. data/utils/gcovr +986 -0
  40. data/utils/identitieslist +0 -0
  41. data/utils/simian-2.3.33.jar +0 -0
  42. metadata +118 -2
@@ -0,0 +1,69 @@
1
+ #!/bin/sh -e
2
+
3
+ # Created by Yuri Govorushchenko on 22/05/2013.
4
+ # Copyright 2013 nix. All rights reserved.
5
+
6
+ # Script reverts all changes in working copy and removes unversioned files.
7
+
8
+ currentScriptDir=$(cd "$(dirname "$0")"; pwd)
9
+ SCM_TYPE=$("${currentScriptDir}/DetectSCM.sh")
10
+
11
+ cleanAll=$1
12
+
13
+ CLEAN_ALL=0
14
+ if [ "${cleanAll}" == "all" ]; then
15
+ echo "--- Clean all specified"
16
+ CLEAN_ALL=1
17
+ fi
18
+
19
+ # Subversion
20
+ if [[ "${SCM_TYPE}" = "svn" ]]; then
21
+ echo "SVN working copy detected, cleaning..."
22
+
23
+ # revert all changes
24
+ svn revert --depth=infinity "./"
25
+
26
+ # revert all changes in external directories
27
+ for i in $(svn status | grep ^Performing | cut -d\' -f 2)
28
+ do
29
+ svn revert -R $i
30
+ done
31
+
32
+ # wipe out unversioned files
33
+ perl "${currentScriptDir}/svn-clean.pl" "./"
34
+
35
+ # git
36
+ elif [[ "${SCM_TYPE}" = "git" ]]; then
37
+ echo "GIT working copy detected, cleaning..."
38
+
39
+ # revert all changes
40
+ git reset --hard
41
+
42
+ if [ ${CLEAN_ALL} -eq 1 ]; then
43
+ # wipe out unversioned files (force, remove whole directories, remove ignored files)
44
+ git clean -fdx
45
+ else
46
+ # wipe out unversioned files (force, remove whole directories)
47
+ git clean -fd
48
+ fi
49
+
50
+ # mercurial
51
+ elif [[ "${SCM_TYPE}" = "mercurial" ]]; then
52
+ echo "Mercurial working copy detected, cleaning..."
53
+
54
+ # revert all changes
55
+ hg revert --all
56
+
57
+ if [ ${CLEAN_ALL} -eq 1 ]; then
58
+ # wipe out unversioned files
59
+ hg --config extensions.purge= clean --all
60
+ else
61
+ # wipe out unversioned files (except ignored files)
62
+ hg --config extensions.purge= clean
63
+ fi
64
+
65
+ # undefined SCM
66
+ else
67
+ echo "error: script must be run from working copy" 1>&2
68
+ exit 1
69
+ fi
data/legacy/Deploy.sh ADDED
@@ -0,0 +1,44 @@
1
+ #!/bin/sh -e
2
+
3
+ # Created by Yaroslav on 10/21/11.
4
+ # Copyright 2011 nix. All rights reserved.
5
+
6
+ # Script uploads IPA product. Creates appropriate subdirectories.
7
+
8
+ if [[ $# < 5 ]]; then
9
+ echo "usage: $0 DEPLOY_HOST DEPLOY_DIR DEPLOY_USER DEPLOY_PASSWORD LOCAL_PATH_TO_BUILD"
10
+ exit 1
11
+ fi
12
+
13
+ DEPLOY_HOST=$1
14
+ DEPLOY_DIR=$2
15
+ DEPLOY_USER=$3
16
+ DEPLOY_PASS=$4
17
+ LOCAL_PATH_TO_BUILD=$5
18
+
19
+ chmod -R 775 "${LOCAL_PATH_TO_BUILD}"
20
+
21
+ echo "Uploading build"
22
+
23
+ expect -d <<END_OF_SCRIPT
24
+ set timeout -1
25
+ spawn scp -p -r "${LOCAL_PATH_TO_BUILD}" "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_DIR}"
26
+ expect {
27
+ "Password:" {
28
+ send "${DEPLOY_PASS}\r"
29
+ }
30
+ "yes/no)?" {
31
+ send "yes\r"
32
+ }
33
+ eof {
34
+ exit
35
+ }
36
+ -re . {
37
+ exp_continue
38
+ }
39
+ }
40
+ expect eof
41
+ exit
42
+ END_OF_SCRIPT
43
+
44
+ rm -rf "${LOCAL_PATH_TO_BUILD}"
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/python
2
+
3
+ # Created by Egor Zubkov on 22/12/14.
4
+ # Copyright 2014 NIX. All rights reserved.
5
+
6
+ import os
7
+ import sys
8
+ import re
9
+ import shutil
10
+ import UnityBuildEnvVars
11
+
12
+
13
+ def main():
14
+ build_env_vars = UnityBuildEnvVars
15
+ configuration, build_number, build_path = build_env_vars.env_vars()
16
+ build_name, build_version = build_data(build_path)
17
+
18
+ print "BUNDLE_ID = %s" % build_name
19
+ print "APP_VERSION = %s" % build_version
20
+ print "BUILD_VERSION = %s" % build_number
21
+
22
+ upload_build(configuration, build_name, build_version, build_number, build_path)
23
+
24
+
25
+ def build_data(build_path):
26
+ regex_template = "^package:.*\s%s='([a-zA-Z0-9._]*)'.*"
27
+ build_name_regex = regex_template % "name"
28
+ build_version_regex = regex_template % "versionName"
29
+
30
+ aapt_path = os.path.join(os.path.dirname(__file__), "Utils/aapt")
31
+ output = os.popen("'%s' dump badging '%s'" % (aapt_path, build_path)).read()
32
+
33
+ build_name = re.match(build_name_regex, output).groups()[0]
34
+ build_version = re.match(build_version_regex, output).groups()[0]
35
+
36
+ return build_name, build_version
37
+
38
+
39
+ def upload_build(configuration, build_name, build_version, build_number, build_path):
40
+ deploy_host = os.environ['DEPLOY_HOST']
41
+ deploy_dir = os.environ['ANDROID_DEPLOY_PATH']
42
+ deploy_user = os.environ['ANDROID_DEPLOY_USERNAME']
43
+ deploy_password = os.environ['ANDROID_DEPLOY_PASSWORD']
44
+
45
+ deploy_file_path = os.path.join(os.path.dirname(__file__), "Deploy.sh")
46
+ build_version_path = "v.%s_%s" % (build_version, build_number)
47
+ temp_build_dir = os.path.join(os.path.dirname(build_path), build_name)
48
+ temp_build_path = os.path.join(temp_build_dir, build_version_path, configuration)
49
+
50
+ if os.path.exists(temp_build_dir):
51
+ shutil.rmtree(temp_build_dir)
52
+
53
+ os.makedirs(temp_build_path)
54
+ shutil.copy(build_path, temp_build_path)
55
+ os.system("'%s' %s %s %s %s '%s'" % (deploy_file_path, deploy_host, deploy_dir, deploy_user, deploy_password, temp_build_dir))
56
+
57
+ if __name__ == '__main__':
58
+ sys.exit(main())
@@ -0,0 +1,125 @@
1
+ #!/bin/sh -e
2
+
3
+ # Created by Yaroslav on 10/21/11.
4
+ # Copyright 2011 nix. All rights reserved.
5
+
6
+ # Script uploads IPA product. Creates appropriate subdirectories.
7
+
8
+ if [[ $# < 6 ]]; then
9
+ echo "usage: $0 DEPLOY_HOST DEPLOY_DIR DEPLOY_USER DEPLOY_PASSWORD DEPLOY_ITUNESCONNECT_USER DELIVER_DEPLOY"
10
+ exit 1
11
+ fi
12
+
13
+ function zipDSYM {
14
+ if [ -d "${APP_DSYM}" ]; then
15
+ cd "${BUILT_PRODUCTS_DIR}"
16
+ zip -r "$1" "${EXECUTABLE_NAME}.app.dSYM"
17
+ cd "${currentScriptDir}"
18
+ fi
19
+ }
20
+
21
+ DEPLOY_HOST=$1
22
+ DEPLOY_DIR=$2
23
+ DEPLOY_USER=$3
24
+ DEPLOY_PASS=$4
25
+ DEPLOY_ITUNESCONNECT_USER=$5
26
+ DELIVER_DEPLOY=$6
27
+
28
+ # load variables
29
+ currentScriptDir=$(cd "$(dirname "$0")"; pwd)
30
+ source "${currentScriptDir}/LoadBuildEnvVars.sh"
31
+
32
+ checkWorkingCopyIsClean
33
+
34
+ if [[ ! -f "${IPA_PRODUCT}" ]] && [[ ! -f "${IPA_PRODUCT_RESIGNED_DEVICE}" ]] && [[ ! -f "${IPA_PRODUCT_RESIGNED_ADHOC}" ]] && [[ ! -f "${IPA_PRODUCT_RESIGNED_APPSTORE}" ]]; then
35
+ echo "error: Nothing to upload. Generate ipa first."
36
+ exit 1
37
+ fi
38
+
39
+ # ********************
40
+ # 1) resigned_appstore
41
+ # ********************
42
+
43
+ if [[ -f "${IPA_PRODUCT_RESIGNED_APPSTORE}" ]]; then
44
+ LOCAL_PATH_TO_APP="/tmp/${IPA_BUNDLE_ID_RESIGNED_APPSTORE}"
45
+ LOCAL_PATH_TO_BUILD="${LOCAL_PATH_TO_APP}/v.${CURRENT_APP_VERSION}_${CURRENT_BUILD_VERSION}"
46
+ rm -rf "${LOCAL_PATH_TO_BUILD}" | true # cleanup in case of previous releases
47
+ mkdir -p "${LOCAL_PATH_TO_BUILD}"
48
+
49
+ CONFIGURATION_FULL_PATH="${LOCAL_PATH_TO_BUILD}/${NAME_FOR_DEPLOYMENT_RESIGNED_APPSTORE}"
50
+ mkdir "${CONFIGURATION_FULL_PATH}"
51
+ cp "${IPA_PRODUCT_RESIGNED_APPSTORE}" "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.ipa"
52
+
53
+ echo "Starting deliver..."
54
+
55
+ if [ "${DEPLOY_ITUNESCONNECT_USER}" == "unknown" ]; then
56
+ echo "DEPLOY_ITUNESCONNECT_USER isn't specified, skipping deliver..."
57
+ else
58
+ if [ "${DELIVER_DEPLOY}" == 1 ]; then
59
+ deliver testflight "${IPA_PRODUCT_RESIGNED_APPSTORE}" -u "${DEPLOY_ITUNESCONNECT_USER}"
60
+ else
61
+ deliver testflight "${IPA_PRODUCT_RESIGNED_APPSTORE}" -u "${DEPLOY_ITUNESCONNECT_USER}" --skip-deploy
62
+ fi
63
+ fi
64
+
65
+ zipDSYM "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.app.dSYM.zip"
66
+
67
+ ${currentScriptDir}/Deploy.sh "${DEPLOY_HOST}" "${DEPLOY_DIR}" "${DEPLOY_USER}" "${DEPLOY_PASS}" "${LOCAL_PATH_TO_APP}"
68
+ fi
69
+
70
+ # *********
71
+ # 2) device
72
+ # *********
73
+
74
+ if [[ -f "${IPA_PRODUCT}" ]]; then
75
+ LOCAL_PATH_TO_APP="/tmp/${IPA_BUNDLE_ID}"
76
+ LOCAL_PATH_TO_BUILD="${LOCAL_PATH_TO_APP}/v.${CURRENT_APP_VERSION}_${CURRENT_BUILD_VERSION}"
77
+ rm -rf "${LOCAL_PATH_TO_BUILD}" | true # cleanup in case of previous releases
78
+ mkdir -p "${LOCAL_PATH_TO_BUILD}"
79
+
80
+ CONFIGURATION_FULL_PATH="${LOCAL_PATH_TO_BUILD}/${NAME_FOR_DEPLOYMENT}"
81
+ mkdir "${CONFIGURATION_FULL_PATH}"
82
+ cp "${IPA_PRODUCT}" "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.ipa"
83
+
84
+ zipDSYM "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.app.dSYM.zip"
85
+
86
+ ${currentScriptDir}/Deploy.sh "${DEPLOY_HOST}" "${DEPLOY_DIR}" "${DEPLOY_USER}" "${DEPLOY_PASS}" "${LOCAL_PATH_TO_APP}"
87
+ fi
88
+
89
+ # ******************
90
+ # 3) resigned_device
91
+ # ******************
92
+
93
+ if [[ -f "${IPA_PRODUCT_RESIGNED_DEVICE}" ]]; then
94
+ LOCAL_PATH_TO_APP="/tmp/${IPA_BUNDLE_ID_RESIGNED_DEVICE}"
95
+ LOCAL_PATH_TO_BUILD="${LOCAL_PATH_TO_APP}/v.${CURRENT_APP_VERSION}_${CURRENT_BUILD_VERSION}"
96
+ rm -rf "${LOCAL_PATH_TO_BUILD}" | true # cleanup in case of previous releases
97
+ mkdir -p "${LOCAL_PATH_TO_BUILD}"
98
+
99
+ CONFIGURATION_FULL_PATH="${LOCAL_PATH_TO_BUILD}/${NAME_FOR_DEPLOYMENT_RESIGNED_DEVICE}"
100
+ mkdir "${CONFIGURATION_FULL_PATH}"
101
+ cp "${IPA_PRODUCT_RESIGNED_DEVICE}" "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.ipa"
102
+
103
+ zipDSYM "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.app.dSYM.zip"
104
+
105
+ ${currentScriptDir}/Deploy.sh "${DEPLOY_HOST}" "${DEPLOY_DIR}" "${DEPLOY_USER}" "${DEPLOY_PASS}" "${LOCAL_PATH_TO_APP}"
106
+ fi
107
+
108
+ # *****************
109
+ # 4) resigned_adhoc
110
+ # *****************
111
+
112
+ if [[ -f "${IPA_PRODUCT_RESIGNED_ADHOC}" ]]; then
113
+ LOCAL_PATH_TO_APP="/tmp/${IPA_BUNDLE_ID_RESIGNED_ADHOC}"
114
+ LOCAL_PATH_TO_BUILD="${LOCAL_PATH_TO_APP}/v.${CURRENT_APP_VERSION}_${CURRENT_BUILD_VERSION}"
115
+ rm -rf "${LOCAL_PATH_TO_BUILD}" | true # cleanup in case of previous releases
116
+ mkdir -p "${LOCAL_PATH_TO_BUILD}"
117
+
118
+ CONFIGURATION_FULL_PATH="${LOCAL_PATH_TO_BUILD}/${NAME_FOR_DEPLOYMENT_RESIGNED_ADHOC}"
119
+ mkdir "${CONFIGURATION_FULL_PATH}"
120
+ cp "${IPA_PRODUCT_RESIGNED_ADHOC}" "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.ipa"
121
+
122
+ zipDSYM "${CONFIGURATION_FULL_PATH}/${EXECUTABLE_NAME}.app.dSYM.zip"
123
+
124
+ ${currentScriptDir}/Deploy.sh "${DEPLOY_HOST}" "${DEPLOY_DIR}" "${DEPLOY_USER}" "${DEPLOY_PASS}" "${LOCAL_PATH_TO_APP}"
125
+ fi
@@ -0,0 +1,11 @@
1
+ #!/bin/sh -e
2
+
3
+ if $(svn info &>/dev/null); then
4
+ echo svn
5
+ elif $(git status &>/dev/null); then
6
+ echo git
7
+ elif $(hg status &>/dev/null); then
8
+ echo mercurial
9
+ else
10
+ echo undefined
11
+ fi
@@ -0,0 +1,134 @@
1
+ #!/bin/sh -e
2
+
3
+ # Created by Nezhelskoy Iliya on 10/09/14.
4
+ # Copyright (c) 2014 NIX. All rights reserved.
5
+
6
+ # Script generates code coverage report for Cobertura Jenkins plugin. Call it after running tests.
7
+ # Tests target should be setup for generating GCOV data.
8
+
9
+ # Prepare variables
10
+ workspace="" scheme="" configuration="" sdk="" exclude="" output="" extraParams=()
11
+
12
+ currentScriptDir=$(cd "$(dirname "$0")"; pwd)
13
+
14
+ # Description of command usage
15
+ function Usage()
16
+ {
17
+ echo "\tUsage: -workspace <workspacename>\n\t\
18
+ -scheme <schemeName>\n\t\
19
+ -configuration <configurationName>\n\t\
20
+ -sdk <sdkName>\n\t\
21
+ [-exclude <excludePattern>]\n\t\
22
+ [-output <outputDirectory>]\n\t\
23
+ ..."
24
+ }
25
+
26
+ function GetParams()
27
+ {
28
+ while [[ $# > 0 ]]
29
+ do
30
+ key="$1"
31
+
32
+ case $key in
33
+ -workspace)
34
+ workspace="$2"
35
+ shift 2;;
36
+ -scheme)
37
+ scheme="$2"
38
+ shift 2;;
39
+ -configuration)
40
+ configuration="$2"
41
+ shift 2 ;;
42
+ -sdk)
43
+ sdk="$2"
44
+ shift 2 ;;
45
+ -exclude)
46
+ exclude="-exclude $2"
47
+ shift 2 ;;
48
+ -output)
49
+ output="$2"
50
+ shift 2 ;;
51
+ *)
52
+ extraParams=(${extraParams[@]} \"$1\")
53
+ shift ;;
54
+ esac
55
+ done
56
+ }
57
+
58
+ # Сheck for required arguments
59
+ function CheckParams()
60
+ {
61
+ if [ ! "$workspace" ] || [ ! "$scheme" ] || [ ! "$configuration" ] || [ ! "$sdk" ]; then
62
+ echo "Missing parameter argument" >&2
63
+ Usage >&2
64
+ exit 1
65
+ fi
66
+ }
67
+
68
+ function GenerateCoverage()
69
+ {
70
+ productName="$1"
71
+ objectsDir="$2"
72
+ exclude="$3"
73
+ outputPath="$4"
74
+
75
+ # Create output directory
76
+ mkdir -p $outputPath
77
+
78
+ printf " Generating coverage for '$productName'... "
79
+ "${currentScriptDir}/Utils/gcovr" -r "$(PWD)" --object-directory="${objectsDir}" "${exclude}" --xml > "$outputPath${productName}.xml"
80
+
81
+ if [ $? -ne 0 ]; then
82
+ exit 1
83
+ fi
84
+
85
+ echo "Done"
86
+ }
87
+
88
+ function ProcessBuildSetting ()
89
+ {
90
+ # The characters in the value are used to split the line into words
91
+ IFS=" = "
92
+
93
+ # Prepare variables
94
+ readonly currentVariantKey="CURRENT_VARIANT"
95
+ readonly defaultVariant="normal"
96
+ readonly productNameKey="PRODUCT_NAME"
97
+ readonly currentArchKey="NATIVE_ARCH"
98
+ readonly objectDirPrefix="OBJECT_FILE_DIR_"
99
+
100
+ # To be determined by 'currentVariantKey'. Initially will use the default value
101
+ objectsDirKey="$objectDirPrefix$defaultVariant"
102
+
103
+ productName=""
104
+ objectsDir=""
105
+ currentArch=""
106
+
107
+ # Read input settings
108
+ while read settingKey settingValue; do
109
+ case $settingKey in
110
+ $currentVariantKey)
111
+ objectsDirKey="$objectDirPrefix$settingValue" ;;
112
+ $objectsDirKey)
113
+ objectsDir=$settingValue ;;
114
+ $productNameKey)
115
+ productName=$settingValue ;;
116
+ $currentArchKey)
117
+ currentArch=$settingValue ;;
118
+ esac
119
+
120
+ if [ "$productName" ] && [ "$objectsDir" ] && [ "$currentArch" ]; then
121
+ GenerateCoverage $productName "${objectsDir}/${currentArch}" "$exclude" "$output"
122
+ productName=""
123
+ objectsDir=""
124
+ currentArch=""
125
+ fi
126
+ done
127
+ }
128
+
129
+ # Load variables
130
+ GetParams "$@"
131
+ CheckParams
132
+
133
+ # Execute
134
+ eval xcodebuild -workspace "$workspace" -scheme "$scheme" -configuration "$configuration" -sdk "$sdk" test -showBuildSettings "${extraParams[@]}" | ProcessBuildSetting