private boolean addGradlePropertiesToModel(Map<String, Object> model, SFinishedBuild finishedBuild,
ReleaseManagementConfigModel managementConfig, Map<String, String> runnerParameters) throws IOException {
List<String> releasePropertyKeys = getPropertyKeys(RunnerParameterKeys.RELEASE_PROPERTIES, runnerParameters);
List<String> nextIntegrationPropertyKeys = getPropertyKeys(RunnerParameterKeys.NEXT_INTEGRATION_PROPERTIES,
runnerParameters);
File artifactsDirectory = new File(finishedBuild.getBuildType().getArtifactsDirectory(),
finishedBuild.getBuildId() + "");
File gradlePropertiesFile =
new File(artifactsDirectory, ".teamcity/" + ConstantValues.GRADLE_PROPERTIES_FILE_NAME_PACKED);
if (gradlePropertiesFile.exists()) {
Properties gradleProperties = new Properties();
InputStream stream = null;
try {
stream = new GZIPInputStream(new FileInputStream(gradlePropertiesFile));
gradleProperties.load(stream);
} finally {
IOUtils.closeQuietly(stream);
}
addPropertiesToModel(model, managementConfig, releasePropertyKeys, gradleProperties, true);
addPropertiesToModel(model, managementConfig, nextIntegrationPropertyKeys, gradleProperties, false);
return true;
} else {
throw new FileNotFoundException("Unable to find gradle properties file at '" +
gradlePropertiesFile.getAbsolutePath() + "' for build '" + finishedBuild.getBuildNumber() + "'");
}
}