summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-07-21 16:25:50 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-07-21 16:25:50 -0700
commit55775e5f34af8d7c22ab3212c253b3a7d34a6f8a (patch)
tree87b37b98bfbe1201ed236aef1f563fb914539c04 /tools
parente612c881ecf74770098aa9c07d4f0611ac982038 (diff)
parente70b2b8fe0c265171f3a367a66c99b36c62567c7 (diff)
downloadframeworks_base-55775e5f34af8d7c22ab3212c253b3a7d34a6f8a.zip
frameworks_base-55775e5f34af8d7c22ab3212c253b3a7d34a6f8a.tar.gz
frameworks_base-55775e5f34af8d7c22ab3212c253b3a7d34a6f8a.tar.bz2
am e70b2b8f: am 9bcf26ea: Merge "Layoutlib_create flag -p: don\'t change all accesses to public."
* commit 'e70b2b8fe0c265171f3a367a66c99b36c62567c7': Layoutlib_create flag -p: don't change all accesses to public.
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateClassAdapter.java6
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java12
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/TransformClassAdapter.java25
3 files changed, 30 insertions, 13 deletions
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateClassAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateClassAdapter.java
index 49ddf1d..0e24cc0 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateClassAdapter.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/DelegateClassAdapter.java
@@ -117,8 +117,10 @@ public class DelegateClassAdapter extends ClassAdapter {
int accessDelegate = access;
// change access to public for the original one
- access &= ~(Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE);
- access |= Opcodes.ACC_PUBLIC;
+ if (Main.sOptions.generatePublicAccess) {
+ access &= ~(Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE);
+ access |= Opcodes.ACC_PUBLIC;
+ }
MethodVisitor mwOriginal = super.visitMethod(access, name + ORIGINAL_SUFFIX,
desc, signature, exceptions);
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
index 0fce7ef..c539578 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
@@ -37,7 +37,7 @@ import java.util.Set;
* which does:
* <pre>
* $ make layoutlib_create &lt;bunch of framework jars&gt;
- * $ out/host/linux-x86/framework/bin/layoutlib_create \
+ * $ java -jar out/host/linux-x86/framework/layoutlib_create.jar \
* out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar \
* out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar \
* out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
@@ -45,6 +45,12 @@ import java.util.Set;
*/
public class Main {
+ public static class Options {
+ public boolean generatePublicAccess = true;
+ }
+
+ public static final Options sOptions = new Options();
+
public static void main(String[] args) {
Log log = new Log();
@@ -53,7 +59,7 @@ public class Main {
String[] osDestJar = { null };
if (!processArgs(log, args, osJarPath, osDestJar)) {
- log.error("Usage: layoutlib_create [-v] output.jar input.jar ...");
+ log.error("Usage: layoutlib_create [-v] [-p] output.jar input.jar ...");
System.exit(1);
}
@@ -135,6 +141,8 @@ public class Main {
String s = args[i];
if (s.equals("-v")) {
log.setVerbose(true);
+ } else if (s.equals("-p")) {
+ sOptions.generatePublicAccess = false;
} else if (!s.startsWith("-")) {
if (osDestJar[0] == null) {
osDestJar[0] = s;
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/TransformClassAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/TransformClassAdapter.java
index f2d9755..5a0a44a 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/TransformClassAdapter.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/TransformClassAdapter.java
@@ -72,8 +72,10 @@ class TransformClassAdapter extends ClassAdapter {
name = mClassName;
// remove protected or private and set as public
- access = access & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED);
- access |= Opcodes.ACC_PUBLIC;
+ if (Main.sOptions.generatePublicAccess) {
+ access = access & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED);
+ access |= Opcodes.ACC_PUBLIC;
+ }
// remove final
access = access & ~Opcodes.ACC_FINAL;
// note: leave abstract classes as such
@@ -87,8 +89,10 @@ class TransformClassAdapter extends ClassAdapter {
@Override
public void visitInnerClass(String name, String outerName, String innerName, int access) {
// remove protected or private and set as public
- access = access & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED);
- access |= Opcodes.ACC_PUBLIC;
+ if (Main.sOptions.generatePublicAccess) {
+ access = access & ~(Opcodes.ACC_PRIVATE | Opcodes.ACC_PROTECTED);
+ access |= Opcodes.ACC_PUBLIC;
+ }
// remove final
access = access & ~Opcodes.ACC_FINAL;
// note: leave abstract classes as such
@@ -117,8 +121,10 @@ class TransformClassAdapter extends ClassAdapter {
String methodSignature = mClassName.replace('/', '.') + "#" + name;
// change access to public
- access &= ~(Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE);
- access |= Opcodes.ACC_PUBLIC;
+ if (Main.sOptions.generatePublicAccess) {
+ access &= ~(Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE);
+ access |= Opcodes.ACC_PUBLIC;
+ }
// remove final
access = access & ~Opcodes.ACC_FINAL;
@@ -155,9 +161,10 @@ class TransformClassAdapter extends ClassAdapter {
public FieldVisitor visitField(int access, String name, String desc, String signature,
Object value) {
// change access to public
- access &= ~(Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE);
- access |= Opcodes.ACC_PUBLIC;
-
+ if (Main.sOptions.generatePublicAccess) {
+ access &= ~(Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE);
+ access |= Opcodes.ACC_PUBLIC;
+ }
return super.visitField(access, name, desc, signature, value);
}