diff options
author | Andreas Gampe <agampe@google.com> | 2014-05-21 18:46:59 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-06-25 19:34:58 -0700 |
commit | 833a48501d560c9fa7fc78ef619888138c2d374f (patch) | |
tree | add308298a5486d44caddea120cc9200dd70c38a /test/113-multidex | |
parent | b849f6dd638fd1246724160cd5c01ab1a5ff33bd (diff) | |
download | art-833a48501d560c9fa7fc78ef619888138c2d374f.zip art-833a48501d560c9fa7fc78ef619888138c2d374f.tar.gz art-833a48501d560c9fa7fc78ef619888138c2d374f.tar.bz2 |
ART: Native support for multidex
Native support for zip files with multiple classesX.dex.
Works by explicitly looking for those files in ascending order. As
these files have no file system representation for themselves,
introduce synthetic dex locations: the name of the originating file
plus a colon plus the name of the dex file, e.g., test.jar:classes2.dex.
Opening a zip dex file will return all dex files in this way. This
keeps the changes to dex2oat minimal.
To hide multidex/synthetic names from the Java layer, let the handle
of dalvik.system.DexFile refer to a vector of DexFile objects. When
opening a location, test possible synthetic names and add them to the
vector. Thus, the original multidex jar in the classpath will be
associated with all embedded dex files.
Change-Id: I0de107e1369cbc94416c544aca3b17525c9eac8b
Diffstat (limited to 'test/113-multidex')
-rw-r--r-- | test/113-multidex/build | 32 | ||||
-rw-r--r-- | test/113-multidex/expected.txt | 12 | ||||
-rw-r--r-- | test/113-multidex/info.txt | 2 | ||||
-rw-r--r-- | test/113-multidex/src/FillerA.java | 23 | ||||
-rw-r--r-- | test/113-multidex/src/FillerB.java | 23 | ||||
-rw-r--r-- | test/113-multidex/src/Inf1.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Inf2.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Inf3.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Inf4.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Inf5.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Inf6.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Inf7.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Inf8.java | 28 | ||||
-rw-r--r-- | test/113-multidex/src/Main.java | 35 | ||||
-rw-r--r-- | test/113-multidex/src/Second.java | 57 |
15 files changed, 408 insertions, 0 deletions
diff --git a/test/113-multidex/build b/test/113-multidex/build new file mode 100644 index 0000000..ec8706e --- /dev/null +++ b/test/113-multidex/build @@ -0,0 +1,32 @@ +#!/bin/bash +# +# Copyright (C) 2014 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Stop if something fails. +set -e + +mkdir classes + +# All except Main +${JAVAC} -d classes `find src -name '*.java'` +rm classes/Main.class +${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes + +# Only Main +${JAVAC} -d classes `find src -name '*.java'` +rm classes/Second.class classes/FillerA.class classes/FillerB.class classes/Inf*.class +${DX} -JXmx256m --debug --dex --dump-to=classes2.lst --output=classes2.dex classes + +zip $TEST_NAME.jar classes.dex classes2.dex diff --git a/test/113-multidex/expected.txt b/test/113-multidex/expected.txt new file mode 100644 index 0000000..603e911 --- /dev/null +++ b/test/113-multidex/expected.txt @@ -0,0 +1,12 @@ +FillerA +Second +Second::zcall +Second::zcall1 +Second::zcall2 +Second::zcall3 +Second::zcall4 +Second::zcall5 +Second::zcall6 +Second::zcall7 +Second::zcall8 +Second::zcall9 diff --git a/test/113-multidex/info.txt b/test/113-multidex/info.txt new file mode 100644 index 0000000..d0a4ac1 --- /dev/null +++ b/test/113-multidex/info.txt @@ -0,0 +1,2 @@ +Test whether we can run code from an application split into multiple dex files (similar to +MultiDex). diff --git a/test/113-multidex/src/FillerA.java b/test/113-multidex/src/FillerA.java new file mode 100644 index 0000000..d169018 --- /dev/null +++ b/test/113-multidex/src/FillerA.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class FillerA { + public void methodA() { + } + + public void methodB() { + } +} diff --git a/test/113-multidex/src/FillerB.java b/test/113-multidex/src/FillerB.java new file mode 100644 index 0000000..ec3ac9d --- /dev/null +++ b/test/113-multidex/src/FillerB.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class FillerB { + public void methodC() { + } + + public void methodD() { + } +} diff --git a/test/113-multidex/src/Inf1.java b/test/113-multidex/src/Inf1.java new file mode 100644 index 0000000..3deb6b4 --- /dev/null +++ b/test/113-multidex/src/Inf1.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf1 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Inf2.java b/test/113-multidex/src/Inf2.java new file mode 100644 index 0000000..ac09509 --- /dev/null +++ b/test/113-multidex/src/Inf2.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf2 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Inf3.java b/test/113-multidex/src/Inf3.java new file mode 100644 index 0000000..d6c377b --- /dev/null +++ b/test/113-multidex/src/Inf3.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf3 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Inf4.java b/test/113-multidex/src/Inf4.java new file mode 100644 index 0000000..a1801b9 --- /dev/null +++ b/test/113-multidex/src/Inf4.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf4 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Inf5.java b/test/113-multidex/src/Inf5.java new file mode 100644 index 0000000..e8115ce --- /dev/null +++ b/test/113-multidex/src/Inf5.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf5 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Inf6.java b/test/113-multidex/src/Inf6.java new file mode 100644 index 0000000..554bdb8 --- /dev/null +++ b/test/113-multidex/src/Inf6.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf6 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Inf7.java b/test/113-multidex/src/Inf7.java new file mode 100644 index 0000000..1982775 --- /dev/null +++ b/test/113-multidex/src/Inf7.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf7 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Inf8.java b/test/113-multidex/src/Inf8.java new file mode 100644 index 0000000..87296db --- /dev/null +++ b/test/113-multidex/src/Inf8.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public interface Inf8 { + public void zcall(); + public void zcall1(); + public void zcall2(); + public void zcall3(); + public void zcall4(); + public void zcall5(); + public void zcall6(); + public void zcall7(); + public void zcall8(); + public void zcall9(); +}
\ No newline at end of file diff --git a/test/113-multidex/src/Main.java b/test/113-multidex/src/Main.java new file mode 100644 index 0000000..1c74220 --- /dev/null +++ b/test/113-multidex/src/Main.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Main { + static public void main(String[] args) throws Exception { + System.out.println(new FillerA().getClass().getName()); + + Inf1 second = new Second(); + System.out.println(second.getClass().getName()); + second.zcall(); + second.zcall1(); + second.zcall2(); + second.zcall3(); + second.zcall4(); + second.zcall5(); + second.zcall6(); + second.zcall7(); + second.zcall8(); + second.zcall9(); + } + +} diff --git a/test/113-multidex/src/Second.java b/test/113-multidex/src/Second.java new file mode 100644 index 0000000..d0c2535 --- /dev/null +++ b/test/113-multidex/src/Second.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class Second implements Inf1, Inf2, Inf3, Inf4, Inf5, Inf6, Inf7, Inf8 { + public void zcall() { + System.out.println("Second::zcall"); + } + + public void zcall1() { + System.out.println("Second::zcall1"); + } + + public void zcall2() { + System.out.println("Second::zcall2"); + } + + public void zcall3() { + System.out.println("Second::zcall3"); + } + + public void zcall4() { + System.out.println("Second::zcall4"); + } + + public void zcall5() { + System.out.println("Second::zcall5"); + } + + public void zcall6() { + System.out.println("Second::zcall6"); + } + + public void zcall7() { + System.out.println("Second::zcall7"); + } + + public void zcall8() { + System.out.println("Second::zcall8"); + } + + public void zcall9() { + System.out.println("Second::zcall9"); + } +} |