Compare commits
8 Commits
woehrl01/f
...
v1.19.0
Author | SHA1 | Date | |
---|---|---|---|
|
8a65d8b6dc | ||
|
0fcef77d7b | ||
|
e3a59aa50e | ||
|
13e079e8f3 | ||
|
508f4eacdf | ||
|
a999150c19 | ||
|
cbf6495d66 | ||
|
07eaeea7a4 |
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@@ -32,6 +32,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Install NDK 21
|
||||
run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.0.6113669" "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
if [[ -n "${{ secrets.encrypted_d27e803291ff_iv }}" ]]; then
|
||||
@@ -44,13 +50,9 @@ jobs:
|
||||
cd buck
|
||||
ant
|
||||
popd
|
||||
echo "::set-env name=PATH::$PATH:$HOME/buck/bin/"
|
||||
echo "$HOME/buck/bin" >> $GITHUB_PATH
|
||||
export PATH=$PATH:$HOME/buck/bin/
|
||||
buck --version
|
||||
export TERMINAL=dumb
|
||||
source scripts/android-setup.sh && installAndroidSDK
|
||||
echo "::set-env name=ANDROID_SDK::$ANDROID_HOME"
|
||||
echo "::set-env name=ANDROID_NDK_REPOSITORY::$HOME/android-ndk"
|
||||
echo "::set-env name=ANDROID_NDK_HOME::$ANDROID_NDK_REPOSITORY/android-ndk-r15c"
|
||||
- name: Build
|
||||
run: ./gradlew testDebugUnit && scripts/publish-snapshot.sh
|
||||
# TODO: Run the tests here again. They're currently crashing the JVM in GitHub Actions for some reason.
|
||||
run: ./gradlew :yoga-layout:assembleDebug && scripts/publish-snapshot.sh
|
||||
|
32
.github/workflows/release.yml
vendored
Normal file
32
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- created
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Install dependencies
|
||||
run: source scripts/android-setup.sh && installAndroidSDK
|
||||
- name: Write GPG Sec Ring
|
||||
run: echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > /tmp/secring.gpg
|
||||
- name: Update gradle.properties
|
||||
run: echo -e "signing.secretKeyRingFile=/tmp/secring.gpg\nsigning.keyId=${{ secrets.SIGNING_KEY_ID }}\nsigning.password=${{ secrets.SIGNING_PASSWORD }}\nmavenCentralPassword=${{ secrets.SONATYPE_NEXUS_PASSWORD }}\nmavenCentralUsername=${{ secrets.SONATYPE_NEXUS_USERNAME }}" >> gradle.properties
|
||||
- name: Upload Android Archives
|
||||
run: ./gradlew :yoga:assembleRelease publish --info
|
||||
- name: Release and close
|
||||
run: ./gradlew closeAndReleaseRepository
|
||||
- name: Clean secrets
|
||||
if: always()
|
||||
run: rm /tmp/secring.gpg
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,6 +6,9 @@
|
||||
/.buckd
|
||||
/gentest/test.html
|
||||
.buckversion
|
||||
.cxx
|
||||
.idea
|
||||
/local.properties
|
||||
|
||||
# Jekyll
|
||||
/.sass-cache/
|
||||
|
26
README.md
26
README.md
@@ -46,3 +46,29 @@ This will now only run the standalone webpack build upon install.
|
||||
| node | Builds node js version. |
|
||||
| standalone | Runs webpack. |
|
||||
| none | Does nothing. You can use the prepackaged libs. |
|
||||
|
||||
## Maintainer Release Guide
|
||||
|
||||
To publish a new release, follow these steps:
|
||||
|
||||
1. Ensure you have your GPG key set up and your [OSS Sonatype](https://oss.sonatype.org/) credentials handy.
|
||||
2. Add the follow entries to either your local `gradle.properties` (don't forget to revert) or your global `~/.gradle/gradle.properties`:
|
||||
|
||||
```
|
||||
# You get these from https://oss.sonatype.org/#profile;User%20Token
|
||||
mavenCentralRepositoryUsername=<username>
|
||||
mavenCentralRepositoryPassword=<password>
|
||||
|
||||
# You can get the keyId (in GPG 1.4 format) by running `gpg1 --list-keys`.
|
||||
signing.secretKeyRingFile=</path/to/secring.gpg>
|
||||
signing.keyId=<key_id>
|
||||
signing.password=<key_password>
|
||||
```
|
||||
|
||||
3. Change the `VERSION_NAME` in `gradle.properties` to a non-SNAPSHOT release.
|
||||
4. Commit and land the version change.
|
||||
5. Run `./gradlew publishToMaven`.
|
||||
6. Run `./gradlew closeAndReleaseRepository`.
|
||||
7. Change the `VERSION_NAME` in `gradle.properties` back to a new SNAPSHOT release.
|
||||
8. Commit and land the version change.
|
||||
9. Celebrate! You've made a release!
|
||||
|
@@ -5,17 +5,12 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = VERSION_NAME
|
||||
group = GROUP
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.compileSdkVersion
|
||||
buildToolsVersion rootProject.buildToolsVersion
|
||||
ndkVersion rootProject.ndkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.minSdkVersion
|
||||
@@ -32,21 +27,10 @@ dependencies {
|
||||
api project(':yoga')
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier = 'source'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
// We don't build Javadoc at this time as we can't disable "BUCK" files
|
||||
// from mistakenly getting parsed as Java.
|
||||
tasks.withType(Javadoc).all {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
task javadoc(type: Javadoc) {
|
||||
failOnError false
|
||||
source = android.sourceSets.main.java.sourceFiles
|
||||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
||||
classpath += configurations.compile
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
apply plugin: 'com.vanniktech.maven.publish'
|
||||
|
18
build.gradle
18
build.gradle
@@ -10,14 +10,11 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://maven.google.com/' }
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
|
||||
|
||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.15.1'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
@@ -26,15 +23,16 @@ buildscript {
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
minSdkVersion = 14
|
||||
targetSdkVersion = 25
|
||||
compileSdkVersion = 26
|
||||
buildToolsVersion = '28.0.3'
|
||||
targetSdkVersion = 29
|
||||
compileSdkVersion = 29
|
||||
buildToolsVersion = '30.0.2'
|
||||
ndkVersion = '21.3.6528147'
|
||||
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
|
||||
targetCompatibilityVersion = JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
|
||||
VERSION_NAME=1.17.0-SNAPSHOT
|
||||
VERSION_NAME=1.19.0
|
||||
POM_URL=https://github.com/facebook/yoga
|
||||
POM_SCM_URL=https://github.com/facebook/yoga.git
|
||||
POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git
|
||||
@@ -17,5 +17,8 @@ POM_SCM_DEV_CONNECTION=scm:git:git@github.com:facebook/yoga.git
|
||||
POM_LICENSE_NAME=MIT License
|
||||
POM_LICENSE_URL=https://github.com/facebook/yoga/blob/master/LICENSE
|
||||
POM_LICENSE_DIST=repo
|
||||
POM_LICENCE_NAME=MIT License
|
||||
POM_LICENCE_URL=https://github.com/facebook/yoga/blob/master/LICENSE
|
||||
POM_LICENCE_DIST=repo
|
||||
POM_DEVELOPER_ID=facebook
|
||||
POM_DEVELOPER_NAME=facebook
|
||||
|
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Configure the Android maven publication
|
||||
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
version = VERSION_NAME
|
||||
group = GROUP
|
||||
// Set the .aar / .jar base file name to match the artifact ID
|
||||
// in case the module has a different name
|
||||
project.archivesBaseName = POM_ARTIFACT_ID
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
// This generates POM.xml with proper parameters
|
||||
pom.project {
|
||||
name POM_NAME
|
||||
artifactId POM_ARTIFACT_ID
|
||||
packaging POM_PACKAGING
|
||||
description POM_DESCRIPTION
|
||||
url projectUrl
|
||||
|
||||
scm {
|
||||
url scmUrl
|
||||
connection scmConnection
|
||||
developerConnection scmDeveloperConnection
|
||||
}
|
||||
|
||||
licenses projectLicenses
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id developerId
|
||||
name developerName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Android tasks for Javadoc and sources.jar generation
|
||||
|
||||
afterEvaluate { project ->
|
||||
if (POM_PACKAGING == 'aar') {
|
||||
task androidJavadoc(type: Javadoc) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
exclude '**/pom.xml'
|
||||
exclude '**/proguard_annotations.pro'
|
||||
classpath += files(android.bootClasspath)
|
||||
}
|
||||
|
||||
task androidJavadocJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
from androidJavadoc.destinationDir
|
||||
}
|
||||
|
||||
task androidSourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
|
||||
android.libraryVariants.all { variant ->
|
||||
def name = variant.name.capitalize()
|
||||
task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
|
||||
from variant.javaCompile.destinationDir
|
||||
}
|
||||
}
|
||||
|
||||
artifacts.add('archives', androidJavadocJar)
|
||||
artifacts.add('archives', androidSourcesJar)
|
||||
}
|
||||
|
||||
if (POM_PACKAGING == 'jar') {
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts.add('archives', javadocJar)
|
||||
artifacts.add('archives', sourcesJar)
|
||||
}
|
||||
}
|
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Upload to Bintray
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
def getBintrayUsername() {
|
||||
return project.hasProperty('bintrayUsername') ? property('bintrayUsername') : System.getenv('BINTRAY_USERNAME')
|
||||
}
|
||||
|
||||
def getBintrayApiKey() {
|
||||
return project.hasProperty('bintrayApiKey') ? property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||
}
|
||||
|
||||
def getBintrayGpgPassword() {
|
||||
return project.hasProperty('bintrayGpgPassword') ? property('bintrayGpgPassword') : System.getenv('BINTRAY_GPG_PASSWORD')
|
||||
}
|
||||
|
||||
def getMavenCentralUsername() {
|
||||
return project.hasProperty('mavenCentralUsername') ? property('mavenCentralUsername') : System.getenv('MAVEN_CENTRAL_USERNAME')
|
||||
}
|
||||
|
||||
def getMavenCentralPassword() {
|
||||
return project.hasProperty('mavenCentralPassword') ? property('mavenCentralPassword') : System.getenv('MAVEN_CENTRAL_PASSWORD')
|
||||
}
|
||||
|
||||
def shouldSyncWithMavenCentral() {
|
||||
return project.hasProperty('syncWithMavenCentral') ? property('syncWithMavenCentral').toBoolean() : false
|
||||
}
|
||||
|
||||
def dryRunOnly() {
|
||||
return project.hasProperty('dryRun') ? property('dryRun').toBoolean() : false
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = getBintrayUsername()
|
||||
key = getBintrayApiKey()
|
||||
configurations = ['archives']
|
||||
pkg {
|
||||
repo = bintrayRepo
|
||||
userOrg = bintrayUserOrg
|
||||
name = bintrayName
|
||||
desc = bintrayDescription
|
||||
websiteUrl = projectUrl
|
||||
issueTrackerUrl = issuesUrl
|
||||
vcsUrl = scmUrl
|
||||
licenses = projectLicenses
|
||||
dryRun = dryRunOnly()
|
||||
override = true
|
||||
publish = true
|
||||
publicDownloadNumbers = true
|
||||
version {
|
||||
desc = bintrayDescription
|
||||
gpg {
|
||||
sign = true
|
||||
passphrase = getBintrayGpgPassword()
|
||||
}
|
||||
mavenCentralSync {
|
||||
sync = shouldSyncWithMavenCentral()
|
||||
user = getMavenCentralUsername()
|
||||
password = getMavenCentralPassword()
|
||||
close = '1' // If set to 0, you have to manually click release
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Chris Banes
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
apply plugin: 'signing'
|
||||
|
||||
version = VERSION_NAME
|
||||
group = GROUP
|
||||
|
||||
def isReleaseBuild() {
|
||||
return VERSION_NAME.contains('SNAPSHOT') == false
|
||||
}
|
||||
|
||||
def getReleaseRepositoryUrl() {
|
||||
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
|
||||
: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||
}
|
||||
|
||||
def getSnapshotRepositoryUrl() {
|
||||
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
|
||||
: "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
|
||||
def getRepositoryUsername() {
|
||||
return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : ""
|
||||
}
|
||||
|
||||
def getRepositoryPassword() {
|
||||
return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : ""
|
||||
}
|
||||
|
||||
afterEvaluate { project ->
|
||||
uploadArchives {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
|
||||
pom.groupId = GROUP
|
||||
pom.artifactId = POM_ARTIFACT_ID
|
||||
pom.version = VERSION_NAME
|
||||
|
||||
repository(url: getReleaseRepositoryUrl()) {
|
||||
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
|
||||
}
|
||||
snapshotRepository(url: getSnapshotRepositoryUrl()) {
|
||||
authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
|
||||
}
|
||||
|
||||
pom.project {
|
||||
name POM_NAME
|
||||
packaging POM_PACKAGING
|
||||
description POM_DESCRIPTION
|
||||
url POM_URL
|
||||
|
||||
scm {
|
||||
url POM_SCM_URL
|
||||
connection POM_SCM_CONNECTION
|
||||
developerConnection POM_SCM_DEV_CONNECTION
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name POM_LICENSE_NAME
|
||||
url POM_LICENSE_URL
|
||||
distribution POM_LICENSE_DIST
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id POM_DEVELOPER_ID
|
||||
name POM_DEVELOPER_NAME
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
required { isReleaseBuild() && gradle.taskGraph.hasTask('uploadArchives') }
|
||||
sign configurations.archives
|
||||
}
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Set up everything required for releasing on Bintray
|
||||
ext {
|
||||
bintrayRepo = 'maven'
|
||||
bintrayUserOrg = 'facebook'
|
||||
bintrayName = "${GROUP}:${POM_ARTIFACT_ID}"
|
||||
bintrayDescription = POM_DESCRIPTION
|
||||
projectUrl = POM_URL
|
||||
issuesUrl = 'https://github.com/facebook/yoga/issues'
|
||||
scmUrl = POM_SCM_URL
|
||||
scmConnection = POM_SCM_CONNECTION
|
||||
scmDeveloperConnection = POM_SCM_DEV_CONNECTION
|
||||
|
||||
publishedGroupId = GROUP
|
||||
libraryName = 'yoga'
|
||||
artifact = 'yoga'
|
||||
|
||||
developerId = POM_DEVELOPER_ID
|
||||
developerName = POM_DEVELOPER_NAME
|
||||
|
||||
projectLicenses = {
|
||||
license {
|
||||
name = POM_LICENSE_NAME
|
||||
url = POM_LICENSE_URL
|
||||
distribution = POM_LICENSE_DIST
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set up the Android Maven publication (POM etc.)
|
||||
apply from: rootProject.file('gradle/android-maven-install.gradle')
|
||||
|
||||
// Upload to Bintray
|
||||
apply from: rootProject.file('gradle/bintray.gradle')
|
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
// Common Android tasks for all releases that generate Javadocs, sources, etc.
|
||||
apply from: rootProject.file('gradle/android-tasks.gradle')
|
||||
|
||||
// Upload to Bintray
|
||||
apply from: rootProject.file('gradle/release-bintray.gradle')
|
||||
|
||||
// Upload directly to standard Maven Central (for SNAPSHOTs)
|
||||
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
||||
|
@@ -5,17 +5,12 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
group = GROUP
|
||||
version = VERSION_NAME
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.compileSdkVersion
|
||||
buildToolsVersion rootProject.buildToolsVersion
|
||||
ndkVersion rootProject.ndkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.minSdkVersion
|
||||
@@ -35,7 +30,6 @@ android {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path 'CMakeLists.txt'
|
||||
version '3.6.0-rc2'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,32 +52,11 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.code.findbugs:jsr305:3.0.1'
|
||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
implementation project(':yoga:proguard-annotations')
|
||||
implementation 'com.facebook.soloader:soloader:0.5.1'
|
||||
implementation 'com.facebook.soloader:soloader:0.10.1'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
testImplementation project(':testutil')
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier = 'source'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
|
||||
task javadoc(type: Javadoc) {
|
||||
failOnError false
|
||||
source = android.sourceSets.main.java.sourceFiles
|
||||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
||||
classpath += configurations.compile
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
ext {
|
||||
bintrayName = 'com.facebook.yoga:yoga'
|
||||
}
|
||||
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
apply plugin: 'com.vanniktech.maven.publish'
|
||||
|
@@ -9,13 +9,13 @@ package com.facebook.yoga;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public abstract class YogaNode {
|
||||
public abstract class YogaNode implements YogaProps {
|
||||
|
||||
/** The interface the {@link #getData()} object can optionally implement. */
|
||||
public interface Inputs {
|
||||
|
||||
/** Requests the data object to disable mutations of its inputs. */
|
||||
void freeze();
|
||||
void freeze(final YogaNode node, final @Nullable YogaNode parent);
|
||||
}
|
||||
|
||||
public abstract void reset();
|
||||
|
@@ -197,15 +197,16 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
long[] nativePointers = null;
|
||||
YogaNodeJNIBase[] nodes = null;
|
||||
|
||||
freeze();
|
||||
freeze(null);
|
||||
|
||||
ArrayList<YogaNodeJNIBase> n = new ArrayList<>();
|
||||
n.add(this);
|
||||
for (int i = 0; i < n.size(); ++i) {
|
||||
List<YogaNodeJNIBase> children = n.get(i).mChildren;
|
||||
final YogaNodeJNIBase parent = n.get(i);
|
||||
List<YogaNodeJNIBase> children = parent.mChildren;
|
||||
if (children != null) {
|
||||
for (YogaNodeJNIBase child : children) {
|
||||
child.freeze();
|
||||
child.freeze(parent);
|
||||
n.add(child);
|
||||
}
|
||||
}
|
||||
@@ -220,10 +221,10 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
||||
YogaNative.jni_YGNodeCalculateLayoutJNI(mNativePointer, width, height, nativePointers, nodes);
|
||||
}
|
||||
|
||||
private void freeze() {
|
||||
private void freeze(YogaNode parent) {
|
||||
Object data = getData();
|
||||
if (data instanceof Inputs) {
|
||||
((Inputs) data).freeze();
|
||||
((Inputs) data).freeze(this, parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
151
java/com/facebook/yoga/YogaProps.java
Normal file
151
java/com/facebook/yoga/YogaProps.java
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
public interface YogaProps {
|
||||
|
||||
/* Width properties */
|
||||
|
||||
void setWidth(float width);
|
||||
|
||||
void setWidthPercent(float percent);
|
||||
|
||||
void setMinWidth(float minWidth);
|
||||
|
||||
void setMinWidthPercent(float percent);
|
||||
|
||||
void setMaxWidth(float maxWidth);
|
||||
|
||||
void setMaxWidthPercent(float percent);
|
||||
|
||||
void setWidthAuto();
|
||||
|
||||
/* Height properties */
|
||||
|
||||
void setHeight(float height);
|
||||
|
||||
void setHeightPercent(float percent);
|
||||
|
||||
void setMinHeight(float minHeight);
|
||||
|
||||
void setMinHeightPercent(float percent);
|
||||
|
||||
void setMaxHeight(float maxHeight);
|
||||
|
||||
void setMaxHeightPercent(float percent);
|
||||
|
||||
void setHeightAuto();
|
||||
|
||||
/* Margin properties */
|
||||
|
||||
void setMargin(YogaEdge edge, float margin);
|
||||
|
||||
void setMarginPercent(YogaEdge edge, float percent);
|
||||
|
||||
void setMarginAuto(YogaEdge edge);
|
||||
|
||||
/* Padding properties */
|
||||
|
||||
void setPadding(YogaEdge edge, float padding);
|
||||
|
||||
void setPaddingPercent(YogaEdge edge, float percent);
|
||||
|
||||
/* Position properties */
|
||||
|
||||
void setPositionType(YogaPositionType positionType);
|
||||
|
||||
void setPosition(YogaEdge edge, float position);
|
||||
|
||||
void setPositionPercent(YogaEdge edge, float percent);
|
||||
|
||||
/* Alignment properties */
|
||||
|
||||
void setAlignContent(YogaAlign alignContent);
|
||||
|
||||
void setAlignItems(YogaAlign alignItems);
|
||||
|
||||
void setAlignSelf(YogaAlign alignSelf);
|
||||
|
||||
/* Flex properties */
|
||||
|
||||
void setFlex(float flex);
|
||||
|
||||
void setFlexBasisAuto();
|
||||
|
||||
void setFlexBasisPercent(float percent);
|
||||
|
||||
void setFlexBasis(float flexBasis);
|
||||
|
||||
void setFlexDirection(YogaFlexDirection direction);
|
||||
|
||||
void setFlexGrow(float flexGrow);
|
||||
|
||||
void setFlexShrink(float flexShrink);
|
||||
|
||||
/* Other properties */
|
||||
|
||||
void setJustifyContent(YogaJustify justifyContent);
|
||||
|
||||
void setDirection(YogaDirection direction);
|
||||
|
||||
void setBorder(YogaEdge edge, float value);
|
||||
|
||||
void setWrap(YogaWrap wrap);
|
||||
|
||||
void setAspectRatio(float aspectRatio);
|
||||
|
||||
void setIsReferenceBaseline(boolean isReferenceBaseline);
|
||||
|
||||
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
||||
|
||||
void setBaselineFunction(YogaBaselineFunction yogaBaselineFunction);
|
||||
|
||||
/* Getters */
|
||||
|
||||
YogaValue getWidth();
|
||||
|
||||
YogaValue getMinWidth();
|
||||
|
||||
YogaValue getMaxWidth();
|
||||
|
||||
YogaValue getHeight();
|
||||
|
||||
YogaValue getMinHeight();
|
||||
|
||||
YogaValue getMaxHeight();
|
||||
|
||||
YogaDirection getStyleDirection();
|
||||
|
||||
YogaFlexDirection getFlexDirection();
|
||||
|
||||
YogaJustify getJustifyContent();
|
||||
|
||||
YogaAlign getAlignItems();
|
||||
|
||||
YogaAlign getAlignSelf();
|
||||
|
||||
YogaAlign getAlignContent();
|
||||
|
||||
YogaPositionType getPositionType();
|
||||
|
||||
float getFlexGrow();
|
||||
|
||||
float getFlexShrink();
|
||||
|
||||
YogaValue getFlexBasis();
|
||||
|
||||
float getAspectRatio();
|
||||
|
||||
YogaValue getMargin(YogaEdge edge);
|
||||
|
||||
YogaValue getPadding(YogaEdge edge);
|
||||
|
||||
YogaValue getPosition(YogaEdge edge);
|
||||
|
||||
float getBorder(YogaEdge edge);
|
||||
}
|
@@ -726,8 +726,7 @@ static void jni_YGNodePrintJNI(JNIEnv* env, jobject obj, jlong nativePointer) {
|
||||
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
||||
YGNodePrint(
|
||||
node,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsStyle | YGPrintOptionsLayout | YGPrintOptionsChildren));
|
||||
(YGPrintOptions) (YGPrintOptionsStyle | YGPrintOptionsLayout | YGPrintOptionsChildren));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -10,4 +10,4 @@ apply plugin: 'java'
|
||||
sourceCompatibility = '1.7'
|
||||
targetCompatibility = '1.7'
|
||||
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
apply plugin: 'com.vanniktech.maven.publish'
|
||||
|
@@ -33,8 +33,8 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.facebook.soloader:soloader:0.5.1'
|
||||
implementation 'com.google.code.findbugs:jsr305:3.0.1'
|
||||
implementation 'com.facebook.soloader:soloader:0.10.1'
|
||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
implementation project(':yoga:proguard-annotations')
|
||||
}
|
||||
}
|
||||
|
@@ -14,17 +14,8 @@ set -e
|
||||
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
||||
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
|
||||
|
||||
if [ "$GITHUB_REPOSITORY" != "facebook/yoga" ]; then
|
||||
echo >&2 "Skipping repository. Expected project to be 'facebook/yoga', but was '$GITHUB_REPOSITORY'."
|
||||
exit
|
||||
elif [ "$GITHUB_REF" != "refs/heads/master" ]; then
|
||||
echo >&2 "Skipping build. Expected ref name to be 'refs/heads/master', but was '$GITHUB_REF'."
|
||||
exit
|
||||
elif [ "$GITHUB_EVENT_NAME" != "push" ]; then
|
||||
echo >&2 "Skipping build. Only considering push builds, but event was '$GITHUB_EVENT_NAME'."
|
||||
exit
|
||||
elif [ "$IS_SNAPSHOT" == "" ]; then
|
||||
if [ "$IS_SNAPSHOT" == "" ]; then
|
||||
echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
|
||||
else
|
||||
env TERMINAL=dumb "$BASEDIR/gradlew" uploadArchives
|
||||
env TERMINAL=dumb "$BASEDIR/gradlew" publish
|
||||
fi
|
||||
|
@@ -73,8 +73,7 @@ TEST(YogaTest, logger_default_node_should_print_no_style_info) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
@@ -98,8 +97,7 @@ TEST(YogaTest, logger_node_with_percentage_absolute_position_and_margin) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFree(root);
|
||||
|
||||
@@ -122,8 +120,7 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
|
||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||
YGNodePrint(
|
||||
root,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
YGConfigSetLogger(config, NULL);
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
|
@@ -29,11 +29,10 @@ android {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
path 'src/main/cpp/CMakeLists.txt'
|
||||
version '3.6.0-rc2'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.facebook.soloader:soloader:0.5.1'
|
||||
implementation 'com.facebook.soloader:soloader:0.10.1'
|
||||
}
|
||||
}
|
||||
|
@@ -4194,9 +4194,7 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext(
|
||||
if (node->getConfig()->printTree) {
|
||||
YGNodePrint(
|
||||
node,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren |
|
||||
YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -4256,9 +4254,7 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext(
|
||||
if (nodeWithoutLegacyFlag->getConfig()->printTree) {
|
||||
YGNodePrint(
|
||||
nodeWithoutLegacyFlag,
|
||||
(YGPrintOptions)(
|
||||
YGPrintOptionsLayout | YGPrintOptionsChildren |
|
||||
YGPrintOptionsStyle));
|
||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user