Skip to content
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

Add the first iteration of the Zinc API 1.0 #304

Merged
merged 51 commits into from
May 26, 2017

Commits on May 21, 2017

  1. Remove deprecated compatibility stubs

    Remove unused `GlobalCompat` for compatibility with 2.8.1 and extract
    the run subclassing out of the main logic of the `run` method.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    8a86b55 View commit details
    Browse the repository at this point in the history
  2. Make Zinc Global implementations independent

    The callback implementation should be independent of the compiler
    interface and the source code should reflect so.
    
    Breaking change in comparison with the previous API: `Compiler` is now
    called `ZincCompiler` to make the naming more clear and better
    distinguish between `CachedCompiler` and its underlying `ZincCompiler`.
    
    Docs have been added and simplifications to methods have been provided
    and double checked with previous Scala versions. For instance, `dropRun`
    has been confirmed to only exist in 2.10.x series and removed in 2.11.x.
    Therefore, its implementation has been moved to the compatibility traits
    for 2.10.x series.  We then remove a reflective call for versions above
    2.10.6.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    e39dd51 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2609a34 View commit details
    Browse the repository at this point in the history
  4. Port CompileAnalysis from contraband to Java

    We need `CompileAnalysis` to start creating the Java API with good docs.
    Contraband is not necessary for the analysis since we only
    serialize/deserialize `MAnalysis`, its subclass.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    e519c08 View commit details
    Browse the repository at this point in the history
  5. Change Stamps interface and functionality

    * Make `ReadStamps` a Java interface exposed in the public API.
    * Create a `Stamp` interface that Java users can use without any
      knowledge of the internal requirement.
    * Add docs to the pertinent Java interface.
    * Change `Stamp` companion object by `Stamper` to make it Java-friendly.
      I also think the name is clearer about the contents of the object.
    * Rename `internalSouce` to `source` for consistency with the Scala API.
      It's made clear that source should always be an internal source in the
      docs. This makes sense anyway, otherwise it wouldn't make sense to ask
      for the stamp of a source file that is not compiled in the current
      analysis.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    ae6381c View commit details
    Browse the repository at this point in the history
  6. Remove unused stamp Exists

    `Exists` has never been used, neither internally in Zinc nor in sbt and
    pants (I double checked on both).
    
    The concept of `exists` does not make sense, since there is no value in
    asserting that a stamp "exists" only in asserting that a stamp is
    **not** available for a given file.
    
    The latter is represented by the new `Stamp` API since last modified
    time and hash are both optional. If both are empty, a stamp does not
    exist.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    8834f0b View commit details
    Browse the repository at this point in the history
  7. Turn CompileAnalysis to an interface

    `CompileAnalysis` should be an interface instead of an abstract class.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    ad5e59a View commit details
    Browse the repository at this point in the history
  8. Add ReadStamps to CompileAnalysis

    Users of `CompileAnalysis` will have access to the stamps of the files
    that have been processed by Zinc.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    529c709 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8cde423 View commit details
    Browse the repository at this point in the history
  10. Create ReadSourceInfos & add to CompileAnalysis

    `ReadSourceInfos` is a read-only interface for getting source info
    (namely, compiler errors) associated with a given file.
    
    This is very useful in lots of cases. Especially to process and improve
    error messages in a lightweight way, though ScalaClippy already exists
    for that purpose.
    
    In any case, having access to the compiler errors outside of is of
    ultimate importance for tools that want to preprocess compilation
    results independently of sbt.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    1d5da03 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    df4d222 View commit details
    Browse the repository at this point in the history
  12. Replace OutputSetting by OutputGroup

    `OutputSetting` is like `OutputGroup` by just returns strings instead of
    files. I see no reason why `OutputGroup` should not be used instead,
    therefore simplifying the Zinc API and allowing users to have access to
    files and not mere strings. If they want strings, they always can do
    `getAbsolutePath`.
    
    N.B. This is good for machine independence.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    1f2d12c View commit details
    Browse the repository at this point in the history
  13. Fix Output and Compilation API

    * Remove dangerous use of output groups as fields in compilation. In the
      case of `SingleOutput`, the source directory was invented and
      incorrect (the root). Users of the API processing this file could
      create chaos in people's computers. The new design forces consumers
      of the `Compilation` API to make up their minds and identify whether
      the compilation was used with a single output or several outputs.
      In order to do that, we return `Output` instead of an array of
      `OutputGroup`.
    * Rename `outputDirectory` and `sourceDirectory` to be Java friendly.
    * Augment `Output` interface with Java-friendly methods. Scala users
      can use pattern matching instead.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    761ea0e View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    73ff81a View commit details
    Browse the repository at this point in the history
  15. Make the Output API more Java friendly

    * Make methods in `Output` subclasses public
    * Changes to the API. Java idiomatic renames:
      * sourceDirectory -> getSourceDirectory
      * outputDirectory -> getOutputDirectory
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    df6f5a4 View commit details
    Browse the repository at this point in the history
  16. Add ReadCompilations to CompileAnalysis

    * `Compilation` has been ported to Java code and documented.
    * `ReadCompilations` is a read-only API of `Compilations`.
    * Add a TODO to check the ordering of the array of compilations.
    * Expose `ReadCompilations` to the `CompileAnalysis`.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    4850acf View commit details
    Browse the repository at this point in the history
  17. Add CompilerBridgeProvider interface and misc.

    * Add interface for the provider.
    * Rename `IvyComponentCompiler` to `ZincComponentCompiler`.
    * Split `ZincComponentCompiler` and `ZincComponentManager`.
    * Define `IfMissing` and `InvalidComponent` into independent files.
    * Rename variables and internal API to be clearer.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    9eea8bd View commit details
    Browse the repository at this point in the history
  18. Move constant to static in CompilerBridgeProvider

    No need to have it in the internal Scala side.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    8381e29 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    d061e9e View commit details
    Browse the repository at this point in the history
  20. Rename getCompilerSources to getCompiledBridge

    Previous name was incorrect, we actually return the compiled bridge.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    4b475b1 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    b48a783 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    f1fc0d5 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    ae88038 View commit details
    Browse the repository at this point in the history
  24. Test getScalaInstance & getCompiledBridge

    * Remove unused code in `BridgeProviderSpecification` and test the real
      code in the default provider.
    * Don't use temporary directory to download the Scala jars, retrive them
      in a directory specified by the user.
    * Use `java.net.ClassLoader` instead of `ScalaClassLoader`.
    * Use the `ScalaInstance` interface, not the implementation. Remove any
      reference to the implementation.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    7903c60 View commit details
    Browse the repository at this point in the history
  25. Compile bridge for 2.12.x and other Scala versions

    This commit makes sure that we always check that we compile against the
    latest two versions in Scala 2.10, Scala 2.11 and Scala 2.12.
    
    This commit also removes the null loggers and uses normal loggers to
    check what the output of the bridge provider is. This output is
    important and the rationale to do this is that it should be visible for
    us in order to detect cases where there's a regression or the output is
    modified in some way. Output is short anyway.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    3bac784 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    182aec7 View commit details
    Browse the repository at this point in the history
  27. Add Java API for Zinc Ivy integration

    * Adds a method to fetch the default implementation of the compiler
      provider.
    * Adds a method to get a default `IvyConfiguration` from a small number
      of parameters.
    
    The public API is implemented in Java to ensure binary compatibility no
    matter what happens to the internal Scala implementations. It also makes
    it easier for Java users to use the API and avoid importing MODULE$'s
    and Scala generated class files.'
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    55583d7 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    b1eac04 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    0bf12de View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    af702ae View commit details
    Browse the repository at this point in the history
  31. Add public method to get default component provider

    Expose default component provider through a static method in
    `ZincCompilerBridge`. This method is necessary to invoke the bridge.
    
    Removes the previous global lock and component provider implementations
    in `BridgeProviderSpecification`.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    6391ae7 View commit details
    Browse the repository at this point in the history
  32. Remove the use of BaseIvySpecification

    This is the proof that we're now testing the Zinc public API because
    we're resolving with the ivy options and resolution specified in the
    default compiler bridge provider.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    436a985 View commit details
    Browse the repository at this point in the history
  33. Move IncOptionsUtil to zincCore project

    It does not make sense to define it in the compiler interface since the
    default implementations of class file manager and some inc options are
    defined in `zincCore`.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    4452126 View commit details
    Browse the repository at this point in the history
  34. Format IncOptionsUtil

    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    14d37d8 View commit details
    Browse the repository at this point in the history
  35. Fix fromStringMap for classfile manager key

    Previously, classfile manager key was not read from
    `incOptions.properties` files because there was no way to specify which
    classfile manager should be chosen.
    
    Now, the class file manager can be indeed chosen. As we cannot serialize
    the logger that should be used for the transactional classfile manager
    type, we reuse the one passed in at the time of reading the incremental
    options values.
    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    5590cc5 View commit details
    Browse the repository at this point in the history
  36. Add docs to IncToolOptionsUtil

    jvican committed May 21, 2017
    Configuration menu
    Copy the full SHA
    9c53bf0 View commit details
    Browse the repository at this point in the history
  37. Configuration menu
    Copy the full SHA
    686b6bb View commit details
    Browse the repository at this point in the history

Commits on May 22, 2017

  1. Make the equiv for stamp public

    This is necessary for other users to implement external hooks and
    reason about which files have been changed and which have not.
    
    Java users can access it with:
    
    ```
    sbt.internal.inc.Stamp$.MODULE$.equivStamp
    ```
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    d13928f View commit details
    Browse the repository at this point in the history
  2. Add interface for external Lookup

    * Move `JavaInterfaceUtil` to zincCore.
    * Define `Changes` in `compilerInterface`.
    * Define a `Lookup` interface.
      Note that this lookup interface can now be implemented by third
      parties because the stamps of the files are provided by the
      `CompileAnalysis` interface.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    f984ed9 View commit details
    Browse the repository at this point in the history
  3. Replace null by Optional in ExternalHooks

    For God's sake, no nulls.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    bd23a51 View commit details
    Browse the repository at this point in the history
  4. Fix sbt#125: Get default classfile manager for inc

    Previously, there was no way to get the underlying classfile manager
    without depending on internal implementation details (sbt.internal.inc).
    
    This problem is described in this issue: sbt#125.
    That is a blocker for scalajs.
    
    * Add `ClassFileManagerUtil` static methods to get access to the
      underlying class file manager implementation from both the key and the
      incremental options.
    * Add docs to subclasses of `ClassFileManagerType` and the
      implementations.
    * Remove closures for getting the `deleteImmediately` and
      `transactional` class file manager implementations.
    * Extract implementation from anonymous classes, make them final and
      private.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    e6eb0b0 View commit details
    Browse the repository at this point in the history
  5. Remove deprecated transactional

    In sbt 0.13.x series, there exist a transactional classfile manager that
    did not have any logger on which to log its steps.
    
    As this is not used anymore, and a classfile manager should always log
    them, we remove this from the internal API.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    f49e945 View commit details
    Browse the repository at this point in the history
  6. Remove allInternalSrcDeps from Relations

    It's safe to remove this deprecated method in M1 because it's part of
    the private API (sbt.internal.inc).
    
    This method has been deprecated and removed because class-based
    dependency tracking does not need to know about internal source
    dependencies anymore (in fact, this is not a useful concept for
    class-based dependency tracking).
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    7ee4c9d View commit details
    Browse the repository at this point in the history
  7. Add ZincCompilerUtil to get the Scalac compiler

    * Move `IncrementalCompilerUtil` to `ZincCompilerUtil`.
    * Change `IncrementalCompilerUtil` to an interface with static methods.
    * Remove bug in which ScalaInstance implementation was leaking to the
      public API.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    d1a4627 View commit details
    Browse the repository at this point in the history
  8. Hide Zinc Compilation implementation

    Before, we had made this public in `sbt.inc`, but this is not necessary
    anymore.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    f98c221 View commit details
    Browse the repository at this point in the history
  9. Move formats away from public API

    Formats for `AnalyzedClass`, `Compilation` and `Companions` were in the
    public API (xsbti.api)! They have been removed from there.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    d00234d View commit details
    Browse the repository at this point in the history
  10. Move ZincBridgeProvider to xsbti.compile

    Before, we were using `sbt.inc`. As we have settled to define all the
    interfaces in the `xsbti.compile` namespaces, it's not worth it to force
    users remember other locations for the interfaces forwarding the default
    implementations in Scala.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    df5915f View commit details
    Browse the repository at this point in the history
  11. Move ClasspathOptionsUtil to the Java public API

    Move the previous Scala implementation to Java as static methods.
    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    3c846ad View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    a4f877e View commit details
    Browse the repository at this point in the history
  13. Make CompilerCache public

    jvican committed May 22, 2017
    Configuration menu
    Copy the full SHA
    293c400 View commit details
    Browse the repository at this point in the history

Commits on May 26, 2017

  1. Rename getXXX by fetchXXX

    As suggested by Eugene.
    jvican committed May 26, 2017
    Configuration menu
    Copy the full SHA
    e6cbee2 View commit details
    Browse the repository at this point in the history