From 2addab7a800ea933fa5fbb4fe083f90039a20abd Mon Sep 17 00:00:00 2001 From: Mathias Westerdahl Date: Mon, 10 Apr 2017 16:07:28 +0200 Subject: [PATCH] DEF-2639 Classes.dex is now always built again (bugfix) (#40) * DEF-2639 Classes.dex is now always built again (bugfix) * DEF-2639 review fixes --- .../main/java/com/defold/extender/Extender.java | 4 ---- .../com/defold/extender/IntegrationTest.java | 7 ++++++- .../test-data/sdk/a/defoldsdk/extender/build.yml | 2 +- .../sdk/a/defoldsdk/share/java/Engine.jar | Bin 0 -> 1316 bytes .../sdk/a/defoldsdk/share/java/build.sh | 3 +++ .../share/java/com/defoldtest/engine/Engine.java | 7 +++++++ 6 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 server/test-data/sdk/a/defoldsdk/share/java/Engine.jar create mode 100755 server/test-data/sdk/a/defoldsdk/share/java/build.sh create mode 100644 server/test-data/sdk/a/defoldsdk/share/java/com/defoldtest/engine/Engine.java diff --git a/server/src/main/java/com/defold/extender/Extender.java b/server/src/main/java/com/defold/extender/Extender.java index cfb3f30c..28966623 100644 --- a/server/src/main/java/com/defold/extender/Extender.java +++ b/server/src/main/java/com/defold/extender/Extender.java @@ -391,10 +391,6 @@ public File buildClassesDex() throws ExtenderException { extJars.addAll(getJars(extDir)); } - if (extJars.isEmpty()) { - return null; - } - Map context = context(platformConfig.context); context.put("classes_dex", classesDex.getAbsolutePath()); context.put("jars", extJars); diff --git a/server/src/test/java/com/defold/extender/IntegrationTest.java b/server/src/test/java/com/defold/extender/IntegrationTest.java index b2226bee..5dd2ff9a 100644 --- a/server/src/test/java/com/defold/extender/IntegrationTest.java +++ b/server/src/test/java/com/defold/extender/IntegrationTest.java @@ -320,8 +320,13 @@ public void buildAndroidCheckClassesDex() throws IOException, ExtenderClientExce // Verify that classes.dex contains our Dummy class DexFile dexFile = DexFileFactory.loadDexFile(tmpClassesDexPath.toFile().getAbsolutePath(), 19 ); // api level + + List expected = new ArrayList<>(); + expected.add("Lcom/svenandersson/dummy/Dummy;"); + expected.add("Lcom/defoldtest/engine/Engine;"); + for (ClassDef classDef: dexFile.getClasses()) { - assertEquals("Lcom/svenandersson/dummy/Dummy;", classDef.getType()); + assertTrue( expected.contains( classDef.getType() ) ); } } } diff --git a/server/test-data/sdk/a/defoldsdk/extender/build.yml b/server/test-data/sdk/a/defoldsdk/extender/build.yml index a61da48f..7940ae76 100644 --- a/server/test-data/sdk/a/defoldsdk/extender/build.yml +++ b/server/test-data/sdk/a/defoldsdk/extender/build.yml @@ -60,7 +60,7 @@ platforms: armv7-android: context: - engineJars: [] + engineJars: ["{{dynamo_home}}/share/java/Engine.jar"] engineLibs: [] exePrefix: 'lib' diff --git a/server/test-data/sdk/a/defoldsdk/share/java/Engine.jar b/server/test-data/sdk/a/defoldsdk/share/java/Engine.jar new file mode 100644 index 0000000000000000000000000000000000000000..890eeeda609bfbbc2d2337a09d0c74b9aadd539a GIT binary patch literal 1316 zcmWIWW@Zs#;Nak3cpcK^#ef7j8CV#6T|*poJ^kGD|D9rBU}gyLX6FE@V1g_)~c7B zlUQ6F>+kD**g>H7a?RB(x3sE)6nAcwi}|qXOOWWnMeQQ*f8IEzJ6q?-+Wp@CP3-jz z_Fi*b91Ga)ow2#MC(&;IJ$r^ZiRLZcZ|%yMdYF1R|Fy1~I#+Pc$uEr$&iN{GE^b}* z^zO1#DVu$a&-Uz|;y-PJ{Y<@UFN?KGqNXct>|J%b*lETL-^r)5uX?eEm!5pRd~F^F zzum(JZdtjDLX%gWusfx(b5HN%83j{jdx;dKmL%ScKam&wM?&CO{qlF4x1P~WviRd5 zZ5#0Vti*?sGgEg|spl^U&*P|d+pjE}Q`olu(&4`3vi09T`M)savwHu~9F&G$-QOwm z1{g9%jF9MqgxzVh=u;#Vc3FvKiMri}e9Z;|EWfLd&eF>K!Js=)X{n05!Lx!jGG?3l zwI01U?9fb44}ZPynsH3jtbfW_B)P=m2|W5Dx(R*l$?? literal 0 HcmV?d00001 diff --git a/server/test-data/sdk/a/defoldsdk/share/java/build.sh b/server/test-data/sdk/a/defoldsdk/share/java/build.sh new file mode 100755 index 00000000..8363c3ff --- /dev/null +++ b/server/test-data/sdk/a/defoldsdk/share/java/build.sh @@ -0,0 +1,3 @@ + +javac -source 1.6 -target 1.6 -cp . com/defoldtest/engine/Engine.java +jar cvf Engine.jar com diff --git a/server/test-data/sdk/a/defoldsdk/share/java/com/defoldtest/engine/Engine.java b/server/test-data/sdk/a/defoldsdk/share/java/com/defoldtest/engine/Engine.java new file mode 100644 index 00000000..38a7ba43 --- /dev/null +++ b/server/test-data/sdk/a/defoldsdk/share/java/com/defoldtest/engine/Engine.java @@ -0,0 +1,7 @@ +package com.defoldtest.engine; + +public class Engine { + static public String Test() { + return "Hello from the SDK!!!"; + } +}