Skip to content

Commit 4b645b8

Browse files
committed
removing Google APIs requirement (issue #613)
1 parent a396c86 commit 4b645b8

File tree

3 files changed

+41
-17
lines changed

3 files changed

+41
-17
lines changed

app/src/processing/app/exec/ProcessHelper.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ public String toString() {
7272
* @throws IOException
7373
*/
7474
public ProcessResult execute() throws InterruptedException, IOException {
75+
return execute(null);
76+
}
77+
78+
79+
/**
80+
* Blocks execution, also passes a single line to the command's input stream.
81+
* @return exit value of process
82+
* @throws InterruptedException
83+
* @throws IOException
84+
*/
85+
public ProcessResult execute(String outgoing) throws InterruptedException, IOException {
7586
final StringWriter outWriter = new StringWriter();
7687
final StringWriter errWriter = new StringWriter();
7788
final long startTime = System.currentTimeMillis();
@@ -84,6 +95,16 @@ public ProcessResult execute() throws InterruptedException, IOException {
8495
Runtime.getRuntime().exec(cmd) :
8596
Runtime.getRuntime().exec(cmd, new String[] { }, dir);
8697
ProcessRegistry.watch(process);
98+
99+
// Write a single line of output to the app... used to write 'no' to 'create avd'
100+
if (outgoing != null) {
101+
OutputStream os = process.getOutputStream();
102+
PrintWriter pw = new PrintWriter(new OutputStreamWriter(os));
103+
pw.println(outgoing);
104+
pw.flush();
105+
pw.close();
106+
}
107+
87108
try {
88109
String title = prettyCommand;
89110
new StreamPump(process.getInputStream(), "out: " + title).addTarget(outWriter).start();

app/src/processing/mode/android/AVD.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public class AVD {
3636
"found at http://android.processing.org and try again.";
3737

3838
static final String DEFAULT_SKIN = "WVGA800";
39+
static final String DEFAULT_SDCARD_SIZE = "64M";
3940

4041
/** Name of this avd. */
4142
protected String name;
@@ -45,10 +46,9 @@ public class AVD {
4546

4647
/** Default virtual device used by Processing. */
4748
static public final AVD defaultAVD =
48-
new AVD(//"Processing-Android-" + AndroidBuild.sdkVersion,
49-
"Processing-0" + Base.REVISION,
50-
"Google Inc.:Google APIs:" + AndroidBuild.sdkVersion);
51-
//AndroidBuild.sdkTarget);
49+
new AVD("Processing-0" + Base.REVISION,
50+
"android-" + AndroidBuild.sdkVersion);
51+
// "Google Inc.:Google APIs:" + AndroidBuild.sdkVersion);
5252

5353
static ArrayList<String> avdList;
5454
static ArrayList<String> badList;
@@ -134,8 +134,9 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
134134
final String[] params = {
135135
sdk.getAndroidToolPath(),
136136
"create", "avd",
137-
"-n", name, "-t", target,
138-
"-c", "64M",
137+
"-n", name,
138+
"-t", target,
139+
"-c", DEFAULT_SDCARD_SIZE,
139140
"-s", DEFAULT_SKIN
140141
};
141142

@@ -144,7 +145,10 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
144145

145146
final ProcessHelper p = new ProcessHelper(params);
146147
try {
147-
final ProcessResult createAvdResult = p.execute();
148+
// Passes 'no' to "Do you wish to create a custom hardware profile [no]"
149+
// System.out.println("CREATE AVD STARTING");
150+
final ProcessResult createAvdResult = p.execute("no");
151+
// System.out.println("CREATE AVD HAS COMPLETED");
148152
if (createAvdResult.succeeded()) {
149153
return true;
150154
}

todo.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ X http://code.google.com/p/processing/issues/detail?id=1426
6060
X double textMode() error message with P3D:
6161
X textMode(SCREEN) has been removed from Processing 2.0.
6262
X textMode(256) is not supported by this renderer.
63-
X prevent errors on first line of a new tab from highlighting on previous tab
63+
X errors that cannot be placed (i.e. missing brace)
64+
X this makes things to jump to the last tab
65+
X also happens with stray characters sometimes...
66+
X casey: accidentally typing a letter at the top of the tab
67+
X throws you onto the end of the last tab... exactly the worst location
68+
o if the error cannot be placed, just don't change tabs/placement at all
69+
X prevent errors on first line of a new tab from highlighting on previous tab
6470

6571
earlier
6672
X The sketch name can't begin with '_' (underscore)
@@ -76,18 +82,11 @@ _ add to build.xml
7682
_ insert "@SuppressWarnings({"unused", "cast"})" into
7783
_ JavaLexer, JavaRecognizer, PdeLexer, PdeRecognizer
7884
_ from processing/mode/java/preproc/
79-
80-
2.0 FINAL / casey requests
81-
_ errors that cannot be placed (i.e. missing brace)
82-
_ this makes things to jump to the last tab
83-
_ also happens with stray characters sometimes...
84-
_ casey: accidentally typing a letter at the top of the tab
85-
_ throws you onto the end of the last tab... exactly the worst location
86-
_ if the error cannot be placed, just don't change tabs/placement at all
85+
_ also add means to move changes from desktop to Android (and vice-versa)
8786

8887
_ include debug mode as 'experimental'?
8988
_ DebugMode throwing exception about breakpoints when trying to save
90-
_ what to call it?
89+
_ what to call it? change java2 folder name?
9190

9291
_ if RuntimeException thrown, needs to check if it's a wrapped exception
9392
_ for instance, if there's a crash inside makeGraphics()

0 commit comments

Comments
 (0)