summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.py72
1 files changed, 41 insertions, 31 deletions
diff --git a/build.py b/build.py
index cc77c431..09718cb2 100644
--- a/build.py
+++ b/build.py
@@ -9,7 +9,6 @@ Author = "Cuchaz"
9DirBin = "bin" 9DirBin = "bin"
10DirLib = "lib" 10DirLib = "lib"
11DirBuild = "build" 11DirBuild = "build"
12DirTemp = os.path.join(DirBuild, "tmp")
13PathLocalMavenRepo = "../maven" 12PathLocalMavenRepo = "../maven"
14 13
15 14
@@ -19,18 +18,21 @@ import ssjb
19import ssjb.ivy 18import ssjb.ivy
20 19
21 20
22ThisArtifact = ssjb.ivy.Dep("cuchaz:enigma:0.6b") 21ArtifactStandalone = ssjb.ivy.Dep("cuchaz:enigma:0.6b")
22ArtifactLib = ssjb.ivy.Dep("cuchaz:enigma-lib:0.6b")
23 23
24# dependencies 24# dependencies
25ExtraRepos = [ 25ExtraRepos = [
26 "http://maven.cuchazinteractive.com" 26 "http://maven.cuchazinteractive.com"
27] 27]
28Deps = [ 28LibDeps = [
29 ssjb.ivy.Dep("com.google.guava:guava:17.0"), 29 ssjb.ivy.Dep("com.google.guava:guava:17.0"),
30 ssjb.ivy.Dep("de.sciss:jsyntaxpane:1.0.0"),
31 ssjb.ivy.Dep("org.javassist:javassist:3.18.1-GA"), 30 ssjb.ivy.Dep("org.javassist:javassist:3.18.1-GA"),
32 ssjb.ivy.Dep("org.bitbucket.mstrobel:procyon-decompiler:0.5.26-enigma") 31 ssjb.ivy.Dep("org.bitbucket.mstrobel:procyon-decompiler:0.5.26-enigma")
33] 32]
33StandaloneDeps = LibDeps + [
34 ssjb.ivy.Dep("de.sciss:jsyntaxpane:1.0.0")
35]
34ProguardDep = ssjb.ivy.Dep("net.sf.proguard:proguard-base:5.1") 36ProguardDep = ssjb.ivy.Dep("net.sf.proguard:proguard-base:5.1")
35TestDeps = [ 37TestDeps = [
36 ssjb.ivy.Dep("junit:junit:4.12"), 38 ssjb.ivy.Dep("junit:junit:4.12"),
@@ -57,6 +59,39 @@ def buildTestJar(name, glob):
57 ) 59 )
58 60
59 61
62def applyReadme(dirTemp):
63 ssjb.file.copy(dirTemp, "license.APL2.txt")
64 ssjb.file.copy(dirTemp, "license.GPL3.txt")
65 ssjb.file.copy(dirTemp, "readme.txt")
66
67
68def buildStandaloneJar(dirOut):
69 with ssjb.file.TempDir(os.path.join(dirOut, "tmp")) as dirTemp:
70 ssjb.file.copyTree(dirTemp, DirBin, ssjb.file.find(DirBin))
71 for path in ssjb.ivy.getJarPaths(StandaloneDeps, ExtraRepos):
72 ssjb.jar.unpackJar(dirTemp, path)
73 ssjb.file.delete(os.path.join(dirTemp, "LICENSE.txt"))
74 ssjb.file.delete(os.path.join(dirTemp, "META-INF/maven"))
75 applyReadme(dirTemp)
76 manifest = ssjb.jar.buildManifest(
77 ArtifactStandalone.artifactId,
78 ArtifactStandalone.version,
79 Author,
80 "cuchaz.enigma.Main"
81 )
82 pathJar = os.path.join(DirBuild, "%s.jar" % ArtifactStandalone.getName())
83 ssjb.jar.makeJar(pathJar, dirTemp, manifest=manifest)
84 ssjb.ivy.deployJarToLocalMavenRepo(PathLocalMavenRepo, pathJar, ArtifactStandalone)
85
86def buildLibJar(dirOut):
87 with ssjb.file.TempDir(os.path.join(dirOut, "tmp")) as dirTemp:
88 ssjb.file.copyTree(dirTemp, DirBin, ssjb.file.find(DirBin))
89 applyReadme(dirTemp)
90 pathJar = os.path.join(DirBuild, "%s.jar" % ArtifactLib.getName())
91 ssjb.jar.makeJar(pathJar, dirTemp)
92 ssjb.ivy.deployJarToLocalMavenRepo(PathLocalMavenRepo, pathJar, ArtifactLib, deps=LibDeps)
93
94
60# tasks 95# tasks
61 96
62def taskGetDeps(): 97def taskGetDeps():
@@ -72,35 +107,10 @@ def taskBuildTestJars():
72 buildTestJar("testInnerClasses", "cuchaz/enigma/inputs/innerClasses/*.class") 107 buildTestJar("testInnerClasses", "cuchaz/enigma/inputs/innerClasses/*.class")
73 108
74def taskBuild(): 109def taskBuild():
75
76 # make the build directory
77 ssjb.file.delete(DirBuild) 110 ssjb.file.delete(DirBuild)
78 ssjb.file.mkdir(DirBuild) 111 ssjb.file.mkdir(DirBuild)
79 112 buildStandaloneJar(DirBuild)
80 # make the main jar 113 buildLibJar(DirBuild)
81 with ssjb.file.TempDir(DirTemp) as dirTemp:
82 ssjb.file.copyTree(dirTemp, DirBin, ssjb.file.find(DirBin))
83 for path in ssjb.ivy.getJarPaths(Deps, ExtraRepos):
84 ssjb.jar.unpackJar(dirTemp, path)
85 ssjb.file.delete(os.path.join(dirTemp, "LICENSE.txt"))
86 ssjb.file.delete(os.path.join(dirTemp, "META-INF/maven"))
87 ssjb.file.copy(dirTemp, "license.APL2.txt")
88 ssjb.file.copy(dirTemp, "license.GPL3.txt")
89 ssjb.file.copy(dirTemp, "readme.txt")
90 manifest = ssjb.jar.buildManifest(
91 ThisArtifact.artifactId,
92 ThisArtifact.version,
93 Author,
94 "cuchaz.enigma.Main"
95 )
96 pathJar = os.path.join(DirBuild, "%s.jar" % ThisArtifact.getName())
97 ssjb.jar.makeJar(pathJar, dirTemp, manifest=manifest)
98
99 ssjb.ivy.deployJarToLocalMavenRepo(
100 PathLocalMavenRepo,
101 pathJar,
102 ThisArtifact
103 )
104 114
105ssjb.registerTask("getDeps", taskGetDeps) 115ssjb.registerTask("getDeps", taskGetDeps)
106ssjb.registerTask("buildTestJars", taskBuildTestJars) 116ssjb.registerTask("buildTestJars", taskBuildTestJars)