Skip to content

Commit 3e6886b

Browse files
committed
Wrap Kotlin project to produce kotlin-compiler-lite
1 parent 90e2738 commit 3e6886b

File tree

9 files changed

+775
-0
lines changed

9 files changed

+775
-0
lines changed

.circleci/config.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
defaults: &defaults
2+
docker: [image: 'circleci/openjdk:8-jdk']
3+
working_directory: ~/repo
4+
environment:
5+
TERM: dumb
6+
JVM_OPTS: -Xmx1024m -Xms512m
7+
GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx1024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError"'
8+
9+
version: 2
10+
11+
workflows:
12+
version: 2
13+
build-deploy:
14+
jobs:
15+
- build:
16+
filters:
17+
tags:
18+
only: /.*/
19+
- deploy:
20+
context: org-global
21+
requires: [build]
22+
filters:
23+
tags:
24+
only: /^v.*/
25+
branches:
26+
ignore: /.*/
27+
28+
jobs:
29+
build:
30+
<<: *defaults
31+
steps:
32+
- checkout
33+
- run:
34+
name: Sync submodules
35+
command: |
36+
git submodule sync --recursive
37+
git submodule update --recursive --init
38+
- run:
39+
name: Update external dependencies
40+
command: ./gradlew --stacktrace updateDependencies
41+
- run:
42+
name: Generate artifacts
43+
command: ./gradlew --stacktrace publish
44+
- store_artifacts:
45+
path: &out build/out
46+
destination: maven-repo
47+
- persist_to_workspace:
48+
root: .
49+
paths: [*out]
50+
deploy:
51+
<<: *defaults
52+
steps:
53+
- checkout
54+
- attach_workspace:
55+
at: .
56+
- deploy:
57+
name: Upload artifacts
58+
command: gradle --stacktrace upload

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55

66
/gradle/wrapper/
77
/gradlew.bat
8+
9+
/__injected/*/build/

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# kotlin-compiler-lite
2+
[![bintray](https://img.shields.io/bintray/v/takhion/kotlin-metadata/kotlin-compiler-lite.svg?style=flat-square&label=bintray)](https://bintray.com/takhion/kotlin-metadata/kotlin-compiler-lite)
3+
[![maven-central](https://img.shields.io/maven-central/v/me.eugeniomarletti.kotlin.metadata/kotlin-compiler-lite.svg?style=flat-square&label=maven-central)](https://mvnrepository.com/artifact/me.eugeniomarletti.kotlin.metadata/kotlin-compiler-lite)
4+
5+
Wraps [JetBrains/kotlin] to produce a subset of the [Kotlin] compiler to be used by [kotlin-metadata].
6+
7+
##### It's a standalone project because versioning is parallel (follows the compiler) and building it is quite heavy, especially for the CI.
8+
9+
## Features
10+
11+
+ all Kotlin/Java sources, even for external dependencies
12+
+ every package relocated under `me.eugeniomarletti.kotlin.metadata.shadow.*` in both compiled classes and sources
13+
+ "full" version of all [Protocol Buffers], instead of the "lite" one used by default (see [Options > `optimize_for` > `LITE_RUNTIME`](https://developers.google.com/protocol-buffers/docs/proto#options))
14+
+ `.proto` files `package`/`import` directives fixed to reflect their relative locations (allows inspection through [the IDE](https://plugins.jetbrains.com/plugin/8277-protobuf-support))
15+
16+
## Download
17+
### This should _not_ be used directly, see [kotlin-metadata] instead!
18+
```gradle
19+
compile "me.eugeniomarletti.kotlin.metadata:kotlin-compiler-lite:$version"
20+
```
21+
22+
## Random notes
23+
24+
+ since having different versions of the gradle wrapper often makes the CI run out of memory and fail, `gradlew` is a symlink to the one in the wrapped repository
25+
+ doesn't modify any files on the original build, instead relies on runtime injection of modules through an
26+
[initialization script]
27+
+ overrides are performed in [`kotlin.init.gradle`] and [`__injected/override/build.gradle.kts`]
28+
+ the [top level build](build.gradle.kts) handles:
29+
+ downloading external dependencies
30+
+ starting inner build with init script
31+
+ uploading generated artifacts
32+
33+
[kotlin-metadata]: https://github.com/Takhion/kotlin-metadata
34+
[JetBrains/kotlin]: https://github.com/JetBrains/kotlin
35+
[Kotlin]: https://kotlinlang.org/
36+
[Protocol Buffers]: https://developers.google.com/protocol-buffers/
37+
[initialization script]: https://docs.gradle.org/current/userguide/init_scripts.html
38+
[`kotlin.init.gradle`]: kotlin.init.gradle
39+
[`__injected/override/build.gradle.kts`]: __injected/override/build.gradle.kts

__injected/empty/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// dependencies can't be removed, but they can be replaced by an empty project (this)
2+
3+
configurations.create("default")

0 commit comments

Comments
 (0)