Merge pull request #5314 from JohnNiang/refactor/console-as-subproject

Add Gradle build script for ui project
pull/5340/head
John Niang 2024-02-06 14:22:58 +08:00 committed by GitHub
commit 2cf19a4581
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1011 changed files with 76 additions and 23 deletions

View File

@ -27,9 +27,7 @@ jobs:
- uses: actions/checkout@v3
- name: Setup Environment
uses: ./.github/actions/setup-env
- name: Check Halo console
run: make -C console check
- name: Check Halo core
- name: Check Halo
run: ./gradlew check
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
@ -42,8 +40,6 @@ jobs:
- uses: actions/checkout@v3
- name: Setup Environment
uses: ./.github/actions/setup-env
- name: Build Halo console
run: make -C console build
- name: Reset version of Halo
if: github.event_name == 'release'
shell: bash
@ -52,7 +48,7 @@ jobs:
version=${{ github.event.release.tag_name }}
version=${version#v}
sed -i "s/version=.*-SNAPSHOT$/version=$version/1" gradle.properties
- name: Build Halo core
- name: Build Halo
run: ./gradlew clean && ./gradlew downloadPluginPresets && ./gradlew build -x check
- name: Upload Artifacts
uses: actions/upload-artifact@v4

View File

@ -82,6 +82,14 @@ tasks.register('createChecksums', Checksum) {
checksumAlgorithm = Checksum.Algorithm.SHA256
}
tasks.named('processResources', ProcessResources) {
from project(':ui').layout.buildDirectory.dir('dist')
into layout.buildDirectory.dir('resources/main')
configure {
mustRunAfter project(':ui').tasks.named('build')
}
}
tasks.named('build') {
dependsOn tasks.named('createChecksums')
}

View File

@ -1,13 +0,0 @@
plugins {
id "org.sonarqube" version "4.4.1.3373"
}
group = "run.halo.app"
sonar {
properties {
property "sonar.projectKey", "halo-dev_halo"
property "sonar.organization", "halo-dev"
property "sonar.host.url", "https://sonarcloud.io"
}
}

View File

@ -6,4 +6,4 @@ pluginManagement {
}
rootProject.name = 'halo'
include 'api', 'application', 'platform:application', 'platform:plugin'
include 'api', 'application', 'platform:application', 'platform:plugin', 'ui'

View File

60
ui/build.gradle Normal file
View File

@ -0,0 +1,60 @@
plugins {
id "com.github.node-gradle.node" version "7.0.1"
}
tasks.register('clean', Delete) {
delete layout.buildDirectory
delete fileTree('packages') {
include '*/dist/**'
}
}
tasks.register('build', PnpmTask) {
dependsOn tasks.named('check'), tasks.named('buildPackages')
pnpmCommand = ['run', 'build']
inputs.files(fileTree(layout.projectDirectory) {
include 'console-src/**', 'uc-src/**', 'src/**', 'public/**', '*.js', '*.json', '*.yaml', 'index.html'
exclude '**/node_modules/**', '**/build/**', '**/dist/**'
})
outputs.dir(layout.buildDirectory.dir('dist'))
configure {
shouldRunAfter tasks.named('clean')
}
}
tasks.register('buildPackages', PnpmTask) {
dependsOn tasks.named('pnpmInstall')
inputs.files(fileTree('packages') {
exclude '**/node_modules/**', '**/dist/**'
})
inputs.file('package.json')
pnpmCommand = ['run', 'build:packages']
outputs.files(fileTree('packages') {
include '*/dist/**'
})
}
tasks.register('test', PnpmTask) {
dependsOn tasks.named('buildPackages')
pnpmCommand = ['run', 'test:unit']
shouldRunAfter tasks.named('lint'), tasks.named('typecheck')
}
tasks.register('lint', PnpmTask) {
dependsOn tasks.named('buildPackages')
pnpmCommand = ['run', 'lint']
}
tasks.register('typecheck', PnpmTask) {
dependsOn tasks.named('buildPackages')
pnpmCommand = ['run', 'typecheck']
}
tasks.register('check') {
dependsOn tasks.named('lint'), tasks.named('typecheck'), tasks.named('test')
}
tasks.register('dev', PnpmTask) {
dependsOn tasks.named('buildPackages')
pnpmCommand = ['run', 'dev']
}

Some files were not shown because too many files have changed in this diff Show More