Compare commits
3 Commits
v1.19.0
...
woehrl01/f
Author | SHA1 | Date | |
---|---|---|---|
|
ce8b27b235 | ||
|
b61a63669c | ||
|
2e9c2d4d7a |
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
@@ -32,12 +32,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- 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
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
if [[ -n "${{ secrets.encrypted_d27e803291ff_iv }}" ]]; then
|
if [[ -n "${{ secrets.encrypted_d27e803291ff_iv }}" ]]; then
|
||||||
@@ -50,9 +44,13 @@ jobs:
|
|||||||
cd buck
|
cd buck
|
||||||
ant
|
ant
|
||||||
popd
|
popd
|
||||||
echo "$HOME/buck/bin" >> $GITHUB_PATH
|
echo "::set-env name=PATH::$PATH:$HOME/buck/bin/"
|
||||||
export PATH=$PATH:$HOME/buck/bin/
|
export PATH=$PATH:$HOME/buck/bin/
|
||||||
buck --version
|
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
|
- name: Build
|
||||||
# TODO: Run the tests here again. They're currently crashing the JVM in GitHub Actions for some reason.
|
run: ./gradlew testDebugUnit && scripts/publish-snapshot.sh
|
||||||
run: ./gradlew :yoga-layout:assembleDebug && scripts/publish-snapshot.sh
|
|
||||||
|
32
.github/workflows/release.yml
vendored
32
.github/workflows/release.yml
vendored
@@ -1,32 +0,0 @@
|
|||||||
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,9 +6,6 @@
|
|||||||
/.buckd
|
/.buckd
|
||||||
/gentest/test.html
|
/gentest/test.html
|
||||||
.buckversion
|
.buckversion
|
||||||
.cxx
|
|
||||||
.idea
|
|
||||||
/local.properties
|
|
||||||
|
|
||||||
# Jekyll
|
# Jekyll
|
||||||
/.sass-cache/
|
/.sass-cache/
|
||||||
|
26
README.md
26
README.md
@@ -46,29 +46,3 @@ This will now only run the standalone webpack build upon install.
|
|||||||
| node | Builds node js version. |
|
| node | Builds node js version. |
|
||||||
| standalone | Runs webpack. |
|
| standalone | Runs webpack. |
|
||||||
| none | Does nothing. You can use the prepackaged libs. |
|
| 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,12 +5,17 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
apply plugin: 'com.jfrog.bintray'
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
version = VERSION_NAME
|
||||||
|
group = GROUP
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion rootProject.compileSdkVersion
|
compileSdkVersion rootProject.compileSdkVersion
|
||||||
buildToolsVersion rootProject.buildToolsVersion
|
buildToolsVersion rootProject.buildToolsVersion
|
||||||
ndkVersion rootProject.ndkVersion
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion rootProject.minSdkVersion
|
minSdkVersion rootProject.minSdkVersion
|
||||||
@@ -27,10 +32,21 @@ dependencies {
|
|||||||
api project(':yoga')
|
api project(':yoga')
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't build Javadoc at this time as we can't disable "BUCK" files
|
task sourcesJar(type: Jar) {
|
||||||
// from mistakenly getting parsed as Java.
|
classifier = 'source'
|
||||||
tasks.withType(Javadoc).all {
|
from android.sourceSets.main.java.srcDirs
|
||||||
enabled = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.vanniktech.maven.publish'
|
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')
|
||||||
|
18
build.gradle
18
build.gradle
@@ -10,11 +10,14 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
|
maven { url 'https://maven.google.com/' }
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
classpath 'com.android.tools.build:gradle:3.1.0'
|
||||||
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.15.1'
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
||||||
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
}
|
}
|
||||||
@@ -23,16 +26,15 @@ buildscript {
|
|||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
jcenter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
minSdkVersion = 14
|
minSdkVersion = 14
|
||||||
targetSdkVersion = 29
|
targetSdkVersion = 25
|
||||||
compileSdkVersion = 29
|
compileSdkVersion = 26
|
||||||
buildToolsVersion = '30.0.2'
|
buildToolsVersion = '28.0.3'
|
||||||
ndkVersion = '21.3.6528147'
|
|
||||||
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
|
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
|
||||||
targetCompatibilityVersion = JavaVersion.VERSION_1_7
|
targetCompatibilityVersion = JavaVersion.VERSION_1_7
|
||||||
}
|
}
|
||||||
|
@@ -107,3 +107,9 @@
|
|||||||
<div style="width: 100%;"></div>
|
<div style="width: 100%;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="percentage_nested_child" style="flex-direction: row; width: 40px; height: 20px;">
|
||||||
|
<div style="flex-direction: row; width: 10px;">
|
||||||
|
<div style="flex-direction: row; min-width: 50%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
|
|
||||||
VERSION_NAME=1.19.0
|
VERSION_NAME=1.17.0-SNAPSHOT
|
||||||
POM_URL=https://github.com/facebook/yoga
|
POM_URL=https://github.com/facebook/yoga
|
||||||
POM_SCM_URL=https://github.com/facebook/yoga.git
|
POM_SCM_URL=https://github.com/facebook/yoga.git
|
||||||
POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git
|
POM_SCM_CONNECTION=scm:git:https://github.com/facebook/yoga.git
|
||||||
@@ -17,8 +17,5 @@ POM_SCM_DEV_CONNECTION=scm:git:git@github.com:facebook/yoga.git
|
|||||||
POM_LICENSE_NAME=MIT License
|
POM_LICENSE_NAME=MIT License
|
||||||
POM_LICENSE_URL=https://github.com/facebook/yoga/blob/master/LICENSE
|
POM_LICENSE_URL=https://github.com/facebook/yoga/blob/master/LICENSE
|
||||||
POM_LICENSE_DIST=repo
|
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_ID=facebook
|
||||||
POM_DEVELOPER_NAME=facebook
|
POM_DEVELOPER_NAME=facebook
|
||||||
|
44
gradle/android-maven-install.gradle
Normal file
44
gradle/android-maven-install.gradle
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
gradle/android-tasks.gradle
Normal file
54
gradle/android-tasks.gradle
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
}
|
||||||
|
}
|
70
gradle/bintray.gradle
Normal file
70
gradle/bintray.gradle
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
96
gradle/gradle-mvn-push.gradle
Normal file
96
gradle/gradle-mvn-push.gradle
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
}
|
40
gradle/release-bintray.gradle
Normal file
40
gradle/release-bintray.gradle
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* 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')
|
15
gradle/release.gradle
Normal file
15
gradle/release.gradle
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
|
||||||
|
@@ -5,12 +5,17 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
apply plugin: 'com.jfrog.bintray'
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
group = GROUP
|
||||||
|
version = VERSION_NAME
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion rootProject.compileSdkVersion
|
compileSdkVersion rootProject.compileSdkVersion
|
||||||
buildToolsVersion rootProject.buildToolsVersion
|
buildToolsVersion rootProject.buildToolsVersion
|
||||||
ndkVersion rootProject.ndkVersion
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion rootProject.minSdkVersion
|
minSdkVersion rootProject.minSdkVersion
|
||||||
@@ -30,6 +35,7 @@ android {
|
|||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
path 'CMakeLists.txt'
|
path 'CMakeLists.txt'
|
||||||
|
version '3.6.0-rc2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +58,32 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
implementation 'com.google.code.findbugs:jsr305:3.0.1'
|
||||||
implementation project(':yoga:proguard-annotations')
|
implementation project(':yoga:proguard-annotations')
|
||||||
implementation 'com.facebook.soloader:soloader:0.10.1'
|
implementation 'com.facebook.soloader:soloader:0.5.1'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation project(':testutil')
|
testImplementation project(':testutil')
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.vanniktech.maven.publish'
|
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')
|
||||||
|
@@ -9,13 +9,13 @@ package com.facebook.yoga;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class YogaNode implements YogaProps {
|
public abstract class YogaNode {
|
||||||
|
|
||||||
/** The interface the {@link #getData()} object can optionally implement. */
|
/** The interface the {@link #getData()} object can optionally implement. */
|
||||||
public interface Inputs {
|
public interface Inputs {
|
||||||
|
|
||||||
/** Requests the data object to disable mutations of its inputs. */
|
/** Requests the data object to disable mutations of its inputs. */
|
||||||
void freeze(final YogaNode node, final @Nullable YogaNode parent);
|
void freeze();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void reset();
|
public abstract void reset();
|
||||||
|
@@ -197,16 +197,15 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
long[] nativePointers = null;
|
long[] nativePointers = null;
|
||||||
YogaNodeJNIBase[] nodes = null;
|
YogaNodeJNIBase[] nodes = null;
|
||||||
|
|
||||||
freeze(null);
|
freeze();
|
||||||
|
|
||||||
ArrayList<YogaNodeJNIBase> n = new ArrayList<>();
|
ArrayList<YogaNodeJNIBase> n = new ArrayList<>();
|
||||||
n.add(this);
|
n.add(this);
|
||||||
for (int i = 0; i < n.size(); ++i) {
|
for (int i = 0; i < n.size(); ++i) {
|
||||||
final YogaNodeJNIBase parent = n.get(i);
|
List<YogaNodeJNIBase> children = n.get(i).mChildren;
|
||||||
List<YogaNodeJNIBase> children = parent.mChildren;
|
|
||||||
if (children != null) {
|
if (children != null) {
|
||||||
for (YogaNodeJNIBase child : children) {
|
for (YogaNodeJNIBase child : children) {
|
||||||
child.freeze(parent);
|
child.freeze();
|
||||||
n.add(child);
|
n.add(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,10 +220,10 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeCalculateLayoutJNI(mNativePointer, width, height, nativePointers, nodes);
|
YogaNative.jni_YGNodeCalculateLayoutJNI(mNativePointer, width, height, nativePointers, nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void freeze(YogaNode parent) {
|
private void freeze() {
|
||||||
Object data = getData();
|
Object data = getData();
|
||||||
if (data instanceof Inputs) {
|
if (data instanceof Inputs) {
|
||||||
((Inputs) data).freeze(this, parent);
|
((Inputs) data).freeze();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,151 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
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,7 +726,8 @@ static void jni_YGNodePrintJNI(JNIEnv* env, jobject obj, jlong nativePointer) {
|
|||||||
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
||||||
YGNodePrint(
|
YGNodePrint(
|
||||||
node,
|
node,
|
||||||
(YGPrintOptions) (YGPrintOptionsStyle | YGPrintOptionsLayout | YGPrintOptionsChildren));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsStyle | YGPrintOptionsLayout | YGPrintOptionsChildren));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,4 +10,4 @@ apply plugin: 'java'
|
|||||||
sourceCompatibility = '1.7'
|
sourceCompatibility = '1.7'
|
||||||
targetCompatibility = '1.7'
|
targetCompatibility = '1.7'
|
||||||
|
|
||||||
apply plugin: 'com.vanniktech.maven.publish'
|
apply from: rootProject.file('gradle/release.gradle')
|
||||||
|
@@ -33,8 +33,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.facebook.soloader:soloader:0.10.1'
|
implementation 'com.facebook.soloader:soloader:0.5.1'
|
||||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
implementation 'com.google.code.findbugs:jsr305:3.0.1'
|
||||||
implementation project(':yoga:proguard-annotations')
|
implementation project(':yoga:proguard-annotations')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,17 @@ set -e
|
|||||||
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
|
||||||
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
|
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
|
||||||
|
|
||||||
if [ "$IS_SNAPSHOT" == "" ]; then
|
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
|
||||||
echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
|
echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
|
||||||
else
|
else
|
||||||
env TERMINAL=dumb "$BASEDIR/gradlew" publish
|
env TERMINAL=dumb "$BASEDIR/gradlew" uploadArchives
|
||||||
fi
|
fi
|
||||||
|
@@ -73,7 +73,8 @@ TEST(YogaTest, logger_default_node_should_print_no_style_info) {
|
|||||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||||
YGNodePrint(
|
YGNodePrint(
|
||||||
root,
|
root,
|
||||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||||
YGConfigSetLogger(config, NULL);
|
YGConfigSetLogger(config, NULL);
|
||||||
YGNodeFree(root);
|
YGNodeFree(root);
|
||||||
|
|
||||||
@@ -97,7 +98,8 @@ TEST(YogaTest, logger_node_with_percentage_absolute_position_and_margin) {
|
|||||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||||
YGNodePrint(
|
YGNodePrint(
|
||||||
root,
|
root,
|
||||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||||
YGConfigSetLogger(config, NULL);
|
YGConfigSetLogger(config, NULL);
|
||||||
YGNodeFree(root);
|
YGNodeFree(root);
|
||||||
|
|
||||||
@@ -120,7 +122,8 @@ TEST(YogaTest, logger_node_with_children_should_print_indented) {
|
|||||||
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUnitUndefined, YGUnitUndefined, YGDirectionLTR);
|
||||||
YGNodePrint(
|
YGNodePrint(
|
||||||
root,
|
root,
|
||||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
||||||
YGConfigSetLogger(config, NULL);
|
YGConfigSetLogger(config, NULL);
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
@@ -909,3 +909,81 @@ TEST(YogaTest, percent_padding_and_percent_margin_with_measure_func) {
|
|||||||
|
|
||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static YGSize _measureCk_test_label_shrink_based_on_height(
|
||||||
|
YGNodeRef node,
|
||||||
|
float width,
|
||||||
|
YGMeasureMode widthMode,
|
||||||
|
float height,
|
||||||
|
YGMeasureMode heightMode) {
|
||||||
|
|
||||||
|
if (heightMode == YGMeasureModeAtMost) {
|
||||||
|
return YGSize{
|
||||||
|
.width = 290,
|
||||||
|
.height = 103,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return YGSize{
|
||||||
|
.width = 290,
|
||||||
|
.height = height,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, margin_percent_with_measure_func) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root, 320);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetHeight(root_child0_child0, 450);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root_child0_child0_child0, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 5);
|
||||||
|
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child0_child0_child0 =
|
||||||
|
YGNodeNewWithConfig(config);
|
||||||
|
YGNodeSetMeasureFunc(
|
||||||
|
root_child0_child0_child0_child0,
|
||||||
|
_measureCk_test_label_shrink_based_on_height);
|
||||||
|
YGNodeInsertChild(
|
||||||
|
root_child0_child0_child0, root_child0_child0_child0_child0, 0);
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(290, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
* This source code is licensed under the MIT license found in the LICENSE
|
* This source code is licensed under the MIT license found in the LICENSE
|
||||||
* file in the root directory of this source tree.
|
* file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
// @Generated by gentest/gentest.rb from gentest/fixtures/YGPercentageTest.html
|
// @Generated by gentest/gentest.rb from
|
||||||
|
// gentest/fixtures/YGPercentageTest.html
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <yoga/Yoga.h>
|
#include <yoga/Yoga.h>
|
||||||
@@ -273,12 +274,12 @@ TEST(YogaTest, percentage_flex_basis_cross_min_height) {
|
|||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetTop(root_child1));
|
||||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
||||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
@@ -290,12 +291,12 @@ TEST(YogaTest, percentage_flex_basis_cross_min_height) {
|
|||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||||
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetTop(root_child1));
|
||||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child1));
|
||||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
@@ -647,9 +648,7 @@ TEST(YogaTest, percentage_flex_basis_cross_min_width) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(
|
TEST(YogaTest, percentage_multiple_nested_with_padding_margin_and_percentage_values) {
|
||||||
YogaTest,
|
|
||||||
percentage_multiple_nested_with_padding_margin_and_percentage_values) {
|
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
@@ -1194,78 +1193,56 @@ TEST(YogaTest, percent_absolute_position) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
static YGSize _measureCk_test_label_shrink_based_on_height(
|
TEST(YogaTest, percentage_nested_child) {
|
||||||
YGNodeRef node,
|
|
||||||
float width,
|
|
||||||
YGMeasureMode widthMode,
|
|
||||||
float height,
|
|
||||||
YGMeasureMode heightMode) {
|
|
||||||
|
|
||||||
if (heightMode == YGMeasureModeAtMost) {
|
|
||||||
return YGSize{
|
|
||||||
.width = 290,
|
|
||||||
.height = 103,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return YGSize{
|
|
||||||
.width = 290,
|
|
||||||
.height = height,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(YogaTest, margin_percent_with_measure_func) {
|
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root, 320);
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetWidth(root, 40);
|
||||||
|
YGNodeStyleSetHeight(root, 20);
|
||||||
|
|
||||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 10);
|
||||||
YGNodeInsertChild(root, root_child0, 0);
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetHeight(root_child0_child0, 450);
|
YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetMinWidthPercent(root_child0_child0, 50);
|
||||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
|
||||||
YGNodeStyleSetFlexDirection(root_child0_child0_child0, YGFlexDirectionRow);
|
|
||||||
YGNodeStyleSetMarginPercent(root_child0_child0_child0, YGEdgeTop, 5);
|
|
||||||
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
|
||||||
|
|
||||||
const YGNodeRef root_child0_child0_child0_child0 =
|
|
||||||
YGNodeNewWithConfig(config);
|
|
||||||
YGNodeSetMeasureFunc(
|
|
||||||
root_child0_child0_child0_child0,
|
|
||||||
_measureCk_test_label_shrink_based_on_height);
|
|
||||||
YGNodeInsertChild(
|
|
||||||
root_child0_child0_child0, root_child0_child0_child0_child0, 0);
|
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0));
|
ASSERT_FLOAT_EQ(5, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(450, YGNodeLayoutGetHeight(root_child0_child0));
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
ASSERT_FLOAT_EQ(16, YGNodeLayoutGetTop(root_child0_child0_child0));
|
|
||||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
|
||||||
ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(290, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(103, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(5, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(5, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
@@ -29,10 +29,11 @@ android {
|
|||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
path 'src/main/cpp/CMakeLists.txt'
|
path 'src/main/cpp/CMakeLists.txt'
|
||||||
|
version '3.6.0-rc2'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.facebook.soloader:soloader:0.10.1'
|
implementation 'com.facebook.soloader:soloader:0.5.1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2070,7 +2070,7 @@ static float YGDistributeFreeSpaceSecondPass(
|
|||||||
currentRelativeChild,
|
currentRelativeChild,
|
||||||
mainAxis,
|
mainAxis,
|
||||||
currentRelativeChild->getLayout().computedFlexBasis,
|
currentRelativeChild->getLayout().computedFlexBasis,
|
||||||
mainAxisownerSize)
|
availableInnerMainDim)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
float updatedMainSize = childFlexBasis;
|
float updatedMainSize = childFlexBasis;
|
||||||
|
|
||||||
@@ -2256,7 +2256,7 @@ static void YGDistributeFreeSpaceFirstPass(
|
|||||||
currentRelativeChild,
|
currentRelativeChild,
|
||||||
mainAxis,
|
mainAxis,
|
||||||
currentRelativeChild->getLayout().computedFlexBasis,
|
currentRelativeChild->getLayout().computedFlexBasis,
|
||||||
mainAxisownerSize)
|
availableInnerMainDim)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
if (collectedFlexItemsValues.remainingFreeSpace < 0) {
|
if (collectedFlexItemsValues.remainingFreeSpace < 0) {
|
||||||
@@ -4194,7 +4194,9 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext(
|
|||||||
if (node->getConfig()->printTree) {
|
if (node->getConfig()->printTree) {
|
||||||
YGNodePrint(
|
YGNodePrint(
|
||||||
node,
|
node,
|
||||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren |
|
||||||
|
YGPrintOptionsStyle));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -4254,7 +4256,9 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext(
|
|||||||
if (nodeWithoutLegacyFlag->getConfig()->printTree) {
|
if (nodeWithoutLegacyFlag->getConfig()->printTree) {
|
||||||
YGNodePrint(
|
YGNodePrint(
|
||||||
nodeWithoutLegacyFlag,
|
nodeWithoutLegacyFlag,
|
||||||
(YGPrintOptions) (YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle));
|
(YGPrintOptions)(
|
||||||
|
YGPrintOptionsLayout | YGPrintOptionsChildren |
|
||||||
|
YGPrintOptionsStyle));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user