Skip to content

Commit 325b634

Browse files
committed
save mode pacakge to dist
1 parent e407fa1 commit 325b634

File tree

12 files changed

+114
-207
lines changed

12 files changed

+114
-207
lines changed

.gitignore

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
bin
2-
processing-core.zip
3-
release
1+
dist
2+
mode/processing-core.zip
43

5-
.AppleDouble
6-
._*
7-
*~
84
.DS_Store
9-
/sdk/
10-
/temp/
5+
*/**/.DS_Store
6+
7+
build
8+
*/**/build
9+
bin
10+
*/**/bin
1111

12-
libraries/build/**
13-
build/**
1412
.gradle
1513

build.gradle

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ allprojects {
1414
apply plugin: 'java'
1515

1616
ext.android_platform = "$sdkdir/platforms/android-$sdkver"
17-
ext.android_tools_lib = "$sdkdir/platforms/android-$sdkver/tools/lib"
17+
ext.android_tools_lib = "$sdkdir/tools/lib"
1818
ext.core_jar_path = "$rootDir/mode/processing-core.zip"
1919

2020
repositories {
2121
jcenter()
22-
flatDir dirs: "$rootDir/libs/core/library"
23-
flatDir dirs: "$rootDir/libs/core/build/libs"
24-
flatDir dirs: "$rootDir/libs/vr/library"
25-
flatDir dirs: "$sdkdir/tools/lib"
22+
flatDir dirs: "$rootDir/core/library"
23+
flatDir dirs: "$rootDir/core/build/libs"
24+
flatDir dirs: "$rootDir/mode/libraries/vr/library"
2625
flatDir dirs: android_platform
2726
flatDir dirs: android_tools_lib
2827
}
@@ -33,9 +32,14 @@ allprojects {
3332

3433
dependencies {
3534
compile name: 'android'
36-
compile project(":mode")
37-
compile project(":libs:core")
38-
compile project(":libs:vr")
35+
compile project(":core")
36+
compile project(":mode:libraries:vr")
37+
compile project(":mode")
38+
}
39+
40+
41+
clean.doFirst {
42+
delete "dist"
3943
}
4044

4145
import java.nio.file.Files
@@ -44,7 +48,8 @@ import org.apache.commons.io.FileUtils
4448
import static java.nio.file.StandardCopyOption.*;
4549

4650
task dist {
47-
try {
51+
dependsOn subprojects.build
52+
doLast {
4853
def root = "$buildDir/zip/AndroidMode"
4954

5055
// Copy assets to build dir
@@ -54,34 +59,34 @@ task dist {
5459
FileUtils.copyDirectory(file("mode/mode"), file("$root/mode"))
5560
FileUtils.copyDirectory(file("mode/theme"), file("$root/theme"))
5661

57-
Files.copy(file("libs/core/build/libs/processing-core.zip").toPath(),
62+
Files.copy(file("core/build/libs/processing-core.zip").toPath(),
5863
file("$root/processing-core.zip").toPath(), REPLACE_EXISTING);
5964

6065
Files.copy(file("mode/mode.properties").toPath(),
6166
file("$root/mode.properties").toPath(), REPLACE_EXISTING);
6267

63-
FileUtils.copyDirectory(file("tools/SDKUpdater/tool"),
68+
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/tool"),
6469
file("$root/tools/SDKUpdater/tool"))
65-
FileUtils.copyDirectory(file("tools/SDKUpdater/src"),
70+
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/src"),
6671
file("$root/tools/SDKUpdater/src"))
6772

68-
FileUtils.copyDirectory(file("libs/vr/examples"),
69-
file("$root/libs/vr/examples"))
70-
FileUtils.copyDirectory(file("libs/vr/gvrsdk"),
71-
file("$root/libs/vr/gvrsdk"))
72-
FileUtils.copyDirectory(file("libs/vr/library"),
73-
file("$root/libs/vr/library"))
74-
FileUtils.copyDirectory(file("libs/vr/src"),
75-
file("$root/libs/vr/src"))
76-
Files.copy(file("libs/vr/library.properties").toPath(),
77-
file("$root/libs/vr/library.properties").toPath(), REPLACE_EXISTING);
73+
FileUtils.copyDirectory(file("mode/libraries/vr/examples"),
74+
file("$root/libraries/vr/examples"))
75+
FileUtils.copyDirectory(file("mode/libraries/vr/gvrsdk"),
76+
file("$root/libraries/vr/gvrsdk"))
77+
FileUtils.copyDirectory(file("mode/libraries/vr/library"),
78+
file("$root/libraries/vr/library"))
79+
FileUtils.copyDirectory(file("mode/libraries/vr/src"),
80+
file("$root/libraries/vr/src"))
81+
Files.copy(file("mode/libraries/vr/library.properties").toPath(),
82+
file("$root/libraries/vr/library.properties").toPath(), REPLACE_EXISTING);
7883

79-
ZipUtil.pack(file("$buildDir/zip"), new File("release/AndroidMode.zip"))
84+
File distFolder = file("dist");
85+
//create intermediate folder if they don't exist
86+
distFolder.mkdirs();
87+
ZipUtil.pack(file("$buildDir/zip"), new File("dist/AndroidMode.zip"));
8088
Files.copy(file("mode/mode.properties").toPath(),
81-
file("release/AndroidMode.txt").toPath(), REPLACE_EXISTING);
82-
} catch (Exception ex) {
83-
logger.error ex.getMessage()
89+
file("dist/AndroidMode.txt").toPath(), REPLACE_EXISTING);
8490
}
8591
}
8692

87-
dist.dependsOn build

build.xml

Lines changed: 25 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,34 @@
11
<?xml version="1.0"?>
22

3-
<project name="Android Mode for Processing" default="build">
3+
<project name="Processing for Android" default="build">
44

55
<!-- path to the main processing repo -->
66
<property name="processing.dir" value="../processing" />
77

8-
<property name="core.jar.path" value="processing-core.zip" />
9-
<property name="mode.jar.path" value="mode/AndroidMode.jar" />
10-
<property name="mode.dist.path" value="release/AndroidMode.zip" />
11-
<property name="tools.jar.path" value="mode/tools.jar" />
8+
<property name="core.jar.path" value="mode/processing-core.zip" />
9+
<property name="mode.jar.path" value="mode/mode/AndroidMode.jar" />
10+
<property name="mode.dist.path" value="dist/AndroidMode.zip" />
11+
<property name="tools.jar.path" value="mode/mode/tools.jar" />
1212

1313
<target name="clean" depends="subprojects-clean" description="Clean the build directories">
14-
<delete dir="bin" />
14+
<delete dir="dist" />
1515
<delete file="${mode.jar.path}" />
1616
</target>
1717

1818
<target name="compile" depends="subprojects-build" description="Compile sources">
19-
20-
<condition property="core-built">
21-
<available file="${processing.dir}/core/library/core.jar" />
22-
</condition>
23-
<fail unless="core-built"
24-
message="Please build the core library first and make sure it sits in ${processing.dir}/core/library/core.jar" />
25-
26-
<mkdir dir="bin" />
27-
28-
<!-- env used to set classpath below -->
29-
<property environment="env" />
30-
31-
<javac source="1.7"
32-
target="1.7"
33-
destdir="bin"
34-
encoding="UTF-8"
35-
includeAntRuntime="false"
36-
classpath="${processing.dir}/core/library/core.jar;
37-
${processing.dir}/java/mode/JavaMode.jar;
38-
${processing.dir}/java/mode/org.eclipse.core.runtime.jar;
39-
${processing.dir}/app/pde.jar;
40-
mode/gradle-tooling-api-4.4.1.jar"
41-
debug="on">
42-
<src path="src" />
43-
</javac>
4419
</target>
4520

4621

47-
<target name="build" depends="compile" description="Build Android mode">
48-
<jar basedir="bin" destfile="${mode.jar.path}" />
22+
<target name="build" depends="compile" description="Build modules">
4923
</target>
5024

5125

5226
<target name="dist" depends="build"
5327
description="Create AndroidMode.zip and AndroidMode.txt">
54-
<mkdir dir="release" />
28+
<mkdir dir="dist" />
5529

5630
<zip destfile="${mode.dist.path}">
57-
<zipfileset dir="." prefix="AndroidMode">
31+
<zipfileset dir="./mode" prefix="AndroidMode">
5832
<include name="processing-core.zip" />
5933
<include name="mode.properties" />
6034
<include name="mode/**" />
@@ -64,34 +38,36 @@
6438
<include name="theme/**" />
6539
<include name="tools/SDKUpdater/tool/**" />
6640
<include name="tools/SDKUpdater/src/**" />
67-
<include name="libs/vr/library.properties" />
68-
<include name="libs/vr/examples/**" />
69-
<include name="libs/vr/gvrsdk/**" />
70-
<include name="libs/vr/lib/**" />
71-
<include name="libs/vr/library/**" />
72-
<include name="libs/vr/src/**" />
41+
<include name="libraries/vr/library.properties" />
42+
<include name="libraries/vr/examples/**" />
43+
<include name="libraries/vr/gvrsdk/**" />
44+
<include name="libraries/vr/lib/**" />
45+
<include name="libraries/vr/library/**" />
46+
<include name="libraries/vr/src/**" />
7347
<exclude name="**/._*" />
7448
</zipfileset>
7549
</zip>
7650

77-
<copy file="mode.properties"
78-
tofile="release/AndroidMode.txt" />
51+
<copy file="mode/mode.properties"
52+
tofile="dist/AndroidMode.txt" />
7953
</target>
8054

8155
<!-- - - - - - - - - - - - - - - - - - -->
8256
<!-- Subprojects: libraries, tools -->
8357
<!-- - - - - - - - - - - - - - - - - - -->
8458

8559
<target name="subprojects-clean">
86-
<subant buildpath="libs/core" target="clean"/>
87-
<subant buildpath="libs/vr" target="clean"/>
88-
<subant buildpath="tools/SDKUpdater" target="clean"/>
60+
<subant buildpath="core" target="clean"/>
61+
<subant buildpath="mode/libraries/vr" target="clean"/>
62+
<subant buildpath="mode/tools/SDKUpdater" target="clean"/>
63+
<subant buildpath="mode" target="clean"/>
8964
</target>
9065

9166
<target name="subprojects-build">
92-
<subant buildpath="libs/core" target="build"/>
93-
<subant buildpath="libs/vr" target="build"/>
94-
<subant buildpath="tools/SDKUpdater" target="build"/>
67+
<subant buildpath="core" target="build"/>
68+
<subant buildpath="mode/libraries/vr" target="build"/>
69+
<subant buildpath="mode/tools/SDKUpdater" target="build"/>
70+
<subant buildpath="mode" target="build"/>
9571
</target>
9672

9773
</project>

core/build.gradle

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,12 @@ jar.doLast { task ->
8484
ant.checksum file: task.archivePath
8585
}
8686

87-
task dist {
88-
doLast {
89-
// make copy of jar file as zip
90-
Files.copy(file("$buildDir/libs/core.jar").toPath(),
91-
file("$buildDir/libs/processing-core.zip").toPath(), REPLACE_EXISTING);
87+
build.doLast {
88+
// make copy of jar file as zip
89+
Files.copy(file("$buildDir/libs/core.jar").toPath(),
90+
file("$buildDir/libs/processing-core.zip").toPath(), REPLACE_EXISTING);
9291

93-
// and copy it to root
94-
Files.copy(file("$buildDir/libs/core.jar").toPath(),
95-
file("$core_jar_path").toPath(), REPLACE_EXISTING);
96-
}
92+
// and copy it to root
93+
Files.copy(file("$buildDir/libs/core.jar").toPath(),
94+
file("$core_jar_path").toPath(), REPLACE_EXISTING);
9795
}
98-
99-
dist.dependsOn build

core/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<property name="sdk.dir" value="/Users/andres/code/android/sdk" />
88

99
<!-- path to the main processing repo -->
10-
<property name="processing.dir" value="../../../processing" />
10+
<property name="processing.dir" value="../../processing" />
1111

1212
<!-- path to the core library -->
13-
<property name="core.jar.path" value="../../processing-core.zip" />
13+
<property name="core.jar.path" value="../mode/processing-core.zip" />
1414

1515
<!-- Android platform to build the core library -->
1616
<property name="android.platform" value="android-26" />

mode/build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ sourceSets {
2828
import java.nio.file.Files
2929
import static java.nio.file.StandardCopyOption.*;
3030

31-
task dist {
32-
doLast {
33-
Files.copy(file("$buildDir/libs/mode.jar").toPath(),
34-
file("mode/AndroidMode.jar").toPath(), REPLACE_EXISTING);
35-
}
31+
build.doLast {
32+
Files.copy(file("$buildDir/libs/mode.jar").toPath(),
33+
file("mode/AndroidMode.jar").toPath(), REPLACE_EXISTING);
3634
}
37-
38-
dist.dependsOn build

0 commit comments

Comments
 (0)