Skip to content

Commit

Permalink
Refactor CreateDmg and BundleMacosJdk: use Property<..>, migrate to K…
Browse files Browse the repository at this point in the history
…otlin

This change bumps the version to 1.5 since it updates APIs for CreateDmg and BundleMacosJdk.
  • Loading branch information
vlsi committed Apr 18, 2021
1 parent 0f64e82 commit 022272c
Show file tree
Hide file tree
Showing 12 changed files with 595 additions and 217 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

0 comments on commit 022272c

Please sign in to comment.