Skip to content

Commit 01512f4

Browse files
authored
Merge pull request #132 from xtext/cd_issue108_issue131
[#108][#131] ship custom IWorkspaceConfig to be compatible with multiple Xtext versions
2 parents b13a345 + 5724d0d commit 01512f4

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

xtext-gradle-builder/src/main/java/org/xtext/gradle/builder/GradleProjectConfig.xtend

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import org.eclipse.xtext.util.UriUtil
77
import org.eclipse.xtext.workspace.IProjectConfig
88
import org.eclipse.xtext.workspace.ISourceFolder
99
import org.xtext.gradle.protocol.GradleBuildRequest
10-
import org.eclipse.xtext.workspace.SingleProjectWorkspaceConfig
1110

1211
@FinalFieldsConstructor
1312
class GradleProjectConfig implements IProjectConfig {
@@ -34,7 +33,7 @@ class GradleProjectConfig implements IProjectConfig {
3433
}
3534

3635
override getWorkspaceConfig() {
37-
new SingleProjectWorkspaceConfig(this)
36+
new GradleWorkspaceConfig(this)
3837
}
3938

4039
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2018 itemis AG (http://www.itemis.eu) and others.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*******************************************************************************/
8+
package org.xtext.gradle.builder
9+
10+
11+
import org.eclipse.emf.common.util.URI
12+
import org.eclipse.xtend.lib.annotations.Data
13+
import org.eclipse.xtext.workspace.IProjectConfig
14+
import org.eclipse.xtext.workspace.IWorkspaceConfig
15+
import static extension org.eclipse.xtext.util.UriUtil.*
16+
17+
/**
18+
* @author dietrich - Initial contribution and API
19+
*/
20+
@Data
21+
class GradleWorkspaceConfig implements IWorkspaceConfig {
22+
23+
IProjectConfig projectConfig
24+
25+
override findProjectByName(String name) {
26+
if (projectConfig.name == name)
27+
return projectConfig
28+
}
29+
30+
override findProjectContaining(URI member) {
31+
if (projectConfig.path.isPrefixOf(member))
32+
return projectConfig
33+
}
34+
35+
override getProjects() {
36+
return #{projectConfig}
37+
}
38+
39+
}

0 commit comments

Comments
 (0)