Revision 725985528f77ba939a5cddc71e5006fee7638465 authored by Tim Foley on 29 October 2018, 21:44:39 UTC, committed by GitHub on 29 October 2018, 21:44:39 UTC
* Rework command-line options handling for entry points and targets

Overview:

* The biggest functionality change is that the implicit ordering constraints when multiple `-entry` options are reversed: any `-stage` option affects the `-entry` to its *left* instead of to its *right* as it used to. This is technically a breaking change, but I expect most users aren't using this feature.

* The options parsing tries to handle profile versions and stages as distinct data (rather than using the combined `Profile` type all over), and treats a `-profile` option that specifies both a profile version and a stage (e.g., `-profile ps_5_0`) as if it were sugar for both a `-profile` and a `-stage` (e.g., `-profile sm_5_0 -stage fragment`).

* We now technically handle multiple `-target` options in one invocation of `-slangc`, but do not advertise that fact in the documentation because it might be confusing for users. Similar to the relationship between `-stage` and `-entry`, any `-profile` option affects the most recent `-target` option unless there is only one `-target`.

* The logic for associating `-o` options with corresponding entry points and targets has been beefed up. The rule is that a `-o` option for a compiled kernel binds to the entry point to its left, unless there is only one entry point (just like for `-stage`). The associated target for a `-o` option is found via a search, however, because otherwise it would be impossible to specify `-o` options for both SPIR-V and DXIL in one pass.

* The handling of output paths for entry points in the internal compiler structures was changed, because previously it could only handle one output path per entry point (even when there are multiple targets). The new logic builds up a per-target mapping from an entry point to its desired output path (if any).

Details:

* Support for formatting profile versions, stages, and compile targets (formats) was added to diagnostic printing, so that we can make better error messages. This is fairly ad hoc, and it would be nice to have all of the string<->enum stuff be more data-driven throughout the codebase.

* Test cases were added for (almost) all of the error conditions in the current options validation. The main one that is missing is around specifying an `-entry` option before any source file when compiling multiple files. This is because the test runner is putting the source file name first on the command line automatically, so we can't reproduce that case.

* Several reflection-related tests now reflect entry points where they didn't before, because the logic for detecting when to infer a default `main` entry point have been made more loose

* On the dxc path, beefed up the handling of mapping from Slang `Profile`s to the coresponding string to use when invoking dxc.

* A bunch of tests cases were in violation of the newly imposed rules, so those needed to be cleaned up.

* There were also a bunch of test cases that had accidentally gotten "disabled" at some point because there were comparing output from `slangc` both with and without a `-pass-through` option, but that meant that any errors in command-line parsing produced the *same* error output in both the Slang and pass-through cases. This change updates `slang-test` to always expect a successful run for these tests, and then manually updates or disables the various test cases that are affected.

* When merging the updated test for matrix layout mode, I found that the new command-line logic was failing to propagate a matrix layout mode passed to `render-test` into the compiler. This was because the `-matrix-layout*` options were implemented as per-target, but the target was being set by API while the option came in via command line (passed through the API). It seems like we want matrix layout mode to be a global option anyway (rather than per-target), so I made that change here.

* Add missing expected output files

* A 64-bit fix

* Remove commented-out code noted in review
1 parent 56c9de0
Raw File
appveyor.yml
# Our solution file is currently set up for VS2015
image: Visual Studio 2015

init:
  # Construct a version number suitable for using as a release name
  - ps: >-
      if ($env:APPVEYOR_REPO_TAG -eq "true")
      {
        $env:SLANG_VERSION = "$($env:APPVEYOR_REPO_TAG_NAME.TrimStart("v"))"
      }
      else
      {
        $env:SLANG_VERSION = "dev-$($env:APPVEYOR_REPO_COMMIT.Substring(0, 7))"
      }

# The project uses a submodule for the "glslang" dependency,
# so we need to make sure to pull that before building.
install:
  - git submodule update --init --recursive

# We want to build the full matrix of platforms and configurations
# that we support on Windows.
#
# Put Release|x64 first since that is the target which runs the most tests.
platform:
  - x64
  - Win32

configuration:
  - Release
  - Debug

# In the interests of time, go ahead and immediately fail a build
# if any job fails, rather than keep on building to discover the
# full set of failures.
matrix:
  fast_finish: true

# MSBUILD should ideally be able to find our solution file
# automatically, but it seems to get confused, so we specify
# the file name to use here.
build:
  project: slang.sln
  parallel: true
  verbosity: minimal

# Testing

# We only run tests on the Release build for now, just to speed
# up the build process.
#
# TODO: We should really define different levels of tests, and
# at least run some "smoke" tests across all builds.

test_script:
  - ps: |
      if ($env:CONFIGURATION -eq "Debug")
      {
        $testCategory = "smoke"
      }
      elseif($env:PLATFORM -eq "x64")
      {
        $testCategory = "full"
      }
      else
      {
        $testCategory = "quick"
      }
      .\test.bat -platform %PLATFORM% -configuration %CONFIGURATION% -appveyor -category $testCategory

# Package up the stuff we want to deploy into a single .zip file

after_build:
  - ps: |
      if ($env:PLATFORM -eq "x64")
      {
        $env:SLANG_DEPLOY_PLATFORM = "win64"
      }
      else
      {
        $env:SLANG_DEPLOY_PLATFORM = "win32"
      }
      $env:SLANG_BINARY_ARCHIVE = "slang-$($env:SLANG_VERSION)-$($env:SLANG_DEPLOY_PLATFORM).zip"

      7z a "$env:SLANG_BINARY_ARCHIVE" slang.h
      7z a "$env:SLANG_BINARY_ARCHIVE" slang-com-helper.h
      7z a "$env:SLANG_BINARY_ARCHIVE" slang-com-ptr.h
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang.dll
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang.lib
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang-glslang.dll
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slangc.exe
      7z a "$env:SLANG_BINARY_ARCHIVE" docs\*.md

      $env:SLANG_SOURCE_ARCHIVE = "slang-$($env:SLANG_VERSION)-source.zip"
      
      7z a "$env:SLANG_SOURCE_ARCHIVE" slang.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" slang-com-helper.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" slang-com-ptr.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" source\*\*.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" source\*\*.cpp
      7z a "$env:SLANG_SOURCE_ARCHIVE" docs\*.md
      7z a "$env:SLANG_SOURCE_ARCHIVE" README.md
      7z a "$env:SLANG_SOURCE_ARCHIVE" LICENSE

# Register the created .zip file as an artifact with AppVeyor

artifacts:
  - path: $(SLANG_BINARY_ARCHIVE)
    name: binary_archive
  - path: $(SLANG_SOURCE_ARCHIVE)
    name: source_archive

# On a successful build of a tag, push archices to GitHub releases

deploy:
  release: v$(SLANG_VERSION)
  description: 'Slang $(SLANG_VERSION)'
  provider: GitHub
  auth_token:
    secure: +FukP7TA9F+fofZRZnu2FSqPcrQ1u4r8r4pl+/83owiY6M1R4ykg+8RcSzXi2f63
  artifact: 'binary_archive,source_archive'
  draft: false
  prerelease: false
  force_update: true # TODO: consider if we can avoid this
  on:
    configuration: Release
    appveyor_repo_tag: true        # deploy on tag push only
back to top