Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
PRJ-169 Get rid of second Gradle project
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Nov 19, 2020
1 parent 6d58fb9 commit 2818811
Show file tree
Hide file tree
Showing 23 changed files with 5,079 additions and 4,130 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/release-launcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ jobs:
java-version: '11'
- run: sudo apt update && sudo apt install wine-stable -y
- name: Build project
run: |
cd projector-launcher
./gradlew distZip
run: ./gradlew :projector-launcher:distZip
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ jobs:
java-version: '11'
- run: sudo apt update && sudo apt install wine-stable -y
- name: check projector-launcher building
run: |
cd projector-launcher
./gradlew distZip
run: ./gradlew :projector-launcher:distZip
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
bootstrapVersion=4.5.2
coroutinesVersion=1.3.9
electronVersion=^10.1.2
electronPackagerVersion=^15.1.0
inlineStylePrefixerVersion=~6.0.0
javassistVersion=3.27.0-GA
javaWebSocketVersion=1.5.1
jqueryVersion=3.5.1
kotlinVersion=1.4.0
kotlinExtensionsVersion=1.0.1-pre.114-kotlin-1.4.0
kotlinReactVersion=16.13.1-pre.112-kotlin-1.4.0
kotlinStyledComponentsVersion=1.0.0-pre.110-kotlin-1.4.0
ktorVersion=1.4.0
openVersion=^7.2.1
radiumVersion=0.26.1
reactVersion=16.13.1
reactLoadingIndicatorVersion=1.0.2
Expand Down
5 changes: 0 additions & 5 deletions projector-launcher/.gitignore

This file was deleted.

4 changes: 2 additions & 2 deletions projector-launcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ Please check [releases](https://github.com/JetBrains/projector-client/releases)

### Building from source
```shell script
./gradlew dist
./gradlew :projector-launcher:dist
```

After that, executables will be generated in the `build/electronOut` dir.

### Running from source
```shell script
./gradlew electronProductionRun
./gradlew :projector-launcher:electronProductionRun
```
226 changes: 112 additions & 114 deletions projector-launcher/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackCssMode.EXTRACT

plugins {
kotlin("js")
kotlin("js")
}

val bootstrapVersion: String by project
Expand All @@ -16,90 +16,88 @@ val kotlinExtensionsVersion: String by project
val openVersion: String by project

kotlin {
js {
// todo: switch to nodejs or electron (KT-35327)
// while webpack is not supported in nodejs target, need to override target in webpack.config.d
browser {
webpackTask {
cssSupport.enabled = true
cssSupport.mode = EXTRACT
}
}
js {
// todo: switch to nodejs or electron (KT-35327)
// while webpack is not supported in nodejs target, need to override target in webpack.config.d
browser {
webpackTask {
cssSupport.enabled = true
cssSupport.mode = EXTRACT
}
}
}
}

dependencies {
implementation(npm("bootstrap", bootstrapVersion))
implementation(npm("electron", electronVersion))
implementation(npm("jquery", jqueryVersion))
implementation(npm("open", openVersion))
implementation("org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
implementation("org.jetbrains:kotlin-extensions:$kotlinExtensionsVersion")
implementation(npm("bootstrap", bootstrapVersion))
implementation(npm("electron", electronVersion))
implementation(npm("jquery", jqueryVersion))
implementation(npm("open", openVersion))
implementation("org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
implementation("org.jetbrains:kotlin-extensions:$kotlinExtensionsVersion")
}


group = "org.jetbrains"
version = "1.0.0"
version = "1.0.0" // todo: npm doesn't support versions like "1.0-SNAPSHOT"

repositories {
jcenter()
maven("https://kotlin.bintray.com/kotlin-js-wrappers")
jcenter()
maven("https://kotlin.bintray.com/kotlin-js-wrappers")
}

val isWindows = DefaultNativePlatform.getCurrentOperatingSystem().isWindows

val npmCommand = when (isWindows) {
true -> listOf("cmd.exe", "/C", "npm.cmd")
false -> listOf("npm")
true -> listOf("cmd.exe", "/C", "npm.cmd")
false -> listOf("npm")
}

val distDir = "build/distributions"

fun Map<String, Any>.toJsonString(): String {
val gson = GsonBuilder().setPrettyPrinting().create()!!
return gson.toJson(this)!!
val gson = GsonBuilder().setPrettyPrinting().create()!!
return gson.toJson(this)!!
}

val generateDistPackageJson by tasks.creating(Task::class) {
group = "dist"
dependsOn(tasks["browserProductionWebpack"])

doLast {
val packageJson = mapOf(
"main" to "projector-launcher.js",
"scripts" to mapOf(
"electron" to "electron",
"electron-packager" to "electron-packager"
),
"devDependencies" to mapOf(
"electron-packager" to electronPackagerVersion
),
"dependencies" to mapOf(
"electron" to electronVersion
),
"keywords" to listOf(
"projector",
"jetbrains",
"kotlin",
"kotlin-js"
),
"author" to "projector",
"license" to "MIT",
"name" to "projector-launcher",
"description" to "Desktop launcher for Projector, written in Kotlin, Electron and Node",
"version" to project.version.toString()
)

project.file("$distDir/package.json").writeText(packageJson.toJsonString())
}
group = "dist"
dependsOn(tasks["browserProductionWebpack"])

doLast {
val packageJson = mapOf(
"main" to "projector-launcher.js",
"scripts" to mapOf(
"electron" to "electron",
"electron-packager" to "electron-packager"
),
"devDependencies" to mapOf(
"electron-packager" to electronPackagerVersion
),
"dependencies" to mapOf(
"electron" to electronVersion
),
"keywords" to listOf(
"projector",
"jetbrains",
"kotlin",
"kotlin-js"
),
"author" to "projector",
"license" to "MIT",
"name" to "projector-launcher",
"description" to "Desktop launcher for Projector, written in Kotlin, Electron and Node",
"version" to project.version.toString()
)

project.file("$distDir/package.json").writeText(packageJson.toJsonString())
}
}

val initDistEnvironment by tasks.creating(Exec::class) {
group = "dist"
dependsOn(generateDistPackageJson)
workingDir(project.file(distDir))
commandLine(npmCommand + listOf("install"))
group = "dist"
dependsOn(generateDistPackageJson)
workingDir(project.file(distDir))
commandLine(npmCommand + listOf("install"))
}

val electronOutDir = "build/electronOut"
Expand All @@ -118,82 +116,82 @@ val packagerCommand = npmCommand + listOf(
)

val packageDarwinX64 by tasks.creating(Exec::class) {
group = "dist"
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(packagerCommand + listOf("--platform=darwin", "--arch=x64"))
group = "dist"
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(packagerCommand + listOf("--platform=darwin", "--arch=x64"))
}

val packageLinuxX64 by tasks.creating(Exec::class) {
group = "dist"
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(packagerCommand + listOf("--platform=linux", "--arch=x64"))
doLast {
if (!isWindows) {
exec {
commandLine(
"chmod",
"+x",
project.file("$electronOutDir/$appName-linux-x64/$appName").absolutePath
)
}
}
group = "dist"
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(packagerCommand + listOf("--platform=linux", "--arch=x64"))
doLast {
if (!isWindows) {
exec {
commandLine(
"chmod",
"+x",
project.file("$electronOutDir/$appName-linux-x64/$appName").absolutePath
)
}
}
}
}

val packageWin32X64 by tasks.creating(Exec::class) {
group = "dist"
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(packagerCommand + listOf("--platform=win32", "--arch=x64"))
group = "dist"
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(packagerCommand + listOf("--platform=win32", "--arch=x64"))
}

tasks.create("dist") {
group = "dist"
dependsOn(packageDarwinX64, packageLinuxX64, packageWin32X64)
group = "dist"
dependsOn(packageDarwinX64, packageLinuxX64, packageWin32X64)
}

val packageZipDarwinX64 by tasks.creating(Zip::class) {
group = "dist"
dependsOn(packageDarwinX64)
val targetName = "$appName-darwin-x64"
from(project.file(electronOutDir)) {
include("$targetName/**")
}
archiveFileName.set("$targetName.zip")
destinationDirectory.set(project.file(electronOutDir))
group = "dist"
dependsOn(packageDarwinX64)
val targetName = "$appName-darwin-x64"
from(project.file(electronOutDir)) {
include("$targetName/**")
}
archiveFileName.set("$targetName.zip")
destinationDirectory.set(project.file(electronOutDir))
}

val packageZipLinuxX64 by tasks.creating(Zip::class) {
group = "dist"
dependsOn(packageLinuxX64)
val targetName = "$appName-linux-x64"
from(project.file(electronOutDir)) {
include("$targetName/**")
}
archiveFileName.set("$targetName.zip")
destinationDirectory.set(project.file(electronOutDir))
group = "dist"
dependsOn(packageLinuxX64)
val targetName = "$appName-linux-x64"
from(project.file(electronOutDir)) {
include("$targetName/**")
}
archiveFileName.set("$targetName.zip")
destinationDirectory.set(project.file(electronOutDir))
}

val packageZipWin32X64 by tasks.creating(Zip::class) {
group = "dist"
dependsOn(packageWin32X64)
val targetName = "$appName-win32-x64"
from(project.file(electronOutDir)) {
include("$targetName/**")
}
archiveFileName.set("$targetName.zip")
destinationDirectory.set(project.file(electronOutDir))
group = "dist"
dependsOn(packageWin32X64)
val targetName = "$appName-win32-x64"
from(project.file(electronOutDir)) {
include("$targetName/**")
}
archiveFileName.set("$targetName.zip")
destinationDirectory.set(project.file(electronOutDir))
}

tasks.create("distZip") {
group = "dist"
dependsOn(packageZipDarwinX64, packageZipLinuxX64, packageZipWin32X64)
group = "dist"
dependsOn(packageZipDarwinX64, packageZipLinuxX64, packageZipWin32X64)
}

tasks.create<Exec>("electronProductionRun") {
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(npmCommand + listOf("run", "electron", "--", "."))
dependsOn(initDistEnvironment)
workingDir(project.file(distDir))
commandLine(npmCommand + listOf("run", "electron", "--", "."))
}
8 changes: 0 additions & 8 deletions projector-launcher/gradle.properties

This file was deleted.

Binary file removed projector-launcher/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions projector-launcher/gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading

0 comments on commit 2818811

Please sign in to comment.