Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
[Bug 526437] - Android SWT Libraries need to be forked
Browse files Browse the repository at this point in the history
1. Add Generic Category to Package Updater window
2. Add missing "Samples" PackageType
3. Add PackageFilter class to filter categories and package items
according to package type
4. Add label to each PackageType enum for user package type selection
5. Add Package Updater option to select all new packages. Default is
show only latest new packages.
6. On updater window, hilight obsolete checkbox when selected, add
"obsolete" to affected package names and apply alert image
7. Extract version from package path, if appended and show this as
package revision. 
8. Remove version from package display name, if appended.
9. Add "Package Types..." and "Cancel" buttons to Package Updater window
10. Add handling of invalid Android SDK path setting in Package Updater
window 
11. Adjust Package Updater window column widths and change "Rev," to
"Revision"
12. Change SwtBaseDialog to resize after setting contents
13. Convert SWT task framework to work asynchronously, executing tasks
in jobs instead of threads
14. Add a "onTerminateTask" parameter to ITaskFactory to call back when
the job is done
15. Add PackageInstaller and PackageInstallTask classes to encapsulate
the package install steps
16. Add PackageInstallListener interface to call back on package install
termination
17. Update SdkTargets class to associate targets with  system images
using AndroidTargetHash.getPlatformHashString()
18. Remove legacy code vestiges including disposal of image factories
19. Filter out duplicates which appear in the list of package
dependencies produced by sdklib code
20. In AVD Manager, restrict target selection to only those targets with
installed system images
21. Fix missing default AVD folder setting in AvdCreationPresenter
22. Add OK button to AVD Manager
23. Color ToggleButton background to make it look more like a button
24. Remove onSdkLoaded() event from ISdkChangeListener as it had no
usage
25. Delay broadcast of ISdkChangeListener onSdkReload() event until
updater window is closed
26. Complete design of AdtUpdateDialog to enhance user experience and
enlist same package install code as used by updater window  
27. Fix NPE in SdkTargetSelector and AVD manager caused by Target
implementation change
28. Add image factory SdkUserInterfacePlugin and delegate it to dispose
of the image factory
29. Add support to SdkContext for changing SDK location
30. Add to SdkHelper all ISdkChangeListener event broadcasts
31. Reinstate SdkManagerAction ISdkChangeListener events 
32. Remove call to VersionCheck which fails for API27 because library
file "plugin.prop" has disappeared
33. Two minor link check corrections for API25 and update of LintJob to
workaround Eclipse projects not having "testsources"
34. Relocate commons-compress jar from sdkuilib module to swt module to
fix classpath issue impacting package install
35. Fix spurious popup when cancelling AVD edit page

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=526437
Signed-off-by: Andrew Bowley <[email protected]>
  • Loading branch information
Kys3rK1ng committed Dec 2, 2017
1 parent ac4ee26 commit f15fa7b
Show file tree
Hide file tree
Showing 67 changed files with 5,660 additions and 4,571 deletions.
1 change: 0 additions & 1 deletion andmore-swt/org.eclipse.andmore.sdkuilib/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="libs/commons-compress-1.8.1.jar"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
6 changes: 2 additions & 4 deletions andmore-swt/org.eclipse.andmore.sdkuilib/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ Require-Bundle: org.eclipse.core.commands;bundle-version="3.8.1",
com.google.gson;bundle-version="2.2.4",
org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.andmore.ddms;bundle-version="0.5.2"
Bundle-ClassPath: .,
libs/commons-compress-1.8.1.jar
Bundle-ClassPath: .
Export-Package: com.android.sdkuilib.repository,
com.android.sdkuilib.ui,
com.android.sdkuilib.widgets,
org.eclipse.andmore.sdktool
Import-Package: com.android.sdklib.repository,
org.eclipse.ui.plugin
Import-Package: org.eclipse.ui.plugin
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.andmore.sdktool.SdkUserInterfacePlugin
1 change: 0 additions & 1 deletion andmore-swt/org.eclipse.andmore.sdkuilib/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
libs/,\
plugin.properties,\
icons/

1 change: 0 additions & 1 deletion andmore-swt/org.eclipse.andmore.sdkuilib/libs/.gitignore

This file was deleted.

Binary file not shown.
32 changes: 0 additions & 32 deletions andmore-swt/org.eclipse.andmore.sdkuilib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
<version>0.5.2-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -82,33 +77,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>initialize</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.8.1</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.basedir}/libs</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<exclusionGroupIds></exclusionGroupIds>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
package com.android.sdkuilib.internal.repository;

/**
* A task that executes and can update a monitor to display its status.
* The task will generally be run in a separate thread.
* A task that executes updates a monitor to display it's status.
* The task will be run in a separate job.
* @param monitor Progress monitor
*/
public interface ITask {
void run(ITaskMonitor monitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,18 @@


/**
* A factory that can start and run new {@link ITask}s.
* A factory starts {@link ITask}s as a job and returns immediately.
* An optional Runnable parameter can be given to run when the job is done.
*/
public interface ITaskFactory {

/**
* Starts a new task with a new {@link ITaskMonitor}.
* <p/>
* The task will execute in a thread and runs it own UI loop.
* This means the task can perform UI operations using
* {@code Display#asyncExec(Runnable)}.
* <p/>
* In either case, the method only returns when the task has finished.
*
* The task will execute asynchronously in a job.
* @param title The title of the task, displayed in the monitor if any.
* @param task The task to run.
* @param onTerminateTask Callback when task done. Can be null
*/
void start(String title, ITask task);
void start(String title, ITask task, Runnable onTerminateTask);

/**
* Starts a new task contributing to an already existing {@link ITaskMonitor}.
* <p/>
* To use this properly, you should use {@link ITaskMonitor#createSubMonitor(int)}
* and give the sub-monitor to the new task with the number of work units you want
* it to fill. The {@link #start} method will make sure to <em>fill</em> the progress
* when the task is completed, in case the actual task did not.
* <p/>
* When a task is started from within a monitor, it reuses the thread
* from the parent. Otherwise it starts a new thread and runs it own
* UI loop. This means the task can perform UI operations using
* {@code Display#asyncExec(Runnable)}.
* <p/>
* In either case, the method only returns when the task has finished.
*
* @param title The title of the task, displayed in the monitor if any.
* @param parentMonitor The parent monitor. Can be null.
* @param task The task to run and have it display on the monitor.
*/
void start(String title, ITaskMonitor parentMonitor, ITask task);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2017 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.sdkuilib.internal.repository;

/**
* @author Andrew Bowley
*
* 30-11-2017
*/
public interface PackageInstallListener {
void onPackagesInstalled(int count);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
* Copyright (C) 2017 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.sdkuilib.internal.repository;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.eclipse.andmore.sdktool.SdkContext;

import com.android.repository.api.Installer;
import com.android.repository.api.RemotePackage;

/**
* @author Andrew Bowley
*
* 29-11-2017
*/
public abstract class PackageInstallTask implements ITask, Runnable {

private final SdkContext sdkContext;
private final PackageManager packageManager;
private final List<RemotePackage> packageList;
private final List<RemotePackage> acceptedRemotes;
private int numInstalled;

/**
*
*/
public PackageInstallTask(SdkContext sdkContext, List<RemotePackage> packageList, List<RemotePackage> acceptedRemotes) {
this.sdkContext = sdkContext;
this.packageManager = sdkContext.getPackageManager();
this.packageList = packageList;
this.acceptedRemotes = acceptedRemotes;
}

public int getNumInstalled() {
return numInstalled;
}

/* (non-Javadoc)
* @see com.android.sdkuilib.internal.repository.ITask#run(com.android.sdkuilib.internal.repository.ITaskMonitor)
*/
@Override
public void run(ITaskMonitor monitor) {
// Assume installation will proceed instead of complicating the install task
sdkContext.getSdkHelper().broadcastPreInstallHook(sdkContext.getSdkLog());
List<RemotePackage> rejectedRemotes = new ArrayList<>();
Iterator<RemotePackage> iterator = packageList.iterator();
while (iterator.hasNext()) {
RemotePackage remote = iterator.next();
if (!acceptedRemotes.contains(remote))
rejectedRemotes.add(remote);
}
List<RemotePackage> remotes = new ArrayList<>();
remotes.addAll(packageList);
if (!rejectedRemotes.isEmpty()) {
String title = "Package licences not accepted";
StringBuilder builder = new StringBuilder();
builder.append("The following packages can not be installed since their " +
"licenses or those of the packages they depend on were not accepted:");
Iterator<RemotePackage> iterator2 = rejectedRemotes.iterator();
while(iterator2.hasNext())
builder.append('\n').append(iterator2.next().getPath());
if (!acceptedRemotes.isEmpty()) {
builder.append("\n\nContinue installing the remaining packages?");
if (!monitor.displayPrompt(title,
builder.toString()))
return;
else {
monitor.displayInfo(title, builder.toString());
return;
}
}
remotes = acceptedRemotes;
}
final int progressPerPackage = 2 * 100;
monitor.setProgressMax(1 + remotes.size() * progressPerPackage);
monitor.setDescription("Preparing to install packages");
for (RemotePackage remotePackage : remotes) {
int nextProgress = monitor.getProgress() + progressPerPackage;
Installer installer = packageManager.createInstaller(remotePackage);
if (packageManager.applyPackageOperation(installer)) {
++numInstalled;
} else {
// there was an error, abort.
monitor.error(null, "Install of package failed due to an error");
monitor.setProgressMax(0);
break;
}
if (monitor.isCancelRequested()) {
break;
}
monitor.incProgress(nextProgress - monitor.getProgress());
}
if (numInstalled > 0)
sdkContext.getSdkHelper().broadcastPostInstallHook(sdkContext.getSdkLog());
/* Post package install operations used to give the user an opportuning to restart ADB
* and advise check for ADT Updates
if (installedAddon || installedPlatformTools) {
// We need to restart ADB. Actually since we don't know if it's even
// running, maybe we should just kill it and not start it.
// Note: it turns out even under Windows we don't need to kill adb
// before updating the tools folder, as adb.exe is (surprisingly) not
// locked.
askForAdbRestart(monitor);
}
if (installedTools) {
notifyToolsNeedsToBeRestarted(flags);
}
*/
}

}
Loading

0 comments on commit f15fa7b

Please sign in to comment.