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

Conversation

vlsi
Copy link

@vlsi vlsi commented Jul 16, 2020

fixes #69

The PR includes the following changes:

  • Use Gradle's Property API so the tasks support lazily generated inputs. For instance, jdk dependency is downloaded only in case the task is actually executed
  • Migrate to Kotlin
  • File.createTempDir is replaced with build directory to better conform with Gradle conventions
  • README cleanup: added Kotlin DSL samples, fixed that JDK dependency requires .zip rather than .tgz
  • Added cleanTemporaryDirectories option for debugging purposes (if set to false it would skip removing the temporary directories used for preparing the output artifact)
  • Added integration test to verify CreateDmg and BundleMacosJdk tasks

@vlsi
Copy link
Author

vlsi commented Jul 17, 2020

The createDmg test passes locally, however it fails in GitHub Actions :(

arch: posix_spawnp: perl5.18: Bad CPU type in executable

@vlsi vlsi marked this pull request as ready for review July 17, 2020 12:48
@arimer
Copy link
Member

arimer commented Jul 23, 2020

Hello Vladimir. Thanks for contributing! 🎉
Do you mind adding a short discription to this PR to just sumup your idea. This is mostly useful for documentation purposes and might help others during code review.

@vlsi
Copy link
Author

vlsi commented Jul 23, 2020

@arimer , well, I thought It was summarized in the PR title. I duplicated it to the description as well.

Copy link
Member

@arimer arimer left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this contribution I have still some open questions and points which are commented on the code.

@@ -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

import org.gradle.kotlin.dsl.property
import java.io.File

abstract class BaseBundleMacOsTask(
Copy link
Member

Choose a reason for hiding this comment

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

I really like the idea of having a common super class 👍

src/main/kotlin/de/itemis/mps/gradle/BundleMacosJdk.kt Outdated Show resolved Hide resolved
src/main/kotlin/de/itemis/mps/gradle/CreateDmg.kt Outdated Show resolved Hide resolved
@@ -0,0 +1,161 @@
package de.itemis.mps.gradle.test
Copy link
Member

Choose a reason for hiding this comment

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

I really like the idea having a minimal RCP test which can be executed.
Could you maybe just drop some lines in the readme about the test idea and the setup?
This would be great and could help others in the future to update/enrich the test if required.

Copy link
Author

Choose a reason for hiding this comment

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

I'm puzzled here. Can you please clarify what is not clear?

I'm using a standard approach to use Gradle plugins: org.gradle.testkit.runner.GradleRunner
The test creates Gradle project within a temporary directory and executes a single task there.

@vlsi vlsi mentioned this pull request Jul 23, 2020
@arimer arimer requested a review from wsafonov August 18, 2020 19:22
Copy link
Contributor

@sergej-koscejev sergej-koscejev left a comment

Choose a reason for hiding this comment

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

I can't give a good review on this because I don't use these tasks, they run on our build server to produce a DMG for mbeddr RCP and either they work properly or nobody seems to care about DMGs. I also don't understand if there's a particular problem that this PR is supposed to solve.

@vlsi do you intend to maintain these tasks in the future? Have you had problems with these tasks?

Otherwise I'm tending against merging this PR because I'd like to avoid fixing what isn't broken.

Copy link
Contributor

@sergej-koscejev sergej-koscejev left a comment

Choose a reason for hiding this comment

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

Sorry, I overlooked that this fixes #69. In that case let's merge this, but please bump version to 1.5 as @arimer mentioned.

…otlin

This change bumps the version to 1.5 since it updates APIs for CreateDmg and BundleMacosJdk.
@vlsi
Copy link
Author

vlsi commented Apr 18, 2021

@sergej-koscejev , sorry for the delay. I've rebased the PR and I bumped the version.

Do you think it can be merged?

@sergej-koscejev
Copy link
Contributor

I can't merge it because the macOS builds fail. @vlsi any idea why?

@vlsi
Copy link
Author

vlsi commented Apr 21, 2021

macOS builds fail

I think the build fails since macOS scripts are outdated (see #99)
However, I was not sure if that is GitHub's issue or if the scripts went out of date indeed.

@vlsi
Copy link
Author

vlsi commented Apr 21, 2021

So I guess the ways to proceed are:

  • temporarily skip macOS from build matrix (or mark it to ignore errors)
  • update macOS scripts

WDYT?

@sergej-koscejev
Copy link
Contributor

I'm fine with updating the macOS scripts. @coolya do you have any opinion?

@coolya
Copy link
Contributor

coolya commented Apr 23, 2021

I'm fine with updating the macOS scripts. @coolya do you have any opinion?

I'm fine with updating the files.

@vlsi
Copy link
Author

vlsi commented May 11, 2021

Well, I did check the scripts from JetBrains, and it looks like they are worse than the scripts in mps-gradle-plugin :((
They use positional arguments instead of named ones, they hard-code certain assumptions (e.g. JetBrains, .png suffix, and so on).

As far as I understand, there's no point in building .dmg without bundling JDK. Java evolves at extreme pace nowadays, so it looks like the only sane way to release MPS-based IDEs (and .dmg in particular) is to bundle the workable JRE right into the distribution.

generic.zip might be helpful, however, it looks like "always bundle JRE" is the way to go for macOS, Windows, Linux.

So I suggest:

  1. update mps-gradle-plugins to accommodate macOS notarization
  2. heal somehow the Perl failure (e.g. borrow the relevant bits from JetBrains Platform)
  3. drop bundleJdk task altogether and let createDmg do everything (create the dmg with jre inside and sign it). An alternative option is to split createDmg (basically avoid shell scripts) into smaller tasks (perform "create dmg", "sign", "notarize" in different Gradle tasks), however, it would probably require more effort, and the gains are not obvious.

WDYT?

@sergej-koscejev
Copy link
Contributor

@vlsi I'm fine with all your suggestions, I just don't want to be the one to do this.

Yes, there's no point in building a .dmg without a JDK because the JetBrains JDK contains some improvements that help their IDEs work properly. The IDEs might crash or misbehave on a standard JDK, AFAIK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid eager resolving artifact in CreateDmg#jdkDependency
4 participants