yazd / DKit

DKit is a package to aid developing D programs using Sublime Text 3.
62 stars 23 forks source link

cannot create project from dub file #35

Open extrawurst opened 8 years ago

extrawurst commented 8 years ago

I followed the instructions here: https://www.btbytes.com/posts/st3d.html

Unfortunately I cannot "Create Project from DUB Package File" because it will always tell me i should run dub at least once b4. which is BS because i run dub all the time from bash?!

screen shot 2016-02-22 at 08 10 42
yazd commented 8 years ago

You should run dub at least once on the project. You can run it from bash. Maybe the error message should be clarified. To double check, run dub describe, if it works correctly then it is a bug in DKit.

extrawurst commented 8 years ago

"on the project" is exactly what i meant. I never build that project in any other way.

extrawurst commented 8 years ago

this is what dub describe spits out:

stephan@Stephans-MacBook-Pro:~/Documents/_gh/dcdtest$ dub describe
{
    "rootPackage": "dcdtest",
    "mainPackage": "dcdtest",
    "configuration": "application",
    "buildType": "debug",
    "compiler": "dmd",
    "architecture": [
        "x86_64"
    ],
    "platform": [
        "posix",
        "osx"
    ],
    "packages": [
        {
            "path": "/Users/stephan/Documents/_gh/dcdtest/",
            "name": "dcdtest",
            "version": "~master",
            "description": "A minimal D application.",
            "homepage": "",
            "authors": [
                "stephan"
            ],
            "copyright": "Copyright © 2016, stephan",
            "license": "",
            "dependencies": [],
            "active": true,
            "configuration": "application",
            "targetType": "executable",
            "targetPath": "",
            "targetName": "dcdtest",
            "targetFileName": "dcdtest",
            "workingDirectory": "",
            "mainSourceFile": "source/app.d",
            "dflags": [],
            "lflags": [],
            "libs": [],
            "copyFiles": [],
            "versions": [],
            "debugVersions": [],
            "importPaths": [
                "source/"
            ],
            "stringImportPaths": [],
            "preGenerateCommands": [],
            "postGenerateCommands": [],
            "preBuildCommands": [],
            "postBuildCommands": [],
            "buildRequirements": [],
            "options": [],
            "files": [
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/app.d"
                }
            ]
        }
    ],
    "targets": [
        {
            "rootPackage": "dcdtest",
            "packages": [
                "dcdtest"
            ],
            "rootConfiguration": "application",
            "buildSettings": {
                "targetType": 2,
                "targetPath": "/Users/stephan/Documents/_gh/dcdtest",
                "targetName": "dcdtest",
                "workingDirectory": "",
                "mainSourceFile": "/Users/stephan/Documents/_gh/dcdtest/source/app.d",
                "dflags": [],
                "lflags": [],
                "libs": [],
                "linkerFiles": [],
                "sourceFiles": [
                    "/Users/stephan/Documents/_gh/dcdtest/source/app.d"
                ],
                "copyFiles": [],
                "versions": [
                    "Have_dcdtest"
                ],
                "debugVersions": [],
                "importPaths": [
                    "/Users/stephan/Documents/_gh/dcdtest/source/"
                ],
                "stringImportPaths": [],
                "importFiles": [],
                "stringImportFiles": [],
                "preGenerateCommands": [],
                "postGenerateCommands": [],
                "preBuildCommands": [],
                "postBuildCommands": [],
                "requirements": [],
                "options": [
                    "debugMode",
                    "debugInfo",
                    "warningsAsErrors"
                ]
            },
            "dependencies": [],
            "linkDependencies": []
        }
    ]
}
yazd commented 8 years ago

I am unable to reproduce this issue. What platform are you running on? I pushed some debugging code that might help to https://github.com/yazd/DKit/tree/debug_35. Can you post back the output from sublime's console (ctrl+` to show it)?

divmgl commented 8 years ago

I'm having this same problem. Running on Mac OSX (it looks like OP is running OSX as well).

$ dub describe
{
    "rootPackage": "titans",
    "mainPackage": "titans",
    "configuration": "application",
    "buildType": "debug",
    "compiler": "dmd",
    "architecture": [
        "x86_64"
    ],
    "platform": [
        "posix",
        "osx"
    ],
    "packages": [
        {
            "path": "/Users/dimgl/dev/titans/",
            "name": "titans",
            "version": "~master",
            "description": "A minimal D application.",
            "homepage": "",
            "authors": [
                "dimgl"
            ],
            "copyright": "Copyright © 2016, dimgl",
            "license": "",
            "dependencies": [
                "derelict-glfw3"
            ],
            "active": true,
            "configuration": "application",
            "targetType": "executable",
            "targetPath": "",
            "targetName": "titans",
            "targetFileName": "titans",
            "workingDirectory": "",
            "mainSourceFile": "source/app.d",
            "dflags": [],
            "lflags": [],
            "libs": [],
            "copyFiles": [],
            "versions": [],
            "debugVersions": [],
            "importPaths": [
                "source/"
            ],
            "stringImportPaths": [],
            "preGenerateCommands": [],
            "postGenerateCommands": [],
            "preBuildCommands": [],
            "postBuildCommands": [],
            "buildRequirements": [],
            "options": [],
            "files": [
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/app.d"
                }
            ]
        },
        {
            "path": "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/",
            "name": "derelict-glfw3",
            "version": "2.0.0",
            "description": "A dynamic and static binding to the GLFW 3 library.",
            "homepage": "https://derelictorg.github.io/packages/glfw3.html",
            "authors": [
                "Mike Parker"
            ],
            "copyright": "",
            "license": "Boost",
            "dependencies": [
                "derelict-util"
            ],
            "active": true,
            "configuration": "derelict-glfw3-dynamic",
            "targetType": "library",
            "targetPath": "lib",
            "targetName": "derelict-glfw3",
            "targetFileName": "libderelict-glfw3.a",
            "workingDirectory": "",
            "mainSourceFile": "",
            "dflags": [],
            "lflags": [],
            "libs": [],
            "copyFiles": [],
            "versions": [],
            "debugVersions": [],
            "importPaths": [
                "source/"
            ],
            "stringImportPaths": [],
            "preGenerateCommands": [],
            "postGenerateCommands": [],
            "preBuildCommands": [],
            "postBuildCommands": [],
            "buildRequirements": [],
            "options": [],
            "files": [
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/glfw3/dynload.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/glfw3/glfw3.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/glfw3/package.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/glfw3/types.d"
                }
            ]
        },
        {
            "path": "/Users/dimgl/.dub/packages/derelict-util-2.0.4/",
            "name": "derelict-util",
            "version": "2.0.4",
            "description": "Cross-platform shared library loader and a number of utility modules used by the Derelict libraries.",
            "homepage": "https://github.com/DerelictOrg/DerelictUtil",
            "authors": [
                "Mike Parker"
            ],
            "copyright": "",
            "license": "Boost",
            "dependencies": [],
            "active": true,
            "configuration": "library",
            "targetType": "library",
            "targetPath": "lib",
            "targetName": "DerelictUtil",
            "targetFileName": "libDerelictUtil.a",
            "workingDirectory": "",
            "mainSourceFile": "",
            "dflags": [],
            "lflags": [],
            "libs": [],
            "copyFiles": [],
            "versions": [],
            "debugVersions": [],
            "importPaths": [
                "source/"
            ],
            "stringImportPaths": [],
            "preGenerateCommands": [],
            "postGenerateCommands": [],
            "preBuildCommands": [],
            "postBuildCommands": [],
            "buildRequirements": [],
            "options": [],
            "files": [
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/util/exception.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/util/loader.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/util/sharedlib.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/util/system.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/util/wintypes.d"
                },
                {
                    "role": "source",
                    "type": "source",
                    "path": "source/derelict/util/xtypes.d"
                }
            ]
        }
    ],
    "targets": [
        {
            "rootPackage": "titans",
            "packages": [
                "titans"
            ],
            "rootConfiguration": "application",
            "buildSettings": {
                "targetType": 2,
                "targetPath": "/Users/dimgl/dev/titans",
                "targetName": "titans",
                "workingDirectory": "",
                "mainSourceFile": "/Users/dimgl/dev/titans/source/app.d",
                "dflags": [],
                "lflags": [],
                "libs": [],
                "linkerFiles": [
                    "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/lib/libderelict-glfw3.a",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/lib/libDerelictUtil.a"
                ],
                "sourceFiles": [
                    "/Users/dimgl/dev/titans/source/app.d"
                ],
                "copyFiles": [],
                "versions": [
                    "Have_titans",
                    "Have_derelict_glfw3",
                    "Have_derelict_util"
                ],
                "debugVersions": [],
                "importPaths": [
                    "/Users/dimgl/dev/titans/source/",
                    "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/source/",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/"
                ],
                "stringImportPaths": [],
                "importFiles": [],
                "stringImportFiles": [],
                "preGenerateCommands": [],
                "postGenerateCommands": [],
                "preBuildCommands": [],
                "postBuildCommands": [],
                "requirements": [],
                "options": [
                    "debugMode",
                    "debugInfo",
                    "warningsAsErrors"
                ]
            },
            "dependencies": [
                "derelict-glfw3"
            ],
            "linkDependencies": [
                "derelict-glfw3",
                "derelict-util"
            ]
        },
        {
            "rootPackage": "derelict-glfw3",
            "packages": [
                "derelict-glfw3"
            ],
            "rootConfiguration": "derelict-glfw3-dynamic",
            "buildSettings": {
                "targetType": 6,
                "targetPath": "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/lib",
                "targetName": "derelict-glfw3",
                "workingDirectory": "",
                "mainSourceFile": "",
                "dflags": [],
                "lflags": [],
                "libs": [],
                "linkerFiles": [
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/lib/libDerelictUtil.a"
                ],
                "sourceFiles": [
                    "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/source/derelict/glfw3/dynload.d",
                    "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/source/derelict/glfw3/glfw3.d",
                    "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/source/derelict/glfw3/package.d",
                    "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/source/derelict/glfw3/types.d"
                ],
                "copyFiles": [],
                "versions": [
                    "Have_derelict_glfw3",
                    "Have_derelict_util"
                ],
                "debugVersions": [],
                "importPaths": [
                    "/Users/dimgl/.dub/packages/derelict-glfw3-2.0.0/source/",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/"
                ],
                "stringImportPaths": [],
                "importFiles": [],
                "stringImportFiles": [],
                "preGenerateCommands": [],
                "postGenerateCommands": [],
                "preBuildCommands": [],
                "postBuildCommands": [],
                "requirements": [],
                "options": [
                    "debugMode",
                    "debugInfo",
                    "warningsAsErrors"
                ]
            },
            "dependencies": [
                "derelict-util"
            ],
            "linkDependencies": [
                "derelict-util"
            ]
        },
        {
            "rootPackage": "derelict-util",
            "packages": [
                "derelict-util"
            ],
            "rootConfiguration": "library",
            "buildSettings": {
                "targetType": 6,
                "targetPath": "/Users/dimgl/.dub/packages/derelict-util-2.0.4/lib",
                "targetName": "DerelictUtil",
                "workingDirectory": "",
                "mainSourceFile": "",
                "dflags": [],
                "lflags": [],
                "libs": [],
                "linkerFiles": [],
                "sourceFiles": [
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/derelict/util/exception.d",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/derelict/util/loader.d",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/derelict/util/sharedlib.d",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/derelict/util/system.d",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/derelict/util/wintypes.d",
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/derelict/util/xtypes.d"
                ],
                "copyFiles": [],
                "versions": [
                    "Have_derelict_util"
                ],
                "debugVersions": [],
                "importPaths": [
                    "/Users/dimgl/.dub/packages/derelict-util-2.0.4/source/"
                ],
                "stringImportPaths": [],
                "importFiles": [],
                "stringImportFiles": [],
                "preGenerateCommands": [],
                "postGenerateCommands": [],
                "preBuildCommands": [],
                "postBuildCommands": [],
                "requirements": [],
                "options": [
                    "debugMode",
                    "debugInfo",
                    "warningsAsErrors"
                ]
            },
            "dependencies": [],
            "linkDependencies": []
        }
    ]
}
rockdreamer commented 8 years ago

I loaded the debug_35 branch and that was not useful. I added the stderr=PIPE command to Popen to capture the resulting stderr and print it in case of ValueError. Sure enough, the problem was that Sublime Text is started by launchctl, so it doesn't have the necessary PATH entries to load dub or dmd. The solution was to use the FixMacPath plugin