Skip to content

Commit c1a5f1f

Browse files
committed
Add VM and StartArguments to services.
1 parent c770d9e commit c1a5f1f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/com/inet/gradle/setup/msi/WxsFileBuilder.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.Set;
3232
import java.util.UUID;
3333
import java.util.regex.Pattern;
34+
import java.util.stream.Collectors;
3435

3536
import javax.swing.JEditorPane;
3637
import javax.swing.text.DefaultStyledDocument;
@@ -667,10 +668,13 @@ private void addServices() throws IOException {
667668
addRegistryValue( regkey, "JavaHome", "string", "[INSTALLDIR]" + setup.getBundleJreTarget() );
668669
addRegistryValue( regkey, "Jvm", "string", "[INSTALLDIR]" + jvmDll );
669670
}
671+
addMultiStringRegistryValue( regkey, "Options", service.getJavaVMArguments() );
672+
670673
regkey = addRegistryKey( component, "HKLM", id + "_RegStart", baseKey + name + "\\Parameters\\Start" );
671674
addRegistryValue( regkey, "Class", "string", service.getMainClass() );
672675
addRegistryValue( regkey, "Mode", "string", "jvm" );
673676
addRegistryValue( regkey, "WorkingPath", "string", "[INSTALLDIR]" + subdir );
677+
addMultiStringRegistryValue( regkey, "Params", Arrays.asList( service.getStartArguments().split( " " ) ).stream().filter( e -> e.length() > 0 ).collect( Collectors.toList() ) );
674678
regkey = addRegistryKey( component, "HKLM", id + "_RegLog", baseKey + name + "\\Parameters\\Log" );
675679
addRegistryValue( regkey, "Path", "string", "[INSTALLDIR]" + subdir );
676680
addRegistryValue( regkey, "Prefix", "string", "service" );
@@ -1133,6 +1137,26 @@ private Element addRegistryValue( Element regkey, String name, String type, Stri
11331137
return regValue;
11341138
}
11351139

1140+
/**
1141+
* Add a registry value.
1142+
*
1143+
* @param regkey the parent registry key
1144+
* @param name the entry name, null use the default value of a key
1145+
* @param values the list of values
1146+
* @return the value node
1147+
*/
1148+
private Element addMultiStringRegistryValue( Element regkey, String name, List<String> values ) {
1149+
1150+
if ( values.isEmpty() ) return null;
1151+
Element regValue = getOrCreateChildByKeyValue( regkey, "RegistryValue", "Name", name );
1152+
addAttributeIfNotExists( regValue, "Type", "multiString" );
1153+
1154+
for( String value : values ) {
1155+
getOrCreateChild( regValue, "MultiStringValue", value, true );
1156+
}
1157+
1158+
return regValue;
1159+
}
11361160
/**
11371161
* Split a path in segments.
11381162
*

0 commit comments

Comments
 (0)