Forráskód Böngészése

Configure experimental annotations, binary compatibility validator, dokka, build, publishing, for mirai-console.

Him188 5 éve
szülő
commit
550899afa0

+ 27 - 0
.github/workflows/all-build.yml

@@ -0,0 +1,27 @@
+name: All Build
+
+on: [ push, pull_request ]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: chmod +x gradlew
+        run: chmod +x gradlew
+      - name: git submodule init
+        run: git submodule init
+      - name: git submodule update --remote
+        run: git submodule update --remote
+      - name: Init gradle project
+        run: ./gradlew clean
+      - name: Build all
+        run: ./gradlew assemble
+      - name: All Tests
+        run: ./gradlew check

+ 72 - 37
.github/workflows/bintray.yml

@@ -18,60 +18,95 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
+
+      - name: Check keys
+        run: >
+          ./gradlew :mirai-core-utils:ensureBintrayAvailable
+          :mirai-core-api:ensureBintrayAvailable
+          :mirai-core:ensureBintrayAvailable
+          :mirai-console:ensureBintrayAvailable
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+
       - name: Set up JDK 1.8
         uses: actions/setup-java@v1
         with:
           java-version: 1.8
+
       - name: Grant execute permission for gradlew
         run: chmod +x gradlew
-      - name: Gradle clean
-        run: ./gradlew clean
-      - name: Gradle build
-        run: ./gradlew build # if test's failed, don't publish
 
-      - name: Check keys
+      - name: Init gradle project
+        run: ./gradlew clean --info
+
+      - name: fillBuildConstants
         run: >
-            ./gradlew :mirai-core-utils:ensureBintrayAvailable
-            :mirai-core-api:ensureBintrayAvailable
-            :mirai-core:ensureBintrayAvailable
-            -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
-            -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+          ./gradlew
+          fillBuildConstants --info --stacktrace
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+
+      - name: Assemble
+        run: ./gradlew assemble --info --stacktrace
+
+      - name: Check
+        run: ./gradlew check --info --stacktrace
 
       - name: Gradle :mirai-core-utils:publish
         run: >
-            ./gradlew :mirai-core-utils:publish --info
-            -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
-            -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+          ./gradlew :mirai-core-utils:publish --info --stacktrace
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
 
       - name: Gradle :mirai-core-api:publish
         run: >
-            ./gradlew :mirai-core-api:publish --info
-            -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
-            -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+          ./gradlew :mirai-core-api:publish --info --stacktrace
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
 
       - name: Gradle :mirai-core:publish
         run: >
-            ./gradlew :mirai-core:publish --info
-            -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
-            -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+          ./gradlew :mirai-core:publish --info --stacktrace
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
 
       - name: Gradle :mirai-core-all:bintrayUpload
         run: >
-            ./gradlew :mirai-core-all:bintrayUpload --info
-            -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
-            -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
-
-#      - name: Upload artifact
-#        uses: actions/[email protected]
-#        with:
-#          # Artifact name
-#          name: mirai-core
-#          # Directory containing files to upload
-#          path: "mirai-core/build/libs/mirai-core-*-all.jar"
-#      - name: Upload artifact
-#        uses: actions/[email protected]
-#        with:
-#          # Artifact name
-#          name: mirai-core-qqandroid-all
-#          # Directory containing files to upload
-#          path: "mirai-core-qqandroid/build/libs/mirai-core-qqandroid-*-all.jar"
+          ./gradlew :mirai-core-all:bintrayUpload --info
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+
+      - name: Gradle :mirai-console:bintrayUpload
+        run: >
+          ./gradlew
+          :mirai-console:bintrayUpload --info
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+
+      - name: Gradle :mirai-console-terminal:bintrayUpload
+        run: >
+          ./gradlew
+          :mirai-console-terminal:bintrayUpload --info
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+
+      - name: Gradle :mirai-console-compiler-common:bintrayUpload
+        run: >
+          ./gradlew
+          :mirai-console-compiler-common:bintrayUpload --info
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+
+      - name: Gradle :mirai-console-intellij:bintrayUpload
+        run: >
+          ./gradlew
+          :mirai-console-intellij:bintrayUpload --info
+          -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }}
+          -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }}
+
+      - name: Publish Gradle plugin
+        run: >
+          ./gradlew
+          :mirai-console-gradle:publishPlugins --info --stacktrace
+          -Dgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }}
+          -Dgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}

+ 0 - 19
.github/workflows/main.yml

@@ -1,19 +0,0 @@
-name: Gradle CI
-
-on: [push, pull_request]
-
-jobs:
-  build:
-
-    runs-on: ubuntu-latest
-
-    steps:
-    - uses: actions/checkout@v2
-    - name: Set up JDK 1.8
-      uses: actions/setup-java@v1
-      with:
-        java-version: 1.8
-    - name: Grant execute permission for gradlew
-      run: chmod +x gradlew
-    - name: Build with Gradle
-      run: ./gradlew build

+ 23 - 0
.github/workflows/mirai-core-build.yml

@@ -0,0 +1,23 @@
+name: mirai-core Build
+
+on: [ push, pull_request ]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: chmod +x gradlew
+        run: chmod +x gradlew
+      - name: Init gradle project
+        run: ./gradlew clean
+      - name: Build mirai-core series
+        run: ./gradlew assemble
+      - name: mirai-core Tests
+        run: ./gradlew check

+ 10 - 1
build.gradle.kts

@@ -56,7 +56,10 @@ configure<kotlinx.validation.ApiValidationExtension> {
 
 
     ignoredPackages.add("net.mamoe.mirai.internal")
+    ignoredPackages.add("net.mamoe.mirai.console.internal")
     nonPublicMarkers.add("net.mamoe.mirai.MiraiInternalApi")
+    nonPublicMarkers.add("net.mamoe.mirai.console.utils.ConsoleInternalApi")
+    nonPublicMarkers.add("net.mamoe.mirai.console.utils.ConsoleExperimentalApi")
     nonPublicMarkers.add("net.mamoe.mirai.MiraiExperimentalApi")
 }
 
@@ -116,9 +119,11 @@ allprojects {
         }
     }
 }
+
 subprojects {
     afterEvaluate {
         if (project.name == "mirai-core-api") configureDokka()
+        if (project.name == "mirai-console") configureDokka()
     }
 }
 
@@ -148,7 +153,9 @@ fun Project.configureDokka() {
             for (suppressedPackage in arrayOf(
                 """net.mamoe.mirai.internal""",
                 """net.mamoe.mirai.internal.message""",
-                """net.mamoe.mirai.internal.network"""
+                """net.mamoe.mirai.internal.network""",
+                """net.mamoe.mirai.console.internal""",
+                """net.mamoe.mirai.console.compiler.common"""
             )) {
                 perPackageOption {
                     matchingRegex.set(suppressedPackage.replace(".", "\\."))
@@ -274,6 +281,8 @@ val experimentalAnnotations = arrayOf(
     "kotlin.experimental.ExperimentalTypeInference",
     "kotlin.ExperimentalUnsignedTypes",
     "kotlin.time.ExperimentalTime",
+    "kotlin.io.path.ExperimentalPathApi",
+    "io.ktor.util.KtorExperimentalAPI",
 
     "kotlinx.serialization.ExperimentalSerializationApi",