ManifestSystemProperty.valueOf( value.substring(0, value.indexOf('=')).toUpperCase(Locale.ENGLISH)); invoker.setOverride(manifestSystemProperty, value.substring(value.indexOf('=') + 1)); + value.substring(0, value.indexOf('=')) + ", allowed properties are : " + Joiner.on(',').join(ManifestSystemProperty.values())); return 1;
/** * Perform {@link ManifestSystemProperty} injection. * @param mergingReport to log actions and errors. * @param xmlDocument the xml document to inject into. */ protected void performSystemPropertiesInjection( @NonNull MergingReport.Builder mergingReport, @NonNull XmlDocument xmlDocument) { for (ManifestSystemProperty manifestSystemProperty : ManifestSystemProperty.values()) { String propertyOverride = mSystemPropertyResolver.getValue(manifestSystemProperty); if (propertyOverride != null) { manifestSystemProperty.addTo( mergingReport.getActionRecorder(), xmlDocument, propertyOverride); } } }
private static void usage() { System.out.println("Android Manifest Merger Tool Version 2\n"); System.out.println("Usage:"); System.out.println("Merger --main mainAndroidManifest.xml"); System.out.println("\t--log [VERBOSE, INFO, WARNING, ERROR]"); System.out.println("\t--debuggable [true, false]"); System.out.println("\t--libs [path separated list of lib's manifests]"); System.out.println("\t--overlays [path separated list of overlay's manifests]"); System.out.println( "\t--property [" + Joiner.on(" | ").join(ManifestSystemProperty.values()) + "=value]"); System.out.println("\t--placeholder [name=value]"); System.out.println("\t--out [path of the output file]"); }
private static void addToElementInAndroidNS( @NonNull ManifestSystemProperty manifestSystemProperty, @NonNull ActionRecorder actionRecorder, String value, @NonNull XmlElement to) { String toolsPrefix = getAndroidPrefix(to.getXml()); to.getXml().setAttributeNS(SdkConstants.ANDROID_URI, toolsPrefix + XmlUtils.NS_SEPARATOR + manifestSystemProperty.toCamelCase(), value); Attr attr = to.getXml().getAttributeNodeNS(SdkConstants.ANDROID_URI, manifestSystemProperty.toCamelCase()); XmlAttribute xmlAttribute = new XmlAttribute(to, attr, null); actionRecorder.recordAttributeAction(xmlAttribute, new Actions.AttributeRecord( Actions.ActionType.INJECTED, new SourceFilePosition(to.getSourceFile(), SourcePosition.UNKNOWN), xmlAttribute.getId(), null, /* reason */ null /* attributeOperationType */ ) ); }
@NonNull private static XmlElement createOrGetUseSdk( @NonNull ActionRecorder actionRecorder, @NonNull XmlDocument document) { return createOrGetElement(actionRecorder, document, ManifestModel.NodeTypes.USES_SDK, "use-sdk injection requested"); }
public String toCamelCase() { return SdkUtils.constantNameToCamelCase(name()); }
private static void addToElement( @NonNull ManifestSystemProperty manifestSystemProperty, @NonNull ActionRecorder actionRecorder, String value, @NonNull XmlElement to) { to.getXml().setAttribute(manifestSystemProperty.toCamelCase(), value); XmlAttribute xmlAttribute = new XmlAttribute(to, to.getXml().getAttributeNode(manifestSystemProperty.toCamelCase()), null); actionRecorder.recordAttributeAction(xmlAttribute, new Actions.AttributeRecord( Actions.ActionType.INJECTED, new SourceFilePosition(to.getSourceFile(), SourcePosition.UNKNOWN), xmlAttribute.getId(), null, /* reason */ null /* attributeOperationType */)); }
public static void usage() { System.out.println("Android Manifest Merger Tool Version 2\n"); System.out.println("Usage:"); System.out.println("Merger --main mainAndroidManifest.xml"); System.out.println("\t--log [VERBOSE, INFO, WARNING, ERROR]"); System.out.println("\t--libs [path separated list of lib's manifests]"); System.out.println("\t--overlays [path separated list of overlay's manifests]"); System.out.println("\t--property [" + Joiner.on(" | ").join(ManifestSystemProperty.values()) + "=value]"); System.out.println("\t--placeholder [name=value]"); System.out.println("\t--out [path of the output file]"); }
/** See above for details, similar like for uses-sdk tag*/ @NonNull private static XmlElement createOrGetInstrumentation( @NonNull ActionRecorder actionRecorder, @NonNull XmlDocument document) { return createOrGetElement(actionRecorder, document, ManifestModel.NodeTypes.INSTRUMENTATION, "instrumentation injection requested"); }
.valueOf(value.substring(0, value.indexOf('=')) .toUpperCase(Locale.ENGLISH)); invoker.setOverride(manifestSystemProperty, value.substring(value.indexOf('=') + 1)); logger.error(e, "Invalid property name "+ value.substring(0, value.indexOf('=')) + ", allowed properties are : " + Joiner .on(',').join(ManifestSystemProperty.values())); return 1;