forked from core-plot/core-plot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreaterelease.py
More file actions
executable file
·88 lines (71 loc) · 2.94 KB
/
createrelease.py
File metadata and controls
executable file
·88 lines (71 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env python
from os import mkdir, makedirs, environ, chdir, getcwd, system, listdir
from os.path import join
from shutil import copy, copytree, move, rmtree, ignore_patterns
# Usage
def Usage():
return 'Usage: createrelease.py <version>'
# Run Xcode
def RunXcode(project, target):
system('/usr/bin/xcodebuild -project "%s" -target "%s" -configuration Release clean build' % (project, target))
# Get version from args
import sys
if len(sys.argv) <= 1:
print Usage()
exit(1)
version = sys.argv[1]
# Change to root dir of Core Plot
chdir('..')
projectRoot = getcwd()
# Remove old docset files
frameworkDir = join(projectRoot, 'framework')
rmtree(join(frameworkDir, 'CorePlotDocs.docset'), True)
rmtree(join(frameworkDir, 'CorePlotTouchDocs.docset'), True)
# Remove old build directories
rmtree(join(frameworkDir, 'build'), True)
examples = listdir('examples')
for ex in examples:
exampleDir = join('examples', ex)
rmtree(join(exampleDir, 'build'), True)
# Make directory bundle
desktopDir = join(environ['HOME'], 'Desktop')
releaseRootDir = join(desktopDir, 'CorePlot_' + version)
mkdir(releaseRootDir)
# Copy license and READMEs
copy('License.txt', releaseRootDir)
copytree('READMEs', join(releaseRootDir, 'READMEs'), ignore=ignore_patterns('*.orig'))
# Copy podspec
copy('CorePlot.podspec', releaseRootDir)
# Add source code
sourceDir = join(releaseRootDir, 'Source')
copytree('framework', join(sourceDir, 'framework'), ignore=ignore_patterns('*.docset','*.orig'))
copytree('examples', join(sourceDir, 'examples'), ignore=ignore_patterns('*.orig'))
copy('License.txt', sourceDir)
# Binaries
binariesDir = join(releaseRootDir, 'Binaries')
macosDir = join(binariesDir, 'MacOS')
iosDir = join(binariesDir, 'iOS')
makedirs(macosDir)
mkdir(iosDir)
# Build Mac Framework
chdir('framework')
RunXcode('CorePlot.xcodeproj', 'CorePlot')
macProductsDir = join(projectRoot, 'build/Release')
macFramework = join(macProductsDir, 'CorePlot.framework')
copytree(macFramework, join(macosDir, 'CorePlot.framework'), symlinks=True)
# Build iOS Static Library
RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Universal Library')
iOSLibFile = join(join(projectRoot, 'build/Release-universal'), 'libCorePlot-CocoaTouch.a')
copy(iOSLibFile, iosDir)
iOSHeaderFile = join(join(projectRoot, 'build/Release-universal'), 'CorePlotHeaders')
copytree(iOSHeaderFile, join(iosDir, 'CorePlotHeaders'))
# Build Docs
RunXcode('CorePlot.xcodeproj', 'Documentation')
RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Documentation')
# Copy Docs
docDir = join(releaseRootDir, 'Documentation')
copytree(join(projectRoot, 'documentation'), docDir, ignore=ignore_patterns('*.orig','*.git'))
homeDir = environ['HOME']
docsetsDir = join(homeDir, 'Library/Developer/Shared/Documentation/DocSets')
copytree(join(docsetsDir, 'com.CorePlot.Framework.docset'), join(docDir, 'com.CorePlot.Framework.docset'))
copytree(join(docsetsDir, 'com.CorePlotTouch.Framework.docset'), join(docDir, 'com.CorePlotTouch.Framework.docset'))