// TODO: check for valid parameters
AndroidSdkTool tool = new AndroidSdkTool(revision, os, architecture, rootDir, overwrite, verbose, agree);
// step 1: refresh and parse repository
Repository repository = tool.downloadRepository();
logger.info("\n\n" + repository.getLicense().getText());
logger.info("\n\n");
// step 2: EULA agreement
if(!agree)
{
logger.warn("Do you agree with the EULA? [y/N]");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String answer = in.readLine();
if(answer!=null && ("yes".equals(answer.toLowerCase()) || "y".equals(answer.toLowerCase())))
{
logger.info("You agreed with the EULA!");
}
else
{
logger.error("You have to agree with the EULA!");
return;
}
}
if(sdk)
{
// step 3: download the SDK
String sdkFile = tool.downloadSdk();
// step 4: install SDK
tool.install(sdkFile, tool.getInstallDir(), overwrite);
}
// platform
for(Platform platform : repository.getPlatforms())
{
String file = tool.downloadItem(platform, os);
tool.install(file, tool.getInstallDir(platform), overwrite);
}
// add-on
for(AddOn addOn : repository.getAddOns())
{
String file = tool.downloadItem(addOn, os);
tool.install(file, tool.getInstallDir(addOn), overwrite);
tool.writeSourceProperties(tool.getInstallDir(addOn), addOn);
}
// extra
for(Extra extra : repository.getExtras())
{
String file = tool.downloadItem(extra, os);
tool.install(file, tool.getInstallDir(extra), overwrite);
tool.writeSourceProperties(tool.getInstallDir(extra), extra);
}
// sample
for(Sample sample : repository.getSamples())
{
String file = tool.downloadItem(sample, os);
tool.install(file, tool.getInstallDir(sample), true);
}
// doc
for(Doc doc : repository.getDocs())
{
String file = tool.downloadItem(doc, os);
tool.install(file, tool.getInstallDir(doc), true);
}
// tool
for(Tool t : repository.getTools())
{
String file = tool.downloadItem(t, os);
// There is a seperate tools package in the repository;
// when unzipping it under Linux the execute flags are not