Fix output of path preprocessed application package is written to
package com.yahoo.application.preprocessor;
import com.yahoo.config.application.api.ApplicationPackage;
-import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.config.model.application.provider.BaseDeployLogger;
import com.yahoo.config.model.application.provider.FilesApplicationPackage;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
import com.yahoo.yolean.Exceptions;
-
import java.io.File;
import java.io.IOException;
import java.util.Optional;
@@ -34,19 +32,18 @@ public class ApplicationPreprocessor {
}
public void run() throws IOException {
- DeployLogger logger = new BaseDeployLogger();
FilesApplicationPackage.Builder applicationPackageBuilder = new FilesApplicationPackage.Builder(applicationDir);
outputDir.ifPresent(applicationPackageBuilder::preprocessedDir);
ApplicationPackage preprocessed = applicationPackageBuilder.build().preprocess(
new Zone(environment.orElse(Environment.defaultEnvironment()), region.orElse(RegionName.defaultName())),
- logger);
+ new BaseDeployLogger());
preprocessed.validateXML();
}
- public static void main(String args[]) {
+ public static void main(String[] args) {
int argCount = args.length;
if (argCount < 1) {
- System.out.println("Usage: application-preprocessor <application> [environment] [region] [outputDirectory]");
+ System.out.println("Usage: vespa-application-preprocessor <application package path> [environment] [region] [output path]");
System.exit(1);
}
File applicationDir = new File(args[0]);
@@ -56,8 +53,8 @@ public class ApplicationPreprocessor {
ApplicationPreprocessor preprocessor = new ApplicationPreprocessor(applicationDir, outputDir, environment, region);
try {
preprocessor.run();
- System.out.println("Application preprocessed successfully. Preprocessed application stored in " +
- new File(applicationDir, FilesApplicationPackage.preprocessed).getAbsolutePath());
+ System.out.println("Application preprocessed successfully and written to " +
+ outputDir.orElse(new File(applicationDir, FilesApplicationPackage.preprocessed)).getAbsolutePath());
} catch (Exception e) {
System.err.println("Error validating application package: " + Exceptions.toMessageString(e));
System.exit(1);
