Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions .github/workflows/ci.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ workflow(
) {
uses(name = "Check out", action = Checkout())
uses(
name = "Set up JDK 8",
name = "Set up JDK 17",
action = SetupJava(
javaVersion = "8",
javaVersion = "17",
distribution = SetupJava.Distribution.Temurin,
),
)
Expand All @@ -59,13 +59,6 @@ workflow(
name = "Set up Android SDK",
action = SetupAndroid_Untyped(),
)
uses(
name = "Set up JDK 8",
action = SetupJava(
javaVersion = "8",
distribution = SetupJava.Distribution.Temurin,
),
)
run(name = "Build android", command = "./gradlew :android:build")
}

Expand All @@ -75,9 +68,9 @@ workflow(
) {
uses(name = "Check out", action = Checkout())
uses(
name = "Set up JDK 8",
name = "Set up JDK 17",
action = SetupJava(
javaVersion = "8",
javaVersion = "17",
distribution = SetupJava.Distribution.Temurin,
),
)
Expand Down Expand Up @@ -110,9 +103,9 @@ workflow(
) {
uses(name = "Check out", action = Checkout())
uses(
name = "Set up JDK 8",
name = "Set up JDK 17",
action = SetupJava(
javaVersion = "8",
javaVersion = "17",
distribution = SetupJava.Distribution.Temurin,
),
)
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
name: 'Check out'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Set up JDK 8'
name: 'Set up JDK 17'
uses: 'actions/setup-java@v4'
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
- id: 'step-2'
name: 'Build core'
Expand All @@ -59,12 +59,6 @@ jobs:
name: 'Set up Android SDK'
uses: 'android-actions/setup-android@v3'
- id: 'step-3'
name: 'Set up JDK 8'
uses: 'actions/setup-java@v4'
with:
java-version: '8'
distribution: 'temurin'
- id: 'step-4'
name: 'Build android'
run: './gradlew :android:build'
cli:
Expand All @@ -76,10 +70,10 @@ jobs:
name: 'Check out'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Set up JDK 8'
name: 'Set up JDK 17'
uses: 'actions/setup-java@v4'
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
- id: 'step-2'
name: 'Build CLI'
Expand Down Expand Up @@ -115,10 +109,10 @@ jobs:
name: 'Check out'
uses: 'actions/checkout@v4'
- id: 'step-1'
name: 'Set up JDK 8'
name: 'Set up JDK 17'
uses: 'actions/setup-java@v4'
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
- id: 'step-2'
name: 'Build web'
Expand Down
34 changes: 16 additions & 18 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-android-extensions")
}

android {
compileSdkVersion(29)
buildToolsVersion("29.0.2")
namespace = "it.krzeminski.fsynth"
compileSdk = 36
defaultConfig {
applicationId = "it.krzeminski.fsynth"
minSdkVersion(26)
targetSdkVersion(29)
minSdk = 26
targetSdk = 36
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -21,27 +19,27 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

repositories {
google()
mavenCentral()
}

val kotlinVersion: String by rootProject.extra
kotlin {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11)
}
}

dependencies {
implementation(fileTree(Pair("dir", "libs"), Pair("include", listOf("*.jar"))))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion")
implementation("androidx.appcompat:appcompat:1.2.0")
implementation("androidx.core:core-ktx:1.3.2")
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
implementation("com.google.android.material:material:1.3.0")
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("androidx.core:core-ktx:1.18.0")
implementation("androidx.constraintlayout:constraintlayout:2.2.1")
implementation("com.google.android.material:material:1.14.0")
implementation(project(":core"))
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test:runner:1.3.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
androidTestImplementation("androidx.test:runner:1.7.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.7.0")
}
5 changes: 2 additions & 3 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="it.krzeminski.fsynth">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand All @@ -9,7 +8,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

Expand Down
9 changes: 5 additions & 4 deletions android/src/main/kotlin/it/krzeminski/fsynth/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ import android.media.AudioFormat
import android.media.AudioManager
import android.media.AudioTrack
import android.media.AudioTrack.WRITE_BLOCKING
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.core.view.plusAssign
import com.google.android.material.button.MaterialButton
import it.krzeminski.fsynth.songs.allSongs
import it.krzeminski.fsynth.types.Song
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val buttons = findViewById<LinearLayout>(R.id.buttons)

allSongs.forEach { song ->
buttons += MaterialButton(this, null, R.attr.materialButtonOutlinedStyle).apply {
buttons.addView(MaterialButton(this, null, com.google.android.material.R.attr.materialButtonOutlinedStyle).apply {
text = song.name
setOnClickListener {
song.playOnAndroid(sampleRate = 44100)
}
}
})
}
}
}
Expand Down
10 changes: 4 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
val kotlinVersion by extra { "1.5.10" }
val kotlinVersion by extra { "2.3.21" }

repositories {
google()
Expand All @@ -9,9 +9,7 @@ buildscript {

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
// As a workaround, the root project knows about the Android project.
// Otherwise, there are some issues with building the Android project.
classpath("com.android.tools.build:gradle:4.2.0")
classpath("com.android.tools.build:gradle:9.2.0")
}
}

Expand All @@ -21,8 +19,8 @@ allprojects {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-progressive"
compilerOptions {
freeCompilerArgs.add("-progressive")
}
}

Expand Down
25 changes: 18 additions & 7 deletions cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ val kotlinVersion: String by rootProject.extra

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("com.github.ajalt:clikt:1.7.0")
implementation("com.github.ajalt.clikt:clikt:5.1.0")
implementation(project(":core"))

testImplementation("junit:junit:4.13.2")
Expand All @@ -18,21 +18,28 @@ dependencies {
}

application {
mainClassName = "it.krzeminski.fsynth.ConsoleEntryPointKt"
mainClass = "it.krzeminski.fsynth.ConsoleEntryPointKt"
applicationName = "fsynth"
}

val compileKotlin: org.jetbrains.kotlin.gradle.tasks.KotlinCompile by tasks
compileKotlin.kotlinOptions.jvmTarget = "1.8"
kotlin {
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
}
}

java {
targetCompatibility = JavaVersion.VERSION_17
}

jacoco {
toolVersion = "0.8.3"
toolVersion = "0.8.14"
}

val jacocoTestReport = tasks.getByName<JacocoReport>("jacocoTestReport") {
reports {
xml.isEnabled = true
html.isEnabled = true
xml.required.set(true)
html.required.set(true)
}

afterEvaluate {
Expand All @@ -51,3 +58,7 @@ val jacocoTestReport = tasks.getByName<JacocoReport>("jacocoTestReport") {
}

tasks.getByName("check").dependsOn(jacocoTestReport)

tasks.withType<Test>().configureEach {
failOnNoDiscoveredTests = false
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package it.krzeminski.fsynth

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.core.main
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
Expand Down
19 changes: 10 additions & 9 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import org.ajoberstar.grgit.Grgit

plugins {
kotlin("multiplatform")
id("org.ajoberstar.grgit") version "4.1.1"
id("org.ajoberstar.grgit") version "5.3.2"
}

val generatedDir = layout.buildDirectory.dir("generated-src").get().asFile

kotlin {
jvm {
}
Expand All @@ -16,7 +18,7 @@ kotlin {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
}
kotlin.srcDirs(kotlin.srcDirs, "$buildDir/generated/")
kotlin.srcDirs(kotlin.srcDirs, "$generatedDir/")
}
val commonTest by getting {
dependencies {
Expand Down Expand Up @@ -51,7 +53,7 @@ kotlin {

val generateGitInfo = tasks.register("generateGitInfo") {
val grgit = Grgit.open(mapOf("currentDir" to project.rootDir))
val fileDirectory = "$buildDir/generated/it/krzeminski/fsynth/generated"
val fileDirectory = "$generatedDir/it/krzeminski/fsynth/generated"
val fileName = "GitInfo.kt"

val sha1 = grgit.head().id
Expand All @@ -76,12 +78,11 @@ val generateGitInfo = tasks.register("generateGitInfo") {
}
}

// There's no easy way to express that 'generateGitInfo' task needs to be executed before any code is compiled.
// That's why a dependency on this task is added to all known tasks that deal with compiling code, so that this file
// already exists when code for any platform is about to be compiled.
tasks.getByName("compileKotlinJs").dependsOn(generateGitInfo)
tasks.getByName("compileKotlinJvm").dependsOn(generateGitInfo)
tasks.getByName("compileKotlinMetadata").dependsOn(generateGitInfo)
tasks.configureEach {
if (name.startsWith("compileKotlin")) {
dependsOn(generateGitInfo)
}
}

tasks.named<org.gradle.jvm.tasks.Jar>("metadataSourcesJar") {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m
org.gradle.parallel=false
kotlin.js.yarn.ignore-engines=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 5 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading