File: upload_plugins.gradle

package info (click to toggle)
kotlin 1.3.31%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 109,908 kB
  • sloc: java: 454,756; xml: 18,599; javascript: 10,452; sh: 513; python: 97; makefile: 69; ansic: 4
file content (51 lines) | stat: -rw-r--r-- 1,679 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
buildscript {
    repositories {
        mavenCentral()
        maven {
            url('https://dl.bintray.com/jetbrains/plugin-repository-rest-client/')
        }
    }
    dependencies {
        classpath 'org.jetbrains.intellij:plugin-repository-rest-client:0.1.15'
    }
}

task uploadPlugins {
    doLast {
        def env = System.getenv()
        def username = env['PLUGIN_REPOSITORY_USER']
        def password = env['PLUGIN_REPOSITORY_PASSWORD']
        def channel = env['PLUGIN_REPOSITORY_CHANNEL']
        if (channel == "_default_") {
            channel = null
        }
        def path = env['PLUGIN_UPLOAD_PATH']
        if (path == null) {
            path = "."
        }
        def repo = new org.jetbrains.intellij.pluginRepository.PluginRepositoryInstance(
                "https://plugins.jetbrains.com/",
                username, password)

        File[] files = new File(path).listFiles({ _, String filename ->
            if (!filename.startsWith("kotlin-plugin") || !filename.endsWith(".zip")) false
            else {
                // don't publish CIDR plugins to IDEA channel
                def filenameLowerCase = filename.toLowerCase()
                if (filenameLowerCase.contains("clion") || filenameLowerCase.contains("appcode")) false
                else true
            }
        } as FilenameFilter)

        files = files.sort { f1, f2 ->
            f1.name.contains("1.1.2-5") ? 1 : (f2.name.contains("1.1.2-5") ? -1 : (f1.name <=> f2.name))
        }

        files.each { file ->
            println("Uploading ${file.name}")
            repo.uploadPlugin(6954, file, channel)
        }
    }
}

defaultTasks 'uploadPlugins'