Fixed dx bat: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 3: Line 3:
'''<span class="$QTBASE_ROOT/mkspecs/features/data/android/dx.bat to Save"></span>'''
'''<span class="$QTBASE_ROOT/mkspecs/features/data/android/dx.bat to Save"></span>'''


<code>&amp;#64;echo off<br />REM Copyright © 2007 The Android Open Source Project<br />REM<br />REM Licensed under the Apache License, Version 2.0 (the &quot;License&amp;quot;);<br />REM you may not use this file except in compliance with the License.<br />REM You may obtain a copy of the License at<br />REM<br />REM http://www.apache.org/licenses/LICENSE-2.0<br />REM<br />REM Unless required by applicable law or agreed to in writing, software<br />REM distributed under the License is distributed on an &quot;AS IS&amp;quot; BASIS,<br />REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br />REM See the License for the specific language governing permissions and<br />REM limitations under the License.
<code>&amp;#64;echo off
REM Copyright © 2007 The Android Open Source Project
REM
REM Licensed under the Apache License, Version 2.0 (the "License");
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.


REM don't modify the caller's environment<br />setlocal
REM don't modify the caller's environment
setlocal


REM Locate dx.jar in the directory where dx.bat was found and start it.
REM Locate dx.jar in the directory where dx.bat was found and start it.


REM Set up prog to be the path of this script, including following symlinks,<br />REM and set up progdir to be the fully-qualified pathname of its directory.<br />set prog=%~f0
REM Set up prog to be the path of this script, including following symlinks,
REM and set up progdir to be the fully-qualified pathname of its directory.
set prog=%~f0


if [%1]==[] goto badArgs<br />set androidsdk=%1<br />shift /1
if [%1]==[] goto badArgs
set androidsdk=%1
shift /1


rem Check we have a valid Java.exe in the path.<br />set java_exe=<br />call androidsdk_java.bat<br />if not defined java_exe goto :EOF
rem Check we have a valid Java.exe in the path.
set java_exe=
call androidsdk_java.bat
if not defined java_exe goto :EOF


set jarfile=dx.jar
set jarfile=dx.jar
Line 21: Line 42:
set frameworkdir=androidsdk-tools\libif exist frameworkdirjarfile goto JarFileOk
set frameworkdir=androidsdk-tools\libif exist frameworkdirjarfile goto JarFileOk


set frameworkdir=androidsdk<br />:JarFileOk
set frameworkdir=androidsdk
:JarFileOk


set jarpath=frameworkdirjarfile
set jarpath=frameworkdirjarfile


set javaOpts=<br />set args=
set javaOpts=
set args=


REM By default, give dx a max heap size of 1 gig and a stack size of 1meg.<br />rem This can be overridden by using &quot;-JXmx…&quot; and &quot;-JXss…&quot; options below.<br />set defaultXmx=-Xmx1024M<br />set defaultXss=-Xss1m
REM By default, give dx a max heap size of 1 gig and a stack size of 1meg.
rem This can be overridden by using "-JXmx…" and "-JXss…" options below.
set defaultXmx=-Xmx1024M
set defaultXss=-Xss1m


REM Capture all arguments that are not -J options.<br />REM Note that when reading the input arguments with %1, the cmd.exe<br />REM automagically converts —name=value arguments into 2 arguments &quot;—name&amp;quot;<br />REM followed by &quot;value&amp;quot;. Dx has been changed to know how to deal with that.<br />set params=
REM Capture all arguments that are not -J options.
REM Note that when reading the input arguments with %1, the cmd.exe
REM automagically converts —name=value arguments into 2 arguments "—name"
REM followed by "value". Dx has been changed to know how to deal with that.
set params=


:firstArg<br />if [1]==[] goto endArgs<br />set a=~1
:firstArg
if [1]==[] goto endArgs
set a=~1


if [&amp;#37;defaultXmx&amp;amp;#37;]==[] goto notXmx<br /> if a:~0,5 NEQ -JXmx goto notXmx<br /> set defaultXmx=<br /> :notXmx
if [&amp;#37;defaultXmx&amp;amp;#37;]==[] goto notXmx
if a:~0,5 NEQ -JXmx goto notXmx
set defaultXmx=
:notXmx


if [&amp;#37;defaultXss&amp;amp;#37;]==[] goto notXss<br /> if a:~0,5 NEQ -JXss goto notXss<br /> set defaultXss=<br /> :notXss
if [&amp;#37;defaultXss&amp;amp;#37;]==[] goto notXss
if a:~0,5 NEQ -JXss goto notXss
set defaultXss=
:notXss


if a:~0,2 NEQ <s>J goto notJ<br /> set javaOpts=javaOpts</s>a:~2<br /> shift /1<br /> goto firstArg
if a:~0,2 NEQ -J goto notJ
set javaOpts=javaOpts-a:~2
shift /1
goto firstArg


:notJ<br /> set params=params %1<br /> shift /1<br /> goto firstArg
:notJ
set params=params %1
shift /1
goto firstArg


:endArgs
:endArgs
Line 49: Line 93:
goto :EOF
goto :EOF


:badArgs<br />echo Usage: dx &lt;android_sdk_path&amp;gt; &lt;dx_arguments&amp;gt;<br />echo Example: dx d:-sdk —dex —output=d:.jar d:
:badArgs
echo Usage: dx <android_sdk_path> <dx_arguments>
echo Example: dx d:-sdk —dex —output=d:.jar d:

Revision as of 13:08, 25 February 2015

h2. Fixed dx.bat used to build Qtbase/Android on Windows

&#64;echo off REM Copyright © 2007 The Android Open Source Project REM REM Licensed under the Apache License, Version 2.0 (the "License"); REM you may not use this file except in compliance with the License. REM You may obtain a copy of the License at REM REM http://www.apache.org/licenses/LICENSE-2.0 REM REM Unless required by applicable law or agreed to in writing, software REM distributed under the License is distributed on an "AS IS" BASIS, REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. REM See the License for the specific language governing permissions and REM limitations under the License.

REM don't modify the caller's environment setlocal

REM Locate dx.jar in the directory where dx.bat was found and start it.

REM Set up prog to be the path of this script, including following symlinks, REM and set up progdir to be the fully-qualified pathname of its directory. set prog=%~f0

if [%1]==[] goto badArgs set androidsdk=%1 shift /1

rem Check we have a valid Java.exe in the path. set java_exe= call androidsdk_java.bat if not defined java_exe goto :EOF

set jarfile=dx.jar

set frameworkdir=androidsdk-toolsif exist frameworkdirjarfile goto JarFileOk

set frameworkdir=androidsdk-tools\libif exist frameworkdirjarfile goto JarFileOk

set frameworkdir=androidsdk

JarFileOk

set jarpath=frameworkdirjarfile

set javaOpts= set args=

REM By default, give dx a max heap size of 1 gig and a stack size of 1meg. rem This can be overridden by using "-JXmx…" and "-JXss…" options below. set defaultXmx=-Xmx1024M set defaultXss=-Xss1m

REM Capture all arguments that are not -J options. REM Note that when reading the input arguments with %1, the cmd.exe REM automagically converts —name=value arguments into 2 arguments "—name" REM followed by "value". Dx has been changed to know how to deal with that. set params=

firstArg

if [1]==[] goto endArgs set a=~1

if [&#37;defaultXmx&amp;#37;]==[] goto notXmx

if a:~0,5 NEQ -JXmx goto notXmx
set defaultXmx=
:notXmx

if [&#37;defaultXss&amp;#37;]==[] goto notXss

if a:~0,5 NEQ -JXss goto notXss
set defaultXss=
:notXss

if a:~0,2 NEQ -J goto notJ

set javaOpts=javaOpts-a:~2
shift /1
goto firstArg
notJ
set params=params %1
shift /1
goto firstArg
endArgs

set javaOpts=javaOpts &#37;defaultXmx&amp;#37; &#37;defaultXss&amp;#37;

call java_exe javaOpts -Djava.ext.dirs=frameworkdir -jar jarpath params

goto :EOF

badArgs

echo Usage: dx <android_sdk_path> <dx_arguments> echo Example: dx d:-sdk —dex —output=d:.jar d: