Package org.gradle.util

Examples of org.gradle.util.Clock


    public SettingsInternal process(GradleInternal gradle,
                                    SettingsLocation settingsLocation,
                                    ClassLoaderScope baseClassLoaderScope,
                                    StartParameter startParameter) {
        Clock settingsProcessingClock = new Clock();
        Map<String, String> properties = propertiesLoader.mergeProperties(Collections.<String, String>emptyMap());
        SettingsInternal settings = settingsFactory.createSettings(gradle, settingsLocation.getSettingsDir(),
                settingsLocation.getSettingsScriptSource(), properties, startParameter, baseClassLoaderScope);
        applySettingsScript(settingsLocation, settings);
        logger.debug("Timing: Processing settings took: {}", settingsProcessingClock.getTime());
        return settings;
    }
View Full Code Here


        this.incrementalCompilationInitilizer = compilationInitializer;
        this.jarClasspathSnapshotProvider = jarClasspathSnapshotProvider;
    }

    public WorkResult execute(JavaCompileSpec spec) {
        Clock clock = new Clock();
        JarClasspathSnapshot jarClasspathSnapshot = jarClasspathSnapshotProvider.getJarClasspathSnapshot(spec.getClasspath());
        RecompilationSpec recompilationSpec = recompilationSpecProvider.provideRecompilationSpec(inputs, previousCompilation, jarClasspathSnapshot);

        if (recompilationSpec.isFullRebuildNeeded()) {
            LOG.lifecycle("Full recompilation is required because {}. Analysis took {}.", recompilationSpec.getFullRebuildCause(), clock.getTime());
            return cleaningCompiler.execute(spec);
        }

        incrementalCompilationInitilizer.initializeCompilation(spec, recompilationSpec.getClassNames());
        if (spec.getSource().isEmpty()) {
            LOG.lifecycle("None of the classes needs to compiled! Analysis took {}. ", clock.getTime());
            return new RecompilationNotNecessary();
        }

        try {
            //use the original compiler to avoid cleaning up all the files
            return cleaningCompiler.getCompiler().execute(spec);
        } finally {
            LOG.lifecycle("Incremental compilation of {} classes completed in {}.", recompilationSpec.getClassNames().size(), clock.getTime());
        }
    }
View Full Code Here

        this.configurerFactory = configurerFactory;
    }

    public void execute(ProjectInternal project) {
        LOGGER.info(String.format("Evaluating %s using %s.", project, project.getBuildScriptSource().getDisplayName()));
        Clock clock = new Clock();
        try {
            ScriptPlugin configurer = configurerFactory.create(project.getBuildScriptSource(), project.getBuildscript(), project.getClassLoaderScope(), project.getBaseClassLoaderScope(), "buildscript", ProjectScript.class, true);
            configurer.apply(project);
        } finally {
            LOGGER.debug("Timing: Running the build script took " + clock.getTime());
        }
    }
View Full Code Here

        this.fileOperations = fileOperations;
        this.analyzer = analyzer;
    }

    public void updateAnalysis(JavaCompileSpec spec) {
        Clock clock = new Clock();
        FileTree tree = fileOperations.fileTree(spec.getDestinationDir());
        ClassFilesAnalyzer analyzer = new ClassFilesAnalyzer(this.analyzer);
        tree.visit(analyzer);
        ClassSetAnalysisData data = analyzer.getAnalysis();
        stash.put(data);
        LOG.info("Class dependency analysis for incremental compilation took {}.", clock.getTime());
    }
View Full Code Here

        this.testResultsProvider = testResultsProvider;
        this.saxWriter = new JUnitXmlResultWriter(getHostname(), testResultsProvider, outputAssociation);
    }

    public void generate() {
        Clock clock = new Clock();
        testResultsProvider.visitClasses(new Action<TestClassResult>() {
            public void execute(TestClassResult result) {
                File file = new File(testResultsDir, getReportFileName(result));
                OutputStream output = null;
                try {
                    output = new BufferedOutputStream(new FileOutputStream(file));
                    saxWriter.write(result, output);
                    output.close();
                } catch (Exception e) {
                    throw new GradleException(String.format("Could not write XML test results for %s to file %s.", result.getClassName(), file), e);
                } finally {
                    IOUtils.closeQuietly(output);
                }
            }
        });
        LOG.info("Finished generating test XML results ({}) into: {}", clock.getTime(), testResultsDir);
    }
View Full Code Here

    private final static Logger LOG = Logging.getLogger(DefaultTestReport.class);

    public void generateReport(TestResultsProvider resultsProvider, File reportDir) {
        LOG.info("Generating HTML test report...");

        Clock clock = new Clock();
        AllTestResults model = loadModelFromProvider(resultsProvider);
        generateFiles(model, resultsProvider, reportDir);
        LOG.info("Finished generating test html results ({}) into: {}", clock.getTime(), reportDir);
    }
View Full Code Here

        return store.getSize() > maxSize;
    }

    public void close() {
        try {
            Clock clock = new Clock();
            cleanUpLater.stop();
            LOG.debug("Deleted {} resolution results binary files in {}", stores.size(), clock.getTime());
        } finally {
            oldModelCache = null;
            newModelCache = null;
            stores.clear();
        }
View Full Code Here

            });
        }
    }

    private TransientConfigurationResults deserialize(Decoder decoder, ResolvedContentsMapping mapping) {
        Clock clock = new Clock();
        Map<ResolvedConfigurationIdentifier, DefaultResolvedDependency> allDependencies = new HashMap<ResolvedConfigurationIdentifier, DefaultResolvedDependency>();
        DefaultTransientConfigurationResults results = new DefaultTransientConfigurationResults();
        int valuesRead = 0;
        byte type = -1;
        try {
            while (true) {
                type = decoder.readByte();
                ResolvedConfigurationIdentifier id;
                valuesRead++;
                switch (type) {
                    case NEW_DEP:
                        id = resolvedConfigurationIdentifierSerializer.read(decoder);
                        allDependencies.put(id, new DefaultResolvedDependency(id.getId(), id.getConfiguration()));
                        break;
                    case ROOT:
                        id = resolvedConfigurationIdentifierSerializer.read(decoder);
                        results.root = allDependencies.get(id);
                        if (results.root == null) {
                            throw new IllegalStateException(String.format("Unexpected root id %s. Seen ids: %s", id, allDependencies.keySet()));
                        }
                        //root should be the last
                        LOG.debug("Loaded resolved configuration results ({}) from {}", clock.getTime(), binaryStore);
                        return results;
                    case FIRST_LVL:
                        id = resolvedConfigurationIdentifierSerializer.read(decoder);
                        DefaultResolvedDependency dependency = allDependencies.get(id);
                        if (dependency == null) {
View Full Code Here

        }

        private ResolvedComponentResult deserialize(Decoder decoder) {
            int valuesRead = 0;
            byte type = -1;
            Clock clock = new Clock();
            try {
                DefaultResolutionResultBuilder builder = new DefaultResolutionResultBuilder();
                while (true) {
                    type = decoder.readByte();
                    valuesRead++;
                    switch (type) {
                        case ROOT:
                            ModuleVersionIdentifier id = moduleVersionIdentifierSerializer.read(decoder);
                            ComponentIdentifier componentIdentifier = componentIdentifierSerializer.read(decoder);
                            builder.start(id, componentIdentifier);
                            break;
                        case MODULE:
                            ModuleVersionSelection sel = moduleVersionSelectionSerializer.read(decoder);
                            builder.resolvedModuleVersion(sel);
                            break;
                        case DEPENDENCY:
                            id = moduleVersionIdentifierSerializer.read(decoder);
                            int size = decoder.readSmallInt();
                            List<InternalDependencyResult> deps = new LinkedList<InternalDependencyResult>();
                            for (int i = 0; i < size; i++) {
                                deps.add(internalDependencyResultSerializer.read(decoder, failures));
                            }
                            builder.resolvedConfiguration(id, deps);
                            break;
                        case DONE:
                            ResolvedComponentResult root = builder.complete().getRoot();
                            LOG.debug("Loaded resolution results ({}) from {}", clock.getTime(), data);
                            return root;
                        default:
                            throw new IOException("Unknown value type read from stream: " + type);
                    }
                }
            } catch (IOException e) {
                throw new RuntimeException("Problems loading the resolution results (" + clock.getTime() + "). "
                        + "Read " + valuesRead + " values, last was: " + type, e);
            }
        }
View Full Code Here

TOP

Related Classes of org.gradle.util.Clock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.