Skip to content

Instantly share code, notes, and snippets.

@sys1yagi
Created December 1, 2012 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sys1yagi/4181537 to your computer and use it in GitHub Desktop.
Save sys1yagi/4181537 to your computer and use it in GitHub Desktop.
generate Eclipse Builders for Android NDK
ndk_path="$ANDROID_NDK_ROOT/ndk-build"
project_name=`xpath .project "/projectDescription/name/text()" 2> /dev/null`
project_path=`pwd`
external_tool_builders=.externalToolBuilders
file_name=ndk-build.launch
if [ ! -d $external_tool_builders ]; then
mkdir $external_tool_builders
fi
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<launchConfiguration type=\"org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType\">
<stringAttribute key=\"org.eclipse.debug.core.ATTR_REFRESH_SCOPE\" value=\"\${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/$project_name/libs&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}\"/>
<booleanAttribute key=\"org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND\" value=\"false\"/>
<stringAttribute key=\"org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE\" value=\"\${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/$project_name/jni&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}\"/>
<stringAttribute key=\"org.eclipse.ui.externaltools.ATTR_LOCATION\" value=\"$ndk_path\"/>
<stringAttribute key=\"org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS\" value=\"full,incremental,\"/>
<booleanAttribute key=\"org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED\" value=\"true\"/>
<stringAttribute key=\"org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY\" value=\"$project_path\"/>
</launchConfiguration>" > "$external_tool_builders/$file_name"
builder_exists=`xpath .project "/projectDescription/buildSpec/buildCommand/name/text()" 2> /dev/null | grep "org.eclipse.ui.externaltools.ExternalToolBuilder"`
if [ "$builder_exists" = "" ]; then
project_file=`while read LINE; do
echo $LINE
if [ "$LINE" = "<buildSpec>" ]; then
echo "<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/ndk-build.launch</value>
</dictionary>
</arguments>
</buildCommand>"
fi
done < ".project"`
echo $project_file > ".project"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment