auto import from //branches/cupcake_rel/...@138607
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
0.9.0 (work in progress)
|
0.9.0 (work in progress)
|
||||||
|
- Projects now store generated Java files (R.java/Manifest.java and output from aidl) in a 'gen' source folder.
|
||||||
- Support for the new Android SDK with support for multiple versions of the Android platform and for vendor supplied add-ons.
|
- Support for the new Android SDK with support for multiple versions of the Android platform and for vendor supplied add-ons.
|
||||||
* New Project Wizard lets you choose which platform/add-on to target.
|
* New Project Wizard lets you choose which platform/add-on to target.
|
||||||
* Project properties (right click project in Package Explorer, then "Properties"), lets you edit project target.
|
* Project properties (right click project in Package Explorer, then "Properties"), lets you edit project target.
|
||||||
|
|||||||
@@ -481,6 +481,12 @@
|
|||||||
style="push"
|
style="push"
|
||||||
toolbarPath="android_project"
|
toolbarPath="android_project"
|
||||||
tooltip="Opens a wizard to help create a new Android XML file">
|
tooltip="Opens a wizard to help create a new Android XML file">
|
||||||
|
<enablement>
|
||||||
|
<objectState
|
||||||
|
name="projectNature"
|
||||||
|
value="com.android.ide.eclipse.adt.AndroidNature">
|
||||||
|
</objectState>
|
||||||
|
</enablement>
|
||||||
</action>
|
</action>
|
||||||
<action
|
<action
|
||||||
class="com.android.ide.eclipse.adt.wizards.actions.NewProjectAction"
|
class="com.android.ide.eclipse.adt.wizards.actions.NewProjectAction"
|
||||||
|
|||||||
@@ -966,9 +966,10 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
* @param javaProject the javaProject object.
|
* @param javaProject the javaProject object.
|
||||||
* @param referencedJavaProjects the java projects that this project references.
|
* @param referencedJavaProjects the java projects that this project references.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
private void writeStandardResources(SignedJarBuilder jarBuilder, IJavaProject javaProject,
|
private void writeStandardResources(SignedJarBuilder jarBuilder, IJavaProject javaProject,
|
||||||
IJavaProject[] referencedJavaProjects) throws IOException {
|
IJavaProject[] referencedJavaProjects) throws IOException, CoreException {
|
||||||
IWorkspace ws = ResourcesPlugin.getWorkspace();
|
IWorkspace ws = ResourcesPlugin.getWorkspace();
|
||||||
IWorkspaceRoot wsRoot = ws.getRoot();
|
IWorkspaceRoot wsRoot = ws.getRoot();
|
||||||
|
|
||||||
@@ -978,7 +979,9 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
writeStandardProjectResources(jarBuilder, javaProject, wsRoot, list);
|
writeStandardProjectResources(jarBuilder, javaProject, wsRoot, list);
|
||||||
|
|
||||||
for (IJavaProject referencedJavaProject : referencedJavaProjects) {
|
for (IJavaProject referencedJavaProject : referencedJavaProjects) {
|
||||||
writeStandardProjectResources(jarBuilder, referencedJavaProject, wsRoot, list);
|
if (referencedJavaProject.getProject().hasNature(AndroidConstants.NATURE)) {
|
||||||
|
writeStandardProjectResources(jarBuilder, referencedJavaProject, wsRoot, list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1067,7 +1070,9 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of the output folders for the specified {@link IJavaProject} objects.
|
* Returns the list of the output folders for the specified {@link IJavaProject} objects, if
|
||||||
|
* they are Android projects.
|
||||||
|
*
|
||||||
* @param referencedJavaProjects the java projects.
|
* @param referencedJavaProjects the java projects.
|
||||||
* @return an array, always. Can be empty.
|
* @return an array, always. Can be empty.
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
@@ -1079,19 +1084,21 @@ public class ApkBuilder extends BaseBuilder {
|
|||||||
IWorkspaceRoot wsRoot = ws.getRoot();
|
IWorkspaceRoot wsRoot = ws.getRoot();
|
||||||
|
|
||||||
for (IJavaProject javaProject : referencedJavaProjects) {
|
for (IJavaProject javaProject : referencedJavaProjects) {
|
||||||
// get the output folder
|
if (javaProject.getProject().hasNature(AndroidConstants.NATURE)) {
|
||||||
IPath path = null;
|
// get the output folder
|
||||||
try {
|
IPath path = null;
|
||||||
path = javaProject.getOutputLocation();
|
try {
|
||||||
} catch (JavaModelException e) {
|
path = javaProject.getOutputLocation();
|
||||||
continue;
|
} catch (JavaModelException e) {
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
IResource outputResource = wsRoot.findMember(path);
|
IResource outputResource = wsRoot.findMember(path);
|
||||||
if (outputResource != null && outputResource.getType() == IResource.FOLDER) {
|
if (outputResource != null && outputResource.getType() == IResource.FOLDER) {
|
||||||
String outputOsPath = outputResource.getLocation().toOSString();
|
String outputOsPath = outputResource.getLocation().toOSString();
|
||||||
|
|
||||||
list.add(outputOsPath);
|
list.add(outputOsPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.ide.eclipse.adt.launch;
|
||||||
|
|
||||||
|
import com.android.ddmlib.IDevice;
|
||||||
|
import com.android.ddmlib.MultiLineReceiver;
|
||||||
|
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output receiver for am process (Activity Manager)
|
||||||
|
*
|
||||||
|
* Monitors adb output for am errors, and retries launch as appropriate.
|
||||||
|
*/
|
||||||
|
public class AMReceiver extends MultiLineReceiver {
|
||||||
|
|
||||||
|
private static final int MAX_ATTEMPT_COUNT = 5;
|
||||||
|
private static final Pattern sAmErrorType = Pattern.compile("Error type (\\d+)"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
private final DelayedLaunchInfo mLaunchInfo;
|
||||||
|
private final IDevice mDevice;
|
||||||
|
private final ILaunchController mLaunchController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor.
|
||||||
|
*
|
||||||
|
* @param launchInfo the {@link DelayedLaunchInfo} associated with the am process.
|
||||||
|
* @param device the Android device on which the launch is done.
|
||||||
|
* @param launchController the {@link ILaunchController} that is managing the launch
|
||||||
|
*/
|
||||||
|
public AMReceiver(DelayedLaunchInfo launchInfo, IDevice device,
|
||||||
|
ILaunchController launchController) {
|
||||||
|
mLaunchInfo = launchInfo;
|
||||||
|
mDevice = device;
|
||||||
|
mLaunchController = launchController;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Monitors the am process for error messages. If an error occurs, will reattempt launch up to
|
||||||
|
* <code>MAX_ATTEMPT_COUNT</code> times.
|
||||||
|
*
|
||||||
|
* @param lines a portion of the am output
|
||||||
|
*
|
||||||
|
* @see MultiLineReceiver#processNewLines(String[])
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void processNewLines(String[] lines) {
|
||||||
|
// first we check if one starts with error
|
||||||
|
ArrayList<String> array = new ArrayList<String>();
|
||||||
|
boolean error = false;
|
||||||
|
boolean warning = false;
|
||||||
|
for (String s : lines) {
|
||||||
|
// ignore empty lines.
|
||||||
|
if (s.length() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for errors that output an error type, if the attempt count is still
|
||||||
|
// valid. If not the whole text will be output in the console
|
||||||
|
if (mLaunchInfo.getAttemptCount() < MAX_ATTEMPT_COUNT &&
|
||||||
|
mLaunchInfo.isCancelled() == false) {
|
||||||
|
Matcher m = sAmErrorType.matcher(s);
|
||||||
|
if (m.matches()) {
|
||||||
|
// get the error type
|
||||||
|
int type = Integer.parseInt(m.group(1));
|
||||||
|
|
||||||
|
final int waitTime = 3;
|
||||||
|
String msg;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
/* Intended fall through */
|
||||||
|
case 2:
|
||||||
|
msg = String.format(
|
||||||
|
"Device not ready. Waiting %1$d seconds before next attempt.",
|
||||||
|
waitTime);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
msg = String.format(
|
||||||
|
"New package not yet registered with the system. Waiting %1$d seconds before next attempt.",
|
||||||
|
waitTime);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
msg = String.format(
|
||||||
|
"Device not ready (%2$d). Waiting %1$d seconds before next attempt.",
|
||||||
|
waitTime, type);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
AdtPlugin.printToConsole(mLaunchInfo.getProject(), msg);
|
||||||
|
|
||||||
|
// launch another thread, that waits a bit and attempts another launch
|
||||||
|
new Thread("Delayed Launch attempt") {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
sleep(waitTime * 1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
mLaunchController.launchApp(mLaunchInfo, mDevice);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
|
// no need to parse the rest
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for error if needed
|
||||||
|
if (error == false && s.startsWith("Error:")) { //$NON-NLS-1$
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
if (warning == false && s.startsWith("Warning:")) { //$NON-NLS-1$
|
||||||
|
warning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the line to the list
|
||||||
|
array.add("ActivityManager: " + s); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
// then we display them in the console
|
||||||
|
if (warning || error) {
|
||||||
|
AdtPlugin.printErrorToConsole(mLaunchInfo.getProject(), array.toArray());
|
||||||
|
} else {
|
||||||
|
AdtPlugin.printToConsole(mLaunchInfo.getProject(), array.toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
// if error then we cancel the launch, and remove the delayed info
|
||||||
|
if (error) {
|
||||||
|
mLaunchController.stopLaunch(mLaunchInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if launch has been cancelled
|
||||||
|
*/
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return mLaunchInfo.isCancelled();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.ide.eclipse.adt.launch;
|
||||||
|
|
||||||
|
import com.android.ddmlib.IDevice;
|
||||||
|
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launches the given activity
|
||||||
|
*/
|
||||||
|
public class ActivityLaunchAction implements IAndroidLaunchAction {
|
||||||
|
|
||||||
|
private final String mActivity;
|
||||||
|
private final ILaunchController mLaunchController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ActivityLaunchAction
|
||||||
|
*
|
||||||
|
* @param activity fully qualified activity name to launch
|
||||||
|
* @param controller the {@link ILaunchController} that performs launch
|
||||||
|
*/
|
||||||
|
public ActivityLaunchAction(String activity, ILaunchController controller) {
|
||||||
|
mActivity = activity;
|
||||||
|
mLaunchController = controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launches the activity on targeted device
|
||||||
|
*
|
||||||
|
* @param info the {@link DelayedLaunchInfo} that contains launch details
|
||||||
|
* @param device the Android device to perform action on
|
||||||
|
*
|
||||||
|
* @see IAndroidLaunchAction#doLaunchAction(DelayedLaunchInfo, IDevice)
|
||||||
|
*/
|
||||||
|
public boolean doLaunchAction(DelayedLaunchInfo info, IDevice device) {
|
||||||
|
try {
|
||||||
|
String msg = String.format("Starting activity %1$s on device ", mActivity,
|
||||||
|
device);
|
||||||
|
AdtPlugin.printToConsole(info.getProject(), msg);
|
||||||
|
|
||||||
|
// In debug mode, we need to add the info to the list of application monitoring
|
||||||
|
// client changes.
|
||||||
|
// increment launch attempt count, to handle retries and timeouts
|
||||||
|
info.incrementAttemptCount();
|
||||||
|
|
||||||
|
// now we actually launch the app.
|
||||||
|
device.executeShellCommand("am start" //$NON-NLS-1$
|
||||||
|
+ (info.isDebugMode() ? " -D" //$NON-NLS-1$
|
||||||
|
: "") //$NON-NLS-1$
|
||||||
|
+ " -n " //$NON-NLS-1$
|
||||||
|
+ info.getPackageName() + "/" //$NON-NLS-1$
|
||||||
|
+ mActivity.replaceAll("\\$", "\\\\\\$"), //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
new AMReceiver(info, device, mLaunchController));
|
||||||
|
|
||||||
|
// if the app is not a debug app, we need to do some clean up, as
|
||||||
|
// the process is done!
|
||||||
|
if (info.isDebugMode() == false) {
|
||||||
|
// stop the launch object, since there's no debug, and it can't
|
||||||
|
// provide any control over the app
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// something went wrong trying to launch the app.
|
||||||
|
// lets stop the Launch
|
||||||
|
AdtPlugin.printErrorToConsole(info.getProject(),
|
||||||
|
String.format("Launch error: %s", e.getMessage()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a description of the activity being launched
|
||||||
|
*
|
||||||
|
* @see IAndroidLaunchAction#getLaunchDescription()
|
||||||
|
*/
|
||||||
|
public String getLaunchDescription() {
|
||||||
|
return String.format("%1$s activity launch", mActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ import org.eclipse.debug.core.model.ISourceLocator;
|
|||||||
* Custom implementation of Launch to allow access to the LaunchManager
|
* Custom implementation of Launch to allow access to the LaunchManager
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class AndroidLaunch extends Launch {
|
public class AndroidLaunch extends Launch {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic constructor does nothing special
|
* Basic constructor does nothing special
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.ide.eclipse.adt.launch;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch configuration data. This stores the result of querying the
|
||||||
|
* {@link ILaunchConfiguration} so that it's only done once.
|
||||||
|
*/
|
||||||
|
public class AndroidLaunchConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launch action. See {@link LaunchConfigDelegate#ACTION_DEFAULT},
|
||||||
|
* {@link LaunchConfigDelegate#ACTION_ACTIVITY},
|
||||||
|
* {@link LaunchConfigDelegate#ACTION_DO_NOTHING}
|
||||||
|
*/
|
||||||
|
public int mLaunchAction = LaunchConfigDelegate.DEFAULT_LAUNCH_ACTION;
|
||||||
|
|
||||||
|
public static final boolean AUTO_TARGET_MODE = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Target selection mode.
|
||||||
|
* <ul>
|
||||||
|
* <li><code>true</code>: automatic mode, see {@link #AUTO_TARGET_MODE}</li>
|
||||||
|
* <li><code>false</code>: manual mode</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public boolean mTargetMode = LaunchConfigDelegate.DEFAULT_TARGET_MODE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the emulator should be called with -wipe-data
|
||||||
|
*/
|
||||||
|
public boolean mWipeData = LaunchConfigDelegate.DEFAULT_WIPE_DATA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the emulator should be called with -no-boot-anim
|
||||||
|
*/
|
||||||
|
public boolean mNoBootAnim = LaunchConfigDelegate.DEFAULT_NO_BOOT_ANIM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AVD Name.
|
||||||
|
*/
|
||||||
|
public String mAvdName = null;
|
||||||
|
|
||||||
|
public String mNetworkSpeed = EmulatorConfigTab.getSpeed(
|
||||||
|
LaunchConfigDelegate.DEFAULT_SPEED);
|
||||||
|
public String mNetworkDelay = EmulatorConfigTab.getDelay(
|
||||||
|
LaunchConfigDelegate.DEFAULT_DELAY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional custom command line parameter to launch the emulator
|
||||||
|
*/
|
||||||
|
public String mEmulatorCommandLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialized the structure from an ILaunchConfiguration object.
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
|
public void set(ILaunchConfiguration config) {
|
||||||
|
try {
|
||||||
|
mLaunchAction = config.getAttribute(LaunchConfigDelegate.ATTR_LAUNCH_ACTION,
|
||||||
|
mLaunchAction);
|
||||||
|
} catch (CoreException e1) {
|
||||||
|
// nothing to be done here, we'll use the default value
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mTargetMode = config.getAttribute(LaunchConfigDelegate.ATTR_TARGET_MODE,
|
||||||
|
mTargetMode);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// nothing to be done here, we'll use the default value
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mAvdName = config.getAttribute(LaunchConfigDelegate.ATTR_AVD_NAME, mAvdName);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = LaunchConfigDelegate.DEFAULT_SPEED;
|
||||||
|
try {
|
||||||
|
index = config.getAttribute(LaunchConfigDelegate.ATTR_SPEED, index);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// nothing to be done here, we'll use the default value
|
||||||
|
}
|
||||||
|
mNetworkSpeed = EmulatorConfigTab.getSpeed(index);
|
||||||
|
|
||||||
|
index = LaunchConfigDelegate.DEFAULT_DELAY;
|
||||||
|
try {
|
||||||
|
index = config.getAttribute(LaunchConfigDelegate.ATTR_DELAY, index);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// nothing to be done here, we'll use the default value
|
||||||
|
}
|
||||||
|
mNetworkDelay = EmulatorConfigTab.getDelay(index);
|
||||||
|
|
||||||
|
try {
|
||||||
|
mEmulatorCommandLine = config.getAttribute(
|
||||||
|
LaunchConfigDelegate.ATTR_COMMANDLINE, ""); //$NON-NLS-1$
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// lets not do anything here, we'll use the default value
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mWipeData = config.getAttribute(LaunchConfigDelegate.ATTR_WIPE_DATA, mWipeData);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// nothing to be done here, we'll use the default value
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mNoBootAnim = config.getAttribute(LaunchConfigDelegate.ATTR_NO_BOOT_ANIM,
|
||||||
|
mNoBootAnim);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// nothing to be done here, we'll use the default value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,226 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.ide.eclipse.adt.launch;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
|
||||||
|
import com.android.ddmlib.IDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A delayed launch waiting for a device to be present or ready before the
|
||||||
|
* application is launched.
|
||||||
|
*/
|
||||||
|
public final class DelayedLaunchInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to indicate behavior when Android app already exists
|
||||||
|
*/
|
||||||
|
enum InstallRetryMode {
|
||||||
|
NEVER, ALWAYS, PROMPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The device on which to launch the app */
|
||||||
|
private IDevice mDevice = null;
|
||||||
|
|
||||||
|
/** The eclipse project */
|
||||||
|
private final IProject mProject;
|
||||||
|
|
||||||
|
/** Package name */
|
||||||
|
private final String mPackageName;
|
||||||
|
|
||||||
|
/** IFile to the package (.apk) file */
|
||||||
|
private final IFile mPackageFile;
|
||||||
|
|
||||||
|
/** debuggable attribute of the manifest file. */
|
||||||
|
private final Boolean mDebuggable;
|
||||||
|
|
||||||
|
/** Required ApiVersionNumber by the app. 0 means no requirements */
|
||||||
|
private final int mRequiredApiVersionNumber;
|
||||||
|
|
||||||
|
private InstallRetryMode mRetryMode = InstallRetryMode.NEVER;
|
||||||
|
|
||||||
|
/** Launch action. */
|
||||||
|
private final IAndroidLaunchAction mLaunchAction;
|
||||||
|
|
||||||
|
/** the launch object */
|
||||||
|
private final AndroidLaunch mLaunch;
|
||||||
|
|
||||||
|
/** the monitor object */
|
||||||
|
private final IProgressMonitor mMonitor;
|
||||||
|
|
||||||
|
/** debug mode flag */
|
||||||
|
private boolean mDebugMode;
|
||||||
|
|
||||||
|
/** current number of launch attempts */
|
||||||
|
private int mAttemptCount = 0;
|
||||||
|
|
||||||
|
/** cancellation state of launch */
|
||||||
|
private boolean mCancelled = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor with activity and package info.
|
||||||
|
*
|
||||||
|
* @param project the eclipse project that corresponds to Android app
|
||||||
|
* @param packageName package name of Android app
|
||||||
|
* @param launchAction action to perform after app install
|
||||||
|
* @param pack IFile to the package (.apk) file
|
||||||
|
* @param debuggable debuggable attribute of the app's manifest file.
|
||||||
|
* @param requiredApiVersionNumber required SDK version by the app. 0 means no requirements.
|
||||||
|
* @param launch the launch object
|
||||||
|
* @param monitor progress monitor for launch
|
||||||
|
*/
|
||||||
|
public DelayedLaunchInfo(IProject project, String packageName,
|
||||||
|
IAndroidLaunchAction launchAction, IFile pack, Boolean debuggable,
|
||||||
|
int requiredApiVersionNumber, AndroidLaunch launch, IProgressMonitor monitor) {
|
||||||
|
mProject = project;
|
||||||
|
mPackageName = packageName;
|
||||||
|
mPackageFile = pack;
|
||||||
|
mLaunchAction = launchAction;
|
||||||
|
mLaunch = launch;
|
||||||
|
mMonitor = monitor;
|
||||||
|
mDebuggable = debuggable;
|
||||||
|
mRequiredApiVersionNumber = requiredApiVersionNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the device on which to launch the app
|
||||||
|
*/
|
||||||
|
public IDevice getDevice() {
|
||||||
|
return mDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the device on which to launch the app
|
||||||
|
*/
|
||||||
|
public void setDevice(IDevice device) {
|
||||||
|
mDevice = device;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the eclipse project that corresponds to Android app
|
||||||
|
*/
|
||||||
|
public IProject getProject() {
|
||||||
|
return mProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the package name of the Android app
|
||||||
|
*/
|
||||||
|
public String getPackageName() {
|
||||||
|
return mPackageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the application package file
|
||||||
|
*/
|
||||||
|
public IFile getPackageFile() {
|
||||||
|
return mPackageFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if Android app is marked as debuggable in its manifest
|
||||||
|
*/
|
||||||
|
public Boolean getDebuggable() {
|
||||||
|
return mDebuggable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the required api version number for the Android app
|
||||||
|
*/
|
||||||
|
public int getRequiredApiVersionNumber() {
|
||||||
|
return mRequiredApiVersionNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param retryMode the install retry mode to set
|
||||||
|
*/
|
||||||
|
public void setRetryMode(InstallRetryMode retryMode) {
|
||||||
|
this.mRetryMode = retryMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the installation retry mode
|
||||||
|
*/
|
||||||
|
public InstallRetryMode getRetryMode() {
|
||||||
|
return mRetryMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the launch action
|
||||||
|
*/
|
||||||
|
public IAndroidLaunchAction getLaunchAction() {
|
||||||
|
return mLaunchAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the launch
|
||||||
|
*/
|
||||||
|
public AndroidLaunch getLaunch() {
|
||||||
|
return mLaunch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the launch progress monitor
|
||||||
|
*/
|
||||||
|
public IProgressMonitor getMonitor() {
|
||||||
|
return mMonitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param debugMode the debug mode to set
|
||||||
|
*/
|
||||||
|
public void setDebugMode(boolean debugMode) {
|
||||||
|
this.mDebugMode = debugMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this is a debug launch
|
||||||
|
*/
|
||||||
|
public boolean isDebugMode() {
|
||||||
|
return mDebugMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increases the number of launch attempts
|
||||||
|
*/
|
||||||
|
public void incrementAttemptCount() {
|
||||||
|
mAttemptCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the number of launch attempts made
|
||||||
|
*/
|
||||||
|
public int getAttemptCount() {
|
||||||
|
return mAttemptCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set if launch has been cancelled
|
||||||
|
*/
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.mCancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if launch has been cancelled
|
||||||
|
*/
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return mCancelled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -231,9 +231,9 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
|
|
||||||
public static class DeviceChooserResponse {
|
public static class DeviceChooserResponse {
|
||||||
private AvdInfo mAvdToLaunch;
|
private AvdInfo mAvdToLaunch;
|
||||||
private Device mDeviceToUse;
|
private IDevice mDeviceToUse;
|
||||||
|
|
||||||
public void setDeviceToUse(Device d) {
|
public void setDeviceToUse(IDevice d) {
|
||||||
mDeviceToUse = d;
|
mDeviceToUse = d;
|
||||||
mAvdToLaunch = null;
|
mAvdToLaunch = null;
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
mDeviceToUse = null;
|
mDeviceToUse = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Device getDeviceToUse() {
|
public IDevice getDeviceToUse() {
|
||||||
return mDeviceToUse;
|
return mDeviceToUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,3 +737,4 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
mDisableAvdSelectionChange = false;
|
mDisableAvdSelectionChange = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.ide.eclipse.adt.launch;
|
||||||
|
|
||||||
|
import com.android.ddmlib.IDevice;
|
||||||
|
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A launch action that does nothing after the application has been installed
|
||||||
|
*/
|
||||||
|
public class EmptyLaunchAction implements IAndroidLaunchAction {
|
||||||
|
|
||||||
|
public boolean doLaunchAction(DelayedLaunchInfo info, IDevice device) {
|
||||||
|
// we're not supposed to do anything, just return;
|
||||||
|
String msg = String.format("%1$s installed on device",
|
||||||
|
info.getPackageFile().getFullPath().toOSString());
|
||||||
|
AdtPlugin.printToConsole(info.getProject(), msg, "Done!");
|
||||||
|
// return false so launch controller will not wait for debugger to attach
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLaunchDescription() {
|
||||||
|
return "sync";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.ide.eclipse.adt.launch;
|
||||||
|
|
||||||
|
import com.android.ddmlib.IDevice;
|
||||||
|
import com.android.ide.eclipse.adt.launch.DelayedLaunchInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An action to perform after performing a launch of an Android application
|
||||||
|
*/
|
||||||
|
public interface IAndroidLaunchAction {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do the launch
|
||||||
|
*
|
||||||
|
* @param info the {@link DelayedLaunchInfo} that contains launch details
|
||||||
|
* @param device the Android device to perform action on
|
||||||
|
* @returns true if launch was successfully, and controller should wait for debugger to attach
|
||||||
|
* (if applicable)
|
||||||
|
*/
|
||||||
|
boolean doLaunchAction(DelayedLaunchInfo info, IDevice device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a description of launch, to be used for logging and error messages
|
||||||
|
*/
|
||||||
|
String getLaunchDescription();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.ide.eclipse.adt.launch;
|
||||||
|
|
||||||
|
import com.android.ddmlib.IDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for managing Android launches
|
||||||
|
*/
|
||||||
|
public interface ILaunchController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Launches an application on a device or emulator
|
||||||
|
*
|
||||||
|
* @param launchInfo the {@link DelayedLaunchInfo} that indicates the launch action
|
||||||
|
* @param device the device or emulator to launch the application on
|
||||||
|
*/
|
||||||
|
public void launchApp(DelayedLaunchInfo launchInfo, IDevice device);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancels a launch
|
||||||
|
*
|
||||||
|
* @param launchInfo the {@link DelayedLaunchInfo} to cancel
|
||||||
|
*/
|
||||||
|
void stopLaunch(DelayedLaunchInfo launchInfo);
|
||||||
|
}
|
||||||
@@ -18,7 +18,6 @@ package com.android.ide.eclipse.adt.launch;
|
|||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ide.eclipse.adt.AdtPlugin;
|
import com.android.ide.eclipse.adt.AdtPlugin;
|
||||||
import com.android.ide.eclipse.adt.launch.AndroidLaunchController.AndroidLaunchConfiguration;
|
|
||||||
import com.android.ide.eclipse.adt.project.ProjectHelper;
|
import com.android.ide.eclipse.adt.project.ProjectHelper;
|
||||||
import com.android.ide.eclipse.common.AndroidConstants;
|
import com.android.ide.eclipse.common.AndroidConstants;
|
||||||
import com.android.ide.eclipse.common.project.AndroidManifestParser;
|
import com.android.ide.eclipse.common.project.AndroidManifestParser;
|
||||||
@@ -233,7 +232,16 @@ public class LaunchConfigDelegate extends LaunchConfigurationDelegate {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String activityName = null;
|
doLaunch(configuration, mode, monitor, project, androidLaunch, config, controller,
|
||||||
|
applicationPackage, manifestParser);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doLaunch(ILaunchConfiguration configuration, String mode,
|
||||||
|
IProgressMonitor monitor, IProject project, AndroidLaunch androidLaunch,
|
||||||
|
AndroidLaunchConfiguration config, AndroidLaunchController controller,
|
||||||
|
IFile applicationPackage, AndroidManifestParser manifestParser) {
|
||||||
|
|
||||||
|
String activityName = null;
|
||||||
|
|
||||||
if (config.mLaunchAction == ACTION_ACTIVITY) {
|
if (config.mLaunchAction == ACTION_ACTIVITY) {
|
||||||
// Get the activity name defined in the config
|
// Get the activity name defined in the config
|
||||||
@@ -292,11 +300,16 @@ public class LaunchConfigDelegate extends LaunchConfigurationDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IAndroidLaunchAction launchAction = new EmptyLaunchAction();
|
||||||
|
if (activityName != null) {
|
||||||
|
launchAction = new ActivityLaunchAction(activityName, controller);
|
||||||
|
}
|
||||||
|
|
||||||
// everything seems fine, we ask the launch controller to handle
|
// everything seems fine, we ask the launch controller to handle
|
||||||
// the rest
|
// the rest
|
||||||
controller.launch(project, mode, applicationPackage, manifestParser.getPackage(),
|
controller.launch(project, mode, applicationPackage, manifestParser.getPackage(),
|
||||||
manifestParser.getDebuggable(), manifestParser.getApiLevelRequirement(),
|
manifestParser.getDebuggable(), manifestParser.getApiLevelRequirement(),
|
||||||
activityName, config, androidLaunch, monitor);
|
launchAction, config, androidLaunch, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -400,6 +400,9 @@ public final class ProjectHelper {
|
|||||||
try {
|
try {
|
||||||
parser = AndroidManifestParser.parseForData(manifestFile);
|
parser = AndroidManifestParser.parseForData(manifestFile);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
// ignore, handled below.
|
||||||
|
}
|
||||||
|
if (parser == null) {
|
||||||
// skip this project.
|
// skip this project.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,8 +253,7 @@ public class AndroidClasspathContainerInitializer extends ClasspathContainerInit
|
|||||||
if (markerMessage != null) {
|
if (markerMessage != null) {
|
||||||
// log the error and put the marker on the project if we can.
|
// log the error and put the marker on the project if we can.
|
||||||
if (outputToConsole) {
|
if (outputToConsole) {
|
||||||
AdtPlugin.printBuildToConsole(AdtConstants.BUILD_ALWAYS, iProject,
|
AdtPlugin.printErrorToConsole(iProject, markerMessage);
|
||||||
markerMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import org.eclipse.core.resources.IProject;
|
|||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
@@ -823,12 +822,7 @@ public class NewProjectCreationPage extends WizardPage {
|
|||||||
Path path = new Path(f.getPath());
|
Path path = new Path(f.getPath());
|
||||||
String osPath = path.append(AndroidConstants.FN_ANDROID_MANIFEST).toOSString();
|
String osPath = path.append(AndroidConstants.FN_ANDROID_MANIFEST).toOSString();
|
||||||
|
|
||||||
AndroidManifestParser manifestData = null;
|
AndroidManifestParser manifestData = AndroidManifestParser.parseForData(osPath);
|
||||||
try {
|
|
||||||
manifestData = AndroidManifestParser.parseForData(osPath);
|
|
||||||
} catch (CoreException e1) {
|
|
||||||
// ignore any parsing issue
|
|
||||||
}
|
|
||||||
if (manifestData == null) {
|
if (manifestData == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1096,10 +1090,8 @@ public class NewProjectCreationPage extends WizardPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse it and check the important fields.
|
// Parse it and check the important fields.
|
||||||
AndroidManifestParser manifestData;
|
AndroidManifestParser manifestData = AndroidManifestParser.parseForData(osPath);
|
||||||
try {
|
if (manifestData == null) {
|
||||||
manifestData = AndroidManifestParser.parseForData(osPath);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
return setStatus(
|
return setStatus(
|
||||||
String.format("File %1$s could not be parsed.", osPath),
|
String.format("File %1$s could not be parsed.", osPath),
|
||||||
MSG_ERROR);
|
MSG_ERROR);
|
||||||
|
|||||||
@@ -686,7 +686,8 @@ public class AndroidManifestParser {
|
|||||||
* Parses the manifest file, and collects data.
|
* Parses the manifest file, and collects data.
|
||||||
* @param manifestFile The manifest file to parse.
|
* @param manifestFile The manifest file to parse.
|
||||||
* @return an {@link AndroidManifestParser} or null if the parsing failed.
|
* @return an {@link AndroidManifestParser} or null if the parsing failed.
|
||||||
* @throws CoreException
|
* @throws CoreException for example the file does not exist in the workspace or
|
||||||
|
* the workspace needs to be refreshed.
|
||||||
*/
|
*/
|
||||||
public static AndroidManifestParser parseForData(IFile manifestFile) throws CoreException {
|
public static AndroidManifestParser parseForData(IFile manifestFile) throws CoreException {
|
||||||
return parse(null /* javaProject */, manifestFile, null /* errorListener */,
|
return parse(null /* javaProject */, manifestFile, null /* errorListener */,
|
||||||
@@ -698,11 +699,15 @@ public class AndroidManifestParser {
|
|||||||
*
|
*
|
||||||
* @param osManifestFilePath The OS path of the manifest file to parse.
|
* @param osManifestFilePath The OS path of the manifest file to parse.
|
||||||
* @return an {@link AndroidManifestParser} or null if the parsing failed.
|
* @return an {@link AndroidManifestParser} or null if the parsing failed.
|
||||||
* @throws CoreException
|
|
||||||
*/
|
*/
|
||||||
public static AndroidManifestParser parseForData(String osManifestFilePath)
|
public static AndroidManifestParser parseForData(String osManifestFilePath) {
|
||||||
throws CoreException {
|
try {
|
||||||
return parse(new File(osManifestFilePath));
|
return parse(new File(osManifestFilePath));
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// Ignore workspace errors (unlikely to happen since this parses an actual file,
|
||||||
|
// not a workspace resource).
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/org/documents/epl-v10.php
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.ide.eclipse.editors.layout;
|
||||||
|
|
||||||
|
import com.android.ide.eclipse.editors.layout.LayoutReloadMonitor.ILayoutReloadListener;
|
||||||
|
import com.android.ide.eclipse.editors.layout.parts.ElementCreateCommand;
|
||||||
|
import com.android.ide.eclipse.editors.resources.configurations.FolderConfiguration;
|
||||||
|
import com.android.ide.eclipse.editors.uimodel.UiDocumentNode;
|
||||||
|
import com.android.ide.eclipse.editors.uimodel.UiElementNode;
|
||||||
|
|
||||||
|
import org.eclipse.gef.DefaultEditDomain;
|
||||||
|
import org.eclipse.gef.ui.parts.GraphicalEditorWithPalette;
|
||||||
|
import org.eclipse.gef.ui.parts.SelectionSynchronizer;
|
||||||
|
import org.eclipse.swt.dnd.Clipboard;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract GraphicalLayoutEditor.
|
||||||
|
*/
|
||||||
|
/*package*/ abstract class AbstractGraphicalLayoutEditor extends GraphicalEditorWithPalette
|
||||||
|
implements IWorkbenchPart, ILayoutReloadListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the UI for the edition of a new file.
|
||||||
|
* @param configuration the configuration of the new file.
|
||||||
|
*/
|
||||||
|
abstract void editNewFile(FolderConfiguration configuration);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads this editor, by getting the new model from the {@link LayoutEditor}.
|
||||||
|
*/
|
||||||
|
abstract void reloadEditor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for XML model changed. Only update/recompute the layout if the editor is visible
|
||||||
|
*/
|
||||||
|
abstract void onXmlModelChanged();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Responds to a page change that made the Graphical editor page the activated page.
|
||||||
|
*/
|
||||||
|
abstract void activated();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Responds to a page change that made the Graphical editor page the deactivated page
|
||||||
|
*/
|
||||||
|
abstract void deactivated();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by LayoutEditor.UiEditorActions.selectUiNode to select a new UI Node
|
||||||
|
* created by {@link ElementCreateCommand#execute()}.
|
||||||
|
*
|
||||||
|
* @param uiNodeModel The {@link UiElementNode} to select.
|
||||||
|
*/
|
||||||
|
abstract void selectModel(UiElementNode uiNodeModel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the selection synchronizer object.
|
||||||
|
* The synchronizer can be used to sync the selection of 2 or more EditPartViewers.
|
||||||
|
* <p/>
|
||||||
|
* This is changed from protected to public so that the outline can use it.
|
||||||
|
*
|
||||||
|
* @return the synchronizer
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SelectionSynchronizer getSelectionSynchronizer() {
|
||||||
|
return super.getSelectionSynchronizer();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the edit domain.
|
||||||
|
* <p/>
|
||||||
|
* This is changed from protected to public so that the outline can use it.
|
||||||
|
*
|
||||||
|
* @return the edit domain
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DefaultEditDomain getEditDomain() {
|
||||||
|
return super.getEditDomain();
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract void reloadPalette();
|
||||||
|
|
||||||
|
abstract void recomputeLayout();
|
||||||
|
|
||||||
|
abstract UiDocumentNode getModel();
|
||||||
|
|
||||||
|
abstract LayoutEditor getLayoutEditor();
|
||||||
|
|
||||||
|
abstract Clipboard getClipboard();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -86,8 +86,6 @@ import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
|
|||||||
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
|
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
|
||||||
import org.eclipse.gef.palette.PaletteRoot;
|
import org.eclipse.gef.palette.PaletteRoot;
|
||||||
import org.eclipse.gef.requests.CreationFactory;
|
import org.eclipse.gef.requests.CreationFactory;
|
||||||
import org.eclipse.gef.ui.parts.GraphicalEditorWithPalette;
|
|
||||||
import org.eclipse.gef.ui.parts.SelectionSynchronizer;
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.IMenuListener;
|
import org.eclipse.jface.action.IMenuListener;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
@@ -141,7 +139,7 @@ import java.util.Set;
|
|||||||
* <p/>
|
* <p/>
|
||||||
* To understand Drag'n'drop: http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html
|
* To understand Drag'n'drop: http://www.eclipse.org/articles/Article-Workbench-DND/drag_drop.html
|
||||||
*/
|
*/
|
||||||
public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
public class GraphicalLayoutEditor extends AbstractGraphicalLayoutEditor
|
||||||
implements ILayoutReloadListener {
|
implements ILayoutReloadListener {
|
||||||
|
|
||||||
private final static String THEME_SEPARATOR = "----------"; //$NON-NLS-1$
|
private final static String THEME_SEPARATOR = "----------"; //$NON-NLS-1$
|
||||||
@@ -595,6 +593,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
return mPaletteRoot;
|
return mPaletteRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Clipboard getClipboard() {
|
public Clipboard getClipboard() {
|
||||||
return mClipboard;
|
return mClipboard;
|
||||||
}
|
}
|
||||||
@@ -716,7 +715,8 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
*
|
*
|
||||||
* @param uiNodeModel The {@link UiElementNode} to select.
|
* @param uiNodeModel The {@link UiElementNode} to select.
|
||||||
*/
|
*/
|
||||||
public void selectModel(UiElementNode uiNodeModel) {
|
@Override
|
||||||
|
void selectModel(UiElementNode uiNodeModel) {
|
||||||
GraphicalViewer viewer = getGraphicalViewer();
|
GraphicalViewer viewer = getGraphicalViewer();
|
||||||
|
|
||||||
// Give focus to the graphical viewer (in case the outline has it)
|
// Give focus to the graphical viewer (in case the outline has it)
|
||||||
@@ -734,6 +734,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
// Local methods
|
// Local methods
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
|
@Override
|
||||||
public LayoutEditor getLayoutEditor() {
|
public LayoutEditor getLayoutEditor() {
|
||||||
return mLayoutEditor;
|
return mLayoutEditor;
|
||||||
}
|
}
|
||||||
@@ -863,7 +864,8 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
* Sets the UI for the edition of a new file.
|
* Sets the UI for the edition of a new file.
|
||||||
* @param configuration the configuration of the new file.
|
* @param configuration the configuration of the new file.
|
||||||
*/
|
*/
|
||||||
public void editNewFile(FolderConfiguration configuration) {
|
@Override
|
||||||
|
void editNewFile(FolderConfiguration configuration) {
|
||||||
// update the configuration UI
|
// update the configuration UI
|
||||||
setConfiguration(configuration);
|
setConfiguration(configuration);
|
||||||
|
|
||||||
@@ -1015,6 +1017,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
/**
|
/**
|
||||||
* Reloads this editor, by getting the new model from the {@link LayoutEditor}.
|
* Reloads this editor, by getting the new model from the {@link LayoutEditor}.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
void reloadEditor() {
|
void reloadEditor() {
|
||||||
GraphicalViewer viewer = getGraphicalViewer();
|
GraphicalViewer viewer = getGraphicalViewer();
|
||||||
viewer.setContents(getModel());
|
viewer.setContents(getModel());
|
||||||
@@ -1036,6 +1039,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
/**
|
/**
|
||||||
* Callback for XML model changed. Only update/recompute the layout if the editor is visible
|
* Callback for XML model changed. Only update/recompute the layout if the editor is visible
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
void onXmlModelChanged() {
|
void onXmlModelChanged() {
|
||||||
if (mLayoutEditor.isGraphicalEditorActive()) {
|
if (mLayoutEditor.isGraphicalEditorActive()) {
|
||||||
doXmlReload(true /* force */);
|
doXmlReload(true /* force */);
|
||||||
@@ -1265,10 +1269,12 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
mCurrentLayoutLabel.setText(current != null ? current : "(Default)");
|
mCurrentLayoutLabel.setText(current != null ? current : "(Default)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
UiDocumentNode getModel() {
|
UiDocumentNode getModel() {
|
||||||
return mLayoutEditor.getUiRootNode();
|
return mLayoutEditor.getUiRootNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
void reloadPalette() {
|
void reloadPalette() {
|
||||||
PaletteFactory.createPaletteRoot(mPaletteRoot, mLayoutEditor.getTargetData());
|
PaletteFactory.createPaletteRoot(mPaletteRoot, mLayoutEditor.getTargetData());
|
||||||
}
|
}
|
||||||
@@ -1667,6 +1673,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
/**
|
/**
|
||||||
* Recomputes the layout with the help of layoutlib.
|
* Recomputes the layout with the help of layoutlib.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
void recomputeLayout() {
|
void recomputeLayout() {
|
||||||
doXmlReload(false /* force */);
|
doXmlReload(false /* force */);
|
||||||
@@ -1968,6 +1975,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
/**
|
/**
|
||||||
* Responds to a page change that made the Graphical editor page the activated page.
|
* Responds to a page change that made the Graphical editor page the activated page.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
void activated() {
|
void activated() {
|
||||||
if (mNeedsRecompute || mNeedsXmlReload) {
|
if (mNeedsRecompute || mNeedsXmlReload) {
|
||||||
recomputeLayout();
|
recomputeLayout();
|
||||||
@@ -1977,6 +1985,7 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
/**
|
/**
|
||||||
* Responds to a page change that made the Graphical editor page the deactivated page
|
* Responds to a page change that made the Graphical editor page the deactivated page
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
void deactivated() {
|
void deactivated() {
|
||||||
// nothing to be done here for now.
|
// nothing to be done here for now.
|
||||||
}
|
}
|
||||||
@@ -2233,31 +2242,6 @@ public class GraphicalLayoutEditor extends GraphicalEditorWithPalette
|
|||||||
return mConfiguredFrameworkRes;
|
return mConfiguredFrameworkRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the selection synchronizer object.
|
|
||||||
* The synchronizer can be used to sync the selection of 2 or more EditPartViewers.
|
|
||||||
* <p/>
|
|
||||||
* This is changed from protected to public so that the outline can use it.
|
|
||||||
*
|
|
||||||
* @return the synchronizer
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SelectionSynchronizer getSelectionSynchronizer() {
|
|
||||||
return super.getSelectionSynchronizer();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the edit domain.
|
|
||||||
* <p/>
|
|
||||||
* This is changed from protected to public so that the outline can use it.
|
|
||||||
*
|
|
||||||
* @return the edit domain
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public DefaultEditDomain getEditDomain() {
|
|
||||||
return super.getEditDomain();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new layout file from the specificed {@link FolderConfiguration}.
|
* Creates a new layout file from the specificed {@link FolderConfiguration}.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class LayoutEditor extends AndroidEditor implements IShowEditorInput, IPa
|
|||||||
/** Root node of the UI element hierarchy */
|
/** Root node of the UI element hierarchy */
|
||||||
private UiDocumentNode mUiRootNode;
|
private UiDocumentNode mUiRootNode;
|
||||||
|
|
||||||
private GraphicalLayoutEditor mGraphicalEditor;
|
private AbstractGraphicalLayoutEditor mGraphicalEditor;
|
||||||
private int mGraphicalEditorIndex;
|
private int mGraphicalEditorIndex;
|
||||||
/** Implementation of the {@link IContentOutlinePage} for this editor */
|
/** Implementation of the {@link IContentOutlinePage} for this editor */
|
||||||
private UiContentOutlinePage mOutline;
|
private UiContentOutlinePage mOutline;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
class UiContentOutlinePage extends ContentOutlinePage {
|
class UiContentOutlinePage extends ContentOutlinePage {
|
||||||
|
|
||||||
private GraphicalLayoutEditor mEditor;
|
private AbstractGraphicalLayoutEditor mEditor;
|
||||||
|
|
||||||
private Action mAddAction;
|
private Action mAddAction;
|
||||||
private Action mDeleteAction;
|
private Action mDeleteAction;
|
||||||
@@ -79,7 +79,7 @@ class UiContentOutlinePage extends ContentOutlinePage {
|
|||||||
|
|
||||||
private UiOutlineActions mUiActions = new UiOutlineActions();
|
private UiOutlineActions mUiActions = new UiOutlineActions();
|
||||||
|
|
||||||
public UiContentOutlinePage(GraphicalLayoutEditor editor, final EditPartViewer viewer) {
|
public UiContentOutlinePage(AbstractGraphicalLayoutEditor editor, final EditPartViewer viewer) {
|
||||||
super(viewer);
|
super(viewer);
|
||||||
mEditor = editor;
|
mEditor = editor;
|
||||||
IconFactory factory = IconFactory.getInstance();
|
IconFactory factory = IconFactory.getInstance();
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package com.android.ide.eclipse.editors.layout.descriptors;
|
|||||||
|
|
||||||
import com.android.ide.eclipse.common.AndroidConstants;
|
import com.android.ide.eclipse.common.AndroidConstants;
|
||||||
import com.android.ide.eclipse.common.resources.DeclareStyleableInfo;
|
import com.android.ide.eclipse.common.resources.DeclareStyleableInfo;
|
||||||
import com.android.ide.eclipse.common.resources.ResourceType;
|
|
||||||
import com.android.ide.eclipse.common.resources.ViewClassInfo;
|
import com.android.ide.eclipse.common.resources.ViewClassInfo;
|
||||||
import com.android.ide.eclipse.common.resources.DeclareStyleableInfo.AttributeInfo;
|
import com.android.ide.eclipse.common.resources.DeclareStyleableInfo.AttributeInfo;
|
||||||
import com.android.ide.eclipse.common.resources.ViewClassInfo.LayoutParamsInfo;
|
import com.android.ide.eclipse.common.resources.ViewClassInfo.LayoutParamsInfo;
|
||||||
@@ -27,7 +26,6 @@ import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils;
|
|||||||
import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor;
|
import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor;
|
||||||
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
import com.android.ide.eclipse.editors.descriptors.ElementDescriptor;
|
||||||
import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider;
|
import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider;
|
||||||
import com.android.ide.eclipse.editors.descriptors.ReferenceAttributeDescriptor;
|
|
||||||
import com.android.ide.eclipse.editors.descriptors.SeparatorAttributeDescriptor;
|
import com.android.ide.eclipse.editors.descriptors.SeparatorAttributeDescriptor;
|
||||||
import com.android.sdklib.SdkConstants;
|
import com.android.sdklib.SdkConstants;
|
||||||
|
|
||||||
|
|||||||
@@ -217,8 +217,10 @@ public final class CompiledResourcesMonitor implements IFileListener, IProjectLi
|
|||||||
try {
|
try {
|
||||||
IFile manifestFile = AndroidManifestParser.getManifest(project);
|
IFile manifestFile = AndroidManifestParser.getManifest(project);
|
||||||
AndroidManifestParser data = AndroidManifestParser.parseForData(manifestFile);
|
AndroidManifestParser data = AndroidManifestParser.parseForData(manifestFile);
|
||||||
String javaPackage = data.getPackage();
|
if (data != null) {
|
||||||
return javaPackage + ".R"; //$NON-NLS-1$
|
String javaPackage = data.getPackage();
|
||||||
|
return javaPackage + ".R"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// This will typically happen either because the manifest file is not present
|
// This will typically happen either because the manifest file is not present
|
||||||
// and/or the workspace needs to be refreshed.
|
// and/or the workspace needs to be refreshed.
|
||||||
@@ -227,8 +229,8 @@ public final class CompiledResourcesMonitor implements IFileListener, IProjectLi
|
|||||||
"Failed to find the package of the AndroidManifest of project %1$s. Reason: %2$s",
|
"Failed to find the package of the AndroidManifest of project %1$s. Reason: %2$s",
|
||||||
project.getName(),
|
project.getName(),
|
||||||
e.getMessage());
|
e.getMessage());
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,35 @@ public class UiResourceAttributeNode extends UiTextAttributeNode {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all the values one could use to auto-complete a "resource" value in an XML
|
||||||
|
* content assist.
|
||||||
|
* <p/>
|
||||||
|
* Typically the user is editing the value of an attribute in a resource XML, e.g.
|
||||||
|
* <pre> "<Button android:test="@string/my_[caret]_string..." </pre>
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* "prefix" is the value that the user has typed so far (or more exactly whatever is on the
|
||||||
|
* left side of the insertion point). In the example above it would be "@style/my_".
|
||||||
|
* <p/>
|
||||||
|
*
|
||||||
|
* To avoid a huge long list of values, the completion works on two levels:
|
||||||
|
* <ul>
|
||||||
|
* <li> If a resource type as been typed so far (e.g. "@style/"), then limit the values to
|
||||||
|
* the possible completions that match this type.
|
||||||
|
* <li> If no resource type as been typed so far, then return the various types that could be
|
||||||
|
* completed. So if the project has only strings and layouts resources, for example,
|
||||||
|
* the returned list will only include "@string/" and "@layout/".
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* Finally if anywhere in the string we find the special token "android:", we use the
|
||||||
|
* current framework system resources rather than the project resources.
|
||||||
|
* This works for both "@android:style/foo" and "@style/android:foo" conventions even though
|
||||||
|
* the reconstructed name will always be of the former form.
|
||||||
|
*
|
||||||
|
* Note that "android:" here is a keyword specific to Android resources and should not be
|
||||||
|
* mixed with an XML namespace for an XML attribute name.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String[] getPossibleValues(String prefix) {
|
public String[] getPossibleValues(String prefix) {
|
||||||
IResourceRepository repository = null;
|
IResourceRepository repository = null;
|
||||||
@@ -174,6 +203,8 @@ public class UiResourceAttributeNode extends UiTextAttributeNode {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If there's a prefix with "android:" in it, use the system resources
|
// If there's a prefix with "android:" in it, use the system resources
|
||||||
|
//
|
||||||
|
// TODO find a way to only list *public* framework resources here.
|
||||||
AndroidTargetData data = editor.getTargetData();
|
AndroidTargetData data = editor.getTargetData();
|
||||||
repository = data.getSystemResources();
|
repository = data.getSystemResources();
|
||||||
isSystem = true;
|
isSystem = true;
|
||||||
|
|||||||
24
tools/makedict/Android.mk
Normal file
24
tools/makedict/Android.mk
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2009 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(call all-java-files-under,src)
|
||||||
|
LOCAL_JAR_MANIFEST := etc/manifest.txt
|
||||||
|
LOCAL_MODULE := makedict
|
||||||
|
|
||||||
|
include $(BUILD_HOST_JAVA_LIBRARY)
|
||||||
|
include $(LOCAL_PATH)/etc/Android.mk
|
||||||
20
tools/makedict/etc/Android.mk
Normal file
20
tools/makedict/etc/Android.mk
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Copyright (C) 2009 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_PREBUILT_EXECUTABLES := makedict
|
||||||
|
include $(BUILD_HOST_PREBUILT)
|
||||||
|
|
||||||
63
tools/makedict/etc/makedict
Executable file
63
tools/makedict/etc/makedict
Executable file
@@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright 2009, The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# Set up prog to be the path of this script, including following symlinks,
|
||||||
|
# and set up progdir to be the fully-qualified pathname of its directory.
|
||||||
|
prog="$0"
|
||||||
|
while [ -h "${prog}" ]; do
|
||||||
|
newProg=`/bin/ls -ld "${prog}"`
|
||||||
|
newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
|
||||||
|
if expr "x${newProg}" : 'x/' >/dev/null; then
|
||||||
|
prog="${newProg}"
|
||||||
|
else
|
||||||
|
progdir=`dirname "${prog}"`
|
||||||
|
prog="${progdir}/${newProg}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
oldwd=`pwd`
|
||||||
|
progdir=`dirname "${prog}"`
|
||||||
|
cd "${progdir}"
|
||||||
|
progdir=`pwd`
|
||||||
|
prog="${progdir}"/`basename "${prog}"`
|
||||||
|
cd "${oldwd}"
|
||||||
|
|
||||||
|
jarfile=makedict.jar
|
||||||
|
frameworkdir="$progdir"
|
||||||
|
if [ ! -r "$frameworkdir/$jarfile" ]
|
||||||
|
then
|
||||||
|
frameworkdir=`dirname "$progdir"`/tools/lib
|
||||||
|
libdir=`dirname "$progdir"`/tools/lib
|
||||||
|
fi
|
||||||
|
if [ ! -r "$frameworkdir/$jarfile" ]
|
||||||
|
then
|
||||||
|
frameworkdir=`dirname "$progdir"`/framework
|
||||||
|
libdir=`dirname "$progdir"`/lib
|
||||||
|
fi
|
||||||
|
if [ ! -r "$frameworkdir/$jarfile" ]
|
||||||
|
then
|
||||||
|
echo `basename "$prog"`": can't find $jarfile"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$OSTYPE" = "cygwin" ] ; then
|
||||||
|
jarpath=`cygpath -w "$frameworkdir/$jarfile"`
|
||||||
|
progdir=`cygpath -w "$progdir"`
|
||||||
|
else
|
||||||
|
jarpath="$frameworkdir/$jarfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
|
||||||
|
# might need more memory, e.g. -Xmx128M
|
||||||
|
exec java -Djava.ext.dirs="$frameworkdir" -jar "$jarpath" "$@"
|
||||||
1
tools/makedict/etc/manifest.txt
Normal file
1
tools/makedict/etc/manifest.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Main-Class: com.android.tools.dict.MakeBinaryDictionary
|
||||||
294
tools/makedict/src/com/android/tools/dict/MakeBinaryDictionary.java
Executable file
294
tools/makedict/src/com/android/tools/dict/MakeBinaryDictionary.java
Executable file
@@ -0,0 +1,294 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.tools.dict;
|
||||||
|
|
||||||
|
import org.xml.sax.Attributes;
|
||||||
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.xml.parsers.SAXParser;
|
||||||
|
import javax.xml.parsers.SAXParserFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compresses a list of words and frequencies into a tree structured binary dictionary.
|
||||||
|
*/
|
||||||
|
public class MakeBinaryDictionary {
|
||||||
|
|
||||||
|
public static final int ALPHA_SIZE = 256;
|
||||||
|
|
||||||
|
public static final String TAG_WORD = "w";
|
||||||
|
public static final String ATTR_FREQ = "f";
|
||||||
|
|
||||||
|
public static final CharNode EMPTY_NODE = new CharNode();
|
||||||
|
|
||||||
|
List<CharNode> roots;
|
||||||
|
Map<String, Integer> mDictionary;
|
||||||
|
int mWordCount;
|
||||||
|
|
||||||
|
static class CharNode {
|
||||||
|
char data;
|
||||||
|
int freq;
|
||||||
|
boolean terminal;
|
||||||
|
List<CharNode> children;
|
||||||
|
static int sNodes;
|
||||||
|
|
||||||
|
public CharNode() {
|
||||||
|
sNodes++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void usage() {
|
||||||
|
System.err.println("Usage: makedict <src.xml> <dest.dict>");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
if (args.length < 2) {
|
||||||
|
usage();
|
||||||
|
} else {
|
||||||
|
new MakeBinaryDictionary(args[0], args[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MakeBinaryDictionary(String srcFilename, String destFilename) {
|
||||||
|
populateDictionary(srcFilename);
|
||||||
|
writeToDict(destFilename);
|
||||||
|
// Enable the code below to verify that the generated tree is traversable.
|
||||||
|
if (false) {
|
||||||
|
traverseDict(0, new char[32], 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void populateDictionary(String filename) {
|
||||||
|
roots = new ArrayList<CharNode>();
|
||||||
|
try {
|
||||||
|
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
|
||||||
|
parser.parse(new File(filename), new DefaultHandler() {
|
||||||
|
boolean inWord;
|
||||||
|
int freq;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startElement(String uri, String localName,
|
||||||
|
String qName, Attributes attributes) {
|
||||||
|
if (qName.equals("w")) {
|
||||||
|
inWord = true;
|
||||||
|
freq = Integer.parseInt(attributes.getValue(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void characters(char[] data, int offset, int length) {
|
||||||
|
// Ignore other whitespace
|
||||||
|
if (!inWord) return;
|
||||||
|
|
||||||
|
// Ignore one letter words
|
||||||
|
if (length < 2) return;
|
||||||
|
mWordCount++;
|
||||||
|
String word = new String(data, offset, length);
|
||||||
|
addWordTop(word, freq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endElement(String uri, String localName,
|
||||||
|
String qName) {
|
||||||
|
if (qName.equals("w")) inWord = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception ioe) {
|
||||||
|
System.err.println("Exception in parsing\n" + ioe);
|
||||||
|
ioe.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("Nodes = " + CharNode.sNodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int indexOf(List<CharNode> children, char c) {
|
||||||
|
if (children == null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < children.size(); i++) {
|
||||||
|
if (children.get(i).data == c) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addWordTop(String word, int occur) {
|
||||||
|
if (occur > 255) occur = 255;
|
||||||
|
|
||||||
|
char firstChar = word.charAt(0);
|
||||||
|
int index = indexOf(roots, firstChar);
|
||||||
|
if (index == -1) {
|
||||||
|
CharNode newNode = new CharNode();
|
||||||
|
newNode.data = firstChar;
|
||||||
|
newNode.freq = occur;
|
||||||
|
index = roots.size();
|
||||||
|
roots.add(newNode);
|
||||||
|
} else {
|
||||||
|
roots.get(index).freq += occur;
|
||||||
|
}
|
||||||
|
if (word.length() > 1) {
|
||||||
|
addWordRec(roots.get(index), word, 1, occur);
|
||||||
|
} else {
|
||||||
|
roots.get(index).terminal = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addWordRec(CharNode parent, String word, int charAt, int occur) {
|
||||||
|
CharNode child = null;
|
||||||
|
char data = word.charAt(charAt);
|
||||||
|
if (parent.children == null) {
|
||||||
|
parent.children = new ArrayList<CharNode>();
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < parent.children.size(); i++) {
|
||||||
|
CharNode node = parent.children.get(i);
|
||||||
|
if (node.data == data) {
|
||||||
|
child = node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (child == null) {
|
||||||
|
child = new CharNode();
|
||||||
|
parent.children.add(child);
|
||||||
|
}
|
||||||
|
child.data = data;
|
||||||
|
child.freq += occur;
|
||||||
|
if (word.length() > charAt + 1) {
|
||||||
|
addWordRec(child, word, charAt + 1, occur);
|
||||||
|
} else {
|
||||||
|
child.terminal = true;
|
||||||
|
child.freq = occur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] dict;
|
||||||
|
int dictSize;
|
||||||
|
static final int CHAR_WIDTH = 8;
|
||||||
|
static final int FLAGS_WIDTH = 1; // Terminal flag (word end)
|
||||||
|
static final int ADDR_WIDTH = 23; // Offset to children
|
||||||
|
static final int FREQ_WIDTH_BYTES = 1;
|
||||||
|
static final int COUNT_WIDTH_BYTES = 1;
|
||||||
|
static final int NODE_SIZE_BYTES =
|
||||||
|
(CHAR_WIDTH + FLAGS_WIDTH + ADDR_WIDTH) / 8 + FREQ_WIDTH_BYTES;
|
||||||
|
|
||||||
|
private void addCount(int count) {
|
||||||
|
dict[dictSize++] = (byte) (0xFF & count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TODO: Allow characters to be beyond the 0-255 range. This is required for some latin
|
||||||
|
language not currently supported */
|
||||||
|
private void addNode(CharNode node) {
|
||||||
|
int charData = 0xFFFF & node.data;
|
||||||
|
if (charData > 254) {
|
||||||
|
System.out.println("WARNING: Non-ASCII character encountered : " + node.data +
|
||||||
|
", value = " + charData);
|
||||||
|
dict[dictSize++] = '@';
|
||||||
|
} else {
|
||||||
|
dict[dictSize++] = (byte) (0xFF & node.data);
|
||||||
|
}
|
||||||
|
dictSize += 3; // Space for children address
|
||||||
|
if ((0xFFFFFF & node.freq) > 255) {
|
||||||
|
node.freq = (byte) 255;
|
||||||
|
}
|
||||||
|
dict[dictSize++] = (byte) (0xFF & node.freq);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateNodeAddress(int nodeAddress, CharNode node,
|
||||||
|
int childrenAddress) {
|
||||||
|
childrenAddress = 0x7FFFFF & childrenAddress;
|
||||||
|
if (node.terminal) {
|
||||||
|
childrenAddress |= 0x800000;
|
||||||
|
}
|
||||||
|
dict[nodeAddress + 1] = (byte) (childrenAddress >> 16);
|
||||||
|
dict[nodeAddress + 2] = (byte) ((childrenAddress & 0xFF00) >> 8);
|
||||||
|
dict[nodeAddress + 3] = (byte) ((childrenAddress & 0xFF));
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeWordsRec(List<CharNode> children) {
|
||||||
|
if (children == null || children.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
addCount(children.size());
|
||||||
|
int childrenStart = dictSize;
|
||||||
|
for (int j = 0; j < children.size(); j++) {
|
||||||
|
CharNode node = children.get(j);
|
||||||
|
addNode(node);
|
||||||
|
}
|
||||||
|
for (int j = 0; j < children.size(); j++) {
|
||||||
|
CharNode node = children.get(j);
|
||||||
|
// TODO: Fix this when child length becomes variable
|
||||||
|
int nodeAddress = childrenStart + NODE_SIZE_BYTES * j;
|
||||||
|
int cacheDictSize = dictSize;
|
||||||
|
writeWordsRec(node.children);
|
||||||
|
updateNodeAddress(nodeAddress, node, node.children != null
|
||||||
|
? cacheDictSize : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeToDict(String dictFilename) {
|
||||||
|
// 2MB max
|
||||||
|
dict = new byte[2 * 1024 * 1024]; // 2MB upper limit. Actual is probably
|
||||||
|
// < 1MB in most cases, as there is a limit in the
|
||||||
|
// resource size in apks.
|
||||||
|
dictSize = 0;
|
||||||
|
writeWordsRec(roots);
|
||||||
|
System.out.println("Dict Size = " + dictSize);
|
||||||
|
try {
|
||||||
|
FileOutputStream fos = new FileOutputStream(dictFilename);
|
||||||
|
fos.write(dict, 0, dictSize);
|
||||||
|
fos.close();
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
System.err.println("Error writing dict file:" + ioe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void traverseDict(int pos, char[] word, int depth) {
|
||||||
|
int count = dict[pos++] & 0xFF;
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
char c = (char) (dict[pos] & 0xFF);
|
||||||
|
word[depth] = c;
|
||||||
|
if ((dict[pos + 1] & 0x80) > 0) {
|
||||||
|
showWord(word, depth + 1, dict[pos + 4] & 0xFF);
|
||||||
|
}
|
||||||
|
int address =
|
||||||
|
((dict[pos + 1] & 0x7F) << 16)
|
||||||
|
| ((dict[pos + 2] & 0xFF) << 8)
|
||||||
|
| ((dict[pos + 3] & 0xFF));
|
||||||
|
if (address != 0) {
|
||||||
|
traverseDict(address, word, depth + 1);
|
||||||
|
}
|
||||||
|
pos += NODE_SIZE_BYTES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void showWord(char[] word, int size, int freq) {
|
||||||
|
System.out.print(new String(word, 0, size) + " " + freq + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
<!-- Input directories -->
|
<!-- Input directories -->
|
||||||
<property name="source-folder" value="src" />
|
<property name="source-folder" value="src" />
|
||||||
|
<property name="gen-folder" value="gen" />
|
||||||
<property name="resource-folder" value="res" />
|
<property name="resource-folder" value="res" />
|
||||||
<property name="asset-folder" value="assets" />
|
<property name="asset-folder" value="assets" />
|
||||||
<property name="source-location" value="${basedir}/${source-folder}" />
|
<property name="source-location" value="${basedir}/${source-folder}" />
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
<property name="native-libs-folder" value="libs" />
|
<property name="native-libs-folder" value="libs" />
|
||||||
|
|
||||||
<!-- Output directories -->
|
<!-- Output directories -->
|
||||||
|
<property name="gen-folder" value="gen" />
|
||||||
<property name="out-folder" value="bin" />
|
<property name="out-folder" value="bin" />
|
||||||
<property name="out-classes" value="${out-folder}/classes" />
|
<property name="out-classes" value="${out-folder}/classes" />
|
||||||
<property name="out-classes-location" value="${basedir}/${out-classes}"/>
|
<property name="out-classes-location" value="${basedir}/${out-classes}"/>
|
||||||
@@ -46,9 +48,6 @@
|
|||||||
<property name="main-out-folder" value="../${out-folder}" />
|
<property name="main-out-folder" value="../${out-folder}" />
|
||||||
<property name="main-out-classes" value="${main-out-folder}/classes"/>
|
<property name="main-out-classes" value="${main-out-folder}/classes"/>
|
||||||
|
|
||||||
<!-- Create R.java in the source directory -->
|
|
||||||
<property name="r-folder" value="${source-folder}" />
|
|
||||||
|
|
||||||
<!-- Intermediate files -->
|
<!-- Intermediate files -->
|
||||||
<property name="dex-file" value="classes.dex" />
|
<property name="dex-file" value="classes.dex" />
|
||||||
<property name="intermediate-dex" value="${out-folder}/${dex-file}" />
|
<property name="intermediate-dex" value="${out-folder}/${dex-file}" />
|
||||||
@@ -73,6 +72,8 @@
|
|||||||
<!-- Create the output directories if they don't exist yet. -->
|
<!-- Create the output directories if they don't exist yet. -->
|
||||||
<target name="dirs">
|
<target name="dirs">
|
||||||
<echo>Creating output directories if needed...</echo>
|
<echo>Creating output directories if needed...</echo>
|
||||||
|
<mkdir dir="${external-libs-folder}" />
|
||||||
|
<mkdir dir="${gen-folder}" />
|
||||||
<mkdir dir="${out-folder}" />
|
<mkdir dir="${out-folder}" />
|
||||||
<mkdir dir="${out-classes}" />
|
<mkdir dir="${out-classes}" />
|
||||||
</target>
|
</target>
|
||||||
@@ -84,7 +85,7 @@
|
|||||||
<arg value="package" />
|
<arg value="package" />
|
||||||
<arg value="-m" />
|
<arg value="-m" />
|
||||||
<arg value="-J" />
|
<arg value="-J" />
|
||||||
<arg path="${r-folder}" />
|
<arg path="${gen-folder}" />
|
||||||
<arg value="-M" />
|
<arg value="-M" />
|
||||||
<arg path="AndroidManifest.xml" />
|
<arg path="AndroidManifest.xml" />
|
||||||
<arg value="-S" />
|
<arg value="-S" />
|
||||||
@@ -100,6 +101,7 @@
|
|||||||
<apply executable="${aidl}" failonerror="true">
|
<apply executable="${aidl}" failonerror="true">
|
||||||
<arg value="-p${android-aidl}" />
|
<arg value="-p${android-aidl}" />
|
||||||
<arg value="-I${source-folder}" />
|
<arg value="-I${source-folder}" />
|
||||||
|
<arg value="-o${gen-folder}" />
|
||||||
<fileset dir="${source-folder}">
|
<fileset dir="${source-folder}">
|
||||||
<include name="**/*.aidl"/>
|
<include name="**/*.aidl"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
@@ -107,11 +109,12 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- Compile this project's .java files into .class files. -->
|
<!-- Compile this project's .java files into .class files. -->
|
||||||
<target name="compile" depends="dirs, resource-src, aidl">
|
<target name="compile" depends="resource-src, aidl">
|
||||||
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
|
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
|
||||||
srcdir="${source-folder}"
|
|
||||||
destdir="${out-classes}"
|
destdir="${out-classes}"
|
||||||
bootclasspathref="android.target.classpath">
|
bootclasspathref="android.target.classpath">
|
||||||
|
<src path="${source-folder}" />
|
||||||
|
<src path="${gen-folder}" />
|
||||||
<classpath>
|
<classpath>
|
||||||
<fileset dir="${external-libs-folder}" includes="*.jar"/>
|
<fileset dir="${external-libs-folder}" includes="*.jar"/>
|
||||||
<pathelement path="${main-out-classes}"/>
|
<pathelement path="${main-out-classes}"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user