com.android.build.gradle.internal.LoggerWrapper Java Examples

The following examples show how to use com.android.build.gradle.internal.LoggerWrapper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AtlasDexMerger.java    From atlas with Apache License 2.0 6 votes vote down vote up
public AtlasDexMerger(DexingType dexingType, FileCollection mainDexListFile, ErrorReporter errorReporter, DexMergerTool dexMerger, int minSdkVersion, boolean isDebuggable, AppVariantOutputContext appVariantOutputContext) {
    this.dexingType = dexingType;
    this.mainDexListFile = mainDexListFile;
    this.dexMerger = dexMerger;
    this.minSdkVersion = minSdkVersion;
    this.isDebuggable = isDebuggable;
    this.logger= LoggerWrapper.getLogger(getClass());
    Preconditions.checkState(
            (dexingType == DexingType.LEGACY_MULTIDEX) == (mainDexListFile != null),
            "Main dex list must only be set when in legacy multidex");
    this.errorReporter = errorReporter;
    this.variantOutputContext = appVariantOutputContext;
     outputHandler =
            new ParsingProcessOutputHandler(
                    new ToolOutputParser(new DexParser(), Message.Kind.ERROR, logger),
                    new ToolOutputParser(new DexParser(), logger),
                    errorReporter);

}
 
Example #2
Source File: MergeAwbResource.java    From atlas with Apache License 2.0 6 votes vote down vote up
@NonNull
private ResourcePreprocessor getPreprocessor() {
    // Only one pre-processor for now. The code will need slight changes when we add more.

    if (isDisableVectorDrawables()) {
        // If the user doesn't want any PNGs, leave the XML file alone as well.
        return NoOpResourcePreprocessor.INSTANCE;
    }

    Collection<Density> densities =
            getGeneratedDensities().stream().map(Density::getEnum).collect(Collectors.toList());

    return new MergeAwbResource.MergeResourcesVectorDrawableRenderer(
            getMinSdk(),
            getGeneratedPngsOutputDir(),
            densities,
            LoggerWrapper.supplierFor(MergeAwbResource.class));
}
 
Example #3
Source File: AtlasConfigurationHelper.java    From atlas with Apache License 2.0 6 votes vote down vote up
public void createBuilderAfterEvaluate() throws Exception {

        AndroidBuilder androidBuilder = appPluginHook.getAndroidBuilder();

        if (null == androidBuilder) {
            return;
        }

        AndroidBuilder atlasBuilder = new AtlasBuilder(project.equals(project.getRootProject()) ? project
                .getName() : project.getPath(),
                creator,
                new GradleProcessExecutor(project),
                new GradleJavaProcessExecutor(project),
                DefaultGroovyMethods.asType(ReflectUtils.getField(
                        androidBuilder,
                        "mErrorReporter"),
                        ErrorReporter.class),
                LoggerWrapper.getLogger(AtlasBuilder.class),
                DefaultGroovyMethods.asType(ReflectUtils.getField(
                        androidBuilder,
                        "mVerboseExec"), Boolean.class));

        ((AtlasBuilder) atlasBuilder).setDefaultBuilder(androidBuilder);
        ((AtlasBuilder) atlasBuilder).setAtlasExtension(atlasExtension);
        AtlasBuildContext.androidBuilderMap.put(project, (AtlasBuilder) (atlasBuilder));
    }
 
Example #4
Source File: TaobaoInstantRunDex.java    From atlas with Apache License 2.0 6 votes vote down vote up
public TaobaoInstantRunDex(
        AppVariantContext variantContext,
        @NonNull InstantRunVariantScope transformVariantScope,
        DexByteCodeConverter dexByteCodeConverter,
        @NonNull DexOptions dexOptions,
        @NonNull Logger logger,
        int minSdkForDx,
        BaseVariantOutput variantOutput) {
    this.variantScope = transformVariantScope;
    this.variantContext = variantContext;
    this.dexByteCodeConverter = dexByteCodeConverter;
    this.dexOptions = dexOptions;
    this.logger = new LoggerWrapper(logger);
    this.minSdkForDx = minSdkForDx;
    this.variantOutput = variantOutput;
}
 
Example #5
Source File: MergeResources.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private ResourcePreprocessor getPreprocessor() {
    // Only one pre-processor for now. The code will need slight changes when we add more.

    return new MergeResourcesVectorDrawableRenderer(
            getMinSdk(),
            getGeneratedPngsOutputDir(),
            Collections.emptyList(),
            LoggerWrapper.supplierFor(MergeResources.class));
}
 
Example #6
Source File: TransformReplacer.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void replaceDexTransform(AppVariantContext appVariantContext, BaseVariantOutput vod) {
    List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType(
            variantContext, DexTransform.class);

    DefaultDexOptions dexOptions = appVariantContext.getAppExtension().getDexOptions();
    DexingType dexingType = appVariantContext.getScope().getDexingType();
    DexByteCodeConverterHook dexByteCodeConverterHook = new DexByteCodeConverterHook(variantContext
            , variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod))
            , LoggerWrapper.getLogger(DexByteCodeConverterHook.class)
            , appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo()
            , new GradleJavaProcessExecutor(appVariantContext.getProject())
            , appVariantContext.getProject().getLogger().isEnabled(LogLevel.INFO)
            , new ExtraModelInfo(appVariantContext.getScope().getGlobalScope().getProjectOptions(), appVariantContext.getProject().getLogger()));

    for (TransformTask transformTask : baseTransforms) {
        DexTransform newTransform = new DexTransform(dexOptions
                , dexingType
                , false
                , appVariantContext.getProject().files(variantContext.getScope().getMainDexListFile())
                , verifyNotNull(appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo(), "Target Info not set.")
                , dexByteCodeConverterHook
                , appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter()
                , variantContext.getScope().getMinSdkVersion().getFeatureLevel());
        ReflectUtils.updateField(transformTask, "transform",
                newTransform);
    }

}
 
Example #7
Source File: AtlasDataBindingMergeArtifactsTransform.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasDataBindingMergeArtifactsTransform(AppVariantContext variantContext, Logger logger, File outFolder) {

        super(logger, outFolder);
        this.logger = new LoggerWrapper(logger);
        this.outFolder = outFolder;
        this.variantContext = variantContext;
    }
 
Example #8
Source File: AtlasBaseTaskManager.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasBaseTaskManager(AtlasBuilder androidBuilder, T androidExtension, Project project,
                            AtlasExtension atlasExtension) {
    this.tAndroidBuilder = androidBuilder;
    this.androidExtension = androidExtension;
    this.project = project;
    this.tasks = new TaskContainerAdaptor(project.getTasks());
    this.atlasExtension = atlasExtension;
    this.logger = new LoggerWrapper(Logging.getLogger(AtlasBaseTaskManager.class));
    this.extraModelInfo = new ExtraModelInfo(new ProjectOptions(project), Logging.getLogger(AtlasBaseTaskManager.class));

    //this.dependencyManager = new DependencyManager(androidExtension, project, atlasExtension);
}
 
Example #9
Source File: BaseComponentModelPlugin.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Replace BasePlugin's apply method for component model.
 */
@Override
public void apply(Project project) {
    try {
        List<Recorder.Property> propertyList = Lists.newArrayList(
                new Recorder.Property("plugin_version", Version.ANDROID_GRADLE_PLUGIN_VERSION),
                new Recorder.Property("next_gen_plugin", "true"),
                new Recorder.Property("gradle_version", project.getGradle().getGradleVersion())
        );

        ProcessRecorderFactory.initialize(
                new LoggerWrapper(project.getLogger()),
                project.getRootProject()
                        .file("profiler" + System.currentTimeMillis() + ".json"),
                propertyList);
    } catch (IOException e) {
        throw new RuntimeException("Unable to initialize ProcessRecorderFactory");
    }

    project.getPlugins().apply(JavaBasePlugin.class);

    // TODO: Create configurations for build types and flavors, or migrate to new dependency
    // management if it's ready.
    ConfigurationContainer configurations = project.getConfigurations();
    createConfiguration(configurations, "compile", "Classpath for default sources.");
    createConfiguration(configurations, "default-metadata", "Metadata for published APKs");
    createConfiguration(configurations, "default-mapping", "Metadata for published APKs");

}
 
Example #10
Source File: BaseComponentModelPlugin.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Model(ANDROID_BUILDER)
public AndroidBuilder createAndroidBuilder(Project project, ExtraModelInfo extraModelInfo) {
    String creator = "Android Gradle";
    ILogger logger = new LoggerWrapper(project.getLogger());

    return new AndroidBuilder(project.equals(project.getRootProject()) ? project.getName()
            : project.getPath(), creator, new GradleProcessExecutor(project),
            new GradleJavaProcessExecutor(project),
            extraModelInfo, logger, project.getLogger().isEnabled(LogLevel.INFO));

}
 
Example #11
Source File: AndroidExtension.java    From javafxmobile-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public AndroidExtension(Project project, ToolingModelBuilderRegistry registry) {
    this.project = project;

    this.extraModelInfo = new ExtraModelInfo(new ProjectOptions(project), project.getLogger());

    this.signingConfig = project.getExtensions().create("signingConfig", SigningConfig.class, "signing");
    this.packagingOptions = project.getExtensions().create("packagingOptions", PackagingOptions.class);
    this.dexOptions = project.getExtensions().create("dexOptions", DexOptions.class, extraModelInfo);

    try {
        this.buildCache = FileCache.getInstanceWithMultiProcessLocking(new File(AndroidLocation.getFolder(), "build-cache"));
    } catch (AndroidLocation.AndroidLocationException e) {
        throw new RuntimeException(e);
    }

    LoggerWrapper loggerWrapper = new LoggerWrapper(project.getLogger());

    this.sdkHandler = new SdkHandler(project, loggerWrapper);
    this.androidBuilder = new AndroidBuilder(
            project == project.getRootProject() ? project.getName() : project.getPath(),
            "JavaFX Mobile",
            new GradleProcessExecutor(project),
            new GradleJavaProcessExecutor(project),
            extraModelInfo,
            loggerWrapper,
            false);

    this.androidTaskRegistry = new AndroidTaskRegistry();
    this.taskFactory = new TaskContainerAdaptor(project.getTasks());

    installDirectory = new File(project.getBuildDir(), "javafxports/android");
    project.getLogger().info("Android install directory: " + installDirectory);

    temporaryDirectory = new File(project.getBuildDir(), "javafxports/tmp/android");
    project.getLogger().info("Android temporary output directory: " + temporaryDirectory);

    resourcesDirectory = new File(temporaryDirectory, "resources");
    resourcesDirectory.mkdirs();
    project.getLogger().info("Resources directory: " + resourcesDirectory);

    multidexOutputDirectory = new File(temporaryDirectory, "multi-dex");
    multidexOutputDirectory.mkdirs();
    project.getLogger().info("Multi-dex output directory: " + multidexOutputDirectory);

    dexOutputDirectory = new File(temporaryDirectory, "dex");
    dexOutputDirectory.mkdirs();
    project.getLogger().info("Dex output directory: " + dexOutputDirectory);
}