Commit Graph

7122 Commits

Author SHA1 Message Date
Victor Turansky 0d1bf66c2a KT-34468 Yarn. Star version support fix 2020-03-24 11:28:02 +03:00
Victor Turansky d494881cb9 KT-34468 Yarn. Dependency check at the beginning 2020-03-24 11:28:02 +03:00
Victor Turansky c2b3dd8b33 KT-34468 Yarn. Support dependency GitHub version 2020-03-24 11:28:02 +03:00
Sergey Igushkin ad1a1ac49a Fix failures when a common source set compiled to nothing (KT-36674)
This could happen:
* when a common source set had no sources
* when the compile task of a common source set was disabled

In those cases, there were two subsequent failures:
* the metadata JAR could not interpret the missing klib file as ZIP
* the consumer could not read the empty klib in its dependencies

Issue #KT-36674 Fixed
2020-03-24 01:48:34 +03:00
Sergey Igushkin 066d413fb8 Add a test for host-specific metadata publishing and consumption 2020-03-24 01:48:34 +03:00
Sergey Igushkin 2478a57646 Rework source sets metadata consumption
* Add `ResolvedMppVariantsProvider` that provides variant names,
  platform artifacts, and metadata artifacts for MPP dependencies

* Rework SourceSetVisibilityProvider.kt so that it uses the
  `ResolvedMppVariantsProvider` to determine which source sets should be
  read from which metadata artifacts

* Rework `GranularMetadataTransformation` and its consumers so that:

  * it uses the
    visibility result and extracts the source set metadata from the
    host-specific artifacts whenever `SourceSetsVisibilityProvider`
    yields host-specific artifacts in the visibility results

  * it uses the new Gradle API for resolutionResults / artifactView

* Rework module IDs in the code base, unify the logic of their
  construction, also fix possible false-positive visibility in
  `applyToConfiguration` that used a module ID that mismatched the
  published module ID.
2020-03-24 01:48:33 +03:00
Sergey Igushkin 33ef4452b7 Always create shared-Native metadata compilations
Create the compilations even when all of the targets that the
shared-Native source set is compiled for are disabled on the current
host. In that case, disable the compilation task

Also clear the inputs of the disabled tasks so that when Gradle builds
the task graph it doesn't resolve the dependencies.

Otherwise, a Gradle build that includes the compile tasks of the
disabled targets in the task graph would fail as follows, e.g. on a
macOS host with a project containing a mingw target):

```
Could not determine the dependencies of task ':compileKotlinMingwX86'
...
Could not resolve all task dependencies for configuration
':mingwX86CompileKlibraries'
...
Could not find com.example:my-dependency-mingwx86:1.0
...
2020-03-24 01:48:33 +03:00
Sergey Igushkin 593869aa37 Fix incorrect unchecked cast in kotlin.metadata()
It was broken once the metadata target got K/N compilations along with
K2Metadata compilations.
2020-03-24 01:48:33 +03:00
Sergey Igushkin 94e3fa2132 (minor) Extract constants for XML nodes in project structure metadata 2020-03-24 01:48:33 +03:00
Sergey Igushkin f30aada84a If a source set is host-specific, publish it within the Native modules
Consider host-specific all source sets that participate in a compilation
of a target that cannot be built on some of the hosts.

Exclude those source sets from the `-metadata` artifact since the
`metadata` target must publish in the same way from any host.

Instead, add a metadata variant to those targets which use such a source
set and pack the source set's klib into a similar metadata JAR as the
artifact of those metadata variants.
2020-03-24 01:48:32 +03:00
Ilya Gorbunov d7007044c2 Add a note about the Random(...) generators being not thread-safe 2020-03-24 01:37:03 +03:00
Ilya Goncharov e6d39ce785 [Gradle, JS] True on check exit code in mocha
#KT-37668 fixed
2020-03-23 15:36:52 +03:00
Roman Elizarov e26a3ad033 Speed up stdlib readLine function (#3185)
There are several performance optimizations:

* ByteBuffer/CharBuffer/StringBuilder objects pre-allocated and are
  reused on each call to readLine.
* The state for readLine is lazily allocated via JVM classloading
  (using a singleton object).
* There is an auto-detection heuristic for "directEOL" encodings which
  represent LF ('\n') directly as the corresponding byte
  (UTF-8 and many single-byte encodings are like that).
  When "directEOL" encoding is used, then bytes are batched into
  ByteBuffer for a single call to CharsetDecoder.decode which
  results in higher throughput. Otherwise (UTF-16, etc), slower
  byte-by-byte approach is used.
* Bytes and chars are directly moved in/out of byte/char arrays and
  ByteBuffer/CharBuffer wrappers are used only to interface with
  JVM CharsetDecoder class (which is the slowest piece).
* StringBuilder is not used at all for short lines (<=32 chars).

There are also some function improvements to readLine functionality:

* Restriction on "max chars per byte" is lifted, so readLine works with
  all encodings that JVM supports.
* It support on-the-fly changes to system default charset, because
  it rechecks current charset on each call and updates it decoder
  when needed.

All the other features of readLine function are retained:

* It does not read more bytes from System.in than needed, so it
  is compatible with other ways to read System.in. On-the-fly
  changes to System.in are supported.
* It is thread-safe. Its internal mutable state is protected by
  synchronization.
* There is an internal method for tests that supports explicit
  charset specification, but the name of this method has changed.

There are additional tests:

* Check all supported encodings on JVM to make sure that readLine
  works correctly with them all.
* Check unicode code points of different bits length with all standard
  unicode encodings (UTF-8, UTF-16, and UTF-32 in LE/HE byte orders).

Benchmarks that compare different implementations of readLine,
including this one (readLine6NoLV in the set) can be found here:
https://github.com/elizarov/ReadLineBenchmark

Taking BufferedReader as 100% baseline we see that:

* Current readLine is 7.5 times slower than BufferedReader baseline.
* New implementation in this commit is 2.5 timer slower than baseline.
  It is ~3 times faster than existing implementation of readLine.

Altogether these optimizations are enough to enable reading of
~500K lines in sports programming setting under 2s time-limit with
plenty of headroom in time. Example that is using this version of
readLine can be found here:
https://codeforces.com/contest/1322/submission/73005366

#KT-37416 Fixed
2020-03-23 14:36:55 +03:00
Nikolay Krasko 7764492761 Resolve failure with surefire on Windows agents in kotlin-java-example (KT-37654)
Remove version specification like it's done in other modules.
2020-03-20 21:14:23 +03:00
Leonid Startsev f0dc809255 Add explicit api mode flag to top-level kotlin {} DSL block in Gradle
for both MPP and single-target projects.

For now, it is only applied to source sets that are connected to 'main'
compilation. It seems fine for all projects except android ones.
There's a way to determine android variant for source set,
but importing android projects seems to be made via other code path.

 #KT-36019 Fixed
 #KT-37652 Open
2020-03-20 19:41:06 +03:00
Ilya Goncharov 59148cdce4 [Gradle, JS] Fix extracting package json from klib
#KT-37636 fixed
2020-03-20 19:18:02 +03:00
Ilya Goncharov 40a0e31be4 [Gradle, JS] Add other devtools
#KT-37635 fixed
2020-03-20 19:13:24 +03:00
Ilya Goncharov 5058c396c1 [Gradle, JS] Webpack devtool as a String
#KT-37635 fixed
2020-03-20 19:13:00 +03:00
Dmitriy Dolovov b0254a27aa Fix. Provide the proper K/N dependencies in leaf HMPP source sets
Issue #MMPP-213
2020-03-20 19:43:18 +07:00
Ilya Goncharov dd7f10e76e [Gradle, JS] Fix after rebase 2020-03-20 12:55:50 +03:00
Ilya Goncharov a07425e7b0 [Gradle, JS] Fix test 2020-03-20 12:45:29 +03:00
Ilya Goncharov f7a9afbf96 [Gradle, JS] Remove produceExecutable from tests 2020-03-20 12:45:29 +03:00
Ilya Goncharov 3a262c6eb8 [Gradle, JS] Fix build for legacy browser with binaries 2020-03-20 12:45:29 +03:00
Ilya Goncharov b25418df69 [Gradle, JS] Correct renaming 2020-03-20 12:45:29 +03:00
Ilya Goncharov 33992bdc86 [Gradle, JS] Extract common interface for JsBinary 2020-03-20 12:45:29 +03:00
Ilya Goncharov 3c83a3bd34 [Gradle, JS] Error if used binaries.executable in both compiler type 2020-03-20 12:45:28 +03:00
Ilya Goncharov cf6b76fdee [Gradle, JS] Rename BuildVariantKind on KotlinJsBinaryType 2020-03-20 12:45:28 +03:00
Ilya Goncharov 260015fe0b [Gradle, JS] Migrate from build variants on binaries 2020-03-20 12:45:27 +03:00
Ilya Goncharov e1920110a2 [Gradle, JS] Remove produceExecutable 2020-03-20 12:45:25 +03:00
Ilya Goncharov 01b44802c8 [Gradle, JS] Fix compilation after rebase 2020-03-20 12:45:24 +03:00
Ilya Goncharov 158ad630d9 [Gradle, JS] Fix tests 2020-03-20 12:45:24 +03:00
Ilya Goncharov 2b4f9302dc [Gradle, JS] Fix naming for webpack tasks
- while webpack is actual only for executable it is not necessary to add executable part
2020-03-20 12:45:24 +03:00
Ilya Goncharov 5828f8cbf2 [Gradle, JS] Rename KotlinBinaryContainer on KotlinTargetWithBinaries 2020-03-20 12:45:24 +03:00
Ilya Goncharov 19d09fc420 [Gradle, JS] Remove redundant build variants for IR 2020-03-20 12:45:24 +03:00
Ilya Goncharov 703ceff9a3 [Gradle, JS] Return binaries from ir target if it exists 2020-03-20 12:45:24 +03:00
Ilya Goncharov 2d900e2234 [Gradle, JS] Legacy tooling work with binaries and throw error on it 2020-03-20 12:45:24 +03:00
Ilya Goncharov 1bb6429c5c [Gradle, JS] Link tasks depends on compile tasks 2020-03-20 12:45:24 +03:00
Ilya Goncharov 0a19998ae2 [Gradle, JS] Binaries dsl 2020-03-20 12:45:23 +03:00
Ilya Goncharov 0c34acd09a [Gradle, JS] Produce executable for ir compilation 2020-03-20 12:45:23 +03:00
Ilya Goncharov 666b9b3545 [Gradle, JS] Move binaries on compilation level 2020-03-20 12:45:23 +03:00
Ilya Goncharov efb3f16ee4 [Gradle, JS] Browser with binaries 2020-03-20 12:45:22 +03:00
Ilya Goncharov 2fed8aa7b8 [Gradle, JS] NodeJs on binaries 2020-03-20 12:45:09 +03:00
Ilya Goncharov 9bff6a709f [Gradle, JS] Add testExecutable for subtargets 2020-03-20 12:45:09 +03:00
Ilya Goncharov 625e94822f [Gradle, JS] Remove redundant baseName 2020-03-20 12:45:09 +03:00
Ilya Goncharov d00c53fd38 [Gradle, JS] Fix strict type check 2020-03-20 12:45:09 +03:00
Ilya Goncharov e3b5a754cd [Gradle, JS] Register executable tasks for binaries 2020-03-20 12:45:09 +03:00
Ilya Goncharov 9fe0604f00 Revert "[Gradle, JS] binaries API instead of produce*"
This reverts commit 055e98e9
2020-03-20 12:45:09 +03:00
Ilya Goncharov eab6a7d038 [Gradle, JS] Register link tasks for binaries, not for compilations 2020-03-20 12:45:08 +03:00
Ilya Goncharov ab218317de [Gradle, JS] Fix name for binary 2020-03-20 12:45:08 +03:00
Ilya Goncharov e518998da3 [Gradle, JS] Remove KotlinJsIrType on BuildVariantKind 2020-03-20 12:45:08 +03:00