Java Code Examples for org.gradle.util.GUtil#saveProperties()

The following examples show how to use org.gradle.util.GUtil#saveProperties() . 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: SonarRunner.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
JavaExecHandleBuilder prepareExec() {
    Map<String, Object> properties = getSonarProperties();

    if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Executing Sonar Runner with properties:\n[{}]", Joiner.on(", ").withKeyValueSeparator(": ").join(properties));
    }

    JavaExecHandleBuilder javaExec = new JavaExecHandleBuilder(getFileResolver());
    getForkOptions().copyTo(javaExec);

    FileCollection sonarRunnerConfiguration = getProject().getConfigurations().getAt(SonarRunnerExtension.SONAR_RUNNER_CONFIGURATION_NAME);

    Properties propertiesObject = new Properties();
    propertiesObject.putAll(properties);
    File propertyFile = new File(getTemporaryDir(), "sonar-project.properties");
    GUtil.saveProperties(propertiesObject, propertyFile);

    return javaExec
            .systemProperty("project.settings", propertyFile.getAbsolutePath())

            // This value is set in the properties file, but Sonar Runner 2.4 requires it on the command line as well
            // http://forums.gradle.org/gradle/topics/gradle-2-2-nightly-sonarrunner-task-fails-with-toolversion-2-4
            .systemProperty("project.home", getProject().getProjectDir().getAbsolutePath())

            .setClasspath(sonarRunnerConfiguration)
            .setMain(MAIN_CLASS_NAME);
}
 
Example 2
Source File: DefaultPersistentDirectoryCache.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void initialize(FileLock fileLock) {
    for (File file : getBaseDir().listFiles()) {
        if (fileLock.isLockFile(file) || file.equals(propertiesFile)) {
            continue;
        }
        GFileUtils.forceDelete(file);
    }
    if (initAction != null) {
        initAction.execute(DefaultPersistentDirectoryCache.this);
    }
    GUtil.saveProperties(properties, propertiesFile);
    didRebuild = true;
}
 
Example 3
Source File: DefaultPersistentDirectoryCache.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void initialize(FileLock fileLock) {
    for (File file : getBaseDir().listFiles()) {
        if (fileLock.isLockFile(file) || file.equals(propertiesFile)) {
            continue;
        }
        GFileUtils.forceDelete(file);
    }
    if (initAction != null) {
        initAction.execute(DefaultPersistentDirectoryCache.this);
    }
    GUtil.saveProperties(properties, propertiesFile);
    didRebuild = true;
}
 
Example 4
Source File: SonarRunner.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
JavaExecHandleBuilder prepareExec() {
    Map<String, Object> properties = getSonarProperties();

    if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Executing Sonar Runner with properties:\n[{}]", Joiner.on(", ").withKeyValueSeparator(": ").join(properties));
    }

    JavaExecHandleBuilder javaExec = new JavaExecHandleBuilder(getFileResolver());
    getForkOptions().copyTo(javaExec);

    FileCollection sonarRunnerConfiguration = getProject().getConfigurations().getAt(SonarRunnerExtension.SONAR_RUNNER_CONFIGURATION_NAME);

    Properties propertiesObject = new Properties();
    propertiesObject.putAll(properties);
    File propertyFile = new File(getTemporaryDir(), "sonar-project.properties");
    GUtil.saveProperties(propertiesObject, propertyFile);

    return javaExec
            .systemProperty("project.settings", propertyFile.getAbsolutePath())

            // This value is set in the properties file, but Sonar Runner 2.4 requires it on the command line as well
            // http://forums.gradle.org/gradle/topics/gradle-2-2-nightly-sonarrunner-task-fails-with-toolversion-2-4
            .systemProperty("project.home", getProject().getProjectDir().getAbsolutePath())

            .setClasspath(sonarRunnerConfiguration)
            .setMain(MAIN_CLASS_NAME);
}
 
Example 5
Source File: DefaultPersistentDirectoryCache.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void initialize(FileLock fileLock) {
    for (File file : getBaseDir().listFiles()) {
        if (fileLock.isLockFile(file) || file.equals(propertiesFile)) {
            continue;
        }
        GFileUtils.forceDelete(file);
    }
    if (initAction != null) {
        initAction.execute(DefaultPersistentDirectoryCache.this);
    }
    GUtil.saveProperties(properties, propertiesFile);
    didRebuild = true;
}
 
Example 6
Source File: DefaultPersistentDirectoryCache.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void initialize(FileLock fileLock) {
    for (File file : getBaseDir().listFiles()) {
        if (fileLock.isLockFile(file) || file.equals(propertiesFile)) {
            continue;
        }
        GFileUtils.forceDelete(file);
    }
    if (initAction != null) {
        initAction.execute(DefaultPersistentDirectoryCache.this);
    }
    GUtil.saveProperties(properties, propertiesFile);
    didRebuild = true;
}