Skip to content

msys / cygwin support for pub #1120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DartBot opened this issue Jun 5, 2015 · 12 comments
Closed

msys / cygwin support for pub #1120

DartBot opened this issue Jun 5, 2015 · 12 comments
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/4522109?v=3" align="left" width="96" height="96"hspace="10"> Issue by MetaMemoryT
Originally opened as dart-lang/sdk#20822


pub should support being ran on a cygwin terminal more easily.

npm "Node Package Manager" supports this by adding a "npm" shell script to the windows distribution that cygwin terminals can execute:

file npm:

'''

!/bin/sh

basedir=dirname &quot;$0&quot;

case uname in
    CYGWIN) basedir=cygpath -w &quot;$basedir&quot;;;
esac

if [ -x "$basedir/node.exe" ]; then
  "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
else
  node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
fi
'''

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/5479?v=3" align="left" width="48" height="48"hspace="10"> Comment by sethladd


Added Area-Pub, Triaged labels.

@DartBot DartBot added type-enhancement A request for a change that isn't a bug closed-not-planned Closed as we don't intend to take action on the reported issue labels Jun 5, 2015
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan


This is also an issue with the new package executables implemented in issue #970, they have to be called with my_executable.bat which also means they don't work with cygwin's tab completion.

The equivalent feature in npm does not have this issue.

Npm's generated "binstubs" for package executables look almost exactly like the npm shell script embedded above:

'''
#!/bin/sh
basedir=dirname "$0"

case uname in
    CYGWIN) basedir=cygpath -w "$basedir";;
esac

if [ -x "$basedir/node" ]; then
  "$basedir/node" "$basedir/node_modules/grunt-cli/bin/grunt" "$@"
  ret=$?
else
  node "$basedir/node_modules/grunt-cli/bin/grunt" "$@"
  ret=$?
fi
exit $ret
'''

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan


This also affects these executables:

dartfmt
dartanalyzer
dart2js

So not necessarily Area-Pub

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan


It would be nice to run the same build script from from travis-ci.org (linux, osx) and appveyor.com (windows), which could be done via the use of cygwin.

Appveyor has an image with cygwin preinstalled:

  http://help.appveyor.com/discussions/suggestions/427-pre-install-cygwin

However, due to this issue no pub commands, or pub global activated executables could be called from such a bash script.

For projects that use a task runner like grinder (https://github.com/google/grinder.dart) for their build, that can take care of most of the platform abstraction, but not all, and not all projects will use a task runner.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


Cygwin is not currently a supported platform for Dart. This means that we aren't going to allocate any resources towards it, including engineering time or test coverage. You're welcome to submit patches to improve support, but bear in mind that since they won't be tested, we can't guarantee that we won't break them in the future.


Added NotPlanned label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan


Ugh, this makes dart really painful to use from a windows machine. Using a standard windows shell like CMD might be bearable if at least color were supported (issue dart-lang/sdk#21337).

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/444270?v=3" align="left" width="48" height="48"hspace="10"> Comment by seaneagan


Thanks for the update though, I may take a crack at it after the move to github.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/4522109?v=3" align="left" width="48" height="48"hspace="10"> Comment by MetaMemoryT


Should this issue be re-opened? was it fixed, or did the DartBot close it when it moved it here?

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


This isn't planned. See my comment above.

@alextekartik
Copy link

As a workaround, a simple script named pub with the following content and added to the global path works fine on cygwin (dart in c:\tools\dart-sdk here)

#!/bin/bash
SNAPSHOT="/c/tools/dart-sdk/bin/snapshots/pub.dart.snapshot"
dart "$SNAPSHOT" "$@"

@a-berg
Copy link

a-berg commented Oct 17, 2018

Having some trouble getting it to work when Dart is installed into C:\Program Files\Dart.
The script:

#!/bin/bash
SNAPSHOT="/c/Program Files/Dart/dart-sdk/bin/snapshotspub.dart.snapshot"
dart "$SNAPSHOT" "$@"

Gives the error

Error: Input file not found: file:///c/Program%20Files/Dart/dart-sdk/bin/snapshotspub.dart.snapshot%0D.
make: *** [Makefile:4: serve] Error 254

@aktxyz
Copy link

aktxyz commented Jan 17, 2020

tweak to above script to make more cygwin friendly using cygpath -m

$ cat pub.sh
#!/bin/bash
echo "running dart pub in cygwin ..."
dart `cygpath -m /c/tools/dart-sdk/bin/snapshots/pub.dart.snapshot` "$@"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants