Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
[#1726] update wizard to gradle 7
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Dietrich <[email protected]>
  • Loading branch information
cdietrich committed Aug 10, 2021
1 parent 7ee2b58 commit 94dd70c
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 61 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
33 changes: 15 additions & 18 deletions org.eclipse.xtext.xtext.wizard/resources/gradlew/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case "`uname`" in
Darwin* )
darwin=true
;;
MINGW* )
MSYS* | MINGW* )
msys=true
;;
NONSTOP* )
Expand All @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
25 changes: 7 additions & 18 deletions org.eclipse.xtext.xtext.wizard/resources/gradlew/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand All @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -61,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2016 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 2021 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand All @@ -25,7 +25,7 @@ class GradleBuildFile extends TextFile {
«IF !allDependencies.isEmpty»
dependencies {
«FOR p : project.upstreamProjects»
compile project(':«p.name»')
api project(':«p.name»')
«ENDFOR»
«FOR dep : mavenDependencies»
«IF dep.version !== null»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class IdeProjectDescriptor extends ProjectDescriptor {
pluginsSection = '''
«IF config.languageServer === LanguageServer.FATJAR»
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}
«ENDIF»
Expand All @@ -336,7 +336,7 @@ class IdeProjectDescriptor extends ProjectDescriptor {
«IF config.languageServer === LanguageServer.FATJAR»
shadowJar {
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
configurations = [project.configurations.runtime]
configurations = [project.configurations.runtimeClasspath]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA','schema/*',
'.options', '.api_description', '*.profile', '*.html', 'about.*', 'about_files/*',
'plugin.xml', 'systembundle.properties', 'profile.list')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class ParentProjectDescriptor extends ProjectDescriptor {
«ENDIF»
}

apply plugin: 'java'
apply plugin: 'java-library'
dependencies {
compile platform("org.eclipse.xtext:xtext-dev-bom:${xtextVersion}")
api platform("org.eclipse.xtext:xtext-dev-bom:${xtextVersion}")
}

apply plugin: 'org.xtext.xtend'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class RuntimeProjectDescriptor extends TestedProjectDescriptor {
additionalContent = '''
configurations {
mwe2 {
extendsFrom compile
extendsFrom api
}
}

Expand All @@ -297,7 +297,7 @@ class RuntimeProjectDescriptor extends TestedProjectDescriptor {
}

task generateXtextLanguage(type: JavaExec) {
main = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
mainClass = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
classpath = configurations.mwe2
inputs.file "«Outlet.MAIN_JAVA.sourceFolder»/«workflowFilePath»"
inputs.file "«Outlet.MAIN_JAVA.sourceFolder»/«grammarFilePath»"
Expand All @@ -310,6 +310,7 @@ class RuntimeProjectDescriptor extends TestedProjectDescriptor {
«IF testProject.inlined»
«testProject.buildGradle.additionalContent»
«ENDIF»
processResources.dependsOn(generateXtextLanguage)
generateXtext.dependsOn(generateXtextLanguage)
clean.dependsOn(cleanGenerateXtextLanguage)
eclipse.classpath.plusConfigurations += [configurations.mwe2]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2018 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 2021 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand All @@ -9,9 +9,9 @@
package org.eclipse.xtext.xtext.wizard;

public enum Scope {
COMPILE("compile", "compile"),
TESTCOMPILE("test", "testCompile"),
TESTRUNTIME("test", "testRuntime"),
COMPILE("compile", "api"),
TESTCOMPILE("test", "testImplementation"),
TESTRUNTIME("test", "testRuntimeOnly"),
PROVIDED("provided", "providedCompile");

private String mavenNotation;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 2021 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand Down Expand Up @@ -69,7 +69,7 @@ class WebProjectDescriptor extends ProjectDescriptor {
task jettyRun(type:JavaExec) {
dependsOn(sourceSets.main.runtimeClasspath)
classpath = sourceSets.main.runtimeClasspath.filter{it.exists()}
main = '«config.language.basePackage».web.ServerLauncher'
mainClass = '«config.language.basePackage».web.ServerLauncher'
standardInput = System.in
group = 'run'
description = 'Starts an example Jetty server with your language'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015, 2016 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 2021 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand Down Expand Up @@ -43,7 +43,7 @@ public String getContent() {
Set<? extends ProjectDescriptor> _upstreamProjects = this.getProject().getUpstreamProjects();
for(final ProjectDescriptor p : _upstreamProjects) {
_builder.append("\t");
_builder.append("compile project(\':");
_builder.append("api project(\':");
String _name = p.getName();
_builder.append(_name, "\t");
_builder.append("\')");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ public GradleBuildFile buildGradle() {
_builder.append("plugins {");
_builder.newLine();
_builder.append("\t");
_builder.append("id \'com.github.johnrengelman.shadow\' version \'5.2.0\'");
_builder.append("id \'com.github.johnrengelman.shadow\' version \'7.0.0\'");
_builder.newLine();
_builder.append("}");
_builder.newLine();
Expand Down Expand Up @@ -1158,7 +1158,7 @@ public GradleBuildFile buildGradle() {
_builder_1.append("from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("configurations = [project.configurations.runtime]");
_builder_1.append("configurations = [project.configurations.runtimeClasspath]");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("exclude(\'META-INF/INDEX.LIST\', \'META-INF/*.SF\', \'META-INF/*.DSA\', \'META-INF/*.RSA\',\'schema/*\',");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ public GradleBuildFile buildGradle() {
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("apply plugin: \'java\'");
_builder.append("apply plugin: \'java-library\'");
_builder.newLine();
_builder.append("\t");
_builder.append("dependencies {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("compile platform(\"org.eclipse.xtext:xtext-dev-bom:${xtextVersion}\")");
_builder.append("api platform(\"org.eclipse.xtext:xtext-dev-bom:${xtextVersion}\")");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public GradleBuildFile buildGradle() {
_builder.append("mwe2 {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("extendsFrom compile");
_builder.append("extendsFrom api");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
Expand Down Expand Up @@ -614,7 +614,7 @@ public GradleBuildFile buildGradle() {
_builder.append("task generateXtextLanguage(type: JavaExec) {");
_builder.newLine();
_builder.append("\t");
_builder.append("main = \'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher\'");
_builder.append("mainClass = \'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher\'");
_builder.newLine();
_builder.append("\t");
_builder.append("classpath = configurations.mwe2");
Expand Down Expand Up @@ -669,6 +669,8 @@ public GradleBuildFile buildGradle() {
_builder.newLineIfNotEmpty();
}
}
_builder.append("processResources.dependsOn(generateXtextLanguage)");
_builder.newLine();
_builder.append("generateXtext.dependsOn(generateXtextLanguage)");
_builder.newLine();
_builder.append("clean.dependsOn(cleanGenerateXtextLanguage)");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015, 2020 itemis AG (http://www.itemis.eu) and others.
* Copyright (c) 2015, 2021 itemis AG (http://www.itemis.eu) and others.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
Expand Down Expand Up @@ -115,7 +115,7 @@ public GradleBuildFile buildGradle() {
_builder_1.append("classpath = sourceSets.main.runtimeClasspath.filter{it.exists()}");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("main = \'");
_builder_1.append("mainClass = \'");
String _basePackage = this.getConfig().getLanguage().getBasePackage();
_builder_1.append(_basePackage, "\t");
_builder_1.append(".web.ServerLauncher\'");
Expand Down

0 comments on commit 94dd70c

Please sign in to comment.