public static Run getRun(File file) throws Exception { if (!file.isFile()) { return null; } File projectDir = file.getParentFile(); File workspaceDir = projectDir.getParentFile(); if (!workspaceDir.isDirectory()) { return null; } Workspace ws = getWorkspaceWithoutException(workspaceDir); if (ws == null) { return null; } return new Run(ws, projectDir, file); }
public static Run getRun(File file) throws Exception { if (!file.isFile()) { return null; } File projectDir = file.getParentFile(); File workspaceDir = projectDir.getParentFile(); if (!workspaceDir.isDirectory()) { return null; } Workspace ws = getWorkspaceWithoutException(workspaceDir); if (ws == null) { return null; } return new Run(ws, projectDir, file); }
public static Run getRun(File file) throws Exception { if (!file.isFile()) { return null; } File projectDir = file.getParentFile(); File workspaceDir = projectDir.getParentFile(); if (!workspaceDir.isDirectory()) { return null; } Workspace ws = getWorkspaceWithoutException(workspaceDir); if (ws == null) { return null; } return new Run(ws, projectDir, file); }
public static Run getRun(File file) throws Exception { if (!file.isFile()) { return null; } File projectDir = file.getParentFile(); File workspaceDir = projectDir.getParentFile(); if (!workspaceDir.isDirectory()) { return null; } Workspace ws = getWorkspaceWithoutException(workspaceDir); if (ws == null) { return null; } return new Run(ws, projectDir, file); }
/** * Add all bundles resolved by bndrun file to system-under-test. * * @param runFileSpec bndrun file to be used. * * @return this. */ public Option fromBndrun(String runFileSpec) { try { File runFile = workspace.getFile(runFileSpec); Run bndRunInstruction = new Run(workspace, runFile.getParentFile(), runFile); return bndToExam(bndRunInstruction); } catch (Exception e) { throw new RuntimeException("Underlying Bnd Exception: ",e); } }
/** * Create a Run that will be stand alone if it contains -standalone. In that * case the given workspace is ignored. Otherwise, the workspace must be a * valid workspace. */ public static Run createRun(Workspace workspace, File file) throws Exception { Processor processor; if (workspace != null) { Run run = new Run(workspace, file); if (run.getProperties() .get(STANDALONE) == null) { return run; } // -standalone specified processor = run; } else { processor = new Processor(); processor.setProperties(file); } Workspace standaloneWorkspace = Workspace.createStandaloneWorkspace(processor, file.toURI()); Run run = new Run(standaloneWorkspace, file); return run; }
/** * Create a Run that will be stand alone if it contains -standalone. In that * case the given workspace is ignored. Otherwise, the workspace must be a * valid workspace. */ public static Run createRun(Workspace workspace, File file) throws Exception { Processor processor; if (workspace != null) { Run run = new Run(workspace, file); if (run.getProperties() .get(STANDALONE) == null) { return run; } // -standalone specified processor = run; } else { processor = new Processor(); processor.setProperties(file); } Workspace standaloneWorkspace = Workspace.createStandaloneWorkspace(processor, file.toURI()); Run run = new Run(standaloneWorkspace, file); return run; }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<>(); Map<File, Attrs> files = runspec.select(getBase()); for (Entry<File, Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String, String> ee : e.getValue() .entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<Run>(); Map<File,Attrs> files = runspec.select(getBase()); for (Entry<File,Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String,String> ee : e.getValue().entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<Run>(); Map<File,Attrs> files = runspec.select(getBase()); for (Entry<File,Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String,String> ee : e.getValue().entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }
/** * Return the bndrun files that need to be exported * * @throws Exception */ public List<Run> getExportedRuns() throws Exception { Instructions runspec = new Instructions(getProperty(EXPORT)); List<Run> runs = new ArrayList<>(); Map<File, Attrs> files = runspec.select(getBase()); for (Entry<File, Attrs> e : files.entrySet()) { Run run = new Run(project.getWorkspace(), getBase(), e.getKey()); for (Entry<String, String> ee : e.getValue() .entrySet()) { run.setProperty(ee.getKey(), ee.getValue()); } runs.add(run); } return runs; }
public void export(String runFilePath, boolean keep, File output) throws Exception { Map<String, String> options = Collections.singletonMap("keep", Boolean.toString(keep)); Entry<String, Resource> export; if (runFilePath == null || runFilePath.length() == 0 || ".".equals(runFilePath)) { clear(); export = export(ExecutableJarExporter.EXECUTABLE_JAR, options); } else { File runFile = IO.getFile(getBase(), runFilePath); if (!runFile.isFile()) throw new IOException( String.format("Run file %s does not exist (or is not a file).", IO.absolutePath(runFile))); try (Run run = new Run(getWorkspace(), getBase(), runFile)) { export = run.export(ExecutableJarExporter.EXECUTABLE_JAR, options); getInfo(run); } } if (export != null) { try (JarResource r = (JarResource) export.getValue()) { r.getJar() .write(output); } } }
public void export(String runFilePath, boolean keep, File output) throws Exception { Map<String, String> options = Collections.singletonMap("keep", Boolean.toString(keep)); Entry<String, Resource> export; if (runFilePath == null || runFilePath.length() == 0 || ".".equals(runFilePath)) { clear(); export = export(ExecutableJarExporter.EXECUTABLE_JAR, options); } else { File runFile = IO.getFile(getBase(), runFilePath); if (!runFile.isFile()) throw new IOException( String.format("Run file %s does not exist (or is not a file).", IO.absolutePath(runFile))); try (Run run = new Run(getWorkspace(), getBase(), runFile)) { export = run.export(ExecutableJarExporter.EXECUTABLE_JAR, options); getInfo(run); } } if (export != null) { try (JarResource r = (JarResource) export.getValue()) { r.getJar() .write(output); } } }
/** * @since 2.4 */ public void exportRunbundles(String runFilePath, File outputDir) throws Exception { Map<String, String> options = Collections.emptyMap(); Entry<String, Resource> export; if (runFilePath == null || runFilePath.length() == 0 || ".".equals(runFilePath)) { clear(); export = export(RunbundlesExporter.RUNBUNDLES, options); } else { File runFile = IO.getFile(getBase(), runFilePath); if (!runFile.isFile()) throw new IOException( String.format("Run file %s does not exist (or is not a file).", IO.absolutePath(runFile))); try (Run run = new Run(getWorkspace(), getBase(), runFile)) { export = run.export(RunbundlesExporter.RUNBUNDLES, options); getInfo(run); } } if (export != null) { try (JarResource r = (JarResource) export.getValue()) { r.getJar() .writeFolder(outputDir); } } }
/** * @since 2.4 */ public void exportRunbundles(String runFilePath, File outputDir) throws Exception { Map<String, String> options = Collections.emptyMap(); Entry<String, Resource> export; if (runFilePath == null || runFilePath.length() == 0 || ".".equals(runFilePath)) { clear(); export = export(RunbundlesExporter.RUNBUNDLES, options); } else { File runFile = IO.getFile(getBase(), runFilePath); if (!runFile.isFile()) throw new IOException( String.format("Run file %s does not exist (or is not a file).", IO.absolutePath(runFile))); try (Run run = new Run(getWorkspace(), getBase(), runFile)) { export = run.export(RunbundlesExporter.RUNBUNDLES, options); getInfo(run); } } if (export != null) { try (JarResource r = (JarResource) export.getValue()) { r.getJar() .writeFolder(outputDir); } } }
public void _bootstrap(BootstrapOptions options) throws Exception { Workspace ws = getWorkspace(getBase()); File buildDir = ws.getBuildDir(); File bndFile = IO.getFile(buildDir, "bnd.bnd"); if (!bndFile.isFile()) { error("No bnd.bnd file found in cnf directory %s", bndFile); return; } Run run = new Run(ws, buildDir, bndFile); run.runLocal(); getInfo(run); }