diff options
author | Yohann Roussel <yroussel@google.com> | 2015-03-17 18:46:44 +0100 |
---|---|---|
committer | Yohann Roussel <yroussel@google.com> | 2015-03-19 11:06:47 +0000 |
commit | 44fcd8ac9cc721bc8f07300d7f2e8d741644d451 (patch) | |
tree | 8153fa7e66b2c0b5876f2264ffadd87983d50873 /jack | |
parent | 61eb97c58c3dcffbfb1498031e944a9ad528044a (diff) | |
download | toolchain_jack-44fcd8ac9cc721bc8f07300d7f2e8d741644d451.tar.gz toolchain_jack-44fcd8ac9cc721bc8f07300d7f2e8d741644d451.tar.bz2 toolchain_jack-44fcd8ac9cc721bc8f07300d7f2e8d741644d451.zip |
Access annotation processor options through properties
Change-Id: I49bb247f731460ab7c5665fd786c918367d63bee
Diffstat (limited to 'jack')
-rw-r--r-- | jack/src/com/android/jack/Options.java | 17 | ||||
-rw-r--r-- | jack/src/com/android/jack/api/v01/impl/Api01ConfigImpl.java | 14 |
2 files changed, 15 insertions, 16 deletions
diff --git a/jack/src/com/android/jack/Options.java b/jack/src/com/android/jack/Options.java index 1734108e..879d645e 100644 --- a/jack/src/com/android/jack/Options.java +++ b/jack/src/com/android/jack/Options.java @@ -246,8 +246,8 @@ public class Options { @Option(name = "-A", metaVar = "<option>=<value>", usage = "set option for annotation processors (repeatable)", handler = MapOptionHandler.class) - @Nonnull - public final Map<String, String> annotationProcessorOption = new HashMap<String, String>(); + @CheckForNull + private Map<String, String> annotationProcessorOption; @Nonnull public static final PropertyId<Map<String, String>> ANNOTATION_PROCESSOR_OPTIONS = PropertyId @@ -363,7 +363,7 @@ public class Options { @Option(name = "--processor", usage = "annotation processor class names", metaVar = "<NAME>[,<NAME>...]") @CheckForNull - public String processor; + private String processor; @Nonnull public static final BooleanPropertyId ANNOTATION_PROCESSOR_MANUAL = @@ -393,7 +393,7 @@ public class Options { @Option(name = "--processorpath", usage = "annotation processor classpath", metaVar = "<PATH>") @CheckForNull - public String processorPath; + private String processorPath; @Nonnull public static final BooleanPropertyId ANNOTATION_PROCESSOR_PATH = @@ -660,7 +660,9 @@ public class Options { configBuilder.setString(ANNOTATION_PROCESSOR_PATH_LIST, processorPath); } - configBuilder.set(ANNOTATION_PROCESSOR_OPTIONS, annotationProcessorOption); + if (annotationProcessorOption != null) { + configBuilder.set(ANNOTATION_PROCESSOR_OPTIONS, annotationProcessorOption); + } if (!resImport.isEmpty()) { configBuilder.setString(ResourceImporter.IMPORTED_RESOURCES, @@ -985,11 +987,6 @@ public class Options { properties.put(propertyName, propertyValue); } - public void addAnnotationProcessorOption(@Nonnull String propertyName, - @Nonnull String propertyValue) { - annotationProcessorOption.put(propertyName, propertyValue); - } - @Nonnull List<String> getEcjExtraArguments() { return ecjExtraArguments; diff --git a/jack/src/com/android/jack/api/v01/impl/Api01ConfigImpl.java b/jack/src/com/android/jack/api/v01/impl/Api01ConfigImpl.java index d0656c70..6b8e9a72 100644 --- a/jack/src/com/android/jack/api/v01/impl/Api01ConfigImpl.java +++ b/jack/src/com/android/jack/api/v01/impl/Api01ConfigImpl.java @@ -46,7 +46,6 @@ import java.io.File; import java.io.OutputStream; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import javax.annotation.Nonnull; @@ -252,19 +251,22 @@ public class Api01ConfigImpl implements Api01Config { @Override public void setProcessorNames(@Nonnull List<String> processorNames) { - options.processor = Joiner.on(',').join(processorNames); + options.addProperty(Options.ANNOTATION_PROCESSOR_MANUAL.getName(), "true"); + options.addProperty(Options.ANNOTATION_PROCESSOR_MANUAL_LIST.getName(), + Options.ANNOTATION_PROCESSOR_MANUAL_LIST.getCodec().formatValue(processorNames)); } @Override public void setProcessorOptions(@Nonnull Map<String, String> processorOptions) { - for (Entry<String, String> entry : processorOptions.entrySet()) { - options.addAnnotationProcessorOption(entry.getKey(), entry.getValue()); - } + options.addProperty(Options.ANNOTATION_PROCESSOR_OPTIONS.getName(), + Options.ANNOTATION_PROCESSOR_OPTIONS.getCodec().formatValue(processorOptions)); } @Override public void setProcessorPath(@Nonnull List<File> processorPath) { - options.processorPath = Joiner.on(File.pathSeparatorChar).join(processorPath); + options.addProperty(Options.ANNOTATION_PROCESSOR_PATH.getName(), "true"); + options.addProperty(Options.ANNOTATION_PROCESSOR_PATH_LIST.getName(), + Joiner.on(File.pathSeparatorChar).join(processorPath)); } @Override |