Provide bom (bill-of-materials) pom for kotlin libraries

#KT-18398 Fixed
This commit is contained in:
Ilya Gorbunov
2018-10-21 05:03:53 +03:00
parent 329e4f6000
commit 119385839a
6 changed files with 245 additions and 0 deletions
@@ -132,9 +132,14 @@
<artifact>org.jetbrains.kotlin:kotlin-stdlib-jdk8:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-reflect:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-test-common:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-test-annotations-common:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-test:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-test-junit:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-test-junit5:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-test-testng:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-test-js:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-script-util:${project.version}</artifact>
<artifact>org.jetbrains.kotlin:kotlin-bom:${project.version}:pom</artifact>
</extraArtifacts>
<showErrors>true</showErrors>
<postBuildHookScript>verify</postBuildHookScript>
@@ -0,0 +1 @@
invoker.goals=dependency:tree package
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-kotlin-bom</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-bom</artifactId>
<version>${kotlin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk7</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-js</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Depend on some artifact which itself depends on the old kotlin-reflect -->
<!-- And expect newer version of kotlin-reflect to be selected -->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<version>2.9.0</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
import java.io.*;
File file = new File(basedir, "target/test-kotlin-bom-1.0-SNAPSHOT.jar")
if (!file.exists() || !file.isFile()) {
throw new FileNotFoundException("Could not find generated JAR: " + file)
}
String expectedDependency = "org.jetbrains.kotlin:kotlin-reflect:jar:$kotlinVersion:compile"
List<String> lines = new File(basedir, "build.log").readLines()
if (!lines.any { it.contains(expectedDependency) }) {
throw new Exception("Expected to find dependency '$expectedDependency' in dependency tree")
}