@@ -0,0 +1,2034 @@
+package de.fosd.jdime;%0A%0Aimport de.fosd.jdime.common.ArtifactList;%0Aimport de.fosd.jdime.common.FileArtifact;%0Aimport de.fosd.jdime.common.MergeContext;%0Aimport de.fosd.jdime.common.Revision;%0Aimport de.fosd.jdime.common.operations.MergeOperation;%0Aimport de.fosd.jdime.common.operations.Operation;%0Aimport de.fosd.jdime.strategy.NWayStrategy;%0Aimport org.apache.commons.io.FilenameUtils;%0Aimport org.apache.commons.lang3.ClassUtils;%0Aimport org.apache.log4j.BasicConfigurator;%0Aimport org.apache.log4j.Level;%0Aimport org.apache.log4j.Logger;%0A%0Aimport java.io.File;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException;%0A%0Apublic class JDimeWrapper %7B%0A%09private static final Logger LOG = Logger.getLogger(ClassUtils.getShortClassName(JDimeWrapper.class));%0A%0A%09public static void main(String%5B%5D args) throws IOException, InterruptedException %7B%0A%09%09// setup log4j (otherwise we will drown in debug output)%0A%09%09BasicConfigurator.configure();%0A%09%09Logger.getRootLogger().setLevel(Level.INFO);%0A%0A%09%09// setup JDime using the MergeContext%0A%09%09MergeContext context = new MergeContext();%0A%09%09context.setMergeStrategy(new NWayStrategy());%0A%09%09context.setPretend(true);%0A%09%09context.setQuiet(false);%0A%0A%09%09// prepare the list of input files%0A%09%09ArtifactList%3CFileArtifact%3E inputArtifacts = new ArtifactList%3C%3E();%0A%0A%09%09for (Object filename : args) %7B%0A%09%09%09try %7B%0A%09%09%09%09FileArtifact newArtifact = new FileArtifact(new File((String) filename));%0A%0A%09%09%09%09// set the revision name, this will be used as condition for ifdefs%0A%09%09%09%09// as an example, I'll just use the filenames%0A%09%09%09%09newArtifact.setRevision(new Revision(FilenameUtils.getBaseName(newArtifact.getPath())));%0A%0A%09%09%09%09inputArtifacts.add(newArtifact);%0A%09%09%09%7D catch (FileNotFoundException e) %7B%0A%09%09%09%09System.err.println(%22Input file not found: %22 + (String) filename);%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09context.setInputFiles(inputArtifacts);%0A%0A%09%09// create the merge operation%0A%09%09Operation%3CFileArtifact%3E merge = new MergeOperation%3C%3E(context.getInputFiles(), context.getOutputFile(), null, null, context.isConditionalMerge());%0A%0A%09%09// run the merge%0A%09%09merge.apply(context);%0A%09%7D%0A%7D%0A

Add JDime wrapper class.