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

Launcher catchup 4 - Native Debug in Rust #509

Merged

Conversation

AurumTheEnd
Copy link
Contributor

This was my first Rust experience, so hopefully the code's at least mediocre :D

@karianna karianna added the enhancement New feature or request label Nov 13, 2019
@karianna karianna added this to the 2.0.x milestone Nov 13, 2019
}

native_debug_toggle = String::from("-Xdebug");
native_debug_config = [String::from("-Xrunjdwp:transport=dt_socket,server=y,suspend="), suspend, String::from(",address="), port].concat();
Copy link

Choose a reason for hiding this comment

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

I would suggest using format!() macro.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes please!

Comment on lines 177 to 186
match get_native_debug_parameter(env::vars().collect::<Vec<_>>(), String::from("ITW_NATIVEDEBUG_SUSPEND")){
Some(value) => {
suspend = value;
}
_none => {
suspend = String::from("n");
}
}
Copy link

Choose a reason for hiding this comment

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

In my opinion if let would be easier to read.

Copy link

@pitiK3U pitiK3U Nov 13, 2019

Choose a reason for hiding this comment

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

Btw it is more idiomatic to use type None when matching value returned from Option instead of default.

Comment on lines 185 to 194
match get_native_debug_parameter(env::vars().collect::<Vec<_>>(), String::from("ITW_NATIVEDEBUG_PORT")){
Some(value) => {
port = value;
}
_none => {
port = String::from("9009");
}
}
Copy link

@pitiK3U pitiK3U Nov 13, 2019

Choose a reason for hiding this comment

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

ditto

@@ -83,6 +83,24 @@ fn is_splash_forbidden_testable(vars: Vec<(String, String)>, aargs: Vec<String>)
false
}

fn is_native_debug_enabled(args: &Vec<String>) -> bool {
for s in args {
if clean_param(s.to_string()) == ("-nativeDebug") {
Copy link
Contributor

Choose a reason for hiding this comment

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

please extract nativeDebug to constant. It is already used twice

Extracted "-nativeDebug" into a constant, replaced default match case with None, replaced string array concatenation with format!.
@AurumTheEnd AurumTheEnd force-pushed the launcher-catchup-4-rust-native-debug branch from b9dd126 to 499f09e Compare November 20, 2019 13:26
@judovana
Copy link
Contributor

Aurum, tested also on windows? Otherwise loks good to me

@AurumTheEnd
Copy link
Contributor Author

Aurum, tested also on windows? Otherwise loks good to me

I am unfortunately unable to build the rust launchers on Windows - it reports a LLVM error when executing https://github.com/AdoptOpenJDK/IcedTea-Web/blob/master/launchers/utils.sh#L41. Trying to find a fix.

@judovana
Copy link
Contributor

judovana commented Dec 3, 2019

Really? last time we have spoken it was already on wix setup:(

@AurumTheEnd
Copy link
Contributor Author

Really? last time we have spoken it was already on wix setup:(

Retraced my steps and it is a fault with me being in a Windows VM and the project being on a shared drive, as is mentioned here.

Fixed incorrent argument being sent to candle.exe and bumped crate
version to match latest release.
@AurumTheEnd
Copy link
Contributor Author

@judovana Copied directory to a local path, fixed an existing typo and it builds OK now.

@judovana judovana merged commit 6624228 into AdoptOpenJDK:master Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants