Created
December 1, 2012 11:06
-
-
Save sys1yagi/4181537 to your computer and use it in GitHub Desktop.
generate Eclipse Builders for Android NDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/$project_name/libs" type="2"/> </resources>}\"/> | |
<booleanAttribute key=\"org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND\" value=\"false\"/> | |
<stringAttribute key=\"org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE\" value=\"\${working_set:<?xml version="1.0" encoding="UTF-8"?> <resources> <item path="/$project_name/jni" type="2"/> </resources>}\"/> | |
<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><project>/.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