Search in sources :

Example 1 with LayoutXmlProcessor

use of android.databinding.tool.LayoutXmlProcessor in project atlas by alibaba.

the class AwbXmlProcessor method getLayoutXmlProcessor.

public static LayoutXmlProcessor getLayoutXmlProcessor(AppVariantContext appVariantContext, AwbBundle awbBundle, DataBindingBuilder dataBindingBuilder) {
    File resourceBlameLogDir = appVariantContext.getAwbBlameLogFolder(awbBundle);
    //        if (!resourceBlameLogDir.exists()) {
    //            resourceBlameLogDir = appVariantContext.getScope().getResourceBlameLogDir();
    //        }
    final MergingLog mergingLog = new MergingLog(resourceBlameLogDir);
    LayoutXmlProcessor layoutXmlProcessor = new LayoutXmlProcessor(//                "com.taobao.demo2",
    appVariantContext.getVariantConfiguration().getOriginalApplicationId(), dataBindingBuilder.createJavaFileWriter(appVariantContext.getAwbClassOutputForDataBinding(awbBundle)), appVariantContext.getVariantConfiguration().getMinSdkVersion().getApiLevel(), false, //                appVariantContext.getVariantData().getType() == VariantType.LIBRARY,
    new LayoutXmlProcessor.OriginalFileLookup() {

        @Override
        public File getOriginalFileFor(File file) {
            SourceFile input = new SourceFile(file);
            SourceFile original = mergingLog.find(input);
            // it is not what we want so we alter the response.
            return original == input ? null : original.getSourceFile();
        }
    });
    return layoutXmlProcessor;
}
Also used : MergingLog(com.android.ide.common.blame.MergingLog) SourceFile(com.android.ide.common.blame.SourceFile) SourceFile(com.android.ide.common.blame.SourceFile) File(java.io.File) LayoutXmlProcessor(android.databinding.tool.LayoutXmlProcessor)

Aggregations

LayoutXmlProcessor (android.databinding.tool.LayoutXmlProcessor)1 MergingLog (com.android.ide.common.blame.MergingLog)1 SourceFile (com.android.ide.common.blame.SourceFile)1 File (java.io.File)1