Bug 440348 - Loading model files from zip files fails in StandaloneBuilder
Summary: Loading model files from zip files fails in StandaloneBuilder
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.6.1   Edit
Hardware: PC Windows Server 2008
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2014-07-24 09:21 EDT by Fabian Schlier CLA
Modified: 2017-07-27 01:48 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Schlier CLA 2014-07-24 09:21:39 EDT
We are using xtext-maven-plugin in version 2.6.1. Some of the model files are provided from external sources via a ZIP file.

After migrating from 2.4.3 to 2.6.1 org.eclipse.xtext.builder.standalone.StandaloneBuilder fails within registerCurrentSource().

The snippet

val absoluteSource = sourceDirs
	.map[new File(it).absolutePath.createFileURI.toString]
	.filter[resource.URI.toString.startsWith(it)]
	.reduce[longest, current| if(current.length > longest.length) current else longest]
	?.createFileURI

Fails when doing the startsWith filtering, due to the fact that the source folder starts with file:/a/b/c and the toString on the zip file resource results in archive:file:/a/b/c

After patching the StandaloneBuilder to handle the archive: from zip files, generation works as expected.
Comment 1 Fabian Schlier CLA 2014-07-24 09:25:11 EDT
<plugin>
	<groupId>org.eclipse.xtext</groupId>
	<artifactId>xtext-maven-plugin</artifactId>
	<executions>
		<execution>
			<goals>
				<goal>generate</goal>
			</goals>
		</execution>
	</executions>
	<configuration>
		<sourceRoots>
			<sourceRoot>${basedir}/src/main/model</sourceRoot>
			<sourceRoot>${project.build.directory}/xtext-temp/models/business-models.zip</sourceRoot>
		</sourceRoots>
		<languages>
			<language>
				<setup>...</setup>
			</language>
		</languages>
	</configuration>
	<dependencies>
		...
	</dependencies>
</plugin>
Comment 2 Christian Dietrich CLA 2017-07-26 11:20:45 EDT
still valid