Blame | Last modification | View Log | RSS feed
package com.erggroup.buildtool.daemon;import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.List;import java.util.Properties;import com.erggroup.buildtool.ripple.ReportingData;/*** This class is populated from data provided by JATS and ANT about the build that is to be performed* It will contain information about the platforms that the package is to be built for**/public class BuildInfo {public String mStyle = null; // ANT or JATSpublic boolean mGeneric = false; // Package is GENERICpublic String mJavaVersion = null; // Optional java version to be usedpublic List<String> mPlatforms; // Platforms the package can be built forpublic List<String> mBuildPlatforms; // Platforms the package will be built forpublic List<String> mToolsetPlatforms; // Platforms for which tools will be builtpublic List<String> mProdPlatforms; // Platforms that only build for productionpublic List<String> mDebugPlatforms; // Platforms that only build for debug/*** Read properties from a file* @param srcFile* @throws IOException*/public BuildInfo (File srcFile) throws IOException{Properties prop = new Properties();FileInputStream input = new FileInputStream(srcFile);// load the file as a properties fileprop.load(input);// Display the properties read// Set<String> keys = prop.stringPropertyNames();// for (String key : keys) {// System.out.println(key + " : " + prop.getProperty(key));// }// Extract required properties into the classmStyle = prop.getProperty("buildstyle", "JATS");mGeneric = ReportingData.toBool(prop.getProperty("generic.build", "0"));mJavaVersion = prop.getProperty("java.version", null);mPlatforms = toList( prop.getProperty("platforms"));mBuildPlatforms = toList( prop.getProperty("build.platforms"));mToolsetPlatforms = toList( prop.getProperty("toolset.platforms"));mProdPlatforms = toList( prop.getProperty("prod.platforms"));mDebugPlatforms = toList( prop.getProperty("debug.platforms"));}/*** Convert a comma separated string into List<String>* Special handling for null Strings** @param string - A comma separated string. Can have spaces around the commas* @return A List<String>**/private List<String> toList(String string){if (string == null) {return new ArrayList<String>();}return Arrays.asList( string.trim().split("\\s*,\\s*") );}}