From 367d701bcad6fe8589ca0a9c24c6d950d7e00833 Mon Sep 17 00:00:00 2001 From: Xianwen Chen Date: Fri, 10 Nov 2023 11:50:26 -0800 Subject: [PATCH 1/3] Upgrade to Gradle 7.0.2 and fix gradle build --- android/build.gradle | 27 +++++++++--------------- android_tor_installer/build.gradle | 1 - build.gradle | 10 ++++----- gradle.properties | 3 ++- gradle/wrapper/gradle-wrapper.properties | 2 +- java/build.gradle | 2 +- universal/build.gradle | 13 ++++++++++-- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index a8d9bdca..3c21f82b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,4 @@ apply plugin: 'com.android.library' -apply plugin: 'maven' apply plugin: 'maven-publish' buildscript { @@ -23,7 +22,6 @@ android { versionName "0.0.3" consumerProguardFiles 'proguard-rules.pro' testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - } buildTypes { @@ -34,13 +32,22 @@ android { } } +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} + +artifacts { + archives sourcesJar +} + publishing { publications { android(MavenPublication) { groupId 'com.msopentech.thali.toronionproxy.android' artifactId 'android' version '0.0.3' - artifact(sourceJar) + artifact(sourcesJar) artifact("$buildDir/outputs/aar/android-release.aar") pom.withXml { def dependenciesNode = asNode().appendNode('dependencies') @@ -59,11 +66,6 @@ publishing { } } -task sourceJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier "source" -} - dependencies { implementation project(':universal') implementation 'net.freehaven.tor.control:jtorctl:0.2' @@ -98,12 +100,3 @@ task copyPluggableTransports(type: Copy) { gradle.projectsEvaluated { preBuild.dependsOn(copyPluggableTransports) } - -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -artifacts { - archives sourcesJar -} diff --git a/android_tor_installer/build.gradle b/android_tor_installer/build.gradle index 554fd496..18f17b52 100644 --- a/android_tor_installer/build.gradle +++ b/android_tor_installer/build.gradle @@ -1,5 +1,4 @@ apply plugin: 'com.android.library' -apply plugin: 'maven' apply plugin: 'maven-publish' buildscript { diff --git a/build.gradle b/build.gradle index 43b9e133..56a5a7fe 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ -allprojects { - apply plugin: 'maven' +allprojects { + apply plugin: 'maven-publish' group = 'com.msopentech.thali' version = '0.0.3' } @@ -12,7 +12,5 @@ subprojects { } } -evaluationDependsOn ":universal" -evaluationDependsOn ":java" - - +evaluationDependsOn(":universal") +evaluationDependsOn(":java") diff --git a/gradle.properties b/gradle.properties index 7e9d7bde..b970f1e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,3 @@ # Configure Android Gradle Plugin Version -androidplugin=3.2.1 +androidplugin=7.0.2 +org.gradle.jvmargs="--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED" \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 290541c7..e750102e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java/build.gradle b/java/build.gradle index 264d09f1..db104b9d 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/universal/build.gradle b/universal/build.gradle index 43812d9c..f88128fb 100644 --- a/universal/build.gradle +++ b/universal/build.gradle @@ -1,5 +1,5 @@ apply plugin: 'java' -apply plugin: 'maven' +apply plugin: 'maven-publish' sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -14,7 +14,7 @@ repositories { dependencies { implementation 'org.slf4j:slf4j-api:1.7.25' implementation 'net.freehaven.tor.control:jtorctl:0.2' - testCompile group: 'junit', name: 'junit', version: '4.12' + testImplementation group: 'junit', name: 'junit', version: '4.12' } task sourcesJar(type:Jar){ @@ -25,3 +25,12 @@ task sourcesJar(type:Jar){ artifacts { archives sourcesJar } + +// Define publication for maven-publish plugin +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} \ No newline at end of file From f2384b441a80d872d6e48933e7fd755ce525c985 Mon Sep 17 00:00:00 2001 From: Xianwen Chen Date: Fri, 10 Nov 2023 14:41:16 -0800 Subject: [PATCH 2/3] Fix `gradlew publish publishToMavenLocal` --- android/build.gradle | 4 ++-- gradle.properties | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 3c21f82b..fceb093b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -51,8 +51,8 @@ publishing { artifact("$buildDir/outputs/aar/android-release.aar") pom.withXml { def dependenciesNode = asNode().appendNode('dependencies') - //Iterate over the compile dependencies (we don't want the test ones), adding a node for each - configurations.compile.allDependencies.each { + //Iterate over the implementation dependencies (we don't want the test ones), adding a node for each + configurations.implementation.allDependencies.each { if(it.group != null && (it.name != null || "unspecified".equals(it.name)) && it.version != null) { def dependencyNode = dependenciesNode.appendNode('dependency') diff --git a/gradle.properties b/gradle.properties index b970f1e5..5ef7d0e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,2 @@ # Configure Android Gradle Plugin Version -androidplugin=7.0.2 -org.gradle.jvmargs="--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED" \ No newline at end of file +androidplugin=7.0.2 \ No newline at end of file From f0aa57797d7a3e6370f58766287ee275bd6fa014 Mon Sep 17 00:00:00 2001 From: Xianwen Chen Date: Fri, 10 Nov 2023 14:51:19 -0800 Subject: [PATCH 3/3] Add newlines at end of files --- gradle.properties | 2 +- universal/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5ef7d0e5..d2b62724 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ # Configure Android Gradle Plugin Version -androidplugin=7.0.2 \ No newline at end of file +androidplugin=7.0.2 diff --git a/universal/build.gradle b/universal/build.gradle index f88128fb..8a86800f 100644 --- a/universal/build.gradle +++ b/universal/build.gradle @@ -33,4 +33,4 @@ publishing { from components.java } } -} \ No newline at end of file +}