Skip to content

Commit 4bb7677

Browse files
committed
retrieve support packages from android repository
1 parent 037559d commit 4bb7677

File tree

11 files changed

+68
-68
lines changed

11 files changed

+68
-68
lines changed

core/.classpath

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="var" path="ANDROID_LIB"/>
5-
<classpathentry kind="lib" path="library/android-support-v4.jar"/>
65
<classpathentry kind="lib" path="library/wearable-2.0.0.jar"/>
6+
<classpathentry kind="lib" path="library/support-annotations-25.2.0.jar"/>
7+
<classpathentry kind="lib" path="library/support-compat-25.2.0.jar"/>
8+
<classpathentry kind="lib" path="library/support-fragment-25.2.0.jar"/>
79
<classpathentry kind="output" path="bin"/>
810
</classpath>

core/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ buildscript {
1010

1111
dependencies {
1212
compile name: 'android'
13-
compile name: 'android-support-v4'
13+
compile name: 'support-compat-25.2.0'
14+
compile name: 'support-fragment-25.2.0'
15+
compile name: 'support-annotations-25.2.0'
1416
compile name: 'wearable-2.0.0'
1517
}
1618

core/build.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<!-- Wear version to build the core library -->
1616
<property name="wear.version" value="2.0.0" />
1717

18+
<!-- Support version to build the core library -->
19+
<property name="support.version" value="25.2.0" />
20+
1821
<!-- oh ant, you're so cute and convoluted -->
1922
<target name="build" depends="sdk_chatter,actual_build" />
2023

@@ -41,7 +44,9 @@
4144
encoding="UTF-8"
4245
includeAntRuntime="false"
4346
bootclasspath="${env.ANDROID_SDK}/platforms/${android.platform}/android.jar;
44-
library/android-support-v4.jar;
47+
library/support-compat-${support.version}.jar;
48+
library/support-fragment-${support.version}.jar;
49+
library/support-annotations-${support.version}.jar;
4550
library/wearable-${wear.version}.jar"
4651
srcdir="src" destdir="bin" />
4752

core/library/android-support-v4.jar

-1.36 MB
Binary file not shown.
22.4 KB
Binary file not shown.
751 KB
Binary file not shown.
163 KB
Binary file not shown.

scripts/support-update.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Usage:
4+
# call with the version number of the support packages to copy from local SDK and extract, i.e.:
5+
# ./wear-update.sh 2.0.0:
6+
7+
version=$1
8+
9+
cp $ANDROID_SDK/extras/android/m2repository/com/android/support/support-compat/$version/support-compat-$version.aar .
10+
unzip support-compat-$version.aar -d support-compat
11+
cp support-compat/classes.jar ../core/library/support-compat-$version.jar
12+
rm -Rf support-compat
13+
rm support-compat-$version.aar
14+
15+
16+
cp $ANDROID_SDK/extras/android/m2repository/com/android/support/support-fragment/$version/support-fragment-$version.aar .
17+
unzip support-fragment-$version.aar -d support-fragment
18+
cp support-fragment/classes.jar ../core/library/support-fragment-$version.jar
19+
rm -Rf support-fragment
20+
rm support-fragment-$version.aar
21+
22+
cp $ANDROID_SDK/extras/android/m2repository/com/android/support/support-annotations/$version/support-annotations-$version.jar ../core/library
23+
24+
# Done, print out reminder...
25+
echo ""
26+
echo "Done!"
27+
echo "Remember to update the version number of the support jars in processing-core"

src/processing/mode/android/AndroidBuild.java

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ class AndroidBuild extends JavaBuild {
9999
static public final String target_sdk = "25"; // Nougat (7.1.1)
100100
static public final String target_platform = "android-" + target_sdk;
101101

102-
// Versions of Wear and VR in use
102+
// Versions of Support, AppCompatn, Wear and VR in use
103+
static public final String support_version = "25.2.0";
104+
static public final String appcompat_version = "25.2.0";
103105
static public final String wear_version = "2.0.0";
104106
static public final String gvr_sdk_version = "1.20.0";
105107

@@ -305,60 +307,37 @@ public File createProject(boolean wear) throws IOException, SketchException {
305307
}
306308
}
307309
} catch (InterruptedException e) {}
308-
309-
if (getAppComponent() == FRAGMENT) {
310-
// Need to add appcompat as a library project (includes v4 support)
311-
312-
////////////////////////////////////////////////////////////////////////
313-
// first step: copy appcompat library project
314-
315-
// TODO: the support-v7 library project should be copied from the Android
316-
// Support Repository, and not from the Support Library.
317-
File appCompatFolderSrc = new File(sdk.getSupportLibrary(), "v7/appcompat");
318-
// Delete the project.properties files because Processing will regenerate
319-
// it when building the project
320-
File propFile = new File(appCompatFolderSrc, "project.properties");
321-
propFile.delete();
322-
File appCompatFolder = new File(libsFolder, "appcompat");
323-
Util.copyDir(appCompatFolderSrc, appCompatFolder);
324-
325-
////////////////////////////////////////////////////////////////////////
326-
// second step: create library projects
327-
boolean appCompatRes = createLibraryProject("appcompat", targetID,
328-
appCompatFolder.getAbsolutePath(), "android.support.v7.appcompat");
329-
330-
////////////////////////////////////////////////////////////////////////
331-
// third step: reference library projects from main project
332-
if (appCompatRes) {
333-
System.out.println("Library project created succesfully in " + libsFolder.toString());
334-
appCompatRes = referenceLibraryProject(targetID, tmpFolder.getAbsolutePath(), "libs/appcompat");
335-
if (appCompatRes) {
336-
System.out.println("Library project referenced succesfully!");
337-
// Finally, re-write the build files so they use org.eclipse.jdt.core.JDTCompilerAdapter
338-
// instead of com.sun.tools.javac.Main
339-
// TODO: use the build file generated by the android tools, and
340-
// add the custom section redefining the target
341-
File appCompatBuildFile = new File(appCompatFolder, "build.xml");
342-
writeBuildXML(appCompatBuildFile, "appcompat");
343-
}
344-
}
345-
} else {
346-
// Copy the v4 support package only, needed for the permission handling
347-
// in all other components
348-
File compatJarFile = new File(sdk.getSupportLibrary(), "v4/android-support-v4.jar");
349-
Util.copyFile(compatJarFile, new File(libsFolder, "android-support-v4.jar"));
350-
}
351310

352-
// if (getAppComponent() == WATCHFACE) {
311+
File wearAarFile, explodeDir;
312+
353313
// The wear jar is needed even when the app is not a watch face, because on
354314
// devices with android < 5 the dependencies of the PWatchFace* classes
355315
// cannot be resolved.
356316
// TODO: temporary hack until I find a better way to include the wearable aar
357317
// package included in the SDK:
358-
File wearAarFile = new File(sdk.getWearableFolder(), wear_version + "/wearable-" + wear_version + ".aar");
359-
File explodeDir = new File(tmpFolder, "aar");
360-
AndroidMode.explodeAar(wearAarFile, explodeDir, new File(libsFolder, "wearable-" + wear_version + ".jar"));
361-
// }
318+
wearAarFile = new File(sdk.getWearableFolder(), wear_version + "/wearable-" + wear_version + ".aar");
319+
explodeDir = new File(tmpFolder, "aar");
320+
AndroidMode.explodeAar(wearAarFile, explodeDir, new File(libsFolder, "wearable-" + wear_version + ".jar"));
321+
322+
// Copy support packages (compat, fragment, and annotations)
323+
wearAarFile = new File(sdk.getSupportLibrary(), "/support-compat/" + support_version + "/support-compat-" + support_version + ".aar");
324+
explodeDir = new File(tmpFolder, "aar");
325+
AndroidMode.explodeAar(wearAarFile, explodeDir, new File(libsFolder, "support-compat-" + support_version + ".jar"));
326+
327+
wearAarFile = new File(sdk.getSupportLibrary(), "/support-fragment/" + support_version + "/support-fragment-" + support_version + ".aar");
328+
explodeDir = new File(tmpFolder, "aar");
329+
AndroidMode.explodeAar(wearAarFile, explodeDir, new File(libsFolder, "support-fragment-" + support_version + ".jar"));
330+
331+
wearAarFile = new File(sdk.getSupportLibrary(), "/support-annotations/" + support_version + "/support-annotations-" + support_version + ".aar");
332+
explodeDir = new File(tmpFolder, "aar");
333+
AndroidMode.explodeAar(wearAarFile, explodeDir, new File(libsFolder, "support-annotations-" + support_version + ".jar"));
334+
335+
if (getAppComponent() == FRAGMENT) {
336+
// Copy support appcompat-v7 package
337+
wearAarFile = new File(sdk.getSupportLibrary(), "/appcompat-v7/" + support_version + "/appcompat-v7-" + appcompat_version + ".aar");
338+
explodeDir = new File(tmpFolder, "aar");
339+
AndroidMode.explodeAar(wearAarFile, explodeDir, new File(libsFolder, "appcompat-v7-" + appcompat_version + ".jar"));
340+
}
362341

363342
// Copy any imported libraries (their libs and assets),
364343
// and anything in the code folder contents to the project.

src/processing/mode/android/AndroidSDK.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public AndroidSDK(File folder) throws BadSDKException, IOException {
155155
throw new BadSDKException("There is no wearable folder in " + folder);
156156
}
157157

158-
supportLibPath = new File(folder, "extras/android/support");
158+
supportLibPath = new File(folder, "extras/android/m2repository/com/android/support");
159159
if (!supportLibPath.exists()) {
160160
throw new BadSDKException("There is no support library folder in " + folder);
161161
}

0 commit comments

Comments
 (0)