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

Refactor CreateDmg and BundleMacosJdk: use Property<..>, migrate to Kotlin #70

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

name: Java CI with Gradle

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -12,6 +12,26 @@ jobs:
strategy:
matrix:
java: [1.8, 11, 13]
name: 'ubuntu (JDK ${{ matrix.java }}) '

steps:
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew test

build-macos:
runs-on: macos-latest
strategy:
matrix:
java: [1.8, 11]

name: 'macOS (JDK ${{ matrix.java }}) '

steps:
- uses: actions/checkout@v2
Expand Down
74 changes: 60 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,56 @@ created by an MPS-generated Ant script), a JDK, and a background image.

### Usage

```
Groovy:

```gradle
task buildDmg(type: de.itemis.mps.gradle.CreateDmg) {
rcpArtifact file('path/to/RCP.tgz')
rcpArtifact = file('path/to/RCP.tgz')

jdkDependency "com.jetbrains.jdk:jdk:${jdkVersion}:osx_x64@tgz"
// -or -
jdk file('path/to/jdk.tgz')
jdk = file('path/to/jdk.zip')

backgroundImage = file('path/to/background.png')
dmgFile = file('output.dmg')

signKeyChain = file("/path/to/my.keychain-db")

signKeyChainPassword = "my.keychain-db-password"

signIdentity = "my Application ID Name"
}
```

Kotlin:

```kotlin
import de.itemis.mps.gradle.CreateDmg

backgroundImage file('path/to/background.png')
dmgFile file('output.dmg')
val buildDmg by tasks.registering(CreateDmg::class) {
rcpArtifact.set(file("path/to/RCP.tgz"))

signKeyChain file("/path/to/my.keychain-db")
jdkDependency("com.jetbrains.jdk:jdk:${jdkVersion}:osx_x64@tgz")
// -or-
jdk.set(layout.file(provider { jdkConfiguration.singleFile }))
// -or-
jdk.set(file("path/to/jdk.zip"))

signKeyChainPassword "my.keychain-db-password"
backgroundImage.set(file("path/to/background.png"))
dmgFile.set(file("output.dmg"))

signIdentity "my Application ID Name"
// Below properties must be all present or they all must be absent
signKeyChain.set(file("/path/to/my.keychain-db"))
signKeyChainPassword.set("my.keychain-db-password")
signIdentity.set("my Application ID Name")
}
```

Parameters:
* `rcpArtifact` - the path to the RCP artifact produced by a build script.
* `jdkDependency` - the coordinates of a JDK in case it's available in
a repository and can be resolved as a Gradle dependency.
* `jdk` - the path to a JDK .tgz file.
* `jdk` - the path to a JDK .zip file.
* `backgroundImage` - the path to the background image.
* `dmgFile` - the path and file name of the output DMG image. Must end
with `.dmg`.
Expand All @@ -129,23 +155,43 @@ task.

### Usage

```
Groovy:

```gradle
task bundleMacosJdk(type: de.itemis.mps.gradle.BundleMacosJdk) {
rcpArtifact file('path/to/RCP.tgz')
rcpArtifact = file('path/to/RCP.tgz')

jdkDependency "com.jetbrains.jdk:jdk:${jdkVersion}:osx_x64@tgz"
// -or -
jdk file('path/to/jdk.tgz')
jdk = file('path/to/jdk.tgz')

outputFile = file('output.tar.gz')
}
```

Kotlin:

```kotlin
import de.itemis.mps.gradle.BundleMacosJdk

val buildDmg by tasks.registering(BundleMacosJdk::class) {
rcpArtifact.set(file("path/to/RCP.tgz"))

jdkDependency("com.jetbrains.jdk:jdk:${jdkVersion}:osx_x64@tgz")
// -or-
jdk.set(layout.file(provider { jdkConfiguration.singleFile }))
// -or-
jdk.set(file("path/to/jdk.tgz"))

outputFile file('output.tar.gz')
outputFile.set(file("output.dmg"))
}
```

Parameters:
* `rcpArtifact` - the path to the RCP artifact produced by a build script.
* `jdkDependency` - the coordinates of a JDK in case it's available in
a repository and can be resolved as a Gradle dependency.
* `jdk` - the path to a JDK .tgz file.
* `jdk` - the path to a JDK .zip file.
* `outputFile` - the path and file name of the output gzipped tar archive.

### Operation
Expand Down
24 changes: 19 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due the switch to the property API users of this plugins would face problems if they encode a version like 1.4.+ in their project setup.
Therefore I would opt for at least increase the minor verion in L.24.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @coolya or @sergej-koscejev have an other oppinion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frankly speaking, the version is puzzling here, so I need your input here.
Of course, I can bump minor version to 5

buildscript {
configurations.classpath {
Expand All @@ -20,7 +21,7 @@ plugins {
}

val versionMajor = 1
val versionMinor = 4
val versionMinor = 5

group = "de.itemis.mps"

Expand Down Expand Up @@ -133,10 +134,23 @@ dependencies {
testRuntimeOnly(files(tasks["createClasspathManifest"]))
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.apiVersion = kotlinApiVersion
kotlinOptions.allWarningsAsErrors = true
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
apiVersion = kotlinApiVersion
allWarningsAsErrors = true
}
}

tasks.withType<Test>().configureEach {
useJUnit()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
}
}

kotlinDslPluginOptions {
experimentalWarning.set(false)
}


Expand Down
66 changes: 0 additions & 66 deletions src/main/groovy/de/itemis/mps/gradle/BundleMacosJdk.groovy

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/groovy/de/itemis/mps/gradle/BundledScripts.groovy

This file was deleted.

106 changes: 0 additions & 106 deletions src/main/groovy/de/itemis/mps/gradle/CreateDmg.groovy

This file was deleted.

Loading