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

#415 custom mainclass for Windows #442

Merged
merged 3 commits into from
Dec 16, 2014
Merged

#415 custom mainclass for Windows #442

merged 3 commits into from
Dec 16, 2014

Conversation

tartakynov
Copy link
Contributor

This PR adds an option to set a custom main class on Windows

@lightbend-cla-validator

Hi @tartakynov,

Thank you for your contribution! We really value the time you've taken to put this together.

Before we proceed with reviewing this pull request, please sign the Typesafe Contributors License Agreement:

http://typesafe.com/contribute/cla

@muuki88
Copy link
Contributor

muuki88 commented Dec 14, 2014

Nice! Looking good. I'll try this on my windows vm.
/cc @nazoking @bjuric - always appreciate a second look :)

@muuki88
Copy link
Contributor

muuki88 commented Dec 14, 2014

@tartakynov ping here when you signed the CLA :)

@tartakynov
Copy link
Contributor Author

@muuki88 I've signed the CLA

@nazoking
Copy link
Contributor

thanks. bat this pull-request occurd error on test "windows//test-bat-template".

[info] ---------------------------------
[info] Failed to correctly run the main script!.
[info] "cmd" "/c" "C:\Users\nazoking\AppData\Local\Temp\sbt_7ebab7a7\test-bat-template\target\universal\stage\bin\windows-test.bat" "-Dtest.hoge=C:\Program Files\Java" "C:\Program Files\Java"
[info]
[info] --expected----------------------------
[info] arg #0 is [C:\Program Files\Java]
[info] property(test.hoge) is [C:\Program Files\Java]
[info] SUCCESS!
[info]
[info] --found-------------------------------
[info] error < =C:\Program was unexpected at this time.
[info] error code: 255
[info] --detail-------------------------------
  :
(snip)
  :
[info] > if "!_TEST_PARAM:~0,2!" == "-J" (
[info] rem strip -J prefix
[info]  set _JAVA_PARAMS=!_JAVA_PARAMS! !_TEST_PARAM:~2!
[info]  shift
[info]  goto param_loop
[info] )
[info] error < =C:\Program was unexpected at this time.
[info] >   if ""-Dtest.hoge=C:\Program Files\Java""=="-main" (

it mean error occurd on batch code https://github.com/tartakynov/sbt-native-packager/blob/custom-main-windows/src/main/resources/com/typesafe/sbt/packager/archetypes/bat-template#L117

if "%1"=="-main" (

"%1" was expanded on pre-process time before parse time.and if %1 has double-quote, cmd.exe throw parse-error. ( i think, this cmd process is bad design... )

maybe it

  if "!_TEST_PARAM!"=="-main" (
    call set CUSTOM_MAIN_CLASS=%2

"_TEST_PARAM" has %1.

please check 'delayed expansion' keyword in windows batch ( delayed expansion is expend environment value after parse time ).
and run test on your windows machie "scripted windows/*"

@tartakynov
Copy link
Contributor Author

Ok, I've ran "scripted/test-custom-main" on my Windows 8.1 machine and it went well. Will commit the fix asap

@nazoking
Copy link
Contributor

Thanks your fix. I've ran "scripted windows/*" on my windows-7 machine and all test success.

LGTM.

i think that window batch template need feature #184 `--' to stop parsing options, but it will be another pull request .

@bjuric
Copy link
Contributor

bjuric commented Dec 16, 2014

Can confirm that the tests pass on my windows 7 also.

muuki88 added a commit that referenced this pull request Dec 16, 2014
@muuki88 muuki88 merged commit 353a11a into sbt:master Dec 16, 2014
@muuki88
Copy link
Contributor

muuki88 commented Dec 16, 2014

Awesome, thanks a lot for your support!

@tartakynov tartakynov deleted the custom-main-windows branch December 20, 2014 09:27
@muuki88 muuki88 added 0.8.x and removed 0.8.x labels Dec 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants