Upgrade Gradle setup (#1084)
Summary: Trying to dust off the build setup and make it work again with a modern Android Studio / JVM. Removing all JCenter setup, too, as this is no longer supported. Pull Request resolved: https://github.com/facebook/yoga/pull/1084 Test Plan: `./gradlew :yoga-layout:assembleDebug` works already. Looking if CI here likes this. Reviewed By: mweststrate Differential Revision: D28602272 Pulled By: passy fbshipit-source-id: 0cb86f548cc6366ccefcc92c185d6e7772e75547
This commit is contained in:
committed by
Facebook GitHub Bot
parent
508f4eacdf
commit
13e079e8f3
9
.github/workflows/ci.yml
vendored
9
.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
|
||||
@@ -48,4 +54,5 @@ jobs:
|
||||
export PATH=$PATH:$HOME/buck/bin/
|
||||
buck --version
|
||||
- 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
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,6 +6,9 @@
|
||||
/.buckd
|
||||
/gentest/test.html
|
||||
.buckversion
|
||||
.cxx
|
||||
.idea
|
||||
/local.properties
|
||||
|
||||
# Jekyll
|
||||
/.sass-cache/
|
||||
|
@@ -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
|
||||
@@ -31,22 +26,3 @@ android {
|
||||
dependencies {
|
||||
api project(':yoga')
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
|
15
build.gradle
15
build.gradle
@@ -10,14 +10,10 @@
|
||||
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'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
@@ -32,9 +28,10 @@ allprojects {
|
||||
|
||||
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
|
||||
}
|
||||
|
@@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,26 +58,3 @@ dependencies {
|
||||
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')
|
||||
|
@@ -9,5 +9,3 @@ apply plugin: 'java'
|
||||
|
||||
sourceCompatibility = '1.7'
|
||||
targetCompatibility = '1.7'
|
||||
|
||||
apply from: rootProject.file('gradle/release.gradle')
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user