Skip to content

Commit f9d1b62

Browse files
committed
add debug obj ndk to assets folder
1 parent 4ef3d90 commit f9d1b62

File tree

9 files changed

+40
-32
lines changed

9 files changed

+40
-32
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ src/androidTest/
7474
src/main/java/com/duy/ccppcompiler/packagemanager/local/
7575
src/main/java/com/jecelyin/editor/v2/task/
7676
src/gnu/
77+
.gitignore
78+
tmp/

sdlplugin/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.gitignore

sdlplugin/addincludes.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ rm -f ${TOPDIR}/assets/headers.zip
2121
zip -r9 ${TOPDIR}/assets/headers.zip include
2222
cd ${TOPDIR}
2323

24-
find obj -name "SDL_android_main.o" | while read f; do
25-
26-
arch=`echo $f | cut -f3 -d'/'`
24+
find ./build/intermediates/ndkBuild/debug/obj/local/ -name "SDL_android_main.o" | while read f; do
25+
echo "File = ${f}"
26+
arch=`echo $f | cut -f8 -d'/'`
27+
echo "Arch=${arch}"
2728
cd `dirname $f`
2829
rm -f ${TOPDIR}/assets/sdlmain-${arch}.zip
2930
zip -9 ${TOPDIR}/assets/sdlmain-${arch}.zip SDL_android_main.o
3031
cd $TOPDIR
3132
done
32-
3333
cd ${TOPDIR}
3434

3535
rm -rf ${TOPDIR}/assets/examples.zip
3636
zip -r9 ${TOPDIR}/assets/examples.zip Examples
37-
read

sdlplugin/assets/examples.zip

0 Bytes
Binary file not shown.

sdlplugin/assets/headers.zip

0 Bytes
Binary file not shown.
8.78 KB
Binary file not shown.

sdlplugin/assets/sdlmain-x86.zip

8.61 KB
Binary file not shown.

sdlplugin/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ android {
3737
main {
3838
manifest.srcFile 'AndroidManifest.xml'
3939
assets.srcDir 'assets'
40+
jniLibs.srcDir 'src/main/libs' //set libs as .so's location instead of jniLibs
41+
jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk
4042
}
4143
}
4244
buildTypes {

sdlplugin/src/main/java/com/duy/ccppcompiler/sdlplugin/sdlpluginActivity.java

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private void initUI() {
7373
if (mSdCardAppDir.exists() && mSdCardAppDir.isDirectory()) {
7474
File include = new File(mSdCardAppDir, "/SDL/include");
7575
File lib = new File(mSdCardAppDir, "/SDL/lib");
76-
if (!include.exists() || !lib.exists()) {
76+
if (!include.exists() || !lib.exists() || true) {
7777
new InstallDevFilesTask().execute();
7878
} else {
7979
aboutDialog(1);
@@ -129,6 +129,14 @@ public void onCancel(DialogInterface dialog) {
129129
.show();
130130
}
131131

132+
@Override
133+
protected void onDestroy() {
134+
if (mProgressDialog != null && mProgressDialog.isShowing()) {
135+
mProgressDialog.dismiss();
136+
}
137+
super.onDestroy();
138+
}
139+
132140
@SuppressLint("StaticFieldLeak")
133141
private class InstallDevFilesTask extends AsyncTask<Void, String, Void> {
134142
@Override
@@ -150,33 +158,30 @@ protected Void doInBackground(Void... params) {
150158
try {
151159
File sdlDir = new File(mSdCardAppDir, "SDL");
152160
File libDir = new File(sdlDir, "/SDL/lib");
153-
if (!libDir.exists()) {
154-
libDir.mkdirs();
155-
Utils.copyDirectory(new File(getCacheDir().getParentFile().getAbsolutePath() + "/lib"), libDir);
156-
new File(libDir, "libmain.so").delete();
157-
new File(libDir, "libccsdlplugin.so").delete();
158-
String arch = Build.CPU_ABI;
159-
if (arch.startsWith("mips")) {
160-
arch = "mips";
161-
}
162-
publishProgress(getString(R.string.update_install_libs));
163-
InputStream is = getAssets().open("sdlmain-" + arch + ".zip");
164-
Utils.unpackZip(is, libDir.getAbsolutePath());
165-
is.close();
166-
}
167-
if (!(new File(sdlDir, "include").exists())) {
168-
publishProgress(getString(R.string.update_install_headers));
169-
InputStream is = getAssets().open("headers.zip");
170-
Utils.unpackZip(is, sdlDir.getAbsolutePath());
171-
is.close();
172-
}
173-
if (!(new File(mSdCardAppDir, "Examples/SDL").exists())) {
174-
publishProgress(getString(R.string.update_install_examples));
175-
InputStream is = getAssets().open("examples.zip");
176-
Utils.unpackZip(is, mSdCardAppDir.getAbsolutePath());
177-
is.close();
161+
libDir.mkdirs();
162+
Utils.copyDirectory(new File(getCacheDir().getParentFile().getAbsolutePath() + "/lib"), libDir);
163+
new File(libDir, "libmain.so").delete();
164+
new File(libDir, "libccsdlplugin.so").delete();
165+
String arch = Build.CPU_ABI;
166+
if (arch.startsWith("mips")) {
167+
arch = "mips";
178168
}
169+
publishProgress(getString(R.string.update_install_libs));
170+
InputStream is = getAssets().open("sdlmain-" + arch + ".zip");
171+
Utils.unpackZip(is, libDir.getAbsolutePath());
172+
is.close();
173+
174+
publishProgress(getString(R.string.update_install_headers));
175+
is = getAssets().open("headers.zip");
176+
Utils.unpackZip(is, sdlDir.getAbsolutePath());
177+
is.close();
178+
179+
publishProgress(getString(R.string.update_install_examples));
180+
is = getAssets().open("examples.zip");
181+
Utils.unpackZip(is, mSdCardAppDir.getAbsolutePath());
182+
is.close();
179183
} catch (IOException e) {
184+
e.printStackTrace();
180185
Log.e(TAG, "Error installing dev files " + e);
181186
}
182187
return null;
@@ -189,5 +194,4 @@ protected void onPostExecute(Void result) {
189194
aboutDialog(1);
190195
}
191196
}
192-
193197
}

0 commit comments

Comments
 (0)