public void generate() throws IOException { Map<String, String> map = new HashMap<String, String>(); map.put(PH_PACKAGE, mPackageName); map.put(PH_MIN_SDK_VERSION, mMinSdkVersion != null ? mMinSdkVersion : "1"); map.put(PH_TARGET_SDK_VERSION, mTargetSdkVersion != null ? mTargetSdkVersion : map.get(PH_MIN_SDK_VERSION)); map.put(PH_TESTED_PACKAGE, mTestedPackageName); map.put(PH_TEST_RUNNER, mTestRunnerName); map.put(PH_HANDLE_PROFILING, Boolean.toString(mHandleProfiling)); map.put(PH_FUNCTIONAL_TEST, Boolean.toString(mFunctionalTest)); URL resource = TestManifestGenerator.class.getResource(TEMPLATE); if (resource != null) { URLConnection urlConnection = resource.openConnection(); urlConnection.setUseCaches(false); TemplateProcessor processor = new TemplateProcessor( urlConnection.getInputStream(), map); processor.generate(mOutputFile); } else { throw new RuntimeException("Cannot load template, restart gradle daemons ?"); } } }
public void generate() throws IOException { Map<String, String> map = new HashMap<String, String>(); map.put(PH_PACKAGE, mPackageName); map.put(PH_MIN_SDK_VERSION, mMinSdkVersion != null ? mMinSdkVersion : "1"); map.put(PH_TARGET_SDK_VERSION, mTargetSdkVersion != null ? mTargetSdkVersion : map.get(PH_MIN_SDK_VERSION)); map.put(PH_TESTED_PACKAGE, mTestedPackageName); map.put(PH_TEST_RUNNER, mTestRunnerName); map.put(PH_HANDLE_PROFILING, Boolean.toString(mHandleProfiling)); map.put(PH_FUNCTIONAL_TEST, Boolean.toString(mFunctionalTest)); URL resource = TestManifestGenerator.class.getResource(TEMPLATE); if (resource != null) { URLConnection urlConnection = resource.openConnection(); urlConnection.setUseCaches(false); TemplateProcessor processor = new TemplateProcessor( urlConnection.getInputStream(), map); processor.generate(mOutputFile); } else { throw new RuntimeException("Cannot load template, restart gradle daemons ?"); } } }