Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xtools/publish_to_dropbox.py91
-rwxr-xr-xtools/upload_to_dropbox.sh36
3 files changed, 37 insertions, 91 deletions
diff --git a/.gitignore b/.gitignore
index 01245958a3..6525a7973e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -131,6 +131,7 @@ tizen/*/.*
tizen/*/crash-info/*
.idea/*
+.idea
# Private repository files.
.private_repository_url
diff --git a/tools/publish_to_dropbox.py b/tools/publish_to_dropbox.py
deleted file mode 100755
index 5eaa4ae0d7..0000000000
--- a/tools/publish_to_dropbox.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#! /usr/bin/env python
-
-from __future__ import print_function
-from optparse import OptionParser
-import os
-from os import path
-import shutil
-import re
-
-
-class DropBoxPublisher:
- def __init__(self):
- self.folders = list()
- self.patterns = list()
-
- self.found_files = list()
- self.loc_folder = str()
-
-
- def read_options(self):
- usage = """
-
-The script for publishing build results to Dropbox.
-It takes as arguments the path to the dropbox folder (-d or --dropbox_folder_path) and the mode of the build (-m or --mode),
-patterns to include (in python syntax), folders to look for files to copy,
-removes all data from the dropbox_path/mode folder, recreates it anew and places the build artefacst there.
-The dropbox folder must exist. And it doesn't have to be a dropbox folder, it can be an ordinary folder as well.
-No default values are provided.
-
-tools/publish_to_dropbox.py -m debug -d "/Users/jenkins/Dropbox (MapsWithMe)" -p ".*\.ipa" -f "android/build/outputs/apk" -f "." -p ".*[^(unaligned)]\.apk" -p "obj.zip"
-"""
-
- parser = OptionParser(usage=usage)
- parser.add_option("-m", "--mode", dest="mode",
- help="mode of build, i.e. debug or release", metavar="MODE")
-
- parser.add_option("-d", "--dropbpx_folder_path", dest="dropbox",
- help="path to dropbox folder", metavar="DRBOX_PATH")
-
- parser.add_option("-p", "--pattern", dest="patterns", action="append",
- help="regexp to filter files; files with matching names will be copied, one at a time", metavar="PATTERN")
-
- parser.add_option("-f", "--folder", dest="folders", action="append",
- help="folders in which to look for the files to be copied, one at at time", metavar="FOLDER")
-
- (options, args) = parser.parse_args()
-
- if (not options.mode
- or not options.patterns
- or not options.folders
- or not options.dropbox
- or options.mode not in ["debug","release"]):
- parser.print_help()
- exit(2)
-
- self.patterns = map(lambda x: re.compile(x), options.patterns)
- self.folders = options.folders
- self.loc_folder = path.join(options.dropbox, options.mode)
-
-
- def find_files(self):
- for folder in self.folders:
- apks = os.listdir(folder)
- eligible_apks = filter(lambda x: filter(lambda y: y.match(x), self.patterns), apks)
- self.found_files.extend(map(lambda x: path.join(folder, x), eligible_apks))
-
-
- def clean_dropbox(self):
- shutil.rmtree(self.loc_folder)
- os.makedirs(self.loc_folder)
-
-
- def copy_files_to_dropbox(self):
- for artefact in self.found_files:
- shutil.copy(artefact, self.loc_folder)
-
-
- def publish(self):
- self.read_options()
- self.find_files()
- self.clean_dropbox()
- self.copy_files_to_dropbox()
-
-
-def main():
- publisher = DropBoxPublisher()
- publisher.publish()
-
-
-if __name__ == "__main__" :
- main()
diff --git a/tools/upload_to_dropbox.sh b/tools/upload_to_dropbox.sh
new file mode 100755
index 0000000000..b38b09e3cd
--- /dev/null
+++ b/tools/upload_to_dropbox.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+if [ "$#" -lt 3 ]; then
+ echo "Illegal number of parameters"
+ echo "The four arguments to this script are:"
+ echo " 1) build mode (debug/release), use the \${BUILD_MODE} from Jenkins environment vars"
+ echo " 2) the path to the root of the workspace, use \${WORKSPACE} from Jenkins env. vars"
+ echo " 3) the auth key to your dropbox. You can generate it in your dropbox"
+ echo " 4) the target folder (android, drape or anything else, defaults to testing)"
+ exit 0 # Exiting with a non-error code in order not to break the rest of the build
+fi
+
+BUILD_MODE=$1
+FOLDER=$2
+KEY=$3
+TARGET="${4-testing}"
+
+rm -f $FOLDER/omim/android/build/outputs/apk/android-symbols.zip
+
+zip -r $FOLDER/omim/android/build/outputs/apk/android-symbols.zip $FOLDER/omim/android/obj
+
+# Upload the files to DropBox:
+# Later this ugly bit will be replaced by a new and shiny python script
+# 1) Delete the files from dropbox first
+for s in $(curl -H "Authorization: Bearer $KEY" "https://api.dropboxapi.com/1/metadata/auto/$TARGET/$BUILD_MODE" -X GET | python -m json.tool | grep "path" | grep "/$TARGET/" | cut -d ":" -f 2 | sed "s/\",//" | sed "s/\"//");
+do
+ curl -H "Authorization: Bearer $KEY" "https://api.dropbox.com/1/fileops/delete" -X POST --data "root=auto&path=$s"
+done
+
+cd $FOLDER/omim/android/build/outputs/apk/
+
+# 2) Upload the new ones now
+for s in $(ls | grep "android" | grep -v "unaligned");
+do
+ curl -H "Authorization: Bearer $KEY" https://api-content.dropbox.com/1/files_put/auto/$TARGET/$BUILD_MODE/ -T $s;
+done