Merge pull request #316 from eclipse/cd_bug481287

[481287] Fixed bug in plugin.xml content comparison of xtext generator
This commit is contained in:
Christian Dietrich 2017-04-26 10:21:26 +02:00 committed by GitHub
commit b7801f175a
4 changed files with 32 additions and 2 deletions

View file

@ -338,7 +338,7 @@ class XtextGenerator extends AbstractWorkflowComponent2 {
if (root.isFile(pluginXml.path)) {
// only write plugin.xml_gen if entries exist and content differs
if (!pluginXml.entries.isEmpty
&& root.readTextFile(pluginXml.path) != pluginXml.getContent
&& root.readTextFile(pluginXml.path)?.toString != pluginXml.getContentString
&& pluginXml.path.endsWith('.xml')) {
pluginXml.path = pluginXml.path + '_gen'
pluginXml.writeTo(root)

View file

@ -32,6 +32,10 @@ class TextFileAccess {
return internalContents.toString
}
def String getContentString() {
return getContent.toString
}
def void writeTo(IFileSystemAccess2 fileSystemAccess) {
if (fileSystemAccess !== null) {
fileSystemAccess.generateFile(path, content)

View file

@ -447,7 +447,29 @@ public class XtextGenerator extends AbstractWorkflowComponent2 {
final IXtextGeneratorFileSystemAccess root = entry.getValue();
boolean _isFile = root.isFile(pluginXml.getPath());
if (_isFile) {
if ((((!pluginXml.getEntries().isEmpty()) && (!Objects.equal(root.readTextFile(pluginXml.getPath()), pluginXml.getContent()))) && pluginXml.getPath().endsWith(".xml"))) {
boolean _and = false;
boolean _and_1 = false;
boolean _isEmpty = pluginXml.getEntries().isEmpty();
boolean _not = (!_isEmpty);
if (!_not) {
_and_1 = false;
} else {
CharSequence _readTextFile = root.readTextFile(pluginXml.getPath());
String _string = null;
if (_readTextFile!=null) {
_string=_readTextFile.toString();
}
String _contentString = pluginXml.getContentString();
boolean _notEquals = (!Objects.equal(_string, _contentString));
_and_1 = _notEquals;
}
if (!_and_1) {
_and = false;
} else {
boolean _endsWith = pluginXml.getPath().endsWith(".xml");
_and = _endsWith;
}
if (_and) {
String _path = pluginXml.getPath();
String _plus = (_path + "_gen");
pluginXml.setPath(_plus);

View file

@ -38,6 +38,10 @@ public class TextFileAccess {
return this.internalContents.toString();
}
public String getContentString() {
return this.getContent().toString();
}
public void writeTo(final IFileSystemAccess2 fileSystemAccess) {
if ((fileSystemAccess != null)) {
fileSystemAccess.generateFile(this.path, this.getContent());