KotlinBuildScriptCompiler.kt

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Convert to multi-project build in preparation to adding new modules

See #304

  1. … 263 more files in changeset.
Compiler supports ScriptSource with no backing file

  1. … 1 more file in changeset.
Add source dir of generated project accessors to script source path

Enables navigation to the sources and quick documentation access.

See #281

  1. … 7 more files in changeset.
Dedupe script classpath computation

  1. … 4 more files in changeset.
Unify handling of JIT and AOT project accessors

This is the first step toward fixing #340.

Resolves #338

Resolves #339

  1. … 27 more files in changeset.
Polish

- Normalise placement of `private`, `protected`, `internal` and

`inline` modifiers

  1. … 42 more files in changeset.
Execute Kotlin build scripts when computing the classpath

But ignore errors because any classpath is better than no classpath.

See #339

Resolve script classpath asynchronously

And log all the relevant events.

See #249

  1. … 15 more files in changeset.
Update to latest plugin management API

  1. … 1 more file in changeset.
Report correct location for `buildscript` block compilation errors

And for `plugins` block compilation errors.

Resolves #177

  1. … 5 more files in changeset.
Add project hierarchy classpath to the script compilation classpath

Resolves #190

  1. … 9 more files in changeset.
Create script ClassLoader via ClassLoaderScope

Resolves #171

  1. … 1 more file in changeset.
Make generated accessors visible to KotlinBuildScriptModel clients

See #234

  1. … 23 more files in changeset.
Move additional source file discovery logic to `o.g.s.l.k.accessors`

  1. … 1 more file in changeset.
Generate accessors for project extensions during `buildSrc` build

See: #229, #230, #231, #232, #233

  1. … 20 more files in changeset.
Normalise line separators before attempting to lex the script

Resolves: #207, #227

  1. … 4 more files in changeset.
Polish top-level definitions, parameter lists and exceptions

* Separate top-level definitions by two lines

* Segregate visibility modifier of top-level definition to

its own line

* Prefer starting long parameter lists at the next line (more

sustainable in face of method renames)

* Remove unnecessary `Exception` suffix from class names

* Remove unnecessary prefixes from field names

* Use better name for exception variables

  1. … 38 more files in changeset.
Don't let exception during exception handler mask original exception

And protect against `gradleHomeDir` and `gradleUserHomeDir` being null.

Guard against multiple buildscript/plugins blocks in a single script

Resolves #186

  1. … 6 more files in changeset.
Polish `KotlinBuildScriptCompiler`

Support the `plugins` block :tada:

We use a new type - `KotlinPluginDependenciesHandler` - as the target

for the top-level plugins block instead of the core type

`PluginDependenciesSpec` so we can annotate it with a `@DslMarker`

annotation - `@BuildScriptBlockMarker` - in the hopes that once IntelliJ

starts recognising it, the code completion experience will be better.

Better documentation comments and validation will come in subsequent

commits.

See #186

    • -45
    • +109
    ./KotlinBuildScriptCompiler.kt
  1. … 10 more files in changeset.
Make types internal so they don't show up in content assist

During script editing where they shouldn't be used.

  1. … 1 more file in changeset.
Refer to buildscript *blocks* instead of *sections*

And consistenly use a lower-case `s` in the middle of the word when

referring to just the block and an upper-case `S` when referring to the

script file as a whole.

  1. … 8 more files in changeset.
Cache compiled scripts

- Introduce CachingKotlinCompiler

- Add compilation ClassPath (as ClassLoader) to cache key

- Add version number to script cache

- Honor `--recompile-scripts`

- Report compilation progress

Resolves #31

  1. … 5 more files in changeset.
Upgrade to Kotlin 1.1-M02 :tada:

Resolves #164

  1. … 8 more files in changeset.
Don't isolate the script classpath

Now that the kotlin package is visible through the Gradle API

ClassLoader and given the Kotlin runtime backwards compatibility

guarantees there's no longer a reason for the fragile classpath

isolation logic.

Resolves #119

  1. … 3 more files in changeset.
Import java.lang exceptions for compatibility with Kotlin plugin

Version 1.1.0-dev-3687

  1. … 6 more files in changeset.
Reuse embedded Kotlin runtime ClassLoader

Whenever required version matches embedded Kotlin version.

Export gsk extensions as ClassPath not ClassLoader

Let the scope define what the parent ClassLoader should be.

Simplify ClassLoader hierarchy logging code

Using `groovy.json.JsonOutput`.

  1. … 1 more file in changeset.