You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by alsorokin <gi...@git.apache.org> on 2017/07/14 12:29:33 UTC

[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

GitHub user alsorokin opened a pull request:

    https://github.com/apache/cordova-windows/pull/237

    Cb 12636 Fix check_reqs to properly find VS 2017

    ### Platforms affected
    this one!
    
    ### What does this PR do?
    Teaches `cordova-windows` to properly recognize VS 2017 installation in the system.
    
    ### What testing has been done on this change?
    `cordova requirements` on Windows 10 / Windows 8.1 with only VS 2017, as well as with other VS versions.
    
    ### Checklist
    - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
    - [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
    - [ ] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/alsorokin/cordova-windows CB-12636

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-windows/pull/237.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #237
    
----
commit c768bfee3d00d2ac2cdef0592426c7ebc2688d1c
Author: Alexander Sorokin <al...@akvelon.com>
Date:   2017-07-13T08:47:07Z

    CB-12636 Fix check_reqs to properly find VS 2017

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

Posted by matrosov-nikita <gi...@git.apache.org>.
Github user matrosov-nikita commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/237#discussion_r127481484
  
    --- Diff: template/cordova/lib/MSBuildTools.js ---
    @@ -171,6 +182,54 @@ function getAvailableUAPVersions() {
         });
     
         return result;
    +};
    +
    +/**
    + * Lists all VS 2017+ instances dirs in ProgramData
    + * 
    + * @return {String[]} List of paths to all VS2017+ instances
    + */
    +function getWillowProgDataPaths() {
    +    if (!process.env.systemdrive) {
    +        // running on linux/osx?
    +        return [];
    +    }
    +    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    +    if (!shell.test('-d', instancesRoot)) {
    +        // can't seem to find VS instances dir, return empty result
    +        return [];
    +    }
    +
    +    return fs.readdirSync(instancesRoot).map(function(file) {
    +        var instanceDir = path.join(instancesRoot, file);
    +        if (shell.test('-d', instanceDir)) {
    +            return instanceDir;
    +        }
    +    });
     }
     
    -module.exports.getAvailableUAPVersions = getAvailableUAPVersions;
    +/**
    + * Lists all installed VS 2017+ versions
    + * 
    + * @return {Object[]} List of all VS 2017+ versions
    + */
    +module.exports.getWillowInstallations = function () {
    +    var progDataPaths = getWillowProgDataPaths();
    +    var installations = [];
    +    progDataPaths.filter(function (progDataPath) {
    +        // make sure state.json exists
    +        return shell.test('-e', path.join(progDataPath, 'state.json'));
    --- End diff --
    
    `fs.existsSync`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

Posted by matrosov-nikita <gi...@git.apache.org>.
Github user matrosov-nikita commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/237#discussion_r127480919
  
    --- Diff: template/cordova/lib/MSBuildTools.js ---
    @@ -171,6 +182,54 @@ function getAvailableUAPVersions() {
         });
     
         return result;
    +};
    +
    +/**
    + * Lists all VS 2017+ instances dirs in ProgramData
    + * 
    + * @return {String[]} List of paths to all VS2017+ instances
    + */
    +function getWillowProgDataPaths() {
    +    if (!process.env.systemdrive) {
    +        // running on linux/osx?
    +        return [];
    +    }
    +    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    +    if (!shell.test('-d', instancesRoot)) {
    +        // can't seem to find VS instances dir, return empty result
    +        return [];
    +    }
    +
    +    return fs.readdirSync(instancesRoot).map(function(file) {
    +        var instanceDir = path.join(instancesRoot, file);
    +        if (shell.test('-d', instanceDir)) {
    --- End diff --
    
    Can we use `fs.statSync` here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

Posted by matrosov-nikita <gi...@git.apache.org>.
Github user matrosov-nikita commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/237#discussion_r127480213
  
    --- Diff: template/cordova/lib/MSBuildTools.js ---
    @@ -171,6 +182,54 @@ function getAvailableUAPVersions() {
         });
     
         return result;
    +};
    +
    +/**
    + * Lists all VS 2017+ instances dirs in ProgramData
    + * 
    + * @return {String[]} List of paths to all VS2017+ instances
    + */
    +function getWillowProgDataPaths() {
    +    if (!process.env.systemdrive) {
    +        // running on linux/osx?
    +        return [];
    +    }
    +    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    +    if (!shell.test('-d', instancesRoot)) {
    --- End diff --
    
    Can we use `fs.statSync` here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

Posted by matrosov-nikita <gi...@git.apache.org>.
Github user matrosov-nikita commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/237#discussion_r127480714
  
    --- Diff: template/cordova/lib/MSBuildTools.js ---
    @@ -171,6 +182,54 @@ function getAvailableUAPVersions() {
         });
     
         return result;
    +};
    +
    +/**
    + * Lists all VS 2017+ instances dirs in ProgramData
    + * 
    + * @return {String[]} List of paths to all VS2017+ instances
    + */
    +function getWillowProgDataPaths() {
    +    if (!process.env.systemdrive) {
    +        // running on linux/osx?
    +        return [];
    +    }
    +    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    +    if (!shell.test('-d', instancesRoot)) {
    +        // can't seem to find VS instances dir, return empty result
    +        return [];
    +    }
    +
    +    return fs.readdirSync(instancesRoot).map(function(file) {
    --- End diff --
    
    Can we use `filter` instead of `map` in this case?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

Posted by matrosov-nikita <gi...@git.apache.org>.
Github user matrosov-nikita commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/237#discussion_r127481238
  
    --- Diff: template/cordova/lib/MSBuildTools.js ---
    @@ -171,6 +182,54 @@ function getAvailableUAPVersions() {
         });
     
         return result;
    +};
    +
    +/**
    + * Lists all VS 2017+ instances dirs in ProgramData
    + * 
    + * @return {String[]} List of paths to all VS2017+ instances
    + */
    +function getWillowProgDataPaths() {
    +    if (!process.env.systemdrive) {
    +        // running on linux/osx?
    +        return [];
    +    }
    +    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    +    if (!shell.test('-d', instancesRoot)) {
    +        // can't seem to find VS instances dir, return empty result
    +        return [];
    +    }
    +
    +    return fs.readdirSync(instancesRoot).map(function(file) {
    +        var instanceDir = path.join(instancesRoot, file);
    +        if (shell.test('-d', instanceDir)) {
    +            return instanceDir;
    +        }
    +    });
     }
     
    -module.exports.getAvailableUAPVersions = getAvailableUAPVersions;
    +/**
    + * Lists all installed VS 2017+ versions
    + * 
    + * @return {Object[]} List of all VS 2017+ versions
    + */
    +module.exports.getWillowInstallations = function () {
    +    var progDataPaths = getWillowProgDataPaths();
    +    var installations = [];
    +    progDataPaths.filter(function (progDataPath) {
    --- End diff --
    
    Can we make this filter in `getWillowProgDataPaths`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

Posted by alsorokin <gi...@git.apache.org>.
Github user alsorokin commented on a diff in the pull request:

    https://github.com/apache/cordova-windows/pull/237#discussion_r127631518
  
    --- Diff: template/cordova/lib/MSBuildTools.js ---
    @@ -171,6 +182,54 @@ function getAvailableUAPVersions() {
         });
     
         return result;
    +};
    +
    +/**
    + * Lists all VS 2017+ instances dirs in ProgramData
    + * 
    + * @return {String[]} List of paths to all VS2017+ instances
    + */
    +function getWillowProgDataPaths() {
    +    if (!process.env.systemdrive) {
    +        // running on linux/osx?
    +        return [];
    +    }
    +    var instancesRoot = path.join(process.env.systemdrive, 'ProgramData/Microsoft/VisualStudio/Packages/_Instances');
    +    if (!shell.test('-d', instancesRoot)) {
    +        // can't seem to find VS instances dir, return empty result
    +        return [];
    +    }
    +
    +    return fs.readdirSync(instancesRoot).map(function(file) {
    --- End diff --
    
    `filter` would leave it as a relative path, but we need to make an absolute one.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-windows pull request #237: Cb 12636 Fix check_reqs to properly find ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-windows/pull/237


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org