diff options
6 files changed, 41 insertions, 37 deletions
diff --git a/buildSrc/src/main/groovy/refinery-eclipse.gradle b/buildSrc/src/main/groovy/refinery-eclipse.gradle index ec8b9f6c..15dcb5ce 100644 --- a/buildSrc/src/main/groovy/refinery-eclipse.gradle +++ b/buildSrc/src/main/groovy/refinery-eclipse.gradle | |||
@@ -5,19 +5,20 @@ plugins { | |||
5 | // Workaround from https://github.com/gradle/gradle/issues/898#issuecomment-885765821 | 5 | // Workaround from https://github.com/gradle/gradle/issues/898#issuecomment-885765821 |
6 | def eclipseResourceEncoding = tasks.register('eclipseResourceEncoding') { | 6 | def eclipseResourceEncoding = tasks.register('eclipseResourceEncoding') { |
7 | ext.outputFile = file('.settings/org.eclipse.core.resources.prefs') | 7 | ext.outputFile = file('.settings/org.eclipse.core.resources.prefs') |
8 | def compileTask = tasks.findByName('compileJava') | 8 | def compileTask = tasks.findByName('compileJava') |
9 | ext.encoding = provider({ compileTask?.options?.encoding }).orElse(providers.systemProperty('file.encoding')) | 9 | ext.encoding = provider({ compileTask?.options?.encoding }).orElse(providers.systemProperty('file.encoding')) |
10 | 10 | ||
11 | inputs.property("file.encoding", encoding) | 11 | inputs.property('file.encoding', encoding) |
12 | outputs.file(outputFile).withPropertyName('outputFile') | 12 | outputs.file(outputFile).withPropertyName('outputFile') |
13 | 13 | ||
14 | doLast { | 14 | doLast { |
15 | Properties eclipseEncodingProperties = new Properties(Collections.singletonMap('eclipse.preferences.version','1')) | 15 | Properties eclipseEncodingProperties = |
16 | eclipseEncodingProperties.put('encoding/<project>', encoding.get()) | 16 | new Properties(Collections.singletonMap('eclipse.preferences.version', '1')) |
17 | outputFile.withOutputStream { | 17 | eclipseEncodingProperties.put('encoding/<project>', encoding.get()) |
18 | eclipseEncodingProperties.store(it, 'generated by ' + name) | 18 | outputFile.withOutputStream { |
19 | } | 19 | eclipseEncodingProperties.store(it, 'generated by ' + name) |
20 | } | 20 | } |
21 | } | ||
21 | } | 22 | } |
22 | 23 | ||
23 | tasks.named('eclipse') { | 24 | tasks.named('eclipse') { |
diff --git a/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle b/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle index e1324746..1d239fd5 100644 --- a/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle +++ b/buildSrc/src/main/groovy/refinery-frontend-worktree.gradle | |||
@@ -14,13 +14,13 @@ frontend { | |||
14 | 14 | ||
15 | ext.frontedPropertiesFile = "${frontend.nodeInstallDirectory.get()}/frontend.properties" | 15 | ext.frontedPropertiesFile = "${frontend.nodeInstallDirectory.get()}/frontend.properties" |
16 | 16 | ||
17 | def String getFrontendProperty(String propertyName) { | 17 | String getFrontendProperty(String propertyName) { |
18 | FileInputStream inputStream = null | 18 | FileInputStream inputStream = null |
19 | Properties props = new Properties() | 19 | Properties props = new Properties() |
20 | try { | 20 | try { |
21 | inputStream = new FileInputStream(frontedPropertiesFile) | 21 | inputStream = new FileInputStream(frontedPropertiesFile) |
22 | props.load(inputStream) | 22 | props.load(inputStream) |
23 | } catch (FileNotFoundException | IOException e) { | 23 | } catch (IOException ignored) { |
24 | return null | 24 | return null |
25 | } finally { | 25 | } finally { |
26 | if (inputStream != null) { | 26 | if (inputStream != null) { |
@@ -30,13 +30,13 @@ def String getFrontendProperty(String propertyName) { | |||
30 | return props.get(propertyName) | 30 | return props.get(propertyName) |
31 | } | 31 | } |
32 | 32 | ||
33 | def String putFrontedProperty(String propertyName, String propertyValue) { | 33 | void putFrontedProperty(String propertyName, String propertyValue) { |
34 | FileInputStream inputStream = null | 34 | FileInputStream inputStream = null |
35 | Properties props = new Properties() | 35 | Properties props = new Properties() |
36 | try { | 36 | try { |
37 | inputStream = new FileInputStream(frontedPropertiesFile) | 37 | inputStream = new FileInputStream(frontedPropertiesFile) |
38 | props.load(inputStream) | 38 | props.load(inputStream) |
39 | } catch (FileNotFoundException e) { | 39 | } catch (FileNotFoundException ignored) { |
40 | // Use an empty Properties object instead | 40 | // Use an empty Properties object instead |
41 | } finally { | 41 | } finally { |
42 | if (inputStream != null) { | 42 | if (inputStream != null) { |
@@ -48,8 +48,7 @@ def String putFrontedProperty(String propertyName, String propertyValue) { | |||
48 | try { | 48 | try { |
49 | outputStream = new FileOutputStream(frontedPropertiesFile) | 49 | outputStream = new FileOutputStream(frontedPropertiesFile) |
50 | props.store(outputStream, null) | 50 | props.store(outputStream, null) |
51 | } catch (IOException e) { | 51 | } catch (IOException ignored) { |
52 | return true; | ||
53 | } finally { | 52 | } finally { |
54 | if (outputStream != null) { | 53 | if (outputStream != null) { |
55 | outputStream.close() | 54 | outputStream.close() |
diff --git a/buildSrc/src/main/groovy/refinery-java-conventions.gradle b/buildSrc/src/main/groovy/refinery-java-conventions.gradle index bbdaa86c..b95153ce 100644 --- a/buildSrc/src/main/groovy/refinery-java-conventions.gradle +++ b/buildSrc/src/main/groovy/refinery-java-conventions.gradle | |||
@@ -20,8 +20,9 @@ dependencies { | |||
20 | testImplementation libs.mockito.junit | 20 | testImplementation libs.mockito.junit |
21 | } | 21 | } |
22 | 22 | ||
23 | sourceCompatibility = '17' | 23 | java.toolchain { |
24 | targetCompatibility = '17' | 24 | languageVersion = JavaLanguageVersion.of(17) |
25 | } | ||
25 | 26 | ||
26 | def jacocoTestReport = tasks.named('jacocoTestReport') | 27 | def jacocoTestReport = tasks.named('jacocoTestReport') |
27 | jacocoTestReport.configure { | 28 | jacocoTestReport.configure { |
@@ -46,8 +47,8 @@ tasks.register('slowTest', Test) { | |||
46 | tasks.named('jar') { | 47 | tasks.named('jar') { |
47 | manifest { | 48 | manifest { |
48 | attributes( | 49 | attributes( |
49 | 'Bundle-SymbolicName': "${project.group}.${project.name}", | 50 | 'Bundle-SymbolicName': "${project.group}.${project.name}", |
50 | 'Bundle-Version': project.version | 51 | 'Bundle-Version': project.version |
51 | ) | 52 | ) |
52 | } | 53 | } |
53 | } | 54 | } |
@@ -70,7 +71,7 @@ eclipse { | |||
70 | entry.entryAttributes['ignore_optional_problems'] = true | 71 | entry.entryAttributes['ignore_optional_problems'] = true |
71 | } | 72 | } |
72 | // If a project has a main dependency on a project and an test dependency on the testFixtures of a project, | 73 | // If a project has a main dependency on a project and an test dependency on the testFixtures of a project, |
73 | // it will be errorneously added as a test-only dependency to Eclipse. | 74 | // it will be erroneously added as a test-only dependency to Eclipse. |
74 | // As a workaround, we add all project dependencies as main dependencies | 75 | // As a workaround, we add all project dependencies as main dependencies |
75 | // (we do not deliberately use test-only project dependencies). | 76 | // (we do not deliberately use test-only project dependencies). |
76 | if (entry in org.gradle.plugins.ide.eclipse.model.ProjectDependency) { | 77 | if (entry in org.gradle.plugins.ide.eclipse.model.ProjectDependency) { |
@@ -80,7 +81,7 @@ eclipse { | |||
80 | } | 81 | } |
81 | 82 | ||
82 | jdt.file.withProperties { properties -> | 83 | jdt.file.withProperties { properties -> |
83 | // Allow @SupperessWarnings to suppress SonarLint warnings | 84 | // Allow @SuppressWarnings to suppress SonarLint warnings |
84 | properties['org.eclipse.jdt.core.compiler.problem.unhandledWarningToken'] = 'ignore' | 85 | properties['org.eclipse.jdt.core.compiler.problem.unhandledWarningToken'] = 'ignore' |
85 | } | 86 | } |
86 | } | 87 | } |
diff --git a/buildSrc/src/main/groovy/refinery-java-test-fixtures.gradle b/buildSrc/src/main/groovy/refinery-java-test-fixtures.gradle index 693cba98..02568abd 100644 --- a/buildSrc/src/main/groovy/refinery-java-test-fixtures.gradle +++ b/buildSrc/src/main/groovy/refinery-java-test-fixtures.gradle | |||
@@ -1,3 +1,5 @@ | |||
1 | import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry | ||
2 | |||
1 | plugins { | 3 | plugins { |
2 | id 'java-test-fixtures' | 4 | id 'java-test-fixtures' |
3 | id 'refinery-java-conventions' | 5 | id 'refinery-java-conventions' |
@@ -8,15 +10,15 @@ eclipse.classpath { | |||
8 | 10 | ||
9 | file.whenMerged { classpath -> | 11 | file.whenMerged { classpath -> |
10 | def hasTest = classpath.entries.any { entry -> | 12 | def hasTest = classpath.entries.any { entry -> |
11 | entry in org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry && | 13 | entry in AbstractClasspathEntry && |
12 | entry.entryAttributes['gradle_scope'] == 'test' | 14 | entry.entryAttributes['gradle_scope'] == 'test' |
13 | } | 15 | } |
14 | for (entry in classpath.entries) { | 16 | for (entry in classpath.entries) { |
15 | // Workaround https://github.com/gradle/gradle/issues/11845 based on | 17 | // Workaround https://github.com/gradle/gradle/issues/11845 based on |
16 | // https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2 | 18 | // https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2 |
17 | if (entry in org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry) { | 19 | if (entry in AbstractClasspathEntry) { |
18 | def usedBy = new LinkedHashSet( | 20 | def usedBy = new LinkedHashSet( |
19 | Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(',')) | 21 | Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(',')) |
20 | ) | 22 | ) |
21 | if (usedBy.contains('main')) { | 23 | if (usedBy.contains('main')) { |
22 | usedBy += 'testFixtures' | 24 | usedBy += 'testFixtures' |
diff --git a/buildSrc/src/main/groovy/refinery-jmh.gradle b/buildSrc/src/main/groovy/refinery-jmh.gradle index 538159a4..1ab9edc3 100644 --- a/buildSrc/src/main/groovy/refinery-jmh.gradle +++ b/buildSrc/src/main/groovy/refinery-jmh.gradle | |||
@@ -1,3 +1,5 @@ | |||
1 | import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry | ||
2 | |||
1 | plugins { | 3 | plugins { |
2 | id 'refinery-java-conventions' | 4 | id 'refinery-java-conventions' |
3 | id 'refinery-sonarqube' | 5 | id 'refinery-sonarqube' |
@@ -12,9 +14,9 @@ configurations { | |||
12 | sourceSets { | 14 | sourceSets { |
13 | jmh { | 15 | jmh { |
14 | java.srcDirs = ['src/jmh/java'] | 16 | java.srcDirs = ['src/jmh/java'] |
15 | resources.srcDirs = ['src/jmh/resources'] | 17 | resources.srcDirs = ['src/jmh/resources'] |
16 | compileClasspath += sourceSets.main.runtimeClasspath | 18 | compileClasspath += sourceSets.main.runtimeClasspath |
17 | compileClasspath += sourceSets.test.runtimeClasspath | 19 | compileClasspath += sourceSets.test.runtimeClasspath |
18 | } | 20 | } |
19 | } | 21 | } |
20 | 22 | ||
@@ -25,13 +27,13 @@ dependencies { | |||
25 | 27 | ||
26 | tasks.register('jmh', JavaExec) { | 28 | tasks.register('jmh', JavaExec) { |
27 | dependsOn tasks.named('jmhClasses') | 29 | dependsOn tasks.named('jmhClasses') |
28 | mainClass = 'org.openjdk.jmh.Main' | 30 | mainClass = 'org.openjdk.jmh.Main' |
29 | classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath | 31 | classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath |
30 | } | 32 | } |
31 | 33 | ||
32 | eclipse.classpath.file.whenMerged { classpath -> | 34 | eclipse.classpath.file.whenMerged { classpath -> |
33 | for (entry in classpath.entries) { | 35 | for (entry in classpath.entries) { |
34 | if (entry in org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry) { | 36 | if (entry in AbstractClasspathEntry) { |
35 | // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081 | 37 | // Workaround from https://github.com/gradle/gradle/issues/4802#issuecomment-407902081 |
36 | if (entry.entryAttributes['gradle_scope'] == 'jmh') { | 38 | if (entry.entryAttributes['gradle_scope'] == 'jmh') { |
37 | // Allow test helper classes to be used in benchmarks from Eclipse | 39 | // Allow test helper classes to be used in benchmarks from Eclipse |
@@ -41,7 +43,7 @@ eclipse.classpath.file.whenMerged { classpath -> | |||
41 | // Workaround based on | 43 | // Workaround based on |
42 | // https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2 | 44 | // https://discuss.gradle.org/t/gradle-used-by-scope-not-correctly-generated-when-the-java-test-fixtures-plugin-is-used/39935/2 |
43 | def usedBy = new LinkedHashSet( | 45 | def usedBy = new LinkedHashSet( |
44 | Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(',')) | 46 | Arrays.asList((entry.entryAttributes['gradle_used_by_scope'] ?: '').split(',')) |
45 | ) | 47 | ) |
46 | if (['main', 'test', 'testFixtures'].any { e -> usedBy.contains(e) }) { | 48 | if (['main', 'test', 'testFixtures'].any { e -> usedBy.contains(e) }) { |
47 | // main and test sources are also used by jmh sources. | 49 | // main and test sources are also used by jmh sources. |
@@ -57,6 +59,6 @@ eclipse.classpath.file.whenMerged { classpath -> | |||
57 | 59 | ||
58 | sonarqube.properties { | 60 | sonarqube.properties { |
59 | properties['sonar.tests'] += [ | 61 | properties['sonar.tests'] += [ |
60 | 'src/jmh/java', | 62 | 'src/jmh/java', |
61 | ] | 63 | ] |
62 | } | 64 | } |
diff --git a/subprojects/frontend/src/xtext/webSocketMachine.ts b/subprojects/frontend/src/xtext/webSocketMachine.ts index a1eee781..b5b40d11 100644 --- a/subprojects/frontend/src/xtext/webSocketMachine.ts +++ b/subprojects/frontend/src/xtext/webSocketMachine.ts | |||
@@ -39,8 +39,7 @@ export function isWebSocketURLLocal(webSocketURL: string | undefined): boolean { | |||
39 | return ( | 39 | return ( |
40 | hostname === 'localhost' || | 40 | hostname === 'localhost' || |
41 | hostname === '[::1]' || | 41 | hostname === '[::1]' || |
42 | hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/) !== | 42 | hostname.match(/^127(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)){3}$/) !== null |
43 | null | ||
44 | ); | 43 | ); |
45 | } | 44 | } |
46 | 45 | ||