|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +from os import mkdir, makedirs, environ, chdir, getcwd, system |
| 4 | +from os.path import join |
| 5 | +from shutil import copy, copytree, move |
| 6 | + |
| 7 | +# Usage |
| 8 | +def Usage(): |
| 9 | + return 'Usage: createversion.py <version>' |
| 10 | + |
| 11 | +# Run Xcode |
| 12 | +def RunXcode(project, target): |
| 13 | + system('/usr/bin/xcodebuild -project "%s" -target "%s" -configuration Release clean build' % (project, target)) |
| 14 | + |
| 15 | + |
| 16 | +# Get version from args |
| 17 | +import sys |
| 18 | +if len(sys.argv) <= 1: |
| 19 | + print Usage() |
| 20 | + exit(1) |
| 21 | +version = sys.argv[1] |
| 22 | + |
| 23 | +# Change to root dir of Core Plot |
| 24 | +chdir('..') |
| 25 | +projectRoot = getcwd() |
| 26 | + |
| 27 | +# Make directory bundle |
| 28 | +desktopDir = join(environ['HOME'], 'Desktop') |
| 29 | +releaseRootDir = join(desktopDir, 'alpharelease_' + version) |
| 30 | +mkdir(releaseRootDir) |
| 31 | + |
| 32 | +# Copy license and READMEs |
| 33 | +copy('License.txt', releaseRootDir) |
| 34 | +copytree('READMEs', join(releaseRootDir, 'READMEs')) |
| 35 | + |
| 36 | +# Add source code |
| 37 | +sourceDir = join(releaseRootDir, 'Source') |
| 38 | +copytree('framework', join(sourceDir, 'framework')) |
| 39 | +copytree('examples', join(sourceDir, 'examples')) |
| 40 | + |
| 41 | +# Binaries |
| 42 | +binariesDir = join(releaseRootDir, 'Binaries') |
| 43 | +macosDir = join(binariesDir, 'MacOS') |
| 44 | +iosDir = join(binariesDir, 'iOS') |
| 45 | +makedirs(macosDir) |
| 46 | +mkdir(iosDir) |
| 47 | + |
| 48 | +# Build Mac Framework |
| 49 | +chdir('framework') |
| 50 | +RunXcode('CorePlot.xcodeproj', 'CorePlot') |
| 51 | +macProductsDir = join(projectRoot, 'build/Release') |
| 52 | +macFramework = join(macProductsDir, 'CorePlot.framework') |
| 53 | +copytree(macFramework, join(macosDir, 'CorePlot.framework')) |
| 54 | + |
| 55 | +# Build iOS SDK |
| 56 | +RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Build SDK') |
| 57 | +sdkZipFile = join(desktopDir, 'CorePlot.zip') |
| 58 | +move(sdkZipFile, iosDir) |
| 59 | + |
| 60 | +# Build Docs |
| 61 | +RunXcode('CorePlot.xcodeproj', 'Documentation') |
| 62 | +RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Documentation') |
| 63 | + |
| 64 | +# Copy Docs |
| 65 | +homeDir = environ['HOME'] |
| 66 | +docsetsDir = join(homeDir, 'Library/Developer/Shared/Documentation/DocSets') |
| 67 | +docDir = join(releaseRootDir, 'Documentation') |
| 68 | +copytree(join(docsetsDir, 'com.CorePlot.Framework.docset'), join(docDir, 'com.CorePlot.Framework.docset')) |
| 69 | +copytree(join(docsetsDir, 'com.CorePlotTouch.Framework.docset'), join(docDir, 'com.CorePlotTouch.Framework.docset')) |
| 70 | + |
0 commit comments