Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set wildcard classpath for windows start batch #382

Merged
merged 4 commits into from
Nov 8, 2024

Conversation

dr0i
Copy link
Member

@dr0i dr0i commented Oct 29, 2024

The generated start script for Windows consists of a huge classpath. This classpath was too long, resulting in an error when executing the start script. Using wildcard to include libraries shortens the classpath so that now error occurs when executing the start script.

To test this:

./gradlew clean;  ./gradlew distZip

then look in ./metafix-runner/build/scripts/metafix-runner.bat and execute that on windows @maipet.
[edit:] That would not work resp. is not explained precisely enough. Step-by-step:
unzip metafix-runner/build/distributions/$distributionVersion.zip ( This will unpack to a folder named $distributionVersion.)
To run the start scripts execute the script residing in ./$distributionVersion/bin/, depending on your OS (Windows: metafix-runner.bat or *NIX like: metafix-runner). Note that $distributionVersion is a variable and should be substituted by you with e.g. metafix-runner-1.1.3-SNAPSHOT.)

Resolves #371.

The generated start script for Windows consists of a huge classpath.
This classpath was too long, resulting in an error when executing the start
script. Using wildcard to include libraries shortens the classpath so that now
error occurs when executing the start script.
@dr0i dr0i requested review from blackwinter and maipet and removed request for blackwinter October 29, 2024 14:33
@dr0i dr0i changed the title Set wildcard classpath for windows start batch (#371) Set wildcard classpath for windows start batch Oct 29, 2024
@maipet maipet assigned dr0i and unassigned maipet Oct 31, 2024
@dr0i dr0i requested a review from blackwinter October 31, 2024 09:58
@dr0i
Copy link
Member Author

dr0i commented Oct 31, 2024

@blackwinter had worked quite a bit on gradle scripts , so you may want to have look here?

@maipet
Copy link
Collaborator

maipet commented Oct 31, 2024

tested on Windows, it works. (The generated runner.bat as standalone runner is in the folder metafix-runner/build/distributions/metafix-runner-1.1.3-SNAPSHOT.zip )

@dr0i dr0i assigned blackwinter and unassigned dr0i Nov 4, 2024
Copy link
Member

@blackwinter blackwinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a simpler solution that also maintains consistency between Windows and Unix (even though the latter doesn't necessarily require this change, it's preferable that both behave in the same way).

metafix-runner/build.gradle Outdated Show resolved Hide resolved
metafix-runner/build.gradle Outdated Show resolved Hide resolved
@blackwinter blackwinter assigned dr0i and unassigned blackwinter Nov 4, 2024
@dr0i
Copy link
Member Author

dr0i commented Nov 7, 2024

@maipet just to be on the save side - could you test on Windows the new commit by @blackwinter ?

@maipet
Copy link
Collaborator

maipet commented Nov 8, 2024

@dr0i with the last changes I got an error message while executing the gradlew distZip

Task :metafix:generateXtextLanguage
0 [main] INFO text.xtext.generator.XtextGenerator - Initializing Xtext generator
[main] INFO org.eclipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.eclipse.xtext.common.types.TypesPackage'
[main] INFO org.eclipse.emf.mwe.utils.StandaloneSetup - Registering project metafix at 'file:/C:/Users/maier/git_2/metafacture-fix/metafix/'
[main] INFO org.eclipse.emf.mwe.utils.StandaloneSetup - Registering project metafix at 'file:/C:/Users/maier/git_2/metafacture-fix/metafix/'
[main] INFO org.eclipse.emf.mwe.utils.StandaloneSetup - Registering project metafix-ide at 'file:/C:/Users/maier/git_2/metafacture-fix/metafix-ide/'
[main] INFO org.eclipse.emf.mwe.utils.StandaloneSetup - Registering project metafix-web at 'file:/C:/Users/maier/git_2/metafacture-fix/metafix-web/'
[main] INFO org.eclipse.emf.mwe.utils.StandaloneSetup - Using resourceSet registry. The registered Packages will not be registered in the global EPackage.Registry.INSTANCE!
[main] INFO org.eclipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
[main] INFO org.eclipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
[main] INFO org.eclipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
[main] INFO org.eclipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
565 [main] INFO text.xtext.generator.XtextGenerator - Generating org.metafacture.metafix.Fix
741 [main] INFO nerator.ecore.EMFGeneratorFragment2 - Generating EMF model code
[main] INFO org.eclipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.metafacture.org/metafix/Fix' from 'platform:/resource/metafix/model/generated/Fix.genmodel'
6378 [main] INFO text.xtext.generator.XtextGenerator - Generating common infrastructure
6383 [main] INFO .emf.mwe2.runtime.workflow.Workflow - Done.

Task :metafix-runner:startScripts FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':metafix-runner:startScripts'.

Cannot access input property 'classpath' of task ':metafix-runner:startScripts'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.10.2/userguide/incremental_build.html#sec:disable-state-tracking in the Gradle documentation.
Could not stat file C:\Users\maier\git_2\metafacture-fix\metafix-runner*

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.10.2/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 18s
13 actionable tasks: 13 executed

The folder distributions is not created. To be on the safe side, I checked it again with the previous version (ffa5b7a): it worked

@dr0i dr0i assigned blackwinter and unassigned dr0i Nov 8, 2024
@dr0i
Copy link
Member Author

dr0i commented Nov 8, 2024

@blackwinter something is wrong , presumably with be72f98 . Can you have a look?

@blackwinter
Copy link
Member

Works for me on Linux. No idea why Windows behaves differently.

@maipet: Can you try the following?

diff --git metafix-runner/build.gradle metafix-runner/build.gradle
index 94b6337..1ef54e9 100644
--- metafix-runner/build.gradle
+++ metafix-runner/build.gradle
@@ -52,5 +52,6 @@ application {
   startScripts {
     // See https://github.com/metafacture/metafacture-fix/issues/371
     classpath = files('*')
+    doNotTrackState("")
   }
 }

@maipet
Copy link
Collaborator

maipet commented Nov 8, 2024

Thx! Now it works, with added doNotTrackState the error has been fixed.

Gradle would produce the following error on Windows (while Linux is not affected):

"Cannot access input property 'classpath' of task ':metafix-runner:startScripts'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.10.2/userguide/incremental_build.html#sec:disable-state-tracking in the Gradle documentation."
@blackwinter
Copy link
Member

Fixed in a2fbff1.

@blackwinter blackwinter removed their assignment Nov 8, 2024
Copy link
Member Author

@dr0i dr0i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@dr0i dr0i merged commit 6284eab into master Nov 8, 2024
1 check passed
@dr0i dr0i deleted the 371-classpathOfRunnerTooLongOnWindows branch November 8, 2024 14:50
@dr0i
Copy link
Member Author

dr0i commented Nov 8, 2024

Great - a big thx to all who have contributed here to fix this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Windows: Metafix-Runner sometimes complains that file path of runner is too long
3 participants