# HG changeset patch # User Vladimir Kvashin # Date 1450960896 -10800 # Branch release81 # Node ID 2f19e542a3a0cf3b69e5bbb7dc5eaaf4f212c056 # Parent a90ac8b4e921fa192511cc897f6af14f8a03f846 fixing #257285 - Need an easy way to retrieve *multiple* build results from remote host diff -r a90ac8b4e921 -r 2f19e542a3a0 cnd.remote/src/org/netbeans/modules/cnd/remote/support/RemoteProjectSupport.java --- a/cnd.remote/src/org/netbeans/modules/cnd/remote/support/RemoteProjectSupport.java Thu Dec 24 12:38:34 2015 +0300 +++ b/cnd.remote/src/org/netbeans/modules/cnd/remote/support/RemoteProjectSupport.java Thu Dec 24 15:41:36 2015 +0300 @@ -52,7 +52,9 @@ import java.util.logging.Level; import org.netbeans.api.project.Project; import org.netbeans.modules.cnd.api.remote.RemoteProject; +import org.netbeans.modules.cnd.makeproject.api.configurations.ConfigurationDescriptorProvider; import org.netbeans.modules.cnd.makeproject.api.configurations.ConfigurationSupport; +import org.netbeans.modules.cnd.makeproject.api.configurations.Folder; import org.netbeans.modules.cnd.makeproject.api.configurations.Item; import org.netbeans.modules.cnd.makeproject.api.configurations.LibraryItem.ProjectItem; import org.netbeans.modules.cnd.makeproject.api.configurations.MakeConfiguration; @@ -129,14 +131,56 @@ } public static List getBuildResults(MakeConfiguration conf) { - String binaryPath = (conf == null) ? null : conf.getAbsoluteOutputValue(); - if (binaryPath != null) { - return Collections.singletonList(new FSPath(conf.getFileSystem(), binaryPath)); - } else { - return Collections.emptyList(); + if (conf != null) { + String binaryPath = conf.getAbsoluteOutputValue(); + if (binaryPath != null) { + return Collections.singletonList(new FSPath(conf.getFileSystem(), binaryPath)); + } + } + return Collections.emptyList(); + } + + public static List getBuildResultsAndInterestingFiles(Project project, MakeConfiguration conf) { + List result = new ArrayList<>(); + if (conf != null) { + String binaryPath = conf.getAbsoluteOutputValue(); + if (binaryPath != null) { + result.add(new FSPath(conf.getFileSystem(), binaryPath)); + } + } + if (project != null) { + ConfigurationDescriptorProvider cdp = project.getLookup().lookup(ConfigurationDescriptorProvider.class); + if (cdp != null) { + MakeConfigurationDescriptor cd = cdp.getConfigurationDescriptor(); + if (cd != null) { + collectPlainFiles(cd.getExternalFileItems(), result); + } + } + } + return result; + } + + private static void collectPlainFiles(Folder folder, List result) { + for (Item item : folder.getItemsAsArray()) { + collectPlainFiles(item.getFileObject(), result); + } + for (Folder child : folder.getFolders()) { + collectPlainFiles(child, result); } } - + + private static void collectPlainFiles(FileObject fo, List result) { + if (fo != null && fo.isValid()) { + if (fo.isData()) { + result.add(FSPath.toFSPath(fo)); + } else if (fo.isFolder()) { + for (FileObject child : fo.getChildren()) { + collectPlainFiles(child, result); + } + } + } + } + public static List getProjectSourceDirs(Lookup.Provider project, AtomicReference runDir) { MakeConfiguration conf = ConfigurationSupport.getProjectActiveConfiguration(project); RemoteProject rp = project.getLookup().lookup(RemoteProject.class); diff -r a90ac8b4e921 -r 2f19e542a3a0 cnd.remote/src/org/netbeans/modules/cnd/remote/sync/RemoteBuildProjectActionHandler.java --- a/cnd.remote/src/org/netbeans/modules/cnd/remote/sync/RemoteBuildProjectActionHandler.java Thu Dec 24 12:38:34 2015 +0300 +++ b/cnd.remote/src/org/netbeans/modules/cnd/remote/sync/RemoteBuildProjectActionHandler.java Thu Dec 24 15:41:36 2015 +0300 @@ -164,7 +164,7 @@ RemoteSyncFactory syncFactory = conf.getRemoteSyncFactory(); final RemoteSyncWorker worker = (syncFactory == null) ? null : syncFactory.createNew(execEnv, out, err, privProjectStorage, runDir.get(), sourceDirs, - RemoteProjectSupport.getBuildResults(conf)); + RemoteProjectSupport.getBuildResultsAndInterestingFiles(pae.getProject(), conf)); CndUtils.assertTrue(worker != null, "RemoteSyncWorker shouldn't be null"); //NOI18N if (worker == null) { delegate.execute(io);