am b8f35789: merge from open-source master
Merge commit 'b8f35789df5f7ec6405cb05d2bdb8dc52ed082a9' * commit 'b8f35789df5f7ec6405cb05d2bdb8dc52ed082a9': Add --prebuilt-ndk=FILE and --no-git options to build/tools/make-release.sh script. Fix device dpi handling in the Layout device parsing/UI.
This commit is contained in:
committed by
Android Git Automerger
commit
fb105db46b
@@ -22,8 +22,11 @@
|
||||
NDK_ROOT_DIR=`dirname $0`/../..
|
||||
NDK_ROOT_DIR=`cd $NDK_ROOT_DIR && pwd`
|
||||
|
||||
# the release name
|
||||
RELEASE=1.6_r1
|
||||
. $NDK_ROOT_DIR/build/core/ndk-common.sh
|
||||
force_32bit_binaries
|
||||
|
||||
# the default release name (use today's date)
|
||||
RELEASE=`date +%Y%m%d`
|
||||
|
||||
# the package prefix
|
||||
PREFIX=android-ndk
|
||||
@@ -37,6 +40,13 @@ PREBUILT_PREFIX=android-ndk-prebuilt-20090323
|
||||
# the list of supported host development systems
|
||||
PREBUILT_SYSTEMS="linux-x86 darwin-x86 windows"
|
||||
|
||||
# a prebuilt NDK archive (.zip file). empty means don't use any
|
||||
PREBUILT_NDK=
|
||||
|
||||
# set to 'yes' if we should use 'git ls-files' to list the files to
|
||||
# be copied into the archive.
|
||||
USE_GIT_FILES=yes
|
||||
|
||||
OPTION_HELP=no
|
||||
|
||||
for opt do
|
||||
@@ -55,12 +65,16 @@ for opt do
|
||||
;;
|
||||
--prefix=*) PREFIX=$optarg
|
||||
;;
|
||||
--prebuilt-ndk=*) PREBUILT_NDK=$optarg
|
||||
;;
|
||||
--prebuilt-prefix=*) PREBUILT_PREFIX=$optarg
|
||||
;;
|
||||
--prebuilt-path=*) PREBUILT_DIR=$optarg
|
||||
;;
|
||||
--systems=*) PREBUILT_SYSTEMS=$optarg
|
||||
;;
|
||||
--no-git) USE_GIT_FILES=no
|
||||
;;
|
||||
*)
|
||||
echo "unknown option '$opt', use --help"
|
||||
exit 1
|
||||
@@ -74,42 +88,51 @@ if [ $OPTION_HELP = yes ] ; then
|
||||
echo "You will need to specify the path of a directory containing"
|
||||
echo "prebuilt toolchain tarballs with the --prebuilt-path option."
|
||||
echo ""
|
||||
echo "Alternatively, you can specify an existing NDK release package"
|
||||
echo "with the --prebuilt-ndk option."
|
||||
echo ""
|
||||
echo "Options: [defaults in brackets after descriptions]"
|
||||
echo ""
|
||||
echo " --help Print this help message"
|
||||
echo " --prefix=PREFIX Package prefix name [$PREFIX]"
|
||||
echo " --release=NAME Specify release name [$RELEASE]"
|
||||
echo " --systems=SYSTEMS List of host system packages [$PREBUILT_SYSTEMS]"
|
||||
echo " --prebuilt-ndk=FILE Specify a previous NDK package [$PREBUILT_NDK]"
|
||||
echo " --prebuilt-path=PATH Location of prebuilt binary tarballs [$PREBUILT_DIR]"
|
||||
echo " --prebuilt-prefix=PREFIX Prefix of prebuilt binary tarballs [$PREBUILT_PREFIX]"
|
||||
echo " --no-git Don't use git to list input files, take all of them."
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check the prebuilt path
|
||||
#
|
||||
if [ -z "$PREBUILT_DIR" ] ; then
|
||||
echo "ERROR: You must use --prebuilt-path=PATH to specify the path of prebuilt binary tarballs."
|
||||
if [ -n "$PREBUILD_NDK" -a -n "$PREBUILT_DIR" ] ; then
|
||||
echo "ERROR: You cannot use both --prebuilt-ndk and --prebuilt-path at the same time."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PREBUILT_DIR" -a -z "$PREBUILT_NDK" ] ; then
|
||||
echo "ERROR: You must use --prebuilt-path=PATH to specify the path of prebuilt binary tarballs."
|
||||
echo " Or --prebuilt-ndk=FILE to specify an existing NDK release archive."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$PREBUILT_DIR" ] ; then
|
||||
if [ ! -d "$PREBUILT_DIR" ] ; then
|
||||
echo "ERROR: the --prebuilt-path argument is not a directory path: $PREBUILT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check the systems
|
||||
#
|
||||
if [ -z "$PREBUILT_SYSTEMS" ] ; then
|
||||
echo "ERROR: Your systems list is empty, use --system=LIST to specify a different one."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PREBUILT_PREFIX" ] ; then
|
||||
echo "ERROR: Your prebuilt prefix is empty; use --prebuilt-prefix=PREFIX."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$PREBUILT_SYSTEMS" ] ; then
|
||||
echo "ERROR: Your systems list is empty, use --system=LIST to specify a different one."
|
||||
exit 1
|
||||
fi
|
||||
# Check the systems
|
||||
#
|
||||
for SYS in $PREBUILT_SYSTEMS; do
|
||||
if [ ! -f $PREBUILT_DIR/$PREBUILT_PREFIX-$SYS.tar.bz2 ] ; then
|
||||
echo "ERROR: It seems there is no prebuilt binary tarball for the '$SYS' system"
|
||||
@@ -117,9 +140,35 @@ for SYS in $PREBUILT_SYSTEMS; do
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
if [ ! -f "$PREBUILT_NDK" ] ; then
|
||||
echo "ERROR: the --prebuilt-ndk argument is not a file: $PREBUILT_NDK"
|
||||
exit 1
|
||||
fi
|
||||
# Check that the name ends with the proper host tag
|
||||
HOST_NDK_SUFFIX="$HOST_TAG.zip"
|
||||
echo "$PREBUILT_NDK" | grep -q "$HOST_NDK_SUFFIX"
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: the name of the prebuilt NDK must end in $HOST_NDK_SUFFIX"
|
||||
exit 1
|
||||
fi
|
||||
PREBUILT_SYSTEMS=$HOST_TAG
|
||||
fi
|
||||
|
||||
# The list of git files to copy into the archives
|
||||
if [ "$USE_GIT_FILES" = "yes" ] ; then
|
||||
echo "Collecting sources from git (use --no-git to copy all files instead)."
|
||||
GIT_FILES=`cd $NDK_ROOT_DIR && git ls-files`
|
||||
else
|
||||
echo "Collecting all sources files under tree."
|
||||
# Cleanup everything that is likely to not be part of the final NDK
|
||||
# i.e. generated files...
|
||||
rm -rf $NDK_ROOT_DIR/out
|
||||
rm -rf $NDK_ROOT_DIR/apps/*/project/libs/armeabi
|
||||
# Get all files under the NDK root
|
||||
GIT_FILES=`cd $NDK_ROOT_DIR && find .`
|
||||
GIT_FILES=`echo $GIT_FILES | sed -e "s!\./!!g"`
|
||||
fi
|
||||
|
||||
# temporary directory used for packaging
|
||||
TMPDIR=/tmp/ndk-release
|
||||
@@ -129,17 +178,17 @@ RELEASE_PREFIX=$PREFIX-$RELEASE
|
||||
rm -rf $TMPDIR && mkdir -p $TMPDIR
|
||||
|
||||
# first create the reference ndk directory from the git reference
|
||||
echo "Creating reference from git files"
|
||||
echo "Creating reference from source files"
|
||||
REFERENCE=$TMPDIR/reference &&
|
||||
mkdir -p $REFERENCE &&
|
||||
(cd $NDK_ROOT_DIR && tar cf - $GIT_FILES) | (cd $REFERENCE && tar xf -) &&
|
||||
rm -f $REFERENCE/Android.mk
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Could not create git reference. Aborting."
|
||||
echo "Could not create reference. Aborting."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# now, for each system, create a preview package
|
||||
# now, for each system, create a package
|
||||
#
|
||||
for SYSTEM in $PREBUILT_SYSTEMS; do
|
||||
echo "Preparing package for system $SYSTEM."
|
||||
@@ -153,12 +202,28 @@ for SYSTEM in $PREBUILT_SYSTEMS; do
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ -n "$PREBUILT_NDK" ] ; then
|
||||
echo "Unpacking prebuilt toolchain from $PREBUILT_NDK"
|
||||
UNZIP_DIR=$TMPDIR/prev-ndk
|
||||
rm -rf $UNZIP_DIR && mkdir -p $UNZIP_DIR
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Could not create temporary directory: $UNZIP_DIR"
|
||||
exit 1
|
||||
fi
|
||||
cd $UNZIP_DIR && unzip -q $PREBUILT_NDK 1>/dev/null 2>&1
|
||||
if [ $? != 0 ] ; then
|
||||
echo "ERROR: Could not unzip NDK package $PREBUILT_NDK"
|
||||
exit 1
|
||||
fi
|
||||
cd android-ndk-* && cp -rP build/prebuilt $DSTDIR/build
|
||||
else
|
||||
echo "Unpacking $PREBUILT.tar.bz2"
|
||||
(cd $DSTDIR && tar xjf $PREBUILT.tar.bz2) 2>/dev/null 1>&2
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Could not unpack prebuilt for system $SYSTEM. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
ARCHIVE=$BIN_RELEASE.zip
|
||||
echo "Creating $ARCHIVE"
|
||||
@@ -173,6 +238,7 @@ done
|
||||
|
||||
echo "Cleaning up."
|
||||
rm -rf $TMPDIR/reference
|
||||
rm -rf $TMPDIR/prev-ndk
|
||||
|
||||
echo "Done, please see packages in $TMPDIR:"
|
||||
ls -l $TMPDIR
|
||||
|
||||
@@ -12,6 +12,27 @@ IMPORTANT BUG FIXES:
|
||||
|
||||
- Actually use the awk version detected by host-setup.sh during the build.
|
||||
|
||||
OTHER FIXES & CHANGES:
|
||||
|
||||
- Added --prebuilt-ndk=FILE option to build/tools/make-release.sh script to
|
||||
package a new experimental NDK package archive from the current source tree
|
||||
plus the toolchain binaries of an existing NDK release package. E.g.:
|
||||
|
||||
build/tools/make-release.sh \
|
||||
--prebuilt-ndk=/path/to/android-ndk-1.6_r1-linux-x86.zip
|
||||
|
||||
will generate a new NDK package in /tmp/ndk-release that contains the most
|
||||
up-to-date build scripts, plus the toolchain binaries from 1.6_r1 (which
|
||||
are not in the git repository).
|
||||
|
||||
Also added the --no-git option to collect all sources from the current
|
||||
NDK root directory, instead of the list given by 'git ls-files'. This can
|
||||
be useful if you don't want to checkout the whole 'platform/development'
|
||||
project from repo and still work on the NDK.
|
||||
|
||||
This change is to help people easily package experimental NDK releases to
|
||||
test and distribute fixes and improvements.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
android-ndk-1.6_r1
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public class ConfigEditDialog extends GridDialog {
|
||||
|
||||
private String mDeviceName;
|
||||
private String mConfigName;
|
||||
private float mXDpi = 0f;
|
||||
private float mYDpi = 0f;
|
||||
private float mXDpi = Float.NaN;
|
||||
private float mYDpi = Float.NaN;
|
||||
|
||||
|
||||
public ConfigEditDialog(Shell parentShell, FolderConfiguration config) {
|
||||
@@ -140,13 +140,18 @@ public class ConfigEditDialog extends GridDialog {
|
||||
|
||||
final Text deviceXDpiText = new Text(deviceGroup, SWT.BORDER);
|
||||
deviceXDpiText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
if (mXDpi != 0f) {
|
||||
if (Float.isNaN(mXDpi) == false) {
|
||||
deviceXDpiText.setText(String.format("%.1f", mXDpi)); //$NON-NLS-1$
|
||||
}
|
||||
deviceXDpiText.addVerifyListener(floatVerifier);
|
||||
deviceXDpiText.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
mXDpi = Float.parseFloat(deviceXDpiText.getText());
|
||||
String value = deviceXDpiText.getText();
|
||||
if (value.length() == 0) {
|
||||
mXDpi = Float.NaN;
|
||||
} else {
|
||||
mXDpi = Float.parseFloat(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -155,13 +160,18 @@ public class ConfigEditDialog extends GridDialog {
|
||||
|
||||
final Text deviceYDpiText = new Text(deviceGroup, SWT.BORDER);
|
||||
deviceYDpiText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
if (mYDpi != 0f) {
|
||||
if (Float.isNaN(mYDpi) == false) {
|
||||
deviceYDpiText.setText(String.format("%.1f", mYDpi)); //$NON-NLS-1$
|
||||
}
|
||||
deviceYDpiText.addVerifyListener(floatVerifier);
|
||||
deviceYDpiText.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
mYDpi = Float.parseFloat(deviceYDpiText.getText());
|
||||
String value = deviceYDpiText.getText();
|
||||
if (value.length() == 0) {
|
||||
mYDpi = Float.NaN;
|
||||
} else {
|
||||
mYDpi = Float.parseFloat(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -185,11 +195,10 @@ public class ConfigEditDialog extends GridDialog {
|
||||
}
|
||||
});
|
||||
|
||||
mConfigSelector = new ConfigurationSelector(configGroup);
|
||||
mConfigSelector = new ConfigurationSelector(configGroup, true /*deviceMode*/);
|
||||
// configure the selector to be in "device mode" and not accept language/region/version
|
||||
// since those are selected from a different combo
|
||||
// FIXME: add version combo.
|
||||
mConfigSelector.setDeviceMode(true);
|
||||
mConfigSelector.setQualifierFilter(new IQualifierFilter() {
|
||||
public boolean accept(ResourceQualifier qualifier) {
|
||||
if (qualifier instanceof LanguageQualifier ||
|
||||
|
||||
@@ -335,6 +335,8 @@ public class ConfigManagerDialog extends GridDialog {
|
||||
DeviceSelection selection = getSelection();
|
||||
ConfigEditDialog dlg = new ConfigEditDialog(parent.getShell(), null);
|
||||
dlg.setDeviceName(selection.device.getName());
|
||||
dlg.setXDpi(selection.device.getXDpi());
|
||||
dlg.setYDpi(selection.device.getYDpi());
|
||||
dlg.setConfigName(selection.entry.getKey());
|
||||
dlg.setConfig(selection.entry.getValue());
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public final class LayoutCreatorDialog extends GridDialog {
|
||||
new Label(parent, SWT.NONE).setText(
|
||||
String.format("Configuration for the alternate version of %1$s", mFileName));
|
||||
|
||||
mSelector = new ConfigurationSelector(parent);
|
||||
mSelector = new ConfigurationSelector(parent, false /*deviceMode*/);
|
||||
mSelector.setConfiguration(mConfig);
|
||||
|
||||
// parent's layout is a GridLayout as specified in the javadoc.
|
||||
|
||||
@@ -208,7 +208,7 @@ class ExtractStringInputPage extends UserInputWizardPage implements IWizardPage
|
||||
label = new Label(group, SWT.NONE);
|
||||
label.setText("&Configuration:");
|
||||
|
||||
mConfigSelector = new ConfigurationSelector(group);
|
||||
mConfigSelector = new ConfigurationSelector(group, false /*deviceMode*/);
|
||||
GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
|
||||
gd.horizontalSpan = 2;
|
||||
gd.widthHint = ConfigurationSelector.WIDTH_HINT;
|
||||
|
||||
@@ -97,7 +97,7 @@ public class LayoutConfigsXsd {
|
||||
/** The screen-dimension element has 2 size element children. */
|
||||
public static final String NODE_SIZE = "size"; //$NON-NLS-1$
|
||||
|
||||
public static final String NODE_XPDI = "xdpi"; //$NON-NLS-1$
|
||||
public static final String NODE_XDPI = "xdpi"; //$NON-NLS-1$
|
||||
|
||||
public static final String NODE_YDPI = "ydpi"; //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -154,6 +154,10 @@ class LayoutDeviceHandler extends DefaultHandler {
|
||||
if (qual != null) {
|
||||
mCurrentConfig.setScreenDimensionQualifier(qual);
|
||||
}
|
||||
} else if (LayoutConfigsXsd.NODE_XDPI.equals(localName)) {
|
||||
mCurrentDevice.setXDpi(Float.parseFloat(mStringAccumulator.toString()));
|
||||
} else if (LayoutConfigsXsd.NODE_YDPI.equals(localName)) {
|
||||
mCurrentDevice.setYDpi(Float.parseFloat(mStringAccumulator.toString()));
|
||||
} else if (LayoutConfigsXsd.NODE_SIZE.equals(localName)) {
|
||||
if (mSize1 == null) {
|
||||
mSize1 = mStringAccumulator.toString();
|
||||
|
||||
@@ -109,8 +109,8 @@ public class ConfigurationSelector extends Composite {
|
||||
|
||||
private final HashMap<Class<? extends ResourceQualifier>, QualifierEditBase> mUiMap =
|
||||
new HashMap<Class<? extends ResourceQualifier>, QualifierEditBase>();
|
||||
private final boolean mDeviceMode;
|
||||
private Composite mQualifierEditParent;
|
||||
private boolean mDeviceMode = false;
|
||||
private IQualifierFilter mQualifierFilter;
|
||||
|
||||
/**
|
||||
@@ -198,8 +198,20 @@ public class ConfigurationSelector extends Composite {
|
||||
boolean accept(ResourceQualifier qualifier);
|
||||
}
|
||||
|
||||
public ConfigurationSelector(Composite parent) {
|
||||
/**
|
||||
* Creates the selector.
|
||||
*
|
||||
* If the device mode is <code>true</code> then the configuration selector only
|
||||
* allows to create configuration that are valid on a device (as opposed to resource
|
||||
* configuration).
|
||||
* For instance {@link Density#NODPI} is a valid qualifier for a resource configuration but
|
||||
* this is not valid on a device.
|
||||
* @param parent the composite parent.
|
||||
* @param deviceMode the device mode.
|
||||
*/
|
||||
public ConfigurationSelector(Composite parent, boolean deviceMode) {
|
||||
super(parent, SWT.NONE);
|
||||
mDeviceMode = deviceMode;
|
||||
|
||||
mBaseConfiguration.createDefault();
|
||||
|
||||
@@ -388,19 +400,6 @@ public class ConfigurationSelector extends Composite {
|
||||
mUiMap.put(VersionQualifier.class, new VersionEdit(mQualifierEditParent));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the device mode. If <code>true</code> then the configuration selector only
|
||||
* allows to create configuration that are valid on a device (as opposed to resource
|
||||
* configuration).
|
||||
* For instance {@link Density#NODPI} is a valid qualifier for a resource configuration but
|
||||
* this is not valid on a device.
|
||||
* Default is false.
|
||||
* @param deviceMode the device mode.
|
||||
*/
|
||||
public void setDeviceMode(boolean deviceMode) {
|
||||
mDeviceMode = deviceMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a {@link IQualifierFilter}. If non null, this will restrict the qualifiers that
|
||||
* can be chosen.
|
||||
|
||||
@@ -620,7 +620,7 @@ class NewXmlFileCreationPage extends WizardPage {
|
||||
|
||||
// configuration selector
|
||||
emptyCell(parent);
|
||||
mConfigSelector = new ConfigurationSelector(parent);
|
||||
mConfigSelector = new ConfigurationSelector(parent, false /* deviceMode*/);
|
||||
GridData gd = newGridData(2, GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
|
||||
gd.widthHint = ConfigurationSelector.WIDTH_HINT;
|
||||
gd.heightHint = ConfigurationSelector.HEIGHT_HINT;
|
||||
|
||||
Reference in New Issue
Block a user