Java 类org.gradle.api.logging.Logger 实例源码

项目:atlas    文件:AwoInstaller.java   
/**
 * Wait for the Android Debug Bridge to return an initial device list.
 */
protected static void waitForInitialDeviceList(final AndroidDebugBridge androidDebugBridge, Logger logger) {
    if (!androidDebugBridge.hasInitialDeviceList()) {
        logger.info("Waiting for initial device list from the Android Debug Bridge");
        long limitTime = System.currentTimeMillis() + ADB_TIMEOUT_MS;
        while (!androidDebugBridge.hasInitialDeviceList() && (System.currentTimeMillis() < limitTime)) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException("Interrupted waiting for initial device list from Android Debug Bridge");
            }
        }
        if (!androidDebugBridge.hasInitialDeviceList()) {
            logger.error("Did not receive initial device list from the Android Debug Bridge.");
        }
    }
}
项目:atlas    文件:AwoInstaller.java   
/**
 * todo how know which app will be debugged?
 * just support taobao.apk now
 */
private static void notifyApppatching(AndroidBuilder androidBuilder, String patchPkg, Logger logger) {
    CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
    executor.setLogger(logger);
    executor.setCaptureStdOut(true);
    executor.setCaptureStdErr(true);
    //        List<String> killCmd = Arrays.asList("shell", "am", "force-stop", packageNameForPatch);
    //        List<String> startCmd = Arrays.asList("shell", "am", "start", packageNameForPatch + "/" +
    // launcherActivityForPatch);
    List<String> patchCmd = Arrays.asList("shell", "am", "broadcast", "-a", "com.taobao.atlas.intent.PATCH_APP",
                                          "-e", "pkg", patchPkg);
    try {
        executor.executeCommand(androidBuilder.getSdkInfo().getAdb().getAbsolutePath(), patchCmd, false);
    } catch (Exception e) {
        throw new RuntimeException("error while restarting app,you can also restart by yourself", e);
    }
}
项目:unmock-plugin    文件:ProcessRealAndroidJar.java   
private static List<ClassMapping> parseClassesToMap(String[] renameClasses, Logger logger) {
    ArrayList<ClassMapping> result = new ArrayList<>();

    if (renameClasses == null) {
        return result;
    }

    for (String classRenaming : renameClasses) {
        int indexOfEquals = classRenaming.indexOf("=");
        if (indexOfEquals > 0 && indexOfEquals < classRenaming.length()) {
            String from = classRenaming.substring(0, indexOfEquals);
            String to = classRenaming.substring(indexOfEquals + 1);
            result.add(new ClassMapping(from, to));

        } else {
            logger.error("Unparseable mapping:" + classRenaming);
        }
    }

    return result;
}
项目:jsweet-gradle-plugin    文件:JSweetPlugin.java   
@Override
public void apply(final Project project) {
    Logger logger = project.getLogger();
    logger.info("applying jsweet plugin");

    if (!project.getPlugins().hasPlugin(JavaPlugin.class) && !project.getPlugins().hasPlugin(WarPlugin.class)) {
        logger.error("No java or war plugin detected. Enable java or war plugin.");
        throw new IllegalStateException("No java or war plugin detected. Enable java or war plugin.");
    }

    JSweetPluginExtension extension = project.getExtensions().create("jsweet", JSweetPluginExtension.class);

    JavaPluginConvention javaPluginConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
    SourceSetContainer sourceSets = javaPluginConvention.getSourceSets();
    SourceSet mainSources = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);

    JSweetTranspileTask task = project.getTasks().create("jsweet", JSweetTranspileTask.class);
    task.setGroup("generate");
    task.dependsOn(JavaPlugin.COMPILE_JAVA_TASK_NAME);
    task.setConfiguration(extension);
    task.setSources(mainSources.getAllJava());
    task.setClasspath(mainSources.getCompileClasspath());

    JSweetCleanTask cleanTask = project.getTasks().create("jsweetClean", JSweetCleanTask.class);
    cleanTask.setConfiguration(extension);
}
项目:Pushjet-Android    文件:ZincScalaCompiler.java   
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
项目:Pushjet-Android    文件:ZincScalaCompiler.java   
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
项目:lejos-ev3-gradle-plugin    文件:Ev3DeployTask.java   
private String getEv3Host() {
    Logger logger = getLogger();
    LejosEv3PluginExtension ev3 = getEv3PluginExtension();
    String host;
    if (ev3.discoverBrickEnabled()) {
        BrickInfo brick;
        try {
            brick =  BrickFinder.discover()[0];
        } catch (IOException e) {
            throw new GradleException("Error on discovering bricks", e);
        }
        logger.info("Found brick " + brick.getName() + " at " + brick.getIPAddress());
        host = brick.getIPAddress();
    } else {
        if (ev3.getHost() == null) {
            throw new GradleException("Please set property ev3.host");
        }
        host = ev3.getHost();
    }
    return host;
}
项目:gnag    文件:GitHubApi.java   
public GitHubApi(final GitHubExtension gitHubExtension) {
    this.gitHubExtension = gitHubExtension;

    org.slf4j.Logger gradleLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    HttpLoggingInterceptor.Logger logger = gradleLogger::info;

    OkHttpClient okHttpClient = new OkHttpClient.Builder()
            .addInterceptor(new UserAgentInterceptor())
            .addInterceptor(new AuthInterceptor(gitHubExtension.getAuthToken()))
            .addInterceptor(new HttpLoggingInterceptor(logger).setLevel(HttpLoggingInterceptor.Level.BASIC))
            .build();

    String baseUrl = gitHubExtension.getRootUrl() + gitHubExtension.getRepoName() + "/";

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(baseUrl)
            .client(okHttpClient)
            .addConverterFactory(DiffParserConverterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    gitHubApiClient = retrofit.create(GitHubApiClient.class);
}
项目:checkstyle-addons    文件:DependencyConfigs.java   
public DependencyConfigs(@Nonnull final Project pProject)
{
    project = pProject;
    buildUtil = new BuildUtil(pProject);
    depConfigDir = new File(pProject.getProjectDir(), "project/dependencyConfigs");
    final FileCollection listOfDepConfigFiles = readListOfDepConfigs(depConfigDir);
    depConfigs = readAllDependencyVersions(listOfDepConfigFiles);

    if (getDefault() == null || !DEFAULT_NAME.equals(getDefault().getName()) || !getDefault().isDefaultConfig()) {
        throw new GradleException("corrupt default dependency configuration");
    }

    final Logger log = pProject.getLogger();
    log.lifecycle("Default Checkstyle version: " + getDefault().getCheckstyleBaseVersion());
    log.lifecycle("Active dependency configurations:");
    for (Map.Entry<String, DependencyConfig> entry : depConfigs.entrySet()) {
        DependencyConfig depConfig = entry.getValue();
        log.lifecycle("  - " + entry.getKey() + ": Checkstyle " + depConfig.getCheckstyleBaseVersion() //
            + ", Java " + depConfig.getJavaLevel() //
            + ", compatible: " + depConfig.getCompatibleCheckstyleVersions());
    }
}
项目:Reer    文件:HealthLogger.java   
public void logHealth(DaemonHealthStats stats, Logger logger) {
    if (Boolean.getBoolean(HEALTH_MESSAGE_PROPERTY)) {
        logger.lifecycle(stats.getHealthInfo());
    } else {
        //the default
        logger.info(stats.getHealthInfo());
    }
}
项目:Reer    文件:GradleBuildComparison.java   
public GradleBuildComparison(
        ComparableGradleBuildExecuter sourceBuildExecuter,
        ComparableGradleBuildExecuter targetBuildExecuter,
        Logger logger,
        ProgressLogger progressLogger,
        Gradle gradle) {
    this.sourceBuildExecuter = sourceBuildExecuter;
    this.targetBuildExecuter = targetBuildExecuter;
    this.logger = logger;
    this.progressLogger = progressLogger;
    this.gradle = gradle;
}
项目:Reer    文件:InProcessCompilerDaemonFactory.java   
@Override
public WorkerDaemon getDaemon(Class<? extends WorkerDaemonProtocol> serverImplementationClass, File workingDir, final DaemonForkOptions forkOptions) {
    return new WorkerDaemon() {
        public <T extends WorkSpec> WorkerDaemonResult execute(WorkerDaemonAction<T> compiler, T spec) {
            ClassLoader groovyClassLoader = classLoaderFactory.createIsolatedClassLoader(new DefaultClassPath(forkOptions.getClasspath()));
            GroovySystemLoader groovyLoader = groovySystemLoaderFactory.forClassLoader(groovyClassLoader);
            FilteringClassLoader.Spec filteredGroovySpec = new FilteringClassLoader.Spec();
            for (String packageName : forkOptions.getSharedPackages()) {
                filteredGroovySpec.allowPackage(packageName);
            }
            ClassLoader filteredGroovy = classLoaderFactory.createFilteringClassLoader(groovyClassLoader, filteredGroovySpec);

            FilteringClassLoader.Spec loggingSpec = new FilteringClassLoader.Spec();
            loggingSpec.allowPackage("org.slf4j");
            loggingSpec.allowClass(Logger.class);
            loggingSpec.allowClass(LogLevel.class);
            ClassLoader loggingClassLoader = classLoaderFactory.createFilteringClassLoader(compiler.getClass().getClassLoader(), loggingSpec);

            ClassLoader groovyAndLoggingClassLoader = new CachingClassLoader(new MultiParentClassLoader(loggingClassLoader, filteredGroovy));

            ClassLoader workerClassLoader = new VisitableURLClassLoader(groovyAndLoggingClassLoader, ClasspathUtil.getClasspath(compiler.getClass().getClassLoader()));

            try {
                byte[] serializedWorker = GUtil.serialize(new Worker<T>(compiler, spec, gradleUserHomeDir));
                ClassLoaderObjectInputStream inputStream = new ClassLoaderObjectInputStream(new ByteArrayInputStream(serializedWorker), workerClassLoader);
                Callable<?> worker = (Callable<?>) inputStream.readObject();
                Object result = worker.call();
                byte[] serializedResult = GUtil.serialize(result);
                inputStream = new ClassLoaderObjectInputStream(new ByteArrayInputStream(serializedResult), getClass().getClassLoader());
                return (WorkerDaemonResult) inputStream.readObject();
            } catch (Exception e) {
                throw UncheckedException.throwAsUncheckedException(e);
            } finally {
                groovyLoader.shutdown();
            }
        }
    };
}
项目:Reer    文件:ZincScalaCompiler.java   
static WorkResult execute(final Iterable<File> scalaClasspath, final Iterable<File> zincClasspath, File gradleUserHome, final ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    final xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = ZincScalaCompilerFactory.createParallelSafeCompiler(scalaClasspath, zincClasspath, logger, gradleUserHome);

    List<String> scalacOptions = new ZincScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    if (spec.getScalaCompileOptions().isForce()) {
        GFileUtils.deleteDirectory(spec.getDestinationDir());
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
项目:Reer    文件:ZincScalaCompilerFactory.java   
static Compiler createParallelSafeCompiler(final Iterable<File> scalaClasspath, final Iterable<File> zincClasspath, final xsbti.Logger logger, File gradleUserHome) {
    File zincCacheHomeDir = new File(System.getProperty(ZINC_CACHE_HOME_DIR_SYSTEM_PROPERTY, gradleUserHome.getAbsolutePath()));
    CacheRepository cacheRepository = ZincCompilerServices.getInstance(zincCacheHomeDir).get(CacheRepository.class);

    String zincVersion = Setup.zincVersion().published();
    String zincCacheKey = String.format("zinc-%s", zincVersion);
    String zincCacheName = String.format("Zinc %s compiler cache", zincVersion);
    final PersistentCache zincCache = cacheRepository.cache(zincCacheKey)
            .withDisplayName(zincCacheName)
            .withLockOptions(mode(FileLockManager.LockMode.Exclusive))
            .open();

    Compiler compiler;
    try {
        final File cacheDir = zincCache.getBaseDir();

        final String userSuppliedZincDir = System.getProperty("zinc.dir");
        if (userSuppliedZincDir != null && !userSuppliedZincDir.equals(cacheDir.getAbsolutePath())) {
            LOGGER.warn(ZINC_DIR_IGNORED_MESSAGE);
        }

        compiler = SystemProperties.getInstance().withSystemProperty(ZINC_DIR_SYSTEM_PROPERTY, cacheDir.getAbsolutePath(), new Factory<Compiler>() {
            @Override
            public Compiler create() {
                Setup zincSetup = createZincSetup(scalaClasspath, zincClasspath, logger);
                return createCompiler(zincSetup, zincCache, logger);
            }
        });
    } finally {
        zincCache.close();
    }

    return compiler;
}
项目:Reer    文件:ZincScalaCompilerFactory.java   
private static Compiler createCompiler(final Setup setup, final PersistentCache zincCache, final xsbti.Logger logger) {
    return Compiler.compilerCache().get(setup, new scala.runtime.AbstractFunction0<Compiler>() {
        public Compiler apply() {
            ScalaInstance instance = Compiler.scalaInstance(setup);
            File interfaceJar = getCompilerInterface(setup, instance, zincCache, logger);
            AnalyzingCompiler scalac = Compiler.newScalaCompiler(instance, interfaceJar, logger);
            JavaCompiler javac = Compiler.newJavaCompiler(instance, setup.javaHome(), setup.forkJava());
            return new Compiler(scalac, javac);
        }
    });
}
项目:Reer    文件:ZincScalaCompilerFactory.java   
private static Setup createZincSetup(Iterable<File> scalaClasspath, Iterable<File> zincClasspath, xsbti.Logger logger) {
    ScalaLocation scalaLocation = ScalaLocation.fromPath(Lists.newArrayList(scalaClasspath));
    SbtJars sbtJars = SbtJars.fromPath(Lists.newArrayList(zincClasspath));
    Setup setup = Setup.create(scalaLocation, sbtJars, Jvm.current().getJavaHome(), true);
    if (LOGGER.isDebugEnabled()) {
        Setup.debug(setup, logger);
    }
    return setup;
}
项目:Reer    文件:DefaultIsolatedAntBuilder.java   
public DefaultIsolatedAntBuilder(ClassPathRegistry classPathRegistry, ClassLoaderFactory classLoaderFactory, ModuleRegistry moduleRegistry) {
    this.classPathRegistry = classPathRegistry;
    this.classLoaderFactory = classLoaderFactory;
    this.moduleRegistry = moduleRegistry;
    this.libClasspath = new DefaultClassPath();
    GroovySystemLoaderFactory groovySystemLoaderFactory = new GroovySystemLoaderFactory();
    this.classLoaderCache = new ClassPathToClassLoaderCache(groovySystemLoaderFactory);

    List<File> antClasspath = Lists.newArrayList(classPathRegistry.getClassPath("ANT").getAsFiles());
    // Need tools.jar for compile tasks
    File toolsJar = Jvm.current().getToolsJar();
    if (toolsJar != null) {
        antClasspath.add(toolsJar);
    }

    antLoader = classLoaderFactory.createIsolatedClassLoader(new DefaultClassPath(antClasspath));
    FilteringClassLoader.Spec loggingLoaderSpec = new FilteringClassLoader.Spec();
    loggingLoaderSpec.allowPackage("org.slf4j");
    loggingLoaderSpec.allowPackage("org.apache.commons.logging");
    loggingLoaderSpec.allowPackage("org.apache.log4j");
    loggingLoaderSpec.allowClass(Logger.class);
    loggingLoaderSpec.allowClass(LogLevel.class);
    FilteringClassLoader loggingLoader = new FilteringClassLoader(getClass().getClassLoader(), loggingLoaderSpec);

    this.baseAntLoader = new CachingClassLoader(new MultiParentClassLoader(antLoader, loggingLoader));

    // Need gradle core to pick up ant logging adapter, AntBuilder and such
    ClassPath gradleCoreUrls = moduleRegistry.getModule("gradle-core").getImplementationClasspath();
    gradleCoreUrls = gradleCoreUrls.plus(moduleRegistry.getModule("gradle-logging").getImplementationClasspath());
    gradleCoreUrls = gradleCoreUrls.plus(moduleRegistry.getExternalModule("groovy-all").getClasspath());

    // Need Transformer (part of AntBuilder API) from base services
    gradleCoreUrls = gradleCoreUrls.plus(moduleRegistry.getModule("gradle-base-services").getImplementationClasspath());
    this.antAdapterLoader = new VisitableURLClassLoader(baseAntLoader, gradleCoreUrls);

    gradleApiGroovyLoader = groovySystemLoaderFactory.forClassLoader(this.getClass().getClassLoader());
    antAdapterGroovyLoader = groovySystemLoaderFactory.forClassLoader(antAdapterLoader);
}
项目:Reer    文件:DefaultBuildOperationLogger.java   
DefaultBuildOperationLogger(BuildOperationLogInfo configuration, Logger logger, File outputFile) {
    this.configuration = configuration;
    this.logger = logger;
    this.outputFile = outputFile;

    this.numberOfFailedOperationsSeen = 0;
    this.started = false;
}
项目:android-perftracking    文件:Materialization.java   
public Materialization(Base base, int index, ClassProvider provider, Logger log) {
  this.base = base;
  this.index = index;
  name = base.name + "_" + index;
  internalName = base.internalName + "_" + index;
  _provider = provider;
  _log = log;
}
项目:atlas    文件:AwoInstaller.java   
public static void installTPatch(AndroidBuilder androidBuilder, File tPatchFile, File updateInfoFile,
                                 String packageName, Logger logger) {
    try {
        installPatchIfDeviceConnected(androidBuilder, tPatchFile, packageName, logger, tPatchFile.getName());
        installPatchIfDeviceConnected(androidBuilder, updateInfoFile, packageName, logger,
                                      FilenameUtils.getBaseName(tPatchFile.getName()) + ".json");
        notifyApppatching(androidBuilder, packageName, logger);
    } catch (Throwable e) {
        throw new GradleException("install awo error", e);
    }
}
项目:atlas    文件:AwoInstaller.java   
public static void installAwoSo(AndroidBuilder androidBuilder, File maindexFile, Collection<File> awoSoFiles,
                                String packageName, Logger logger) {
    try {
        if (maindexFile != null) {
            if (!maindexFile.exists()) {
                throw new IllegalArgumentException(
                    "maindexFile file " + maindexFile.getAbsolutePath() + " does not exist.");
            }

            installPatchIfDeviceConnected(androidBuilder, maindexFile, packageName, logger,
                                          "libcom_taobao_maindex.so");
        }
        if (awoSoFiles != null) {
            for (File awoSoFile : awoSoFiles) {
                if (!awoSoFile.exists()) {
                    throw new IllegalArgumentException(
                        "awoSoFile file " + awoSoFile.getAbsolutePath() + " does not exist.");
                }

                installPatchIfDeviceConnected(androidBuilder, awoSoFile, packageName, logger, awoSoFile.getName());
            }
        }
        notifyApppatching(androidBuilder, packageName, logger);
    } catch (Throwable e) {
        throw new GradleException("install awo error", e);
    }
}
项目:atlas    文件:AwoInstaller.java   
public static void installAwoSo(AndroidBuilder androidBuilder, File awoSoFile, String packageName, Logger logger,
                                String name) {

    try {
        installPatchIfDeviceConnected(androidBuilder, awoSoFile, packageName, logger, name);
        notifyApppatching(androidBuilder, packageName, logger);
    } catch (Throwable e) {
        throw new GradleException("install awo error", e);
    }
}
项目:atlas    文件:CommandExecutor.java   
public ErrorStreamConsumer(Logger logger, ErrorListener errorListener, boolean captureStdErr) {
    this.logger = logger;
    this.errorListener = errorListener;
    this.captureStdErr = captureStdErr;

    if (logger == null) {
        System.out.println("ANDROID-040-003: Error Log not set: Will not output error logs");
    }
    error = false;
}
项目:gradle-plugins    文件:JavadocLinksPlugin.java   
private void addLink(Javadoc javadoc, String link) {
    MinimalJavadocOptions options = javadoc.getOptions();
    if (options instanceof StandardJavadocDocletOptions) {
        StandardJavadocDocletOptions docletOptions = (StandardJavadocDocletOptions) options;
        Logger logger = javadoc.getLogger();
        List<String> links = docletOptions.getLinks();

        if (!links.contains(link)) {
            logger.debug("Adding '{}' to {}", link, javadoc);
            links.add(link);
        } else {
            logger.info("Not adding '{}' to {} because it's already present", link, javadoc);
        }
    }
}
项目:app-gradle-plugin    文件:CloudSdkBuilderFactory.java   
/**
 * Create a builder with auto-configured metrics, output handlers and failure on non-zero exit.
 */
public CloudSdk.Builder newBuilder(Logger logger) {
  ProcessOutputLineListener listener = new GradleLoggerOutputListener(logger, LogLevel.LIFECYCLE);

  return new CloudSdk.Builder()
      .sdkPath(cloudSdkHome != null ? cloudSdkHome.toPath() : null)
      .exitListener(new NonZeroExceptionExitListener())
      .appCommandMetricsEnvironment(getClass().getPackage().getImplementationTitle())
      .appCommandMetricsEnvironmentVersion(getClass().getPackage().getImplementationVersion())
      .addStdOutLineListener(listener)
      .addStdErrLineListener(listener);
}
项目:javafx-gradle-plugin    文件:JfxAbstractWorker.java   
protected void redirectIO(Process p, Logger logger) {
    // when being on daemon-mode, we have to pipe it to the logger
    // @see https://github.com/FibreFoX/javafx-gradle-plugin/issues/29
    new StreamGobbler(p.getInputStream(), consumeInputLine -> {
        logger.lifecycle(consumeInputLine);
    }).run();
    new StreamGobbler(p.getErrorStream(), consumeInputLine -> {
        logger.lifecycle(consumeInputLine);
    }).run();
}
项目:javafx-gradle-plugin    文件:JfxNativeWorker.java   
private boolean shouldBundlerRun(String requestedBundler, String currentRunningBundlerID, JavaFXGradlePluginExtension ext, final Logger logger, Map<String, ? super Object> params) {
    if( requestedBundler != null && !"ALL".equalsIgnoreCase(requestedBundler) && !requestedBundler.equalsIgnoreCase(currentRunningBundlerID) ){
        // this is not the specified bundler
        return false;
    }

    if( ext.isSkipJNLP() && "jnlp".equalsIgnoreCase(currentRunningBundlerID) ){
        logger.info("Skipped JNLP-bundling as requested.");
        return false;
    }

    boolean runBundler = true;
    // Workaround for native installer bundle not creating working executable native launcher
    // (this is a comeback of issue 124)
    // https://github.com/javafx-maven-plugin/javafx-maven-plugin/issues/205
    // do run application bundler and put the cfg-file to application resources
    if( System.getProperty("os.name").toLowerCase().startsWith("linux") ){
        if( workarounds.isWorkaroundForBug205Needed() ){
            // check if special conditions for this are met (not jnlp, but not linux.app too, because another workaround already works)
            if( !"jnlp".equalsIgnoreCase(requestedBundler) && !"linux.app".equalsIgnoreCase(requestedBundler) && "linux.app".equalsIgnoreCase(currentRunningBundlerID) ){
                if( !ext.isSkipNativeLauncherWorkaround205() ){
                    logger.info("Detected linux application bundler ('linux.app') needs to run before installer bundlers are executed.");
                    runBundler = true;
                    params.put(CFG_WORKAROUND_MARKER, "true");
                } else {
                    logger.info("Skipped workaround for native linux installer bundlers.");
                }
            }
        }
    }
    return runBundler;
}
项目:gradle-modernizer-plugin    文件:ModernizerWrapper.java   
public static void execute(ModernizerPluginExtension extension,
        Path classesDir,
        List<Path> sourceDirs,
        Logger logger) throws Exception {

    Modernizer modernizer = getModernizer(extension);

    List<ViolationOccurrence> foundViolations;
    try (Stream<Path> walk = Files.walk(classesDir)) {
        foundViolations = walk
                .filter(Files::isRegularFile)
                .filter(p -> p.toString().endsWith(".class"))
                .flatMap(p -> {
                            try (InputStream is = Files.newInputStream(p)) {
                                return modernizer.check(is)
                                        .stream()
                                        .peek(v -> {
                                            final Path sourcePath = sourceFileName(p, classesDir, sourceDirs);
                                            final String message = String.format("%s:%d: %s",
                                                    sourcePath.toString(),
                                                    v.getLineNumber(),
                                                    v.getViolation().getComment());
                                            logger.warn(message);
                                        });
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }
                        }
                )
                .collect(Collectors.toList());
    }

    if (!foundViolations.isEmpty() && extension.isFailOnViolations()) {
        throw new Exception("Found " + foundViolations.size() + " violations");
    }
}
项目:shipkit    文件:DefaultProcessRunner.java   
String run(Logger log, List<String> commandLine) {
    // WARNING!!! ensure that masked command line is used for all logging!!!
    String maskedCommandLine = mask(join(commandLine, " "));
    log.lifecycle("  Executing:\n    " + maskedCommandLine);

    ProcessResult result = executeProcess(commandLine, maskedCommandLine);

    if (result.getExitValue() != 0) {
        return executionOfCommandFailed(maskedCommandLine, result);
    } else {
        String output = result.getOutput();
        LOG.info("Output from external process '{}':\n{}", maskedCommandLine, output);
        return output;
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RepackagePluginFeatures.java   
private void setupInputOutputs(Jar jarTask, String classifier) {
    Logger logger = this.project.getLogger();
    logger.debug("Using classifier: " + classifier + " for task "
            + this.task.getName());
    File inputFile = jarTask.getArchivePath();
    String outputName = inputFile.getName();
    outputName = StringUtils.stripFilenameExtension(outputName) + "-" + classifier
            + "." + StringUtils.getFilenameExtension(outputName);
    File outputFile = new File(inputFile.getParentFile(), outputName);
    this.task.getInputs().file(jarTask);
    addLibraryDependencies(this.task);
    this.task.getOutputs().file(outputFile);
    this.task.setOutputFile(outputFile);
}
项目:fabric-loom    文件:DownloadTask.java   
public static void downloadMcJson(LoomGradleExtension extension, Logger logger) throws IOException {
    if (!Constants.MINECRAFT_JSON.get(extension).exists()) {
        logger.lifecycle(":downloading minecraft json");
        FileUtils.copyURLToFile(new URL("https://launchermeta.mojang.com/mc/game/version_manifest.json"), Constants.VERSION_MANIFEST.get(extension));
        ManifestVersion mcManifest = new GsonBuilder().create().fromJson(FileUtils.readFileToString(Constants.VERSION_MANIFEST.get(extension), "UTF-8"), ManifestVersion.class);

        Optional<ManifestVersion.Versions> optionalVersion = mcManifest.versions.stream().filter(versions -> versions.id.equalsIgnoreCase(extension.version)).findFirst();
        if (optionalVersion.isPresent()) {
            FileUtils.copyURLToFile(new URL(optionalVersion.get().url), Constants.MINECRAFT_JSON.get(extension));
        } else {
            logger.info(":failed downloading minecraft json");
            throw new RuntimeException("Failed downloading Minecraft json");
        }
    }
}
项目:spring-boot-concourse    文件:RepackagePluginFeatures.java   
private void setupInputOutputs(Jar jarTask, String classifier) {
    Logger logger = this.project.getLogger();
    logger.debug("Using classifier: " + classifier + " for task "
            + this.task.getName());
    File inputFile = jarTask.getArchivePath();
    String outputName = inputFile.getName();
    outputName = StringUtils.stripFilenameExtension(outputName) + "-" + classifier
            + "." + StringUtils.getFilenameExtension(outputName);
    File outputFile = new File(inputFile.getParentFile(), outputName);
    this.task.getInputs().file(jarTask);
    addLibraryDependencies(this.task);
    this.task.getOutputs().file(outputFile);
    this.task.setOutputFile(outputFile);
}
项目:intellij-ce-playground    文件:ProductFlavorFactory.java   
public ProductFlavorFactory(@NonNull Instantiator instantiator,
        @NonNull Project project,
        @NonNull Logger logger) {
    this.instantiator = instantiator;
    this.project = project;
    this.logger = logger;
}
项目:intellij-ce-playground    文件:BuildTypeFactory.java   
public BuildTypeFactory(@NonNull Instantiator instantiator,
                        @NonNull Project project,
                        @NonNull Logger logger) {
    this.instantiator = instantiator;
    this.project = project;
    this.logger = logger;
}
项目:intellij-ce-playground    文件:UninstallTask.java   
@TaskAction
public void uninstall() throws DeviceException {
    final Logger logger = getLogger();
    final String applicationId = variant.getApplicationId();

    logger.info("Uninstalling app: {}", applicationId);

    final ILogger lifecycleLogger = new LoggerWrapper(getLogger(), LogLevel.LIFECYCLE);
    final DeviceProvider deviceProvider =
            new ConnectedDeviceProvider(getAdbExe(), lifecycleLogger);

    deviceProvider.init();
    final List<? extends DeviceConnector> devices = deviceProvider.getDevices();

    for (DeviceConnector device : devices) {
        device.uninstallPackage(applicationId, getTimeOutInMs(), getILogger());
        logger.lifecycle(
                "Uninstalling {} (from {}:{}) from device '{}' ({}).",
                applicationId, getProject().getName(),
                variant.getVariantConfiguration().getFullName(),
                device.getName(), device.getSerialNumber());
    }

    int n = devices.size();
    logger.quiet("Uninstalled {} from {} device{}.",
            applicationId, n, n == 1 ? "" : "s");

}
项目:gradle-plugins    文件:JavadocLinksPlugin.java   
private void addLink(Javadoc javadoc, String link) {
    MinimalJavadocOptions options = javadoc.getOptions();
    if (options instanceof StandardJavadocDocletOptions) {
        StandardJavadocDocletOptions docletOptions = (StandardJavadocDocletOptions) options;
        Logger logger = javadoc.getLogger();
        List<String> links = docletOptions.getLinks();

        if (!links.contains(link)) {
            logger.debug("Adding '{}' to {}", link, javadoc);
            links.add(link);
        } else {
            logger.info("Not adding '{}' to {} because it's already present", link, javadoc);
        }
    }
}
项目:contestparser    文件:RepackagePluginFeatures.java   
private void setupInputOutputs(Jar jarTask, String classifier) {
    Logger logger = this.project.getLogger();
    logger.debug("Using classifier: " + classifier + " for task "
            + this.task.getName());
    File inputFile = jarTask.getArchivePath();
    String outputName = inputFile.getName();
    outputName = StringUtils.stripFilenameExtension(outputName) + "-" + classifier
            + "." + StringUtils.getFilenameExtension(outputName);
    File outputFile = new File(inputFile.getParentFile(), outputName);
    this.task.getInputs().file(jarTask);
    addLibraryDependencies(this.task);
    this.task.getOutputs().file(outputFile);
    this.task.setOutputFile(outputFile);
}
项目:aws-device-farm-gradle-plugin    文件:DeviceFarmServer.java   
public DeviceFarmServer(final DeviceFarmExtension extension,
                        final Logger logger, final AWSDeviceFarmClient deviceFarmClient) throws IOException {

    this(extension, logger, deviceFarmClient,
            new DeviceFarmUploader(deviceFarmClient, logger),
            new DeviceFarmUtils(deviceFarmClient, extension));
}
项目:aws-device-farm-gradle-plugin    文件:DeviceFarmServer.java   
public DeviceFarmServer(final DeviceFarmExtension extension,
                        final Logger logger, final AWSDeviceFarm deviceFarmClient,
                        final DeviceFarmUploader uploader,
                        final DeviceFarmUtils utils) throws IOException {

    this.extension = extension;
    this.logger = logger;
    this.api = deviceFarmClient;
    this.uploader = uploader;
    this.utils = utils;
}
项目:Pushjet-Android    文件:JsHint.java   
@TaskAction
public void doJsHint() {
    RhinoWorkerHandleFactory handleFactory = new DefaultRhinoWorkerHandleFactory(getWorkerProcessBuilderFactory());

    LogLevel logLevel = getProject().getGradle().getStartParameter().getLogLevel();
    RhinoWorkerHandle<JsHintResult, JsHintSpec> rhinoHandle = handleFactory.create(getRhinoClasspath(), createWorkerSpec(), logLevel, new Action<JavaExecSpec>() {
        public void execute(JavaExecSpec javaExecSpec) {
            javaExecSpec.setWorkingDir(getProject().getProjectDir());
        }
    });

    JsHintSpec spec = new JsHintSpec();
    spec.setSource(getSource().getFiles()); // flatten because we need to serialize
    spec.setEncoding(getEncoding());
    spec.setJsHint(getJsHint().getSingleFile());

    JsHintResult result = rhinoHandle.process(spec);
    setDidWork(true);

    // TODO - this is all terribly lame. We need some proper reporting here (which means implementing Reporting).

    Logger logger = getLogger();
    boolean anyErrors = false;

    Map<String, Map<?, ?>> reportData = new LinkedHashMap<String, Map<?, ?>>(result.getResults().size());
    for (Map.Entry<File, Map<String, Object>> fileEntry: result.getResults().entrySet()) {
        File file = fileEntry.getKey();
        Map<String, Object> data = fileEntry.getValue();

        reportData.put(file.getAbsolutePath(), data);

        if (data.containsKey("errors")) {
            anyErrors = true;

            URI projectDirUri = getProject().getProjectDir().toURI();
            @SuppressWarnings("unchecked") Map<String, Object> errors = (Map<String, Object>) data.get("errors");
            if (!errors.isEmpty()) {
                URI relativePath = projectDirUri.relativize(file.toURI());
                logger.warn("JsHint errors for file: {}", relativePath.getPath());
                for (Map.Entry<String, Object> errorEntry : errors.entrySet()) {
                    @SuppressWarnings("unchecked") Map<String, Object> error = (Map<String, Object>) errorEntry.getValue();
                    int line = Float.valueOf(error.get("line").toString()).intValue();
                    int character = Float.valueOf(error.get("character").toString()).intValue();
                    String reason = error.get("reason").toString();

                    logger.warn("  {}:{} > {}", new Object[] {line, character, reason});
                }
            }
        }
    }

    File jsonReportFile = getJsonReport();
    if (jsonReportFile != null) {
        try {
            FileWriter reportWriter = new FileWriter(jsonReportFile);
            new GsonBuilder().setPrettyPrinting().create().toJson(reportData, reportWriter);
            reportWriter.close();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    if (anyErrors) {
        throw new TaskExecutionException(this, new GradleException("JsHint detected errors"));
    }
}