-
Notifications
You must be signed in to change notification settings - Fork 12
[build] add kokoro dev channel build #294
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| build_file: "dart-intellij-third-party/kokoro/macos_external/kokoro_build.sh" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/bin/bash | ||
|
|
||
| # This script should execute after a commit. | ||
| date | ||
| echo "Automatic build started" | ||
|
|
||
| # Fail on any error. | ||
| set -e | ||
|
|
||
|
|
||
| # Code under repo is checked out to ${KOKORO_ARTIFACTS_DIR}/github. | ||
| cd ${KOKORO_ARTIFACTS_DIR}/github/dart-intellij-third-party | ||
|
|
||
| ./third_party/tool/kokoro/build.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| # This script should execute during the scheduled builds. | ||
| date | ||
| echo "Automatic build started" | ||
|
|
||
| # Fail on any error. | ||
| set -e | ||
|
|
||
| # Code under repo is checked out to ${KOKORO_ARTIFACTS_DIR}/github. | ||
| cd ${KOKORO_ARTIFACTS_DIR}/github/dart-intellij-third-party | ||
|
|
||
| ./third_party/tool/kokoro/deploy.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| build_file: "dart-intellij-third-party/kokoro/macos_external/kokoro_build.sh" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| build_file: "dart-intellij-third-party/kokoro/macos_external/kokoro_release.sh" | ||
|
|
||
| action { | ||
| define_artifacts { | ||
| regex: "github/dart-intellij-third-party/third_party/build/distributions/*.zip" | ||
| strip_prefix: "github/dart-intellij-third-party/third_party/build" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType | |
| import org.jetbrains.intellij.platform.gradle.TestFrameworkType | ||
| import org.jetbrains.intellij.platform.gradle.models.ProductRelease | ||
| import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask | ||
| import java.time.LocalDate | ||
| import java.time.format.DateTimeFormatter | ||
|
|
||
| // Specify UTF-8 for all compilations so we avoid Windows-1252. | ||
| allprojects { | ||
|
|
@@ -34,13 +36,34 @@ repositories { | |
|
|
||
| intellijPlatform { | ||
| pluginConfiguration { | ||
| var pluginVersion = providers.gradleProperty("pluginVersion").toString() | ||
|
|
||
| if (project.hasProperty("dev")) { | ||
| val latestVersion = changelog.getLatest().version | ||
| val majorVersion = latestVersion.substringBefore('.').toInt() | ||
| val nextMajorVersion = majorVersion + 1 | ||
| val datestamp = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now()) | ||
| pluginVersion = "$nextMajorVersion.0.0-dev.$datestamp" | ||
|
|
||
| val commitHash = System.getenv("KOKORO_GIT_COMMIT") | ||
| if (commitHash is String) { | ||
| val shortCommitHash = commitHash.take(7) | ||
| pluginVersion = "$pluginVersion-$shortCommitHash" | ||
| } | ||
| } | ||
|
|
||
| version = pluginVersion | ||
| name = providers.gradleProperty("pluginName") | ||
| id = providers.gradleProperty("pluginId") | ||
| version = providers.gradleProperty("pluginVersion") | ||
|
|
||
| ideaVersion { | ||
| sinceBuild = providers.gradleProperty("pluginSinceBuild") | ||
| untilBuild = providers.gradleProperty("pluginUntilBuild") | ||
| } | ||
|
|
||
| println("plugin version: $pluginVersion") | ||
| println("ideaVersion: $ideaVersion") | ||
|
Comment on lines
+64
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CONCERN] The repository style guide (rule #27) disallows the use of logger.lifecycle("plugin version: $pluginVersion")
logger.lifecycle("ideaVersion: $ideaVersion")References
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might consider updating the style guide to ignore gradle files but here I do think |
||
|
|
||
| changeNotes = provider { | ||
| project.changelog.renderItem(project.changelog.getLatest(), Changelog.OutputType.HTML) | ||
| } | ||
|
|
@@ -157,3 +180,9 @@ tasks.register("printCompileClasspath") { | |
| println("--- End Compile Classpath ---") | ||
| } | ||
| } | ||
|
|
||
| tasks.register("printVersion") { | ||
| doLast { | ||
| println(version) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
|
|
||
| source ./third_party/tool/kokoro/setup.sh | ||
| setup | ||
|
|
||
| echo "kokoro build start" | ||
|
|
||
| cd third_party | ||
| ./gradlew buildPlugin | ||
pq marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| echo "kokoro build finished" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
|
|
||
| source ./third_party/tool/kokoro/setup.sh | ||
| setup | ||
|
|
||
| echo "kokoro build start" | ||
|
|
||
| cd third_party | ||
|
|
||
| VERSION=$(./gradlew -q printVersion) | ||
| ./gradlew buildPlugin -Pdev | ||
|
|
||
| echo "kokoro build finished" | ||
|
|
||
| echo "kokoro deploy start" | ||
|
|
||
| DART_KEYSTORE_ID=74840 | ||
| DART_KEYSTORE_NAME=jetbrains-plugin-upload-auth-token | ||
|
|
||
| KOKORO_TOKEN_FILE="${KOKORO_KEYSTORE_DIR}/${DART_KEYSTORE_ID}_${DART_KEYSTORE_NAME}" | ||
| if [ ! -f "$KOKORO_TOKEN_FILE" ]; then | ||
| echo "Error: Keystore token file not found at $KOKORO_TOKEN_FILE" | ||
| exit 1 | ||
| fi | ||
| TOKEN=$(cat "$KOKORO_TOKEN_FILE") | ||
|
|
||
| ZIP_FILE="build/distributions/Dart-$VERSION.zip" | ||
| if [ ! -f "$ZIP_FILE" ]; then | ||
| echo "Error: Zip file not found at $ZIP_FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Uploading $ZIP_FILE to JetBrains Marketplace..." | ||
| curl -i \ | ||
| --header "Authorization: Bearer $TOKEN" \ | ||
| -F pluginId=6351 \ | ||
| -F file=@$ZIP_FILE \ | ||
| https://plugins.jetbrains.com/plugin/uploadPlugin | ||
|
|
||
| echo "kokoro deploy finished" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
|
||
| setup() { | ||
| # Fail on any error. | ||
| set -e | ||
|
|
||
| java --version | ||
|
|
||
| # Enable verbose output for Gradle | ||
| export JAVA_OPTS=" -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true" | ||
|
|
||
| ./gradlew --version | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CONCERN] Using
is Stringto check if an environment variable exists is unidiomatic.System.getenv()returns a nullableString?. A clearer way to perform a null check in Kotlin is using!= nullor a scope function like.let.References
!!operator is forbidden, and safe calls?., elvis operator?:, or standard null checks should be used instead. Whileis Stringworks,!= nullis more direct and idiomatic for this check. (link)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is Stringreads a bit better to me but I'm ambivalent.@helin24: if you feel strongly, happy to tweak.