Skip to content

Commit

Permalink
Update to a version of layoutlib that runs with JDK 11
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodbx committed Oct 2, 2020
1 parent 4c7dbbd commit 260046c
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
java-version:
- 1.8
- 11

steps:
- name: (Temp) Remove Platforms 30
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8
11
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: android
dist: trusty

jdk:
- openjdk8
- openjdk11

android:
components:
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
ext.versions = [
kotlin: '1.4.10',
agp: '3.6.1',
layoutlib: '4.0.0-alpha01-1a8ff9c', // "should" be similar to versions.agp
androidTools: '26.5.0', // agp + 23.0.0 = androidTools
layoutlib: '4.0.0-alpha02-b169460', // "should" be similar to versions.agp
androidTools: '26.6.0', // agp + 23.0.0 = androidTools
jcodec: '0.2.5',
moshi: '1.10.0',
bytebuddy: '1.10.14',
Expand Down Expand Up @@ -36,7 +36,7 @@ buildscript {
androidx: [
annotations: 'androidx.annotation:annotation:1.1.0'
],
layoutlib: "app.cash.paparazzi:layoutlib:${versions.layoutlib}",
layoutlib: "app.cash.paparazzi:layoutlib-jdk11:${versions.layoutlib}",
okio: 'com.squareup.okio:okio:2.8.0',
moshi: [
core: "com.squareup.moshi:moshi:${versions.moshi}",
Expand Down
12 changes: 6 additions & 6 deletions libs/layoutlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ task cloneLayoutlib() {
dir = repoDir
}
repo.checkout {
// maps to this commit: https://android.googlesource.com/platform/prebuilts/studio/layoutlib/+/1a8ff9cfb0310892adc44d7c0d9e143a286c9aa0
// which is based on Android Q and puts us closer to the version released in Android Studio 4.0
branch = '1a8ff9c'
// maps to this commit: https://android.googlesource.com/platform/prebuilts/studio/layoutlib/+/b169460c8473a1e87aafa01da881556682fa4f86
// which runs on JDK 11
branch = 'b169460'
}
}

ext.layoutlibJar = new File("$repoDir/data/layoutlib.jar")
ext.layoutlibJar = new File("$repoDir/data/layoutlib-jdk11.jar")
}

task sourcesJar(type: Jar) {
Expand All @@ -51,8 +51,8 @@ publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'app.cash.paparazzi'
artifactId = 'layoutlib'
version = '4.0.0-alpha01-1a8ff9c'
artifactId = 'layoutlib-jdk11'
version = '4.0.0-alpha02-b169460'

pom {
name = "layoutlib"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions paparazzi/src/main/java/app/cash/paparazzi/Paparazzi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ class Paparazzi(
versionClass
.getDeclaredField("SDK_INT")
.apply {
isAccessible = true
modifiersField.setInt(this, modifiers and Modifier.FINAL.inv())
setInt(null, compileSdkVersion)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ internal class Renderer(
DeviceConfig.loadProperties(buildProp),
fontLocation,
null,
null,
DeviceConfig.getEnumMap(attrs),
logger
)
Expand Down

0 comments on commit 260046c

Please sign in to comment.