Search in sources :

Example 1 with InstanceProvider

use of com.uber.jenkins.phabricator.provider.InstanceProvider in project phabricator-jenkins-plugin by uber.

the class PhabricatorNotifier method getCoverageProvider.

/**
 * Get the cobertura coverage for the build
 *
 * @param build    The current build
 * @param listener The build listener
 * @return The current cobertura coverage, if any
 */
private CoverageProvider getCoverageProvider(AbstractBuild build, BuildListener listener, Set<String> includeFileNames) {
    if (!build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) {
        return null;
    }
    Logger logger = new Logger(listener.getLogger());
    InstanceProvider<CoverageProvider> provider = new InstanceProvider<CoverageProvider>(Jenkins.getInstance(), COBERTURA_PLUGIN_NAME, COBERTURA_CLASS_NAME, logger);
    CoverageProvider coverage = provider.getInstance();
    if (coverage == null) {
        return null;
    }
    coverage.setBuild(build);
    coverage.setIncludeFileNames(includeFileNames);
    coverage.setCoverageReportPattern(coverageReportPattern);
    if (coverage.hasCoverage()) {
        return coverage;
    } else {
        logger.info(UBERALLS_TAG, "No cobertura results found");
        return null;
    }
}
Also used : CoverageProvider(com.uber.jenkins.phabricator.coverage.CoverageProvider) Logger(com.uber.jenkins.phabricator.utils.Logger) InstanceProvider(com.uber.jenkins.phabricator.provider.InstanceProvider)

Example 2 with InstanceProvider

use of com.uber.jenkins.phabricator.provider.InstanceProvider in project phabricator-jenkins-plugin by uber.

the class PhabricatorNotifier method getUnitProvider.

private UnitTestProvider getUnitProvider(AbstractBuild build, BuildListener listener) {
    Logger logger = new Logger(listener.getLogger());
    InstanceProvider<UnitTestProvider> provider = new InstanceProvider<UnitTestProvider>(Jenkins.getInstance(), JUNIT_PLUGIN_NAME, JUNIT_CLASS_NAME, logger);
    UnitTestProvider unitProvider = provider.getInstance();
    if (unitProvider == null) {
        return null;
    }
    unitProvider.setBuild(build);
    return unitProvider;
}
Also used : UnitTestProvider(com.uber.jenkins.phabricator.unit.UnitTestProvider) Logger(com.uber.jenkins.phabricator.utils.Logger) InstanceProvider(com.uber.jenkins.phabricator.provider.InstanceProvider)

Aggregations

InstanceProvider (com.uber.jenkins.phabricator.provider.InstanceProvider)2 Logger (com.uber.jenkins.phabricator.utils.Logger)2 CoverageProvider (com.uber.jenkins.phabricator.coverage.CoverageProvider)1 UnitTestProvider (com.uber.jenkins.phabricator.unit.UnitTestProvider)1