@Test public void whenStarting_shouldRunTransform() throws Exception { final TransformRunner runner = mock(TransformRunner.class); CliTransform.main( new CliTransform.TransformRunnerProvider() { @Override public TransformRunner provide() { return runner; } }); verify(runner).runTransform(); }
public static void main(String[] args) { if (args.length != 0) { StringBuilder sb = new StringBuilder() .append( "No argument is expected. All parameters should be passed through java system properties.\n") .append(PROPERTY_IN_JARS_DIR + " : jars input directory\n") .append(PROPERTY_OUT_JARS_DIR + " : jars output directory\n") .append(PROPERTY_CONFIG_FILE + " : configuration file\n") .append(PROPERTY_ANDROID_BOOTCLASSPATH + " : android classpath\n") .append( PROPERTY_TRANSFORM_DEPENDENCIES_FILE + " : transform dependencies [optional]\n") .append(PROPERTY_TRANSFORM_CLASS + " : full qualified name for transform class\n"); throw new IllegalArgumentException(sb.toString()); } final String[] postProcessDependencies = readDependenciesFileFromSystemPropertyVar(PROPERTY_TRANSFORM_DEPENDENCIES_FILE); if (postProcessDependencies.length > 0) { new SystemClassLoader().loadJarFiles(postProcessDependencies); } main( new TransformRunnerProvider() { @Override public TransformRunner provide() { String configFilePath = System.getProperty(PROPERTY_CONFIG_FILE); String inJarsDir = System.getProperty(PROPERTY_IN_JARS_DIR); String outJarsDir = System.getProperty(PROPERTY_OUT_JARS_DIR); String[] androidClasspaths = readDependenciesFromSystemPropertyVar(PROPERTY_ANDROID_BOOTCLASSPATH); try { Class<Transform> transformClass; String transformClassName = System.getProperty(PROPERTY_TRANSFORM_CLASS); if (transformClassName != null) { transformClass = (Class<Transform>) Class.forName(transformClassName); } else { throw new IllegalArgumentException("No transform class defined."); } TransformRunner runner = new TransformRunner( configFilePath, inJarsDir, outJarsDir, androidClasspaths, transformClass); return runner; } catch (Exception e) { throw new IllegalStateException(e); } } }); }
CliTransform { public static void main(String[] args) { if (args.length != 0) { StringBuilder sb = new StringBuilder() .append( "No argument is expected. All parameters should be passed through java system properties.\n") .append(PROPERTY_IN_JARS_DIR + " : jars input directory\n") .append(PROPERTY_OUT_JARS_DIR + " : jars output directory\n") .append(PROPERTY_CONFIG_FILE + " : configuration file\n") .append(PROPERTY_ANDROID_BOOTCLASSPATH + " : android classpath\n") .append( PROPERTY_TRANSFORM_DEPENDENCIES_FILE + " : transform dependencies [optional]\n") .append(PROPERTY_TRANSFORM_CLASS + " : full qualified name for transform class\n"); throw new IllegalArgumentException(sb.toString()); } final String[] postProcessDependencies = readDependenciesFileFromSystemPropertyVar(PROPERTY_TRANSFORM_DEPENDENCIES_FILE); if (postProcessDependencies.length > 0) { new SystemClassLoader().loadJarFiles(postProcessDependencies); } main( new TransformRunnerProvider() { @Override public TransformRunner provide() { String configFilePath = System.getProperty(PROPERTY_CONFIG_FILE); String inJarsDir = System.getProperty(PROPERTY_IN_JARS_DIR); String outJarsDir = System.getProperty(PROPERTY_OUT_JARS_DIR); String[] androidClasspaths = readDependenciesFromSystemPropertyVar(PROPERTY_ANDROID_BOOTCLASSPATH); try { Class<Transform> transformClass; String transformClassName = System.getProperty(PROPERTY_TRANSFORM_CLASS); if (transformClassName != null) { transformClass = (Class<Transform>) Class.forName(transformClassName); } else { throw new IllegalArgumentException("No transform class defined."); } TransformRunner runner = new TransformRunner( configFilePath, inJarsDir, outJarsDir, androidClasspaths, transformClass); return runner; } catch (Exception e) { throw new IllegalStateException(e); } } }); } }
CliTransform { public static void main(String[] args) { if (args.length != 0) { StringBuilder sb = new StringBuilder() .append( "No argument is expected. All parameters should be passed through java system properties.\n") .append(PROPERTY_IN_JARS_DIR + " : jars input directory\n") .append(PROPERTY_OUT_JARS_DIR + " : jars output directory\n") .append(PROPERTY_CONFIG_FILE + " : configuration file\n") .append(PROPERTY_ANDROID_BOOTCLASSPATH + " : android classpath\n") .append( PROPERTY_TRANSFORM_DEPENDENCIES_FILE + " : transform dependencies [optional]\n") .append(PROPERTY_TRANSFORM_CLASS + " : full qualified name for transform class\n"); throw new IllegalArgumentException(sb.toString()); } final String[] postProcessDependencies = readDependenciesFileFromSystemPropertyVar(PROPERTY_TRANSFORM_DEPENDENCIES_FILE); if (postProcessDependencies.length > 0) { new SystemClassLoader().loadJarFiles(postProcessDependencies); } main( new TransformRunnerProvider() { @Override public TransformRunner provide() { String configFilePath = System.getProperty(PROPERTY_CONFIG_FILE); String inJarsDir = System.getProperty(PROPERTY_IN_JARS_DIR); String outJarsDir = System.getProperty(PROPERTY_OUT_JARS_DIR); String[] androidClasspaths = readDependenciesFromSystemPropertyVar(PROPERTY_ANDROID_BOOTCLASSPATH); try { Class<Transform> transformClass; String transformClassName = System.getProperty(PROPERTY_TRANSFORM_CLASS); if (transformClassName != null) { transformClass = (Class<Transform>) Class.forName(transformClassName); } else { throw new IllegalArgumentException("No transform class defined."); } TransformRunner runner = new TransformRunner( configFilePath, inJarsDir, outJarsDir, androidClasspaths, transformClass); return runner; } catch (Exception e) { throw new IllegalStateException(e); } } }); } private  CliTransform(); }
CliTransform { public static void main(String[] args) { if (args.length != 0) { StringBuilder sb = new StringBuilder() .append( "No argument is expected. All parameters should be passed through java system properties.\n") .append(PROPERTY_IN_JARS_DIR + " : jars input directory\n") .append(PROPERTY_OUT_JARS_DIR + " : jars output directory\n") .append(PROPERTY_CONFIG_FILE + " : configuration file\n") .append(PROPERTY_ANDROID_BOOTCLASSPATH + " : android classpath\n") .append( PROPERTY_TRANSFORM_DEPENDENCIES_FILE + " : transform dependencies [optional]\n") .append(PROPERTY_TRANSFORM_CLASS + " : full qualified name for transform class\n"); throw new IllegalArgumentException(sb.toString()); } final String[] postProcessDependencies = readDependenciesFileFromSystemPropertyVar(PROPERTY_TRANSFORM_DEPENDENCIES_FILE); if (postProcessDependencies.length > 0) { new SystemClassLoader().loadJarFiles(postProcessDependencies); } main( new TransformRunnerProvider() { @Override public TransformRunner provide() { String configFilePath = System.getProperty(PROPERTY_CONFIG_FILE); String inJarsDir = System.getProperty(PROPERTY_IN_JARS_DIR); String outJarsDir = System.getProperty(PROPERTY_OUT_JARS_DIR); String[] androidClasspaths = readDependenciesFromSystemPropertyVar(PROPERTY_ANDROID_BOOTCLASSPATH); try { Class<Transform> transformClass; String transformClassName = System.getProperty(PROPERTY_TRANSFORM_CLASS); if (transformClassName != null) { transformClass = (Class<Transform>) Class.forName(transformClassName); } else { throw new IllegalArgumentException("No transform class defined."); } TransformRunner runner = new TransformRunner( configFilePath, inJarsDir, outJarsDir, androidClasspaths, transformClass); return runner; } catch (Exception e) { throw new IllegalStateException(e); } } }); } private  CliTransform(); static void main(String[] args); }
CliTransform { public static void main(String[] args) { if (args.length != 0) { StringBuilder sb = new StringBuilder() .append( "No argument is expected. All parameters should be passed through java system properties.\n") .append(PROPERTY_IN_JARS_DIR + " : jars input directory\n") .append(PROPERTY_OUT_JARS_DIR + " : jars output directory\n") .append(PROPERTY_CONFIG_FILE + " : configuration file\n") .append(PROPERTY_ANDROID_BOOTCLASSPATH + " : android classpath\n") .append( PROPERTY_TRANSFORM_DEPENDENCIES_FILE + " : transform dependencies [optional]\n") .append(PROPERTY_TRANSFORM_CLASS + " : full qualified name for transform class\n"); throw new IllegalArgumentException(sb.toString()); } final String[] postProcessDependencies = readDependenciesFileFromSystemPropertyVar(PROPERTY_TRANSFORM_DEPENDENCIES_FILE); if (postProcessDependencies.length > 0) { new SystemClassLoader().loadJarFiles(postProcessDependencies); } main( new TransformRunnerProvider() { @Override public TransformRunner provide() { String configFilePath = System.getProperty(PROPERTY_CONFIG_FILE); String inJarsDir = System.getProperty(PROPERTY_IN_JARS_DIR); String outJarsDir = System.getProperty(PROPERTY_OUT_JARS_DIR); String[] androidClasspaths = readDependenciesFromSystemPropertyVar(PROPERTY_ANDROID_BOOTCLASSPATH); try { Class<Transform> transformClass; String transformClassName = System.getProperty(PROPERTY_TRANSFORM_CLASS); if (transformClassName != null) { transformClass = (Class<Transform>) Class.forName(transformClassName); } else { throw new IllegalArgumentException("No transform class defined."); } TransformRunner runner = new TransformRunner( configFilePath, inJarsDir, outJarsDir, androidClasspaths, transformClass); return runner; } catch (Exception e) { throw new IllegalStateException(e); } } }); } private  CliTransform(); static void main(String[] args);  }