Skip to content

Commit

Permalink
Re-enable and fix the sample project building off master (#2278)
Browse files Browse the repository at this point in the history
* Re-enable and fix the sample project building off master

* Fix spotless

* Run the sample build on a separate worker

* Add gradlew.bat

* Update sample/web/build.gradle

Co-authored-by: Derek Ellis <derek@llamabagel.ca>

* Run build inside the sample directory

Co-authored-by: Derek Ellis <derek@llamabagel.ca>
  • Loading branch information
Alec Strong and dellisd committed Apr 15, 2021
1 parent 6381dab commit 9fbcd6a
Show file tree
Hide file tree
Showing 19 changed files with 386 additions and 48 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/PR.yml
Expand Up @@ -19,8 +19,6 @@ jobs:
job: gradle-plugin-tests
- os: windows-latest
job: gradle-plugin-integrations
- os: macOS-latest
job: gradle-plugin-tests
- os: macOS-latest
job: gradle-plugin-integrations

Expand Down Expand Up @@ -73,6 +71,11 @@ jobs:
- name: Run ios tests
if: matrix.os == 'macOS-latest' && matrix.job == 'test'
run: ./gradlew iosX64Test --stacktrace
- name: Build the sample
if: matrix.os == 'macOS-latest' && matrix.job == 'gradle-plugin-tests'
run: |
cd sample
./gradlew build
- name: Bundle the build report
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -13,7 +13,7 @@ buildscript {
url 'https://jitpack.io'
}
maven { url 'https://www.jetbrains.com/intellij-repository/releases' }
maven { url "https://jetbrains.bintray.com/intellij-third-party-dependencies" }
maven { url "https://cache-redirector.jetbrains.com/intellij-dependencies" }
}

dependencies {
Expand Down Expand Up @@ -53,7 +53,7 @@ allprojects {
google()
jcenter()
maven { url 'https://www.jetbrains.com/intellij-repository/releases' }
maven { url "https://jetbrains.bintray.com/intellij-third-party-dependencies" }
maven { url "https://cache-redirector.jetbrains.com/intellij-dependencies" }
}

tasks.withType(Test).configureEach {
Expand Down
1 change: 0 additions & 1 deletion gradle/dependencies.gradle
Expand Up @@ -6,7 +6,6 @@ ext.versions = [
androidxSqlite: '2.1.0',
minSdk: 14,
schemaCrawler: '14.16.04.01-java7',
sqldelight: '1.3.0-SNAPSHOT',
stately: '1.1.1',
sqliter: '0.7.0',
testhelp: '0.4.0',
Expand Down
11 changes: 3 additions & 8 deletions sample/android/build.gradle
Expand Up @@ -4,17 +4,12 @@ apply plugin: 'org.jetbrains.kotlin.android'
android {
compileSdkVersion versions.compileSdk

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

lintOptions {
textOutput 'stdout'
}

defaultConfig {
minSdkVersion 14
minSdkVersion 21
targetSdkVersion versions.compileSdk

applicationId 'com.example.sqldelight.hockey'
Expand All @@ -41,9 +36,9 @@ android {
}

dependencies {
implementation project(':sample:common')
implementation project(':common')

implementation deps.androidx.recyclerView

implementation "com.squareup.sqldelight:android-driver:${versions.sqldelight}"
implementation "com.squareup.sqldelight:android-driver"
}
47 changes: 47 additions & 0 deletions sample/build.gradle
@@ -0,0 +1,47 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
apply from: "$rootDir/../gradle/dependencies.gradle"

repositories {
mavenCentral()
google()
maven { url 'https://www.jetbrains.com/intellij-repository/releases' }
maven { url "https://cache-redirector.jetbrains.com/intellij-dependencies" }
}

dependencies {
classpath deps.plugins.kotlin
classpath deps.plugins.android
classpath "com.squareup.sqldelight:gradle-plugin"
}
}

apply from: "$rootDir/../gradle/dependencies.gradle"


allprojects {
repositories {
mavenCentral()
google()
maven { url 'https://dl.bintray.com/kotlin/kotlinx' }
}

plugins.withId("org.jetbrains.kotlin.jvm") {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

plugins.withId("com.android.library") {
extensions.getByName("android").compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
17 changes: 9 additions & 8 deletions sample/common/build.gradle
Expand Up @@ -8,6 +8,7 @@ sqldelight {
HockeyDb {
packageName = "com.example.sqldelight.hockey"
}
linkSqlite = true
}

version = 1.0
Expand All @@ -26,12 +27,11 @@ kotlin {
jvm()
sourceSets.jvmTest.dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
implementation "com.squareup.sqldelight:sqlite-driver:${versions.sqldelight}"
implementation "com.squareup.sqldelight:sqlite-driver"
}

// Configure web.
// Disable temporarily
/*js {
js {
useCommonJs()
browser {
testTask {
Expand All @@ -46,10 +46,10 @@ kotlin {
implementation npm('dateformat', '3.0.3')
}
sourceSets.jsTest.dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-js'
implementation deps.kotlin.coroutines.js
implementation project(':drivers:sqljs-driver')
}*/
implementation "org.jetbrains.kotlin:kotlin-test-js"
implementation deps.kotlin.coroutines.core
implementation "com.squareup.sqldelight:sqljs-driver"
}

// Configure iOS.
def sdkName = System.getenv("SDK_NAME")
Expand All @@ -59,8 +59,9 @@ kotlin {
iosX64("ios")
}
sourceSets.iosMain.dependencies {
implementation "com.squareup.sqldelight:native-driver:${versions.sqldelight}"
implementation "com.squareup.sqldelight:native-driver"
}

cocoapods {
summary = "Common core for SQLDelight sample."
homepage = "https://github.com/cashapp/sqldelight/tree/master/sample/common"
Expand Down
12 changes: 7 additions & 5 deletions sample/common/common.podspec
Expand Up @@ -8,11 +8,13 @@ Pod::Spec.new do |spec|
spec.summary = 'Common core for SQLDelight sample.'

spec.static_framework = true
spec.vendored_frameworks = "build/cocoapods/framework/#{spec.name}.framework"
spec.libraries = "c++", 'sqlite3'
spec.vendored_frameworks = "build/cocoapods/framework/common.framework"
spec.libraries = "c++", "sqlite3"
spec.module_name = "#{spec.name}_umbrella"






spec.pod_target_xcconfig = {
'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64',
Expand All @@ -32,7 +34,7 @@ Pod::Spec.new do |spec|
:script => <<-SCRIPT
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../../gradlew" -p "$REPO_ROOT" :sample:common:syncFramework \
"$REPO_ROOT/../gradlew" -p "$REPO_ROOT" :common:syncFramework \
-Pkotlin.native.cocoapods.target=$KOTLIN_TARGET \
-Pkotlin.native.cocoapods.configuration=$CONFIGURATION \
-Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \
Expand All @@ -41,4 +43,4 @@ Pod::Spec.new do |spec|
SCRIPT
}
]
end
end
Expand Up @@ -4,6 +4,8 @@ import com.squareup.sqldelight.ColumnAdapter
import platform.Foundation.NSCalendar
import platform.Foundation.NSDate
import platform.Foundation.NSDateComponents
import platform.Foundation.dateWithTimeIntervalSince1970
import platform.Foundation.timeIntervalSince1970
import kotlin.math.floor

actual class Date internal constructor(internal val nsDate: NSDate) {
Expand Down
2 changes: 2 additions & 0 deletions sample/gradle.properties
@@ -0,0 +1,2 @@
android.useAndroidX=true
kotlin.js.compiler=ir
Binary file added sample/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions sample/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 9fbcd6a

Please sign in to comment.