use of org.apache.tools.ant.BuildListener in project Gargoyle by callakrsos.
the class AntRunConfigView method initialize.
@FXML
public void initialize() {
c = new AntJavaCompiler(this.buildFile.getParentFile(), this.buildFile) {
@Override
protected BuildListener getBuildListener() {
return progressListener;
}
};
c.parse();
this.txtBuildFileLocation.setText(this.buildFile.getAbsolutePath());
this.txtProjectName.setText(c.getProjectName());
// tcTargetName.setCellFactory(value);
tcChkTarget.setCellFactory(CheckBoxTableCell.forTableColumn(tcChkTarget));
tcChkTarget.setCellValueFactory(param -> param.getValue().chkProperty());
tcTargetName.setCellFactory(TextFieldTableCell.forTableColumn());
tcTargetName.setCellValueFactory(param -> param.getValue().targetNameProperty());
tcTargetDesc.setCellFactory(TextFieldTableCell.forTableColumn());
tcTargetDesc.setCellValueFactory(param -> param.getValue().targetDescProperty());
List<AntRunConfigItem> collect = c.getTargets().entrySet().stream().map(ent -> {
String key = ent.getKey();
if (ValueUtil.isEmpty(key))
return null;
String desc = ent.getValue().getDescription() == null ? "" : ent.getValue().getDescription();
AntRunConfigItem item = new AntRunConfigItem(key, desc);
item.chkProperty().addListener(new ChangeListenerImpl(item));
boolean equals = key.equals(c.getDefaultTarget());
item.setChk(equals);
if (equals)
item.setTargetDesc("[default] ".concat(desc));
return item;
}).filter(v -> v != null).collect(Collectors.toList());
tbTargets.getItems().addAll(collect);
tbTargets.setEditable(true);
tcChkTarget.setEditable(true);
tcTargetName.setEditable(false);
tcTargetDesc.setEditable(false);
// Platform.runLater(()->{
//
// });
}
use of org.apache.tools.ant.BuildListener in project Gargoyle by callakrsos.
the class AntJavaCompiler method parse.
/**
*
* build.xml파일을 파싱처리하여
* 빌드처리 준비상태로 처리한다.
* 이후 run 함수를 호출하여 빌드를 실행할 수 있다.
*
* @작성자 : KYJ
* @작성일 : 2017. 3. 7.
*/
public void parse() {
p = new Project();
p.setUserProperty("ant.file", buildFile.getAbsolutePath());
p.setUserProperty("encoding", encoding.displayName());
p.init();
helper = ProjectHelper.getProjectHelper();
p.addReference("ant.projectHelper", helper);
if (baseDir != null && baseDir.exists())
p.setBaseDir(baseDir);
else
p.setBaseDir(buildFile.getParentFile());
//setting console
DefaultLogger consoleLogger = getLogger();
consoleLogger.setOutputPrintStream(new PrintStream(out));
consoleLogger.setErrorPrintStream(new PrintStream(err));
consoleLogger.setMessageOutputLevel(Project.MSG_VERBOSE);
p.addBuildListener(consoleLogger);
//parse build.xml
helper.parse(p, buildFile);
LOGGER.debug(" ##### base dir : " + p.getBaseDir());
LOGGER.debug(" ##### default target : " + p.getDefaultTarget());
//append build debugger.
BuildListener buildListener = getBuildListener();
if (buildListener != null)
p.addBuildListener(buildListener);
wasParse = true;
}
use of org.apache.tools.ant.BuildListener in project ceylon-compiler by ceylon.
the class Util method getCeylonClassLoaderCachedInProject.
public static CeylonClassLoader getCeylonClassLoaderCachedInProject(final Project project) throws ClassLoaderSetupException {
Object classLoader = project.getReference(CEYLON_CLASSLOADER_REFERENCE);
if (classLoader != null) {
CeylonClassLoader oldLoader = (CeylonClassLoader) classLoader;
// make sure it's still valid
try {
List<File> classPath = CeylonClassLoader.getClassPath();
if (oldLoader.hasSignature(CeylonClassLoader.getClassPathSignature(classPath))) {
// compatible
return oldLoader;
} else {
project.log("Needs a new class loader: cp changed!", Project.MSG_VERBOSE);
CeylonClassLoader loader = CeylonClassLoader.newInstance(classPath);
project.addReference(CEYLON_CLASSLOADER_REFERENCE, loader);
return loader;
}
} catch (FileNotFoundException x) {
throw new ClassLoaderSetupException(x);
} catch (URISyntaxException x) {
throw new ClassLoaderSetupException(x);
} catch (MalformedURLException x) {
throw new ClassLoaderSetupException(x);
}
}
CeylonClassLoader loader = Launcher.getClassLoader();
project.addReference(CEYLON_CLASSLOADER_REFERENCE, loader);
// only add the build listed once, even if we change the class loader later
project.addBuildListener(new BuildListener() {
@Override
public void buildFinished(BuildEvent arg0) {
project.log("Build done, cleaning up Ceylon class loader", Project.MSG_VERBOSE);
// make sure we get the latest one
Object reference = project.getReference(CEYLON_CLASSLOADER_REFERENCE);
project.getReferences().remove(CEYLON_CLASSLOADER_REFERENCE);
if (reference instanceof CeylonClassLoader) {
((CeylonClassLoader) reference).clearCache();
}
}
@Override
public void buildStarted(BuildEvent arg0) {
}
@Override
public void messageLogged(BuildEvent arg0) {
}
@Override
public void targetFinished(BuildEvent arg0) {
}
@Override
public void targetStarted(BuildEvent arg0) {
}
@Override
public void taskFinished(BuildEvent arg0) {
}
@Override
public void taskStarted(BuildEvent arg0) {
}
});
return loader;
}
Aggregations