jruby-launcher 0.9.9-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +826 -0
- data/Makefile +106 -0
- data/README.txt +61 -0
- data/Rakefile +27 -0
- data/argnames.h +37 -0
- data/argparser.cpp +559 -0
- data/argparser.h +76 -0
- data/extconf.rb +6 -0
- data/inc/Makefile-conf.mk +75 -0
- data/inc/Makefile-impl.mk +107 -0
- data/inc/Makefile-rules.mk +40 -0
- data/jruby.cpp +77 -0
- data/jrubyexe.cpp +84 -0
- data/jvmlauncher.cpp +421 -0
- data/jvmlauncher.h +141 -0
- data/lib/jruby-launcher.rb +3 -0
- data/lib/rubygems/defaults/jruby_native.rb +4 -0
- data/nbexecloader.h +43 -0
- data/ng.c +642 -0
- data/platformlauncher.cpp +239 -0
- data/platformlauncher.h +73 -0
- data/rb_w32_cmdvector.h +287 -0
- data/resources/jruby.ico +0 -0
- data/resources/jruby.rc +25 -0
- data/spec/launcher_spec.rb +134 -0
- data/spec/spec_helper.rb +61 -0
- data/strlcpy.c +69 -0
- data/unixlauncher.cpp +81 -0
- data/unixlauncher.h +22 -0
- data/utilsfuncs.cpp +269 -0
- data/utilsfuncs.h +84 -0
- data/utilsfuncswin.cpp +229 -0
- metadata +96 -0
data/argparser.h
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2009-2010 JRuby Team (www.jruby.org).
|
3
|
+
*/
|
4
|
+
|
5
|
+
|
6
|
+
#ifndef _ARGPARSER_H_
|
7
|
+
#define _ARGPARSER_H_
|
8
|
+
|
9
|
+
#include <string>
|
10
|
+
#include <list>
|
11
|
+
#include <set>
|
12
|
+
|
13
|
+
class ArgParser {
|
14
|
+
protected:
|
15
|
+
static const char *REQ_JAVA_VERSION;
|
16
|
+
static const char *HELP_MSG;
|
17
|
+
|
18
|
+
static const char *OPT_JDK_HOME;
|
19
|
+
static const char *OPT_JRUBY_HOME;
|
20
|
+
static const char *OPT_JRUBY_COMMAND_NAME;
|
21
|
+
|
22
|
+
static const char *OPT_CLASS_PATH;
|
23
|
+
static const char *OPT_BOOT_CLASS_PATH;
|
24
|
+
|
25
|
+
static const char *OPT_JFFI_PATH;
|
26
|
+
static const char *OPT_JRUBY_SHELL;
|
27
|
+
static const char *OPT_JRUBY_SCRIPT;
|
28
|
+
|
29
|
+
static const char *MAIN_CLASS;
|
30
|
+
static const char *DEFAULT_EXECUTABLE;
|
31
|
+
|
32
|
+
public:
|
33
|
+
ArgParser();
|
34
|
+
virtual ~ArgParser();
|
35
|
+
bool parseArgs(int argc, char *argv[]);
|
36
|
+
void appendToHelp(const char *msg);
|
37
|
+
std::string* buildCommandLine(int argc, char* argv[]);
|
38
|
+
|
39
|
+
protected:
|
40
|
+
ArgParser(const ArgParser& orig);
|
41
|
+
|
42
|
+
bool initPlatformDir();
|
43
|
+
void prepareOptions();
|
44
|
+
void setupMaxHeapAndStack();
|
45
|
+
void addEnvVarToOptions(std::list<std::string> & optionsList, const char * envvar);
|
46
|
+
void constructClassPath();
|
47
|
+
void constructBootClassPath();
|
48
|
+
void addFilesToClassPath(const char *dir, const char *subdir, const char *pattern);
|
49
|
+
void addToClassPath(const char *path, bool onlyIfExists = false);
|
50
|
+
void addToBootClassPath(const char *path, bool onlyIfExists = false);
|
51
|
+
void addJarsToClassPathFrom(const char *dir);
|
52
|
+
void addOptionsToCommandLine(std::list<std::string> & commandLine);
|
53
|
+
|
54
|
+
protected:
|
55
|
+
bool separateProcess;
|
56
|
+
bool nailgunClient;
|
57
|
+
bool nailgunServer;
|
58
|
+
bool printCommandLine;
|
59
|
+
std::string platformDir;
|
60
|
+
std::string bootclass;
|
61
|
+
std::string jdkhome;
|
62
|
+
std::string cpBefore;
|
63
|
+
std::string cpExplicit;
|
64
|
+
std::string cpAfter;
|
65
|
+
std::string nextAction;
|
66
|
+
|
67
|
+
std::list<std::string> javaOptions;
|
68
|
+
std::set<std::string> addedToCP;
|
69
|
+
std::string classPath;
|
70
|
+
std::string bootClassPath;
|
71
|
+
std::set<std::string> addedToBootCP;
|
72
|
+
std::string appendHelp;
|
73
|
+
std::list<std::string> progArgs;
|
74
|
+
};
|
75
|
+
|
76
|
+
#endif // ! _ARGPARSER_H_
|
data/extconf.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Environment
|
2
|
+
MKDIR=mkdir
|
3
|
+
CP=cp
|
4
|
+
CCADMIN=CCadmin
|
5
|
+
RANLIB=ranlib
|
6
|
+
CC=gcc
|
7
|
+
CCC=g++
|
8
|
+
CXX=g++
|
9
|
+
|
10
|
+
# Windows (mingw)?
|
11
|
+
ifneq (,$(findstring mingw, $(CONF)))
|
12
|
+
MINGW := true
|
13
|
+
endif
|
14
|
+
|
15
|
+
# Macros
|
16
|
+
ifndef CND_PLATFORM
|
17
|
+
CND_PLATFORM=$(shell uname -s)
|
18
|
+
endif
|
19
|
+
|
20
|
+
# Include project Makefile
|
21
|
+
include Makefile
|
22
|
+
|
23
|
+
# Object Directory
|
24
|
+
OBJECTDIR=build/${CONF}/${CND_PLATFORM}
|
25
|
+
|
26
|
+
# Object Files
|
27
|
+
OBJECTFILES = ${OBJECTDIR}/argparser.o \
|
28
|
+
${OBJECTDIR}/utilsfuncs.o \
|
29
|
+
${OBJECTDIR}/ng.o \
|
30
|
+
${OBJECTDIR}/strlcpy.o \
|
31
|
+
${OBJECTDIR}/jrubyexe.o
|
32
|
+
|
33
|
+
ifdef JAVA_HOME
|
34
|
+
INCLUDES = -I${JAVA_HOME}/include
|
35
|
+
endif
|
36
|
+
|
37
|
+
ifdef MINGW
|
38
|
+
OBJECTFILES += ${OBJECTDIR}/utilsfuncswin.o \
|
39
|
+
${OBJECTDIR}/platformlauncher.o \
|
40
|
+
${OBJECTDIR}/jvmlauncher.o \
|
41
|
+
${OBJECTDIR}/jruby.o
|
42
|
+
INCLUDES += -I${JAVA_HOME}/include/win32
|
43
|
+
else
|
44
|
+
OBJECTFILES += ${OBJECTDIR}/unixlauncher.o
|
45
|
+
endif
|
46
|
+
|
47
|
+
CFLAGS += -O2 -Wall $(INCLUDES)
|
48
|
+
CCFLAGS = $(CFLAGS)
|
49
|
+
CXXFLAGS = $(CFLAGS)
|
50
|
+
|
51
|
+
# Compiler Flags
|
52
|
+
ifeq (mingw,$(CONF))
|
53
|
+
CFLAGS += -m32 -mno-cygwin -s
|
54
|
+
endif
|
55
|
+
ifeq (mingw64,$(CONF))
|
56
|
+
CFLAGS += -m64 -mno-cygwin -s
|
57
|
+
endif
|
58
|
+
|
59
|
+
# Resources
|
60
|
+
WINDRES = windres
|
61
|
+
|
62
|
+
# Link Libraries and Options
|
63
|
+
LDLIBSOPTIONS = -lstdc++
|
64
|
+
|
65
|
+
ifdef MINGW
|
66
|
+
LDLIBSOPTIONS += -lws2_32 -static-libgcc -Wl,--enable-auto-import -Wl,-Bstatic -Wl,-Bdynamic
|
67
|
+
PROGRAM = jruby.dll
|
68
|
+
else
|
69
|
+
PROGRAM = jruby
|
70
|
+
endif
|
71
|
+
|
72
|
+
ifneq (,$(findstring SunOS,$(CND_PLATFORM)))
|
73
|
+
CFLAGS += -D__SUNOS__
|
74
|
+
LDLIBSOPTIONS += -lsocket -lnsl
|
75
|
+
endif
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
|
2
|
+
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
|
3
|
+
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
|
4
|
+
# and .clean-reqprojects-conf unless SUB has the value 'no'
|
5
|
+
SUB_no=NO
|
6
|
+
SUBPROJECTS=${SUB_${SUB}}
|
7
|
+
BUILD_SUBPROJECTS_=.build-subprojects
|
8
|
+
BUILD_SUBPROJECTS_NO=
|
9
|
+
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
|
10
|
+
CLEAN_SUBPROJECTS_=.clean-subprojects
|
11
|
+
CLEAN_SUBPROJECTS_NO=
|
12
|
+
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
|
13
|
+
|
14
|
+
|
15
|
+
# Project Name
|
16
|
+
PROJECTNAME=jruby-launcher
|
17
|
+
|
18
|
+
# Active Configuration
|
19
|
+
DEFAULTCONF=mingw
|
20
|
+
CONF=${DEFAULTCONF}
|
21
|
+
|
22
|
+
# All Configurations
|
23
|
+
ALLCONFS=mingw mingw64 unix
|
24
|
+
|
25
|
+
# build
|
26
|
+
.build-impl: .build-pre .validate-impl .depcheck-impl
|
27
|
+
@#echo "=> Running $@... Configuration=$(CONF)"
|
28
|
+
${MAKE} -f inc/Makefile-rules.mk CONF=$(CONF) SUBPROJECTS=${SUBPROJECTS} .build-conf
|
29
|
+
|
30
|
+
|
31
|
+
# clean
|
32
|
+
.clean-impl: .clean-pre .depcheck-impl
|
33
|
+
@#echo "=> Running $@... Configuration=$(CONF)"
|
34
|
+
${MAKE} -f inc/Makefile-rules.mk CONF=$(CONF) SUBPROJECTS=${SUBPROJECTS} .clean-conf
|
35
|
+
|
36
|
+
|
37
|
+
# clobber
|
38
|
+
.clobber-impl: .clobber-pre .depcheck-impl
|
39
|
+
@#echo "=> Running $@..."
|
40
|
+
for CONF in ${ALLCONFS}; \
|
41
|
+
do \
|
42
|
+
${MAKE} -f inc/Makefile-rules.mk CONF=$(CONF) SUBPROJECTS=${SUBPROJECTS} .clean-conf; \
|
43
|
+
done
|
44
|
+
|
45
|
+
# all
|
46
|
+
.all-impl: .all-pre .depcheck-impl
|
47
|
+
@#echo "=> Running $@..."
|
48
|
+
for CONF in ${ALLCONFS}; \
|
49
|
+
do \
|
50
|
+
${MAKE} -f inc/Makefile-rules.mk CONF=$(CONF) SUBPROJECTS=${SUBPROJECTS} .build-conf; \
|
51
|
+
done
|
52
|
+
|
53
|
+
# configuration validation (currently only needed on mingw/windows)
|
54
|
+
.validate-impl:
|
55
|
+
@if [ $(CONF) = mingw -a ! "$$JAVA_HOME" ]; \
|
56
|
+
then \
|
57
|
+
echo ""; \
|
58
|
+
echo "Error: JAVA_HOME not set. Please make sure you have a JVM installed"; \
|
59
|
+
echo "and JAVA_HOME pointing to it."; \
|
60
|
+
echo "Current directory: " `pwd`; \
|
61
|
+
echo ""; \
|
62
|
+
exit 1; \
|
63
|
+
fi
|
64
|
+
|
65
|
+
# dependency checking support
|
66
|
+
.depcheck-impl:
|
67
|
+
@echo "# This code depends on make tool being used" >.dep.inc
|
68
|
+
@if [ -n "${MAKE_VERSION}" ]; then \
|
69
|
+
echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
|
70
|
+
echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
|
71
|
+
echo "include \$${DEPFILES}" >>.dep.inc; \
|
72
|
+
echo "endif" >>.dep.inc; \
|
73
|
+
else \
|
74
|
+
echo ".KEEP_STATE:" >>.dep.inc; \
|
75
|
+
echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
|
76
|
+
fi
|
77
|
+
|
78
|
+
# help
|
79
|
+
.help-impl: .help-pre
|
80
|
+
@echo "This makefile supports the following configurations:"
|
81
|
+
@echo " ${ALLCONFS}"
|
82
|
+
@echo ""
|
83
|
+
@echo "and the following targets:"
|
84
|
+
@echo " build (default target)"
|
85
|
+
@echo " clean"
|
86
|
+
@echo " clobber"
|
87
|
+
@echo " all"
|
88
|
+
@echo " help"
|
89
|
+
@echo ""
|
90
|
+
@echo "Makefile Usage:"
|
91
|
+
@echo " make [CONF=<CONFIGURATION>] [SUB=no] build"
|
92
|
+
@echo " make [CONF=<CONFIGURATION>] [SUB=no] clean"
|
93
|
+
@echo " make [SUB=no] clobber"
|
94
|
+
@echo " make [SUB=no] all"
|
95
|
+
@echo " make help"
|
96
|
+
@echo ""
|
97
|
+
@echo "Target 'build' will build a specific configuration and, unless 'SUB=no',"
|
98
|
+
@echo " also build subprojects."
|
99
|
+
@echo "Target 'clean' will clean a specific configuration and, unless 'SUB=no',"
|
100
|
+
@echo " also clean subprojects."
|
101
|
+
@echo "Target 'clobber' will remove all built files from all configurations and,"
|
102
|
+
@echo " unless 'SUB=no', also from subprojects."
|
103
|
+
@echo "Target 'all' will will build all configurations and, unless 'SUB=no',"
|
104
|
+
@echo " also build subprojects."
|
105
|
+
@echo "Target 'help' prints this message."
|
106
|
+
@echo ""
|
107
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
include inc/Makefile-conf.mk
|
2
|
+
|
3
|
+
# Build Targets
|
4
|
+
.build-conf: ${BUILD_SUBPROJECTS}
|
5
|
+
${MAKE} -f inc/Makefile-rules.mk $(PROGRAM)
|
6
|
+
|
7
|
+
jruby.dll: ${OBJECTFILES}
|
8
|
+
${LINK.cc} -shared -s -o $@ $^ $(LDLIBSOPTIONS)
|
9
|
+
|
10
|
+
jruby: $(OBJECTDIR)/jruby-launcher
|
11
|
+
cp $^ $@
|
12
|
+
|
13
|
+
$(OBJECTDIR)/jruby-launcher: ${OBJECTFILES}
|
14
|
+
${LINK.cc} -o $@ $^ $(LDLIBSOPTIONS)
|
15
|
+
|
16
|
+
$(OBJECTDIR)/%.o: %.cpp inc/Makefile-rules.mk inc/Makefile-conf.mk
|
17
|
+
${MKDIR} -p ${OBJECTDIR}
|
18
|
+
${RM} $@.d
|
19
|
+
$(COMPILE.cc) $< -MMD -MP -MF $@.d -o $@
|
20
|
+
|
21
|
+
$(OBJECTDIR)/%.o: %.c inc/Makefile-rules.mk inc/Makefile-conf.mk
|
22
|
+
${MKDIR} -p ${OBJECTDIR}
|
23
|
+
${RM} $@.d
|
24
|
+
$(COMPILE.c) $< -MMD -MP -MF $@.d -o $@
|
25
|
+
|
26
|
+
# Subprojects
|
27
|
+
.build-subprojects:
|
28
|
+
|
29
|
+
# Clean Targets
|
30
|
+
.clean-conf: ${CLEAN_SUBPROJECTS}
|
31
|
+
${RM} -r build/$(CONF)
|
32
|
+
${RM} -f $(PROGRAM)
|
33
|
+
|
34
|
+
# Subprojects
|
35
|
+
.clean-subprojects:
|
36
|
+
|
37
|
+
# Enable dependency checking
|
38
|
+
.dep.inc: .depcheck-impl
|
39
|
+
|
40
|
+
include .dep.inc
|
data/jruby.cpp
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
+
*
|
4
|
+
* Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
|
5
|
+
*
|
6
|
+
* The contents of this file are subject to the terms of either the GNU
|
7
|
+
* General Public License Version 2 only ("GPL") or the Common
|
8
|
+
* Development and Distribution License("CDDL") (collectively, the
|
9
|
+
* "License"). You may not use this file except in compliance with the
|
10
|
+
* License. You can obtain a copy of the License at
|
11
|
+
* http://www.netbeans.org/cddl-gplv2.html
|
12
|
+
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
13
|
+
* specific language governing permissions and limitations under the
|
14
|
+
* License. When distributing the software, include this License Header
|
15
|
+
* Notice in each file and include the License file at
|
16
|
+
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
|
17
|
+
* particular file as subject to the "Classpath" exception as provided
|
18
|
+
* by Sun in the GPL Version 2 section of the License file that
|
19
|
+
* accompanied this code. If applicable, add the following below the
|
20
|
+
* License Header, with the fields enclosed by brackets [] replaced by
|
21
|
+
* your own identifying information:
|
22
|
+
* "Portions Copyrighted [year] [name of copyright owner]"
|
23
|
+
*
|
24
|
+
* Contributor(s):
|
25
|
+
*
|
26
|
+
* The Original Software is NetBeans. The Initial Developer of the Original
|
27
|
+
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
|
28
|
+
* Microsystems, Inc. All Rights Reserved.
|
29
|
+
*
|
30
|
+
* If you wish your version of this file to be governed by only the CDDL
|
31
|
+
* or only the GPL Version 2, indicate your decision by adding
|
32
|
+
* "[Contributor] elects to include this software in this distribution
|
33
|
+
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
34
|
+
* single choice of license, a recipient has the option to distribute
|
35
|
+
* your version of this file under either the CDDL, the GPL Version 2 or
|
36
|
+
* to extend the choice of license to its licensees as provided above.
|
37
|
+
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
38
|
+
* Version 2 license, then the option applies only if the new code is
|
39
|
+
* made subject to such option by the copyright holder.
|
40
|
+
*
|
41
|
+
* Author: Tomas Holy
|
42
|
+
*/
|
43
|
+
|
44
|
+
#include "platformlauncher.h"
|
45
|
+
#include "utilsfuncs.h"
|
46
|
+
|
47
|
+
PlatformLauncher launcher;
|
48
|
+
|
49
|
+
extern "C" BOOL APIENTRY DllMain(HANDLE hModule,
|
50
|
+
DWORD ul_reason_for_call,
|
51
|
+
LPVOID lpReserved
|
52
|
+
) {
|
53
|
+
switch (ul_reason_for_call) {
|
54
|
+
case DLL_PROCESS_ATTACH:
|
55
|
+
break;
|
56
|
+
case DLL_THREAD_ATTACH:
|
57
|
+
break;
|
58
|
+
case DLL_THREAD_DETACH:
|
59
|
+
break;
|
60
|
+
case DLL_PROCESS_DETACH:
|
61
|
+
launcher.onExit();
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
return TRUE;
|
65
|
+
}
|
66
|
+
|
67
|
+
#define NBEXEC_EXPORT extern "C" __declspec(dllexport)
|
68
|
+
|
69
|
+
NBEXEC_EXPORT int startPlatform(int argc, char *argv[], const char *helpMsg, const char *name) {
|
70
|
+
DWORD retCode = 0;
|
71
|
+
launcher.appendToHelp(helpMsg);
|
72
|
+
launcher.setSuppressConsole(!isConsoleAttached());
|
73
|
+
if (!launcher.start(argv, argc, &retCode, name)) {
|
74
|
+
return -1;
|
75
|
+
}
|
76
|
+
return retCode;
|
77
|
+
}
|
data/jrubyexe.cpp
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
/*
|
2
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
+
*
|
4
|
+
* Copyright 1997-2008, 2010 Sun Microsystems, Inc. All rights reserved.
|
5
|
+
*
|
6
|
+
* The contents of this file are subject to the terms of either the GNU
|
7
|
+
* General Public License Version 2 only ("GPL") or the Common
|
8
|
+
* Development and Distribution License("CDDL") (collectively, the
|
9
|
+
* "License"). You may not use this file except in compliance with the
|
10
|
+
* License. You can obtain a copy of the License at
|
11
|
+
* http://www.netbeans.org/cddl-gplv2.html
|
12
|
+
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
13
|
+
* specific language governing permissions and limitations under the
|
14
|
+
* License. When distributing the software, include this License Header
|
15
|
+
* Notice in each file and include the License file at
|
16
|
+
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
|
17
|
+
* particular file as subject to the "Classpath" exception as provided
|
18
|
+
* by Sun in the GPL Version 2 section of the License file that
|
19
|
+
* accompanied this code. If applicable, add the following below the
|
20
|
+
* License Header, with the fields enclosed by brackets [] replaced by
|
21
|
+
* your own identifying information:
|
22
|
+
* "Portions Copyrighted [year] [name of copyright owner]"
|
23
|
+
*
|
24
|
+
* Contributor(s):
|
25
|
+
*
|
26
|
+
* The Original Software is NetBeans. The Initial Developer of the Original
|
27
|
+
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
|
28
|
+
* Microsystems, Inc. All Rights Reserved.
|
29
|
+
*
|
30
|
+
* If you wish your version of this file to be governed by only the CDDL
|
31
|
+
* or only the GPL Version 2, indicate your decision by adding
|
32
|
+
* "[Contributor] elects to include this software in this distribution
|
33
|
+
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
34
|
+
* single choice of license, a recipient has the option to distribute
|
35
|
+
* your version of this file under either the CDDL, the GPL Version 2 or
|
36
|
+
* to extend the choice of license to its licensees as provided above.
|
37
|
+
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
38
|
+
* Version 2 license, then the option applies only if the new code is
|
39
|
+
* made subject to such option by the copyright holder.
|
40
|
+
*
|
41
|
+
* Author: Tomas Holy
|
42
|
+
*/
|
43
|
+
|
44
|
+
#ifdef WIN32
|
45
|
+
#include <windows.h>
|
46
|
+
#include "nbexecloader.h"
|
47
|
+
|
48
|
+
#ifdef JRUBYW
|
49
|
+
const char *CON_ATTACH_MSG =
|
50
|
+
"*WARNING*: The non-console JRubyW launcher is forced to attach to console.\n"
|
51
|
+
"This may cause unexpected behavior of CMD console. Use:\n"
|
52
|
+
" start /wait jrubyw.exe -Xconsole attach [args]\n";
|
53
|
+
#endif // JRUBYW
|
54
|
+
#else
|
55
|
+
#include "unixlauncher.h"
|
56
|
+
#endif // WIN32
|
57
|
+
|
58
|
+
#include "utilsfuncs.h"
|
59
|
+
|
60
|
+
|
61
|
+
int main(int argc, char *argv[], char* envp[]) {
|
62
|
+
checkLoggingArg(argc, argv, true);
|
63
|
+
|
64
|
+
#ifdef WIN32
|
65
|
+
#ifdef JRUBYW
|
66
|
+
if (!isConsoleAttached()) {
|
67
|
+
logMsg("Console is not attached, assume WINDOW mode");
|
68
|
+
DWORD parentProcID = 0;
|
69
|
+
if (!setupProcess(argc, argv, parentProcID, CON_ATTACH_MSG)) {
|
70
|
+
return -1;
|
71
|
+
}
|
72
|
+
} else {
|
73
|
+
logMsg("Console is not attached, assume CONSOLE mode");
|
74
|
+
}
|
75
|
+
#endif // JRUBYW
|
76
|
+
|
77
|
+
NBExecLoader loader;
|
78
|
+
return loader.start("jruby.dll", argc - 1, argv + 1, argv[0]);
|
79
|
+
|
80
|
+
#else // !WIN32
|
81
|
+
UnixLauncher launcher;
|
82
|
+
return launcher.run(argc, argv, envp);
|
83
|
+
#endif // WIN32
|
84
|
+
}
|