use of com.twinsoft.convertigo.engine.util.EventHelper in project convertigo by convertigo.
the class Ionic3Builder method init.
@Override
protected synchronized void init() throws EngineException {
if (initDone) {
return;
}
ApplicationComponent application = (ApplicationComponent) project.getMobileApplication().getApplicationComponent();
String tplName = application.getTplProjectName();
if (!project.getName().equals(tplName)) {
try {
Engine.theApp.referencedProjectManager.getReferenceFromProject(project, tplName);
Engine.theApp.referencedProjectManager.importProjectFrom(project, tplName);
} catch (Exception e) {
throw new EngineException("Failed to import referenced template: " + tplName + " :" + e.getMessage(), e);
}
}
ionicTplDir = application.getIonicTplDir();
if (!ionicTplDir.exists()) {
throw new EngineException("Missing template project '" + application.getTplProjectName() + "'\nThe template folder should be in: " + ionicTplDir.getPath());
}
if (Engine.isStudioMode()) {
File devicePref = new File(Engine.USER_WORKSPACE_PATH, "studio/device-" + project.getName() + ".json");
if (devicePref.exists()) {
try {
JSONObject device = new JSONObject(FileUtils.readFileToString(devicePref, "UTF-8"));
buildMode = MobileBuilderBuildMode.get(device.getString("buildMode"));
} catch (Exception e) {
}
}
}
if (isIonicTemplateBased()) {
if (eventHelper == null) {
eventHelper = new EventHelper();
}
setNeedPkgUpdate(false);
// Clean directories
cleanDirectories();
// Copy template directory to working directory
copyTemplateFiles();
// Copy template assets to build directory
copyAssetsToBuildDir();
// Modify configuration files
updateConfigurationFiles();
// Tpl version
updateTplVersion();
// PWA
configurePwaApp(application);
// Write source files (based on bean components)
updateSourceFiles();
// Studio mode : start worker for build process
if (Engine.isStudioMode() || Engine.isCliMode()) {
if (pushedFiles == null) {
pushedFiles = new HashMap<String, CharSequence>();
}
if (queue == null) {
queue = new LinkedBlockingQueue<Map<String, CharSequence>>();
}
if (worker == null) {
worker = new MbWorker(queue);
if (Engine.isStudioMode()) {
worker.start();
} else {
worker.process();
}
}
}
initDone = true;
Engine.logEngine.debug("(MobileBuilder) Initialized builder for ionic project '" + project.getName() + "'");
}
}
use of com.twinsoft.convertigo.engine.util.EventHelper in project convertigo by convertigo.
the class NgxBuilder method init.
@Override
protected synchronized void init() throws EngineException {
if (initDone) {
return;
}
ApplicationComponent application = (ApplicationComponent) project.getMobileApplication().getApplicationComponent();
String tplName = application.getTplProjectName();
if (!project.getName().equals(tplName)) {
try {
Engine.theApp.referencedProjectManager.getReferenceFromProject(project, tplName);
Engine.theApp.referencedProjectManager.importProjectFrom(project, tplName);
} catch (Exception e) {
throw new EngineException("Failed to import referenced template: " + tplName + " :" + e.getMessage(), e);
}
}
ionicTplDir = application.getIonicTplDir();
if (!ionicTplDir.exists()) {
throw new EngineException("Missing template project '" + application.getTplProjectName() + "'\nThe template folder should be in: " + ionicTplDir.getPath());
}
if (isIonicTemplateBased()) {
if (eventHelper == null) {
eventHelper = new EventHelper();
}
setNeedPkgUpdate(false);
// Clean directories
cleanDirectories();
// Copy template directory to working directory
copyTemplateFiles();
// Copy template assets to build directory
copyAssetsToBuildDir();
// Modify configuration files
updateConfigurationFiles();
// Tpl version
updateTplVersion();
// Modify env.json
initEnvFile();
// PWA
configurePwaApp(application);
// Write source files (based on bean components)
updateSourceFiles();
// Studio mode : start worker for build process
if (Engine.isStudioMode() || Engine.isCliMode()) {
if (pushedFiles == null) {
pushedFiles = new HashMap<String, CharSequence>();
}
if (queue == null) {
queue = new LinkedBlockingQueue<Map<String, CharSequence>>();
}
if (worker == null) {
worker = new MbWorker(queue);
if (Engine.isStudioMode()) {
worker.start();
} else {
worker.process();
}
}
if (watcherService == null) {
updateConsumer();
updateConsumers();
if (Engine.isStudioMode()) {
try {
watcherService = new DirectoryWatcherService(project, true);
watcherService.start();
} catch (Exception e) {
Engine.logEngine.warn(e.getMessage());
}
}
}
}
initDone = true;
Engine.logEngine.debug("(MobileBuilder) Initialized builder for ionic project '" + project.getName() + "'");
}
}
Aggregations