Mercurial > hg > release > icedtea-web-1.8
changeset 1494:232107653932
Build of rust lunchers moved to cargo
* configure.ac: added check for cargo
* .hgignore: added target and Cargo.lock
* .Makefile.am: dropped all launcher.in/libhardoced_paths_*.rs targets and rustc targets. (launcher.build/$(javaws) launcher.build/$(itweb_settings) launcher.build/$(policyeditor)) adapted to use cargo. Variables handled in switch. (clean) now cleans all launcher.in*
* rust-launcher/Cargo.toml: primitive declaration of package
* rust-launcher/src/hardcoded_paths.rs: copied from rust-launcher/hardoced_paths.rs.in adapted to get substitution via cargo rather then by sed. Added test and wrapping getters
* rust-launcher/src/main.rs: copied from rust-launcher/launchers.rs. Adapted imports to new infrastructure,s till just reprinting hardcoded stuff
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Thu, 22 Mar 2018 15:27:55 +0100 |
parents | e6d627b32ca0 |
children | b64b383a4561 |
files | .hgignore ChangeLog Makefile.am configure.ac rust-launcher/Cargo.toml rust-launcher/hardoced_paths.rs.in rust-launcher/launchers.rs rust-launcher/src/hardcoded_paths.rs rust-launcher/src/main.rs |
diffstat | 9 files changed, 142 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Wed Feb 07 13:56:18 2018 +0100 +++ b/.hgignore Thu Mar 22 15:27:55 2018 +0100 @@ -12,3 +12,6 @@ netx/net/sourceforge/jnlp/resources/ChangeLog\.html netx/net/sourceforge/jnlp/resources/NEWS\.html netx-dist-tests-whitelist +rust-launcher/target +rust-launcher/Cargo.lock +
--- a/ChangeLog Wed Feb 07 13:56:18 2018 +0100 +++ b/ChangeLog Thu Mar 22 15:27:55 2018 +0100 @@ -1,3 +1,17 @@ +2018-02-15 Jiri Vanek <jvanek at redhat.com> + + Build of rust lunchers moved to cargo + * configure.ac: added check for cargo + * .hgignore: added target and Cargo.lock + * .Makefile.am: dropped all launcher.in/libhardoced_paths_*.rs targets and rustc targets. + (launcher.build/$(javaws) launcher.build/$(itweb_settings) launcher.build/$(policyeditor)) + adapted to use cargo. Variables handled in switch. (clean) now cleans all launcher.in* + * rust-launcher/Cargo.toml: primitive declaration of package + * rust-launcher/src/hardcoded_paths.rs: copied from rust-launcher/hardoced_paths.rs.in + adapted to get substitution via cargo rather then by sed. Added test and wrapping getters + * rust-launcher/src/main.rs: copied from rust-launcher/launchers.rs. Adapted imports to new + infrastructure,s till just reprinting hardcoded stuff + 2018-02-06 Jiri Vanek <jvanek@redhat.com> Added test for javafx-desc
--- a/Makefile.am Wed Feb 07 13:56:18 2018 +0100 +++ b/Makefile.am Thu Mar 22 15:27:55 2018 +0100 @@ -874,33 +874,46 @@ if ENABLE_NATIVE_LAUNCHERS -launcher.in/libhardoced_paths_$(javaws).rs: rust-launcher/hardoced_paths.rs.in - mkdir -p launcher.in - MAIN_CLASS=net.sourceforge.jnlp.runtime.Boot ;\ - BIN_LOCATION=$(bindir)/$(javaws).sh ;\ - PROGRAM_NAME=$(javaws) ;\ - $(edit_launcher_script) < $< > $@ - -launcher.in/libhardoced_paths_$(itweb_settings).rs: rust-launcher/hardoced_paths.rs.in - mkdir -p launcher.in - MAIN_CLASS=net.sourceforge.jnlp.controlpanel.CommandLine ;\ - BIN_LOCATION=$(bindir)/$(itweb_settings).sh ;\ - PROGRAM_NAME=$(itweb_settings) ;\ - $(edit_launcher_script) < $< > $@ - -launcher.in/libhardoced_paths_$(policyeditor).rs: rust-launcher/hardoced_paths.rs.in - mkdir -p launcher.in - MAIN_CLASS=net.sourceforge.jnlp.security.policyeditor.PolicyEditor ;\ - BIN_LOCATION=$(bindir)/$(policyeditor).sh ;\ - PROGRAM_NAME=$(policyeditor) ;\ - $(edit_launcher_script) < $< > $@ - -launcher.in/libhardoced_paths_$(javaws).rlib launcher.in/libhardoced_paths_$(itweb_settings).rlib launcher.in/libhardoced_paths_$(policyeditor).rlib: %.rlib: %.rs - $(RUSTC) --crate-type=lib -o $@ $< - -launcher.build/$(javaws) launcher.build/$(itweb_settings) launcher.build/$(policyeditor): launcher.build/%: launcher.in/libhardoced_paths_%.rlib rust-launcher/launchers.rs - mkdir -p launcher.build - $(RUSTC) --extern hardcoded_paths=$< -o $@ rust-launcher/launchers.rs +# todo, handling of suffixes +# there is curently harecoded sh, so it can somehow basically work +# see the DESKTOP_SUFFIX for final tuning +launcher.build/$(javaws) launcher.build/$(itweb_settings) launcher.build/$(policyeditor): rust-launcher/src/main.rs rust-launcher/Cargo.toml + filename=`basename $@` ; \ + type=$${filename%.*} ; \ + srcs=$(TOP_SRC_DIR)/rust-launcher ; \ + outs=$(TOP_BUILD_DIR)/launcher.in.$$type ; \ + mkdir -p launcher.build ; \ + cp -r $$srcs $$outs ; \ + pushd $$outs ; \ + export JAVA=$(JAVA) ; \ + export JRE=$(SYSTEM_JRE_DIR) ; \ + unset MAIN_CLASS ; \ + unset BIN_LOCATION ; \ + unset PROGRAM_NAME ; \ + if [ $$filename = $(javaws) ] ; then \ + export MAIN_CLASS=net.sourceforge.jnlp.runtime.Boot ; \ + export BIN_LOCATION=$(bindir)/$(javaws).sh ; \ + export PROGRAM_NAME=$(javaws) ; \ + fi ; \ + if [ $$filename = $(itweb_settings) ] ; then \ + export MAIN_CLASS=net.sourceforge.jnlp.controlpanel.CommandLine ; \ + export BIN_LOCATION=$(bindir)/$(itweb_settings).sh ; \ + export PROGRAM_NAME=$(itweb_settings) ; \ + fi ; \ + if [ $$filename = $(policyeditor) ] ; then \ + export MAIN_CLASS=net.sourceforge.jnlp.security.policyeditor.PolicyEditor ; \ + export BIN_LOCATION=$(bindir)/$(policyeditor).sh ; \ + export PROGRAM_NAME=$(policyeditor) ; \ + fi ; \ + $(CARGO) test ; \ + r=$$? ; \ + $(CARGO) build --release ; \ + popd ;\ + cp -v $$outs/target/release/launcher $@ ; \ + if [ $$r -ne 0 ] ; then \ + mv $@ $@.broken ; \ + fi; \ + exit $$r endif if ENABLE_SHELL_LAUNCHERS @@ -958,7 +971,7 @@ rm -f launcher.build/$(javaws) rm -f launcher.build/$(itweb_settings) rm -f launcher.build/$(policyeditor) - rm -rf launcher.in + rm -rf launcher.in* endif if ENABLE_SHELL_LAUNCHERS rm -f launcher.build/$(javaws).sh
--- a/configure.ac Wed Feb 07 13:56:18 2018 +0100 +++ b/configure.ac Thu Mar 22 15:27:55 2018 +0100 @@ -56,8 +56,15 @@ else echo "rust is used to compile lunchers, is missing but you have enable-shell-launchers as yes, continuing with UNAMAINTAINED shell launchers only" fi +else + AC_PATH_PROG([CARGO], [cargo],,) + if test x${ENABLE_SHELL_LAUNCHERS} = xno ; then + AC_MSG_ERROR([cargo is used to call rustc for lunchers. No go]) + else + echo "cargo is used to manage lunchers sources, is missing but you have enable-shell-launchers as yes, continuing with UNAMAINTAINED shell launchers only" + fi fi -AM_CONDITIONAL([ENABLE_NATIVE_LAUNCHERS], [test ! x"$RUSTC" = x]) +AM_CONDITIONAL([ENABLE_NATIVE_LAUNCHERS], [test ! x"$RUSTC" = x -a ! x"$CARGO" = x]) build_linux=no build_windows=no
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust-launcher/Cargo.toml Thu Mar 22 15:27:55 2018 +0100 @@ -0,0 +1,8 @@ +[package] +name = "launcher" +version = "1.8.0" +authors = ["https://icedtea.classpath.org/wiki/IcedTea-Web"] + +[dependencies] + +
--- a/rust-launcher/hardoced_paths.rs.in Wed Feb 07 13:56:18 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -/*legacy variables*/ -pub static PROGRAM_NAME: &'static str = "@PROGRAM_NAME@"; -pub static LAUNCHER_BOOTCLASSPATH: &'static str = "@LAUNCHER_BOOTCLASSPATH@"; -pub static JAVAWS_SPLASH_LOCATION: &'static str = "@JAVAWS_SPLASH_LOCATION@"; -pub static JAVA: &'static str = "@JAVA@"; -pub static JRE: &'static str = "@JRE@"; -pub static MAIN_CLASS: &'static str = "@MAIN_CLASS@"; -pub static BIN_LOCATION: &'static str = "@BIN_LOCATION@"; -pub static NETX_JAR: &'static str = "@NETX_JAR@"; -pub static PLUGIN_JAR: &'static str = "@PLUGIN_JAR@"; -pub static JSOBJECT_JAR: &'static str = "@JSOBJECT_JAR@"; - -/*new variables*/
--- a/rust-launcher/launchers.rs Wed Feb 07 13:56:18 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -/*extern crate hardcoded_paths;*/ -extern crate hardcoded_paths; - -fn main() { - println!("{}",hardcoded_paths::PROGRAM_NAME); - println!("{}",hardcoded_paths::MAIN_CLASS); - println!("{}",hardcoded_paths::JAVA); - println!("{}",hardcoded_paths::JRE); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust-launcher/src/hardcoded_paths.rs Thu Mar 22 15:27:55 2018 +0100 @@ -0,0 +1,59 @@ +/*legacy variables*/ +const PROGRAM_NAME: Option<&'static str> = option_env!("PROGRAM_NAME"); +const LAUNCHER_BOOTCLASSPATH: Option<&'static str> = option_env!("LAUNCHER_BOOTCLASSPATH"); +const JAVAWS_SPLASH_LOCATION: Option<&'static str> = option_env!("JAVAWS_SPLASH_LOCATION"); +const JAVA: Option<&'static str> = option_env!("JAVA"); +const JRE: Option<&'static str> = option_env!("JRE"); +const MAIN_CLASS: Option<&'static str> = option_env!("MAIN_CLASS"); +const BIN_LOCATION: Option<&'static str> = option_env!("BIN_LOCATION"); +const NETX_JAR: Option<&'static str> = option_env!("NETX_JAR"); +const PLUGIN_JAR: Option<&'static str> = option_env!("PLUGIN_JAR"); +const JSOBJECT_JAR: Option<&'static str> = option_env!("JSOBJECT_JAR"); + + +pub fn get_jre() -> &'static str { + return JRE.unwrap_or("JRE-dev-unspecified") +} + +pub fn get_java() -> &'static str { + return JAVA.unwrap_or("JAVA-dev-unspecified") +} + +pub fn get_main() -> &'static str { + return MAIN_CLASS.unwrap_or("MAIN_CLASS-dev-unspecified") +} + +pub fn get_name() -> &'static str { + return PROGRAM_NAME.unwrap_or("PROGRAM_NAME-dev-unspecified") +} + +pub fn get_bin() -> &'static str { + return BIN_LOCATION.unwrap_or("BIN_LOCATION-dev-unspecified") +} + + + +/*new variables*/ + +/*tests*/ +#[cfg(test)] +mod tests { + + #[test] + fn variables_non_default() { + assert_ne!(String::from(super::get_jre()).trim(), String::from("JRE-dev-unspecified")); + assert_ne!(String::from(super::get_java()).trim(), String::from("JAVA-dev-unspecified")); + assert_ne!(String::from(super::get_main()).trim(), String::from("MAIN_CLASS-dev-unspecified")); + assert_ne!(String::from(super::get_name()).trim(), String::from("PROGRAM_NAME-dev-unspecified")); + assert_ne!(String::from(super::get_bin()).trim(), String::from("BIN_LOCATION-dev-unspecified")); + } + + #[test] + fn variables_non_empty() { + assert_ne!(String::from(super::get_jre()).trim(), String::from("")); + assert_ne!(String::from(super::get_java()).trim(), String::from("")); + assert_ne!(String::from(super::get_main()).trim(), String::from("")); + assert_ne!(String::from(super::get_name()).trim(), String::from("")); + assert_ne!(String::from(super::get_bin()).trim(), String::from("")); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust-launcher/src/main.rs Thu Mar 22 15:27:55 2018 +0100 @@ -0,0 +1,9 @@ +mod hardcoded_paths; + +fn main() { + println!("{}",hardcoded_paths::get_jre()); + println!("{}",hardcoded_paths::get_java()); + println!("{}",hardcoded_paths::get_main()); + println!("{}",hardcoded_paths::get_name()); + println!("{}",hardcoded_paths::get_bin()); +}