diff --git a/.gitignore b/.gitignore index 7981eaa..6d0964b 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ /test/ignore-hidden-2/ignore-hidden-2 /test/expected-import-path-output /test/expected-string-import-path-output +/test/expected-describe-data-output +/test/describe-project/dummy.dat +/test/describe-project/dummy-dep1.dat diff --git a/source/dub/commandline.d b/source/dub/commandline.d index d5c202a..b487526 100644 --- a/source/dub/commandline.d +++ b/source/dub/commandline.d @@ -749,6 +749,7 @@ private { bool m_importPaths = false; bool m_stringImportPaths = false; + string[] m_data; } this() @@ -761,14 +762,24 @@ "their dependencies in a format similar to a JSON package " "description file. This is useful mostly for IDEs.", "", - "When --import-paths is supplied, the import paths for a project ", - "will be printed line-by-line instead. The paths for D source " - "files across all dependent projects will be included.", + "All usual options that are also used for build/run/generate apply.", "", - "--string-import-paths can can supplied to print the string " - "import paths for a project.", + "When --data=VALUE is supplied, specific build settings for a project ", + "will be printed instead (by default, line-by-line).", "", - "All usual options that are also used for build/run/generate apply." + "The --data=VALUE option can be specified multiple times to retrieve " + "several pieces of information at once. The data will be output in " + "the same order requested on the command line.", + "", + "The accepted values for --data=VALUE are:", + "", + "target-type, target-path, target-name, working-directory, " + "main-source-file, dflags, lflags, libs, source-files, " + "copy-files, versions, debug-versions, import-paths, " + "string-import-paths, import-files, string-import-files, " + "pre-generate-commands, post-generate-commands, " + "pre-build-commands, post-build-commands, " + "requirements, options", ]; } @@ -777,11 +788,17 @@ super.prepare(args); args.getopt("import-paths", &m_importPaths, [ - "List the import paths for project." + "Shortcut for --data=import-paths" ]); args.getopt("string-import-paths", &m_stringImportPaths, [ - "List the string import paths for project." + "Shortcut for --data=string-import-paths" + ]); + + args.getopt("data", &m_data, [ + "Just list the values of a particular build setting, either for this "~ + "package alone or recursively including all dependencies. See "~ + "above for more details and accepted possibilities for VALUE." ]); } @@ -792,6 +809,11 @@ "--import-paths and --string-import-paths may not be used together." ); + enforceUsage( + !(m_data && (m_importPaths || m_stringImportPaths)), + "--data may not be used together with --import-paths or --string-import-paths." + ); + // disable all log output and use "writeln" to output the JSON description auto ll = getLogLevel(); setLogLevel(LogLevel.none); @@ -807,9 +829,11 @@ auto config = m_buildConfig.length ? m_buildConfig : m_defaultConfig; if (m_importPaths) { - dub.listImportPaths(m_buildPlatform, config); + dub.listImportPaths(m_buildPlatform, config, m_buildType); } else if (m_stringImportPaths) { - dub.listStringImportPaths(m_buildPlatform, config); + dub.listStringImportPaths(m_buildPlatform, config, m_buildType); + } else if (m_data) { + dub.listProjectData(m_buildPlatform, config, m_buildType, m_data); } else { auto desc = dub.project.describe(m_buildPlatform, config, m_buildType); writeln(desc.serializeToPrettyJson()); diff --git a/source/dub/description.d b/source/dub/description.d index ea8cc10..22ec530 100644 --- a/source/dub/description.d +++ b/source/dub/description.d @@ -28,6 +28,7 @@ string[] platform; PackageDescription[] packages; /// All packages in the dependency tree TargetDescription[] targets; /// Build targets + @ignore TargetDescription[string] targetLookup; /// Targets by name } diff --git a/source/dub/dub.d b/source/dub/dub.d index b0f211a..7b7d810 100644 --- a/source/dub/dub.d +++ b/source/dub/dub.d @@ -421,24 +421,33 @@ writeln(desc.serializeToPrettyJson()); } - void listImportPaths(BuildPlatform platform, string config) + void listImportPaths(BuildPlatform platform, string config, string buildType) { import std.stdio; - foreach(path; m_project.listImportPaths(platform, config)) { + foreach(path; m_project.listImportPaths(platform, config, buildType)) { writeln(path); } } - void listStringImportPaths(BuildPlatform platform, string config) + void listStringImportPaths(BuildPlatform platform, string config, string buildType) { import std.stdio; - foreach(path; m_project.listStringImportPaths(platform, config)) { + foreach(path; m_project.listStringImportPaths(platform, config, buildType)) { writeln(path); } } + void listProjectData(BuildPlatform platform, string config, string buildType, string[] requestedData) + { + import std.stdio; + + foreach(data; m_project.listBuildSettings(platform, config, buildType, requestedData)) { + writeln(data); + } + } + /// Cleans intermediate/cache files of the given package void cleanPackage(Path path) { diff --git a/source/dub/generators/targetdescription.d b/source/dub/generators/targetdescription.d index 5010952..ad54a29 100644 --- a/source/dub/generators/targetdescription.d +++ b/source/dub/generators/targetdescription.d @@ -13,6 +13,7 @@ class TargetDescriptionGenerator : ProjectGenerator { TargetDescription[] targetDescriptions; + TargetDescription[string] targetDescriptionLookup; this(Project project) { @@ -21,6 +22,7 @@ protected override void generateTargets(GeneratorSettings settings, in TargetInfo[string] targets) { + auto configs = m_project.getPackageConfigs(settings.platform, settings.config); targetDescriptions.length = targets.length; size_t i = 0; foreach (t; targets) { @@ -31,6 +33,8 @@ d.buildSettings = t.buildSettings.dup; d.dependencies = t.dependencies.dup; d.linkDependencies = t.linkDependencies.dup; + + targetDescriptionLookup[d.rootPackage] = d; targetDescriptions[i++] = d; } } diff --git a/source/dub/internal/utils.d b/source/dub/internal/utils.d index d0cd482..9692d9a 100644 --- a/source/dub/internal/utils.d +++ b/source/dub/internal/utils.d @@ -21,6 +21,7 @@ import std.file; import std.process; import std.string; +import std.traits : isIntegral; import std.typecons; import std.zip; version(DubUseCurl) import std.net.curl; @@ -269,3 +270,33 @@ return strings.partition3!((a, b) => a.length + threshold < b.length)(input)[1] .schwartzSort!(p => levenshteinDistance(input.toUpper, p.toUpper)); } + +/** + If T is a bitfield-style enum, this function returns a string range + listing the names of all members included in the given value. + + Example: + --------- + enum Bits { + none = 0, + a = 1<<0, + b = 1<<1, + c = 1<<2, + a_c = a | c, + } + + assert( bitFieldNames(Bits.none).equals(["none"]) ); + assert( bitFieldNames(Bits.a).equals(["a"]) ); + assert( bitFieldNames(Bits.a_c).equals(["a", "c", "a_c"]) ); + --------- + */ +auto bitFieldNames(T)(T value) if(is(T==enum) && isIntegral!T) +{ + import std.algorithm : filter, map; + import std.conv : to; + import std.traits : EnumMembers; + + return [ EnumMembers!(T) ] + .filter!(member => member==0? value==0 : (value & member) == member) + .map!(member => to!string(member)); +} diff --git a/source/dub/package_.d b/source/dub/package_.d index 5af1912..9e88c2d 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -364,14 +364,14 @@ /** Returns a description of the package for use in IDEs or build tools. */ PackageDescription describe(BuildPlatform platform, string config) - { + const { PackageDescription ret; ret.path = m_path.toNativeString(); ret.name = this.name; ret.version_ = this.ver; ret.description = m_info.description; ret.homepage = m_info.homepage; - ret.authors = m_info.authors; + ret.authors = m_info.authors.dup; ret.copyright = m_info.copyright; ret.license = m_info.license; ret.dependencies = getDependencies(config).keys; diff --git a/source/dub/project.d b/source/dub/project.d index 058cf99..415bb9f 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -603,6 +603,7 @@ try { gen.generate(settings); ret.targets = gen.targetDescriptions; + ret.targetLookup = gen.targetDescriptionLookup; } catch (Exception e) { logDiagnostic("Skipping targets description: %s", e.msg); logDebug("Full error: %s", e.toString().sanitize); @@ -619,45 +620,180 @@ dst[key] = value; } - private string[] listPaths(string attributeName)(BuildPlatform platform, string config) + private string[] listBuildSetting(string attributeName)(BuildPlatform platform, string config, ProjectDescription projectDescription) + { + return listBuildSetting!attributeName(platform, getPackageConfigs(platform, config), projectDescription); + } + + private string[] listBuildSetting(string attributeName)(BuildPlatform platform, string[string] configs, ProjectDescription projectDescription) { import std.path : buildPath, dirSeparator; - - auto configs = getPackageConfigs(platform, config); + import std.range : only; string[] list; + + auto targetDescription = projectDescription.targetLookup[projectDescription.rootPackage]; + auto buildSettings = targetDescription.buildSettings; + + // Return any BuildSetting member attributeName as a range of strings. Don't attempt to fixup values. + // allowEmptyString: When the value is a string (as opposed to string[]), + // is empty string an actual permitted value instead of + // a missing value? + auto getRawBuildSetting(Package pack, bool allowEmptyString) { + auto value = __traits(getMember, buildSettings, attributeName); + + static if( is(typeof(value) == string[]) ) + return value; + else static if( is(typeof(value) == string) ) + { + auto ret = only(value); - auto fullPackagePaths(Package pack) { - // Return full paths for the import paths, making sure a - // directory separator is on the end of each path. - return __traits(getMember, pack.getBuildSettings(platform, configs[pack.name]), attributeName) - .map!(importPath => buildPath(pack.path.toString(), importPath)) - .map!(path => path.endsWith(dirSeparator) ? path : path ~ dirSeparator); - } + // only() has a different return type from only(value), so we + // have to empty the range rather than just returning only(). + if(value.empty && !allowEmptyString) { + ret.popFront(); + assert(ret.empty); + } - foreach(path; fullPackagePaths(m_rootPackage)) { - list ~= path; - } - - foreach (dep; m_dependencies) { - foreach(path; fullPackagePaths(dep)) { - list ~= path; + return ret; } + else static if( is(typeof(value) == enum) ) + return only(value); + else static if( is(typeof(value) == BuildRequirements) ) + return only(cast(BuildRequirement) cast(int) value.values); + else static if( is(typeof(value) == BuildOptions) ) + return only(cast(BuildOption) cast(int) value.values); + else + static assert(false, "Type of BuildSettings."~attributeName~" is unsupported."); + } + + // Adjust BuildSetting member attributeName as needed. + // Returns a range of strings. + auto getFixedBuildSetting(Package pack) { + // Is relative path(s) to a directory? + enum isRelativeDirectory = + attributeName == "importPaths" || attributeName == "stringImportPaths" || + attributeName == "targetPath" || attributeName == "workingDirectory"; + + // Is relative path(s) to a file? + enum isRelativeFile = + attributeName == "sourceFiles" || attributeName == "importFiles" || + attributeName == "stringImportFiles" || attributeName == "copyFiles" || + attributeName == "mainSourceFile"; + + // For these, empty string means "main project directory", not "missing value" + enum allowEmptyString = + attributeName == "targetPath" || attributeName == "workingDirectory"; + + enum isEnumBitfield = + attributeName == "targetType" || attributeName == "requirements" || + attributeName == "options"; + + auto values = getRawBuildSetting(pack, allowEmptyString); + auto fixRelativePath = (string importPath) => buildPath(pack.path.toString(), importPath); + auto ensureTrailingSlash = (string path) => path.endsWith(dirSeparator) ? path : path ~ dirSeparator; + + static if(isRelativeDirectory) { + // Return full paths for the paths, making sure a + // directory separator is on the end of each path. + return values.map!(fixRelativePath).map!(ensureTrailingSlash); + } + else static if(isRelativeFile) { + // Return full paths. + return values.map!(fixRelativePath); + } + else static if(isEnumBitfield) + return bitFieldNames(values.front); + else + return values; + } + + foreach(value; getFixedBuildSetting(m_rootPackage)) { + list ~= value; } return list; } - /// Outputs the import paths for the project, including its dependencies. - string [] listImportPaths(BuildPlatform platform, string config) + private string[] listBuildSetting(BuildPlatform platform, string[string] configs, ProjectDescription projectDescription, string requestedData) { - return listPaths!"importPaths"(platform, config); + switch(requestedData) + { + case "target-type": return listBuildSetting!"targetType"(platform, configs, projectDescription); + case "target-path": return listBuildSetting!"targetPath"(platform, configs, projectDescription); + case "target-name": return listBuildSetting!"targetName"(platform, configs, projectDescription); + case "working-directory": return listBuildSetting!"workingDirectory"(platform, configs, projectDescription); + case "main-source-file": return listBuildSetting!"mainSourceFile"(platform, configs, projectDescription); + case "dflags": return listBuildSetting!"dflags"(platform, configs, projectDescription); + case "lflags": return listBuildSetting!"lflags"(platform, configs, projectDescription); + case "libs": return listBuildSetting!"libs"(platform, configs, projectDescription); + case "source-files": return listBuildSetting!"sourceFiles"(platform, configs, projectDescription); + case "copy-files": return listBuildSetting!"copyFiles"(platform, configs, projectDescription); + case "versions": return listBuildSetting!"versions"(platform, configs, projectDescription); + case "debug-versions": return listBuildSetting!"debugVersions"(platform, configs, projectDescription); + case "import-paths": return listBuildSetting!"importPaths"(platform, configs, projectDescription); + case "string-import-paths": return listBuildSetting!"stringImportPaths"(platform, configs, projectDescription); + case "import-files": return listBuildSetting!"importFiles"(platform, configs, projectDescription); + case "string-import-files": return listBuildSetting!"stringImportFiles"(platform, configs, projectDescription); + case "pre-generate-commands": return listBuildSetting!"preGenerateCommands"(platform, configs, projectDescription); + case "post-generate-commands": return listBuildSetting!"postGenerateCommands"(platform, configs, projectDescription); + case "pre-build-commands": return listBuildSetting!"preBuildCommands"(platform, configs, projectDescription); + case "post-build-commands": return listBuildSetting!"postBuildCommands"(platform, configs, projectDescription); + case "requirements": return listBuildSetting!"requirements"(platform, configs, projectDescription); + case "options": return listBuildSetting!"options"(platform, configs, projectDescription); + + default: + enforce(false, "--data="~requestedData~ + " is not a valid option. See 'dub describe --help' for accepted --data= values."); + } + + assert(0); + } + + /// Outputs requested data for the project, optionally including its dependencies. + string[] listBuildSettings(BuildPlatform platform, string config, string buildType, string[] requestedData) + { + auto projectDescription = describe(platform, config, buildType); + auto configs = getPackageConfigs(platform, config); + + // Include link dependencies + auto target = projectDescription.targetLookup[projectDescription.rootPackage]; + auto bs = target.buildSettings; + foreach (ldep; target.linkDependencies) { + auto dbs = projectDescription.targetLookup[ldep].buildSettings; + if (bs.targetType != TargetType.staticLibrary) { + bs.addLibs((Path(dbs.targetPath) ~ getTargetFileName(dbs, platform)).toNativeString()); + } + } + target.buildSettings = bs; + + // Update projectDescription.targets + projectDescription.targetLookup[projectDescription.rootPackage] = target; + foreach (ref t; projectDescription.targets) { + if(t.rootPackage == target.rootPackage) { + t = target; + break; + } + } + + return requestedData + .map!(dataName => listBuildSetting(platform, configs, projectDescription, dataName)) + .joiner([""]) // Blank line between each type of requestedData + .array(); + } + + /// Outputs the import paths for the project, including its dependencies. + string[] listImportPaths(BuildPlatform platform, string config, string buildType) + { + auto projectDescription = describe(platform, config, buildType); + return listBuildSetting!"importPaths"(platform, config, projectDescription); } /// Outputs the string import paths for the project, including its dependencies. - string[] listStringImportPaths(BuildPlatform platform, string config) + string[] listStringImportPaths(BuildPlatform platform, string config, string buildType) { - return listPaths!"stringImportPaths"(platform, config); + auto projectDescription = describe(platform, config, buildType); + return listBuildSetting!"stringImportPaths"(platform, config, projectDescription); } void saveSelections() diff --git a/test/4-describe-data.sh b/test/4-describe-data.sh new file mode 100755 index 0000000..bdf5560 --- /dev/null +++ b/test/4-describe-data.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +set -e -o pipefail + +cd "$CURR_DIR"/describe-project + +temp_file=`mktemp` + +function cleanup { + rm $temp_file +} + +trap cleanup EXIT + +if ! $DUB describe --compiler=$COMPILER \ + --data=target-type \ + --data=target-path \ + --data=target-name \ + --data=working-directory \ + --data=main-source-file \ + --data=dflags \ + --data=lflags \ + --data=libs \ + --data=source-files \ + --data=copy-files \ + --data=versions \ + --data=debug-versions \ + --data=import-paths \ + --data=string-import-paths \ + --data=import-files \ + --data=string-import-files \ + --data=pre-generate-commands \ + --data=post-generate-commands \ + --data=pre-build-commands \ + --data=post-build-commands \ + --data=requirements \ + --data=options \ + > "$temp_file"; then + die 'Printing project data failed!' +fi + +# Create the expected output path file to compare against. +expected_file="$CURR_DIR/expected-describe-data-output" +# --data=target-type +echo "executable" > "$expected_file" +echo >> "$expected_file" +# --data=target-path +echo "$CURR_DIR/describe-project/" >> "$expected_file" +echo >> "$expected_file" +# --data=target-name +echo "describe-project" >> "$expected_file" +echo >> "$expected_file" +# --data=working-directory +echo "$CURR_DIR/describe-project/" >> "$expected_file" +echo >> "$expected_file" +# --data=main-source-file +echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file" +echo >> "$expected_file" +# --data=dflags +echo "--some-dflag" >> "$expected_file" +echo "--another-dflag" >> "$expected_file" +echo >> "$expected_file" +# --data=lflags +echo "--some-lflag" >> "$expected_file" +echo "--another-lflag" >> "$expected_file" +echo >> "$expected_file" +# --data=libs +echo "ssl" >> "$expected_file" +echo "curl" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-3/libdescribe-dependency-3.a" >> "$expected_file" +echo >> "$expected_file" +# --data=source-files +echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-1/source/dummy.d" >> "$expected_file" +echo >> "$expected_file" +# --data=copy-files +echo "$CURR_DIR/describe-project/data/dummy.dat" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-1/data/*" >> "$expected_file" +echo >> "$expected_file" +# --data=versions +echo "someVerIdent" >> "$expected_file" +echo "anotherVerIdent" >> "$expected_file" +echo "Have_describe_project" >> "$expected_file" +echo "Have_describe_dependency_1" >> "$expected_file" +echo "Have_describe_dependency_2" >> "$expected_file" +echo "Have_describe_dependency_3" >> "$expected_file" +echo >> "$expected_file" +# --data=debug-versions +echo "someDebugVerIdent" >> "$expected_file" +echo "anotherDebugVerIdent" >> "$expected_file" +echo >> "$expected_file" +# --data=import-paths +echo "$CURR_DIR/describe-project/src/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-1/source/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-2/some-path/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-3/dep3-source/" >> "$expected_file" +echo >> "$expected_file" +# --data=string-import-paths +echo "$CURR_DIR/describe-project/views/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-3/dep3-string-import-path/" >> "$expected_file" +echo >> "$expected_file" +# --data=import-files +echo "$CURR_DIR/describe-dependency-2/some-path/dummy.d" >> "$expected_file" +echo >> "$expected_file" +# --data=string-import-files +echo "$CURR_DIR/describe-project/views/dummy.d" >> "$expected_file" +#echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/dummy.d" >> "$expected_file" # This is missing from result, is that a bug? +echo >> "$expected_file" +# --data=pre-generate-commands +echo "./do-preGenerateCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-preGenerateCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=post-generate-commands +echo "./do-postGenerateCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-postGenerateCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=pre-build-commands +echo "./do-preBuildCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-preBuildCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=post-build-commands +echo "./do-postBuildCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-postBuildCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=requirements +echo "allowWarnings" >> "$expected_file" +echo "disallowInlining" >> "$expected_file" +#echo "requireContracts" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result +echo >> "$expected_file" +# --data=options +echo "debugMode" >> "$expected_file" +echo "releaseMode" >> "$expected_file" +echo "debugInfo" >> "$expected_file" +echo "warnings" >> "$expected_file" +#echo "stackStomping" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result + +if ! diff "$expected_file" "$temp_file"; then + die 'The project data did not match the expected output!' +fi + diff --git a/test/4-describe-import-paths.sh b/test/4-describe-import-paths.sh index b896daf..acbf736 100755 --- a/test/4-describe-import-paths.sh +++ b/test/4-describe-import-paths.sh @@ -20,6 +20,7 @@ echo "$CURR_DIR/describe-project/src/" > "$CURR_DIR/expected-import-path-output" echo "$CURR_DIR/describe-dependency-1/source/" >> "$CURR_DIR/expected-import-path-output" echo "$CURR_DIR/describe-dependency-2/some-path/" >> "$CURR_DIR/expected-import-path-output" +echo "$CURR_DIR/describe-dependency-3/dep3-source/" >> "$CURR_DIR/expected-import-path-output" if ! diff "$CURR_DIR"/expected-import-path-output "$temp_file"; then die 'The import paths did not match the expected output!' diff --git a/test/4-describe-string-importh-paths.sh b/test/4-describe-string-importh-paths.sh index 790af85..c2a3f23 100755 --- a/test/4-describe-string-importh-paths.sh +++ b/test/4-describe-string-importh-paths.sh @@ -19,6 +19,7 @@ # Create the expected output path file to compare against. echo "$CURR_DIR/describe-project/views/" > "$CURR_DIR/expected-string-import-path-output" echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/" >> "$CURR_DIR/expected-string-import-path-output" +echo "$CURR_DIR/describe-dependency-3/dep3-string-import-path/" >> "$CURR_DIR/expected-string-import-path-output" if ! diff "$CURR_DIR"/expected-string-import-path-output "$temp_file"; then die 'The string import paths did not match the expected output!' diff --git a/test/describe-dependency-1/data/dummy-dep1.dat b/test/describe-dependency-1/data/dummy-dep1.dat new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/test/describe-dependency-1/data/dummy-dep1.dat @@ -0,0 +1 @@ + diff --git a/test/describe-dependency-1/dependency-postGenerateCommands.sh b/test/describe-dependency-1/dependency-postGenerateCommands.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/test/describe-dependency-1/dependency-postGenerateCommands.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/test/describe-dependency-1/dependency-preGenerateCommands.sh b/test/describe-dependency-1/dependency-preGenerateCommands.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/test/describe-dependency-1/dependency-preGenerateCommands.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/test/describe-dependency-1/dub.json b/test/describe-dependency-1/dub.json index 236897d..93acf76 100644 --- a/test/describe-dependency-1/dub.json +++ b/test/describe-dependency-1/dub.json @@ -6,9 +6,21 @@ "homepage": "fake.com", "license": "BSD 2-clause", "copyright": "Copyright © 2015, nobody", - "configurations": [ - { - "name": "my-dependency-1-config" - } - ], + "dflags": ["--another-dflag"], + "lflags": ["--another-lflag"], + "libs": ["curl"], + "copyFiles": ["data/*"], + "versions": ["anotherVerIdent"], + "debugVersions": ["anotherDebugVerIdent"], + "preGenerateCommands": ["../describe-dependency-1/dependency-preGenerateCommands.sh"], + "postGenerateCommands": ["../describe-dependency-1/dependency-postGenerateCommands.sh"], + "preBuildCommands": ["../describe-dependency-1/dependency-preBuildCommands.sh"], + "postBuildCommands": ["../describe-dependency-1/dependency-postBuildCommands.sh"], + "buildRequirements": ["requireContracts"], + "buildOptions": ["stackStomping"], + "configurations": [ + { + "name": "my-dependency-1-config" + } + ], } diff --git a/test/describe-dependency-3/.no_build b/test/describe-dependency-3/.no_build new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/test/describe-dependency-3/.no_build @@ -0,0 +1 @@ + diff --git a/test/describe-dependency-3/dep3-source/dummy.d b/test/describe-dependency-3/dep3-source/dummy.d new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/test/describe-dependency-3/dep3-source/dummy.d @@ -0,0 +1 @@ + diff --git a/test/describe-dependency-3/dep3-string-import-path/dummy.d b/test/describe-dependency-3/dep3-string-import-path/dummy.d new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/test/describe-dependency-3/dep3-string-import-path/dummy.d @@ -0,0 +1 @@ + diff --git a/test/describe-dependency-3/dub.json b/test/describe-dependency-3/dub.json new file mode 100644 index 0000000..40f6991 --- /dev/null +++ b/test/describe-dependency-3/dub.json @@ -0,0 +1,13 @@ +{ + "name": "describe-dependency-3", + "targetType": "staticLibrary", + "description": "A test describe project", + "authors": ["nobody"], + "homepage": "fake.com", + "license": "BSD 2-clause", + "copyright": "Copyright © 2015, nobody", + "importPaths": ["dep3-source"], + "sourcePaths": ["dep3-source"], + "stringImportPaths": ["dep3-string-import-path"], + "buildOptions": ["profile"] +} diff --git a/test/describe-project/data/dummy.dat b/test/describe-project/data/dummy.dat new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/test/describe-project/data/dummy.dat @@ -0,0 +1 @@ + diff --git a/test/describe-project/do-postGenerateCommands.sh b/test/describe-project/do-postGenerateCommands.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/test/describe-project/do-postGenerateCommands.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/test/describe-project/do-preGenerateCommands.sh b/test/describe-project/do-preGenerateCommands.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/test/describe-project/do-preGenerateCommands.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/test/describe-project/dub.json b/test/describe-project/dub.json index 21b163f..655058f 100644 --- a/test/describe-project/dub.json +++ b/test/describe-project/dub.json @@ -1,11 +1,24 @@ { "name": "describe-project", - "targetType": "sourceLibrary", + "targetType": "executable", "description": "A test describe project", "authors": ["nobody"], "homepage": "fake.com", "license": "BSD 2-clause", "copyright": "Copyright © 2015, nobody", + "mainSourceFile": "src/dummy.d", + "dflags": ["--some-dflag"], + "lflags": ["--some-lflag"], + "libs": ["ssl"], + "copyFiles": ["data/dummy.dat"], + "versions": ["someVerIdent"], + "debugVersions": ["someDebugVerIdent"], + "preGenerateCommands": ["./do-preGenerateCommands.sh"], + "postGenerateCommands": ["./do-postGenerateCommands.sh"], + "preBuildCommands": ["./do-preBuildCommands.sh"], + "postBuildCommands": ["./do-postBuildCommands.sh"], + "buildRequirements": ["allowWarnings", "disallowInlining"], + "buildOptions": ["releaseMode", "debugInfo"], "dependencies": { "describe-dependency-1": { "version": "1.0", @@ -14,14 +27,18 @@ "describe-dependency-2": { "version": "1.0", "path": "../describe-dependency-2" + }, + "describe-dependency-3": { + "version": "1.0", + "path": "../describe-dependency-3" } }, - "configurations": [ - { - "name": "my-project-config" - } - ], - "subConfigurations": { - "describe-dependency-1": "my-dependency-1-config" - }, + "configurations": [ + { + "name": "my-project-config" + } + ], + "subConfigurations": { + "describe-dependency-1": "my-dependency-1-config" + }, }