NOT A BUG: Trans commandline parameters

Monkey Forums/Monkey Bug Reports/NOT A BUG: Trans commandline parameters

ziggy(Posted 2014) [#1]
I think adding configuration parameters to trans using the + operator, seems to be broken. If I add this parameter:
+MINGW_PATH="C:\MINGW_"
it is ignored.

I'm trying to integrate most SDK installers in an automated process in jungle ide (sort of usability gain and a bit of marketing idea in behind too), Is it possible to make this with current Trans?

The idea is that the IDE should be able to download and install automatically anything required for desktop target. (I'll do the same for Android later). Once the user decides where he wants Mingw to be installed, the IDE should be able to tell trans on every compilation where MINGW is, without having to use the config file becouse this installation should be consistent across all Monkey updates in a way userd do not need to modifying once and again the config file. By leaving the IDE this work, we could have a very nice usability gain.
In the docs, it seems stated that you can add config variables as parameters, but it seems trans is ignoring them (or maybe just some of them?) Am I doing anything wrong?

As a side note, the openal installer exe link in the docs is broken.


dawlane(Posted 2014) [#2]
This is how I would do it.
On first run ask if they have a MinGW compiler installed.
If yes, check to see if MINGW environment variable has been set. If not, then get them to set it's path.
If no, then offer to download a version. Set the MINGW environment variable and it's path in the current users environment settings.
Then update the config.winnt.txt directly by replacing the first instance of MINGW_PATH="${MINGW}"

As a side note, the openal installer exe link in the docs is broken/
It needs removing and instructions to say that a copy is in the targets\glfw directory or linking to OpenAL-Soft (which is a doddle to build and from what I have read is faster than the Creative Labs version).


ziggy(Posted 2014) [#3]
If yes, check to see if MINGW environment variable has been set.
AFAIK, there's no MINGW environment variable required on Monkey. If you add it to the path it happens to work, but I'm needing a more consistent way, specially one that does not require tweaking OS settings, as I plan to allow for unattended automatic and easy SDK install scripts for all targets.

I have Desktop (more or less), XNA and I'm finishing Flash. But without the trans parameter fix/feaure, the desktop compiler has to be installed after every Monkey update, and that's not nice. Also, the same in Flash, I'm automating the Java SDK setup and forcing a pre-maid folder destination, instead of letting the user choose becouse I can't ensure the choosen destination will be available after every Monkey update and I would like to avoid forcing the user to modify the config.txt file as much as possible, and I would love to avoid the scenario: 1.- Update Monkey, 2.- Nothing works, 3.- Ask the forums, 4.- Don't know what's wrong, 5.- arrrrhs, I hate this! Instead, I preffer: 1.- Update Monkey,. 2.- Keep on working.


dawlane(Posted 2014) [#4]
AFAIK, there's no MINGW environment variable required on Monkey.
trans does it internally with the aid of what's in the MINGW_PATH config variable.

Personally I would use my own configuration file for storing paths and then when there is a Monkey update just parse the monkey config.winnt.txt and replace or add said paths.
Speaking of the JDK, I've just about sussed how to automate selection and download the current version (7u55) (not the latest 8u5) it's not fast as to find the required file it has to try to download the file first. And I think I may have a way to automate selection and download of the Android SDK by parsing the xml in the repository.

One thing to remember ziggy, is no matter how idiot proof a designer makes something. He will always underestimate the ingenuity of idiots.


ziggy(Posted 2014) [#5]
trans does it internally with the aid of what's in the MINGW_PATH config variable.
Modifying an environment variable in order to be able to use an application parameter is too much for me!

Speaking of the JDK, I've just about sussed how to automate selection and download the current version (7u55)
I'm ok with this if this version install by default into "${PROGRAMFILES}\Java\jdk1.7.0_17" Otherwise, it's a no go unless another environment variable is added (not nice IMHO) or config parameters are supported on Trans (as it seems to be stated in the trans documentation here: http://www.monkey-x.com/docs/html/Tools_Trans.html )


dawlane(Posted 2014) [#6]
I think that the settings are for what's in the application config settings http://www.monkey-x.com/docs/html/Programming_App%20config%20settings.html

Don't forget that on a 64bit OS any 32bit install goes to Program Files (x86), so the variable in JDK_PATH would have to read ${PROGRAMFILES(x86)} in stead of ${PROGRAMFILES}.


ziggy(Posted 2014) [#7]
Don't forget that on a 64bit OS any 32bit install goes to Program Files (x86), so the variable in JDK_PATH would have to read ${PROGRAMFILES(x86)} in stead of ${PROGRAMFILES}.
Is this true? it makes no sense to me. I mean, if trans is 32, and expecting 32 bits SDKs to be installed, it should return Program Files (x86) on 64 bits windows, and Program File on 32 bits windows. Mixing them seems weird. I can force Java to be installed in whatever folder I want, but it's weird and I can't just install a 64 bits VM right now to test on. The funniest thing is that, on a fresh XP machine, installing java into a folder, and having config.winnt pointing to the wrong location does not prevent Flash from compiling, so I *think* the java path for Flash could just not be required.


dawlane(Posted 2014) [#8]
Any thing that is in ${} are treated as external variables. Open a terminal and type echo %PROGRAMFILES%, echo %PROGRAMFILES(x86)% (or one of the others apart from MONKEYDIR) on a 64bit version of Windows. You will see that they should return the path to what they represent.
Windows XP has a JAVA already installed, but later version of Windows do not. I have used a 64bit version of the JDK with a 64bit JRE without any problems so far. If you ever did read the Adobe FLEX install instructions, you will see that it says to use a 32bit JDK. But, I did a bit of digging around and came across the script that executes the flex jar build tools, and discovered that it used an option called d32. The JDK documentation isn't very clear on this option, but it is supposed to instruct a 64bit JRE to use 32bit mode. Note though any compiled 32bit native code will not work with a 64bit JRE and would have to be recompiled for use with a 64bit JRE.

If at some point Mark gives us some explanation on how to implement the NDK, then I suspect that you will have to use the 32bit JDK or at least the 32bit NDK to develop on Android devices.

Oh. It is possible to recompile any Monkey code to a 64bit executable. MSERVER and the MONKEY stub are written in BlitzMax and unless Mark fixes BlitMax for 64bit compiling or uses another tool then 32bit will always be with us.


ziggy(Posted 2014) [#9]
Ok, more fun related. I've just modified the config file in this way:
 '--------------------
'Java dev kit path
'
'Must be set to a valid dir for ANDROID and FLASH target support
'
'The Java JDK is currently available here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
'
'For normal JDK
'JDK_PATH="${SYSTEMDRIVE}\Program Files\Java\jdk1.7.0_51"
'JDK_PATH="${SYSTEMDRIVE}\Program Files\Java\jdk1.7.0_17"
'JDK_PATH="${SYSTEMDRIVE}\Program Files\Java\jdk1.7.0_02"
'JDK_PATH="${SYSTEMDRIVE}\Program Files\Java\jdk1.6.0_23"
'JDK_PATH="${SYSTEMDRIVE}\Program Files\Java\jdk1.6.0_21"
'JDK_PATH="${SYSTEMDRIVE}\Program Files\Java\jdk1.6.0_19"

'For 32 bit JDK on 64 bit Windows
'JDK_PATH="${SYSTEMDRIVE}\Program Files (x86)\Java\jdk1.7.0_51"
'JDK_PATH="${SYSTEMDRIVE}\Program Files (x86)\Java\jdk1.7.0_17"
'JDK_PATH="${SYSTEMDRIVE}\Program Files (x86)\Java\jdk1.7.0_02"
'JDK_PATH="${SYSTEMDRIVE}\Program Files (x86)\Java\jdk1.6.0_23"
'JDK_PATH="${SYSTEMDRIVE}\Program Files (x86)\Java\jdk1.6.0_21"
'JDK_PATH="${SYSTEMDRIVE}\Program Files (x86)\Java\jdk1.6.0_19"
'--------------------
so there's not any valid JDK_PATH and flash compiles perfectly well. Java is installed, just that Monkey is not told where it is.
What's going on here?

EDIT: is it possible that the config variable is only required for Android, and not for Flash? Flex seems to be happy with any installed JVM. Not sure if it even requieres the whole JDK


dawlane(Posted 2014) [#10]
Have you set JAVA_HOME in you environment variables? And added it with bin to your PATH?


marksibly(Posted 2014) [#11]
The path vars in bin/ config files are not 'normal' #BLAH style vars as they control the behavior of the compiler.

From memory, there is a transcc option that allows you to select different a config file. I think it was you who asked for it in fact, although I didn't really like the idea as it meant Monkey code might compile in one IDE but not another.

> so there's not any valid JDK_PATH and flash compiles perfectly well. Java is installed, just that Monkey is not told where it is. What's going on here?

You may already have javac in your system 'path'. Generally, transcc just adds any config file paths to the system 'PATH' to effectively emulate the user having added the path to PATH, but of course each SDK has it's own idiosyncrasies and there are not really any hard and fast rules here.


ziggy(Posted 2014) [#12]
From memory, there is a transcc option that allows you to select different a config file. I think it was you who asked for it in fact, although I didn't really like the idea as it meant Monkey code might compile in one IDE but not another.
But I thought it was never implemented! Is it? I'll take a look. thanks!

You may already have javac in your system 'path'. Generally, transcc just adds any config file paths to the system 'PATH' to effectively emulate the user having added the path to PATH, but of course each SDK has it's own idiosyncrasies and there are not really any hard and fast rules here.
Thanks! So if trans is just adding the paths to the PATH, then it's ultra easy to setup.
Will keep with the automated installers. Jungle Ide now can automate the download and install of MinGW + OpenAL Desktop (on windows), XNA and Flash. I'll be doing Android soon and I'll add the Android tools to the IDE. I think this could bring a nice usability plus to Monkey.

If there's anything you think I should take into account, just tell me.


marksibly(Posted 2014) [#13]
> So if trans is just adding the paths to the PATH, then it's ultra easy to setup.

Well, it depends on the target...JAVA_HOME still needs to be set for Android (or Ant?) and each target has it's own wrinkles in general. Best thing to do would be to just take a look at transcc source!