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

Provide support for custom plugin repositories #528

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

piotrtomiak
Copy link
Contributor

@piotrtomiak piotrtomiak commented Sep 4, 2020

Building Vue.j plugin from sources on master using gradle requires IDEA nightly builds. It was really cumbersome to get everything to compile, so here is PR with support for nightly builds. Example configuration:

repositories {
  mavenCentral()
  maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
  maven("https://jetbrains.bintray.com/jediterm")
  maven("https://cache-redirector.jetbrains.com/www.myget.org/F/rd-snapshots/maven")
}

intellij {
  pluginName = "Vue.js"
  type = "IU"
  updateSinceUntilBuild = false
  nightlyBuild = "https://..."
  setPlugins("JavaScriptLanguage", "JSIntentionPowerPack", "JavaScriptDebugger", "CSS", "HtmlTools",
             "org.jetbrains.plugins.sass", "org.jetbrains.plugins.less", "org.jetbrains.plugins.stylus",
             "org.intellij.plugins.postcss:${ideaDependency.buildNumber}",
             "com.jetbrains.plugins.Jade:${ideaDependency.buildNumber}",
             "intellij.prettierJS:${ideaDependency.buildNumber}")
}

dependencies {
  testImplementation("com.jetbrains.intellij.javascript:javascript-test-framework:${intellij.ideaDependency.buildNumber}")
  testImplementation("com.jetbrains.intellij.copyright:copyright:${intellij.ideaDependency.buildNumber}")
}

You can of course fix the URL to a particular nightly build. Tested runIde target, which works perfectly.

@piotrtomiak
Copy link
Contributor Author

@zolotov I haven't bumped plugin version nor added documentation. Let me know if any of these is needed.

@zolotov
Copy link
Member

zolotov commented Sep 4, 2020

Thanks. It looks like a solution for #15

I have concerns about the API, though:

  1. it adds yet another option to intellij extension. ideally I'd get rid of the extension completely, I believe all the settings should be configured in particular tasks or in the dependencies block
  2. it reveals intellij build server specifics and is not discoverable or usable for external users
  3. there is also intellij.pluginsRepo settings which is somehow related to the changes

Probably, it makes sense to convert intellij.pluginsRepo into an array setting and automatically detect whether it's an plugins.xml-based repository or maven based (e.g. by downloading plugins.xml files every time).

@zolotov
Copy link
Member

zolotov commented Sep 4, 2020

I haven't bumped plugin version nor added documentation. Let me know if any of these is needed.

No problem, I usually do that right before publishing. I also think that feature should go with 0.5.0

@piotrtomiak
Copy link
Contributor Author

@zolotov I understand all of your concerns, especially point #2. The intellij.pluginsRepo requires Maven repository, that's why I didn't want to reuse it. Let me know if you think we should change something or abandon the idea.

@zolotov
Copy link
Member

zolotov commented Sep 4, 2020

Let me know if you think we should change something or abandon the idea.

I've posted the suggestion :)

Probably, it makes sense to convert intellij.pluginsRepo into an array setting and automatically detect whether it's an plugins.xml-based repository or maven based (e.g. by downloading plugins.xml files every time).

@piotrtomiak
Copy link
Contributor Author

intellij.pluginsRepo into an array setting and automatically detect whether it's an plugins.xml-based repository or maven based

OK, sounds good and more generic! That would however solve just a half of the problem. The other is downloading the latest IDE build. Should we do the same and simply detect if we are dealing with nightly?

@zolotov
Copy link
Member

zolotov commented Sep 4, 2020

The other is downloading the latest IDE build. Should we do the same and simply detect if we are dealing with nightly?

Sorry, didn't get the problem. Could you elaborate,please?

@piotrtomiak
Copy link
Contributor Author

@zolotov Nevermind. I replied too quickly. I'll look into applying your suggestions next week. Do you have an example of a corporate repo layout, so that I can support that as well?

@zolotov
Copy link
Member

zolotov commented Sep 4, 2020

@piotrtomiak as far as I understand, artifacts of nightly teamcity builds is an example of corporate repo layout, so it's just an updatePlugins.xml file and plugin distribution nearby.

@piotrtomiak
Copy link
Contributor Author

piotrtomiak commented Sep 7, 2020

@zolotov I've been trying to figure out the best way to keep backward compatibility and provide support for the corporate layout. How about something like this:

intellij {
  ...
  pluginsRepo {
     marketplace() // maven("https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven")
     maven("https://corpo.net/intellij/maven")
     custom("https://corpo.net/plugins/intellij/updatePlugins.xml")
     custom("https://other-corpo.org/plugins/ij/plugins.xml")
  }
  ...
}

Now, the question is about intellijRepo property and nightlies. Should we require an url to a nightly build snapshot, or should we figure that out from the list of plugins repos. In the first case, an example configuration for nightly would be something like this:

val nightlyBuildUrl = "https://..."
intellij {
  ...
  intellijRepo = "${nightlyBuildUrl}"
  pluginsRepo {
     maven("${nightlyBuildUrl}/maven-artifacts")
     custom("${nightlyBuildUrl}/IU-plugins/plugins.xml")
  }
  ...
}

Let me know what you think!

@zolotov
Copy link
Member

zolotov commented Sep 8, 2020

How about something like this:

Love it

Should we require an url to a nightly build snapshot

I don't think url should be required. It's possible to use local directory as an intellij build without a nightly build. Probably I misunderstood the suggestion.

UPD: ah, you want to download Installers right from the buildserver too. Is there a need for that? From the JB network you can access to them without patching an intellijRepo url.

@piotrtomiak
Copy link
Contributor Author

Love it

Awesome! I'll go with it than :)

@piotrtomiak piotrtomiak changed the title Provide support for IDEA nightly builds through "nightlyBuild" property Provide support for custom plugin repositories Sep 9, 2020
@piotrtomiak piotrtomiak force-pushed the nightly-support branch 2 times, most recently from 8f8e6a6 to de9c1d5 Compare September 9, 2020 10:45
Copy link
Member

@zolotov zolotov left a comment

Choose a reason for hiding this comment

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

LGTM, would be nice to have a test for custom repository. see org.jetbrains.intellij.DownloadIntelliJPluginsSpec

@piotrtomiak
Copy link
Contributor Author

LGTM, would be nice to have a test for custom repository. see org.jetbrains.intellij.DownloadIntelliJPluginsSpec

I'll need to include an xml and single jar in a test directory, unless you are aware of a public and stable custom plugin repository. Sounds good?

@zolotov
Copy link
Member

zolotov commented Sep 9, 2020

I'll need to include an xml and single jar in a test directory, unless you are aware of a public and stable custom plugin repository. Sounds good?

@piotrtomiak sure

Also, upgrade documentr to newer version, as the old one fails to generate output with cryptic message.

Fixes JetBrains#15
@zolotov zolotov merged commit d4604b5 into JetBrains:master Sep 10, 2020
@zolotov
Copy link
Member

zolotov commented Sep 10, 2020

Thank you very much! Merged. I’ll publish 0.5 as soon as I investigate problems with kotlin-serialization 1.4

@Undin
Copy link
Contributor

Undin commented Sep 13, 2020

Awesome!
@piotrtomiak thank you!
Сan't wait for these changes in the release

@rachelcarmena
Copy link

Hi! Please, is this feature deployed? Thanks in advance!

@zolotov
Copy link
Member

zolotov commented Sep 22, 2020

it's in 0.5-SNAPSHOT only so far, will publish as soon as #537 gets fixed

@zolotov
Copy link
Member

zolotov commented Sep 22, 2020

here is the instruction on how to use snapshot version https://github.com/JetBrains/gradle-intellij-plugin#snapshot-version

@rachelcarmena
Copy link

Awesome, thank you so much @zolotov 🙌

Gradle works and accepts the new DSL however It's not finding the plugin.

I'm following this schema: https://jetbrains.org/intellij/sdk/docs/basics/getting_started/update_plugins_format.html#format-of-updatepluginsxml-file

though the test is using this schema: https://github.com/piotrtomiak/gradle-intellij-plugin/blob/9e6031e05d9ad5656c934410c497eba5aab88c7f/src/test/resources/custom-repo/plugins.xml

Please, did I check the wrong documentation for the private repository? Thanks in advance!!

@zolotov
Copy link
Member

zolotov commented Sep 22, 2020

Please, did I check the wrong documentation for the private repository?

That is the right documentation.

Probably running gradle with --info will give some clues. Please attach the output.

cc @piotrtomiak

@rachelcarmena
Copy link

Thank you so much @zolotov !

No clues in the console output with the different Gradle options.

After:

[gradle-intellij-plugin :ide-plugin] Configuring plugin io.arrow-kt.arrow:1.4.10-SNAPSHOT

it appears:

Could not determine the dependencies of task ':ide-plugin:prepareSandbox'.
> Cannot resolve plugin io.arrow-kt.arrow version 1.4.10-SNAPSHOT

and I think the reason is looking for download-url:

        String downloadUrl = pluginsXml.category."idea-plugin"
                .find { it.id.text().equalsIgnoreCase(id) && it.version.text() == version }
                ?."download-url"?.text()

and nothing happens if it's not found:

        if (downloadUrl == null) return null

download-url doesn't exist in the schema that I followed: https://jetbrains.org/intellij/sdk/docs/basics/getting_started/update_plugins_format.html#format-of-updatepluginsxml-file

Thanks again!!

@rachelcarmena
Copy link

And <idea-plugin> doesn't exist but <plugin>.

@piotrtomiak
Copy link
Contributor Author

@rachelcarmena It turns out that I was following a different schema. I will update the code to support both.

@rachelcarmena
Copy link

That would be awesome @piotrtomiak , thank you so much!! 👏 💃

piotrtomiak added a commit to piotrtomiak/gradle-intellij-plugin that referenced this pull request Sep 28, 2020
@zolotov zolotov added this to the 0.5.0 milestone Oct 1, 2020
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.

None yet

4 participants