diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..07ac316 --- /dev/null +++ b/build.bat @@ -0,0 +1,13 @@ +@ECHO OFF + +SET WD=%CD% +SET SD=%~dp0 +SET PARAMS=%* + +cd "%SD%" + +call gradlew clean build %PARAMS% + +cd "%WD%" + +PAUSE diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..14b97ad --- /dev/null +++ b/build.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +SD=$(cd $(dirname $0); pwd -P) +WD="`pwd`" +SCRIPT=$(basename $0) +SCRIPT_NAME=${SCRIPT%.*} +SCRIPT_EXTENSION=${SCRIPT##*.} +SELF=$SD/$SCRIPT + +cd $SD/ + +echo "Building..." +./gradlew clean build $@ + +cd $WD/ diff --git a/buildSrc/src/main/kotlin/com/quickbirdstudios/surveykit/Publication.kt b/buildSrc/src/main/kotlin/com/quickbirdstudios/surveykit/Publication.kt index 5a60593..f0b62f1 100644 --- a/buildSrc/src/main/kotlin/com/quickbirdstudios/surveykit/Publication.kt +++ b/buildSrc/src/main/kotlin/com/quickbirdstudios/surveykit/Publication.kt @@ -18,7 +18,7 @@ private const val bintrayApiKeyKey = "bintray_apikey" fun Project.configureLibraryPublication() { configureSourcesJarTaskIfNecessary() - configureCheckCiTagTaskIfNecessary() + //configureCheckCiTagTaskIfNecessary() configureLibraryAarPublication() configureBintrayForLibraryPublication() configurePublishTask() diff --git a/deploy.bat b/deploy.bat new file mode 100644 index 0000000..6038e12 --- /dev/null +++ b/deploy.bat @@ -0,0 +1,13 @@ +@ECHO OFF + +SET WD=%CD% +SET SD=%~dp0 +SET PARAMS=%* + +cd "%SD%" + +call gradlew clean publish %PARAMS% + +cd "%WD%" + +PAUSE diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..aba8749 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +SD=$(cd $(dirname $0); pwd -P) +WD="`pwd`" +SCRIPT=$(basename $0) +SCRIPT_NAME=${SCRIPT%.*} +SCRIPT_EXTENSION=${SCRIPT##*.} +SELF=$SD/$SCRIPT + +cd $SD/ + +echo "Building..." +./gradlew clean publish $@ + +cd $WD/ diff --git a/gradle.properties b/gradle.properties index e6bd425..1cd9353 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,27 @@ +# Maven stuff +GROUP=at.ac.ait.hbs.android.surveykit + +POM_URL=https://github.com/roedll/SurveyKit + +POM_SCM_URL=https://github.com/roedll/SurveyKit +POM_SCM_CONNECTION=scm:git@github.com/roedll/SurveyKit.git +POM_SCM_DEV_CONNECTION=scm:git@github.com/roedll/SurveyKit.git +POM_SCM_URL_ISSUES=https://github.com/roedll/SurveyKit/issues + +POM_LICENCE_NAME= +POM_LICENCE_URL= +POM_LICENCE_DIST=repo + +POM_ORG_NAME=AIT Austrian Institute of Technology GmbH / Biomedical Systems +POM_ORG_URL=http://www.ait.ac.at + +POM_DEVELOPER_ID=roedll +POM_DEVELOPER_NAME= +POM_DEVELOPER_MAIL= + +NEXUS_REPO_URL=https://nexus.arcsmed.at/content/repositories/android +NEXUS_REPO_URL_SNAPSHOT=https://nexus.arcsmed.at/content/repositories/android-snapshots + org.gradle.jvmargs=-Xmx1536m kotlin.code.style=official org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f6b961f..62d4c05 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3f43cd3..d7dd28b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Apr 01 15:38:24 CEST 2019 +#Thu Sep 17 09:56:59 CEST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip diff --git a/maven_publish_helper.gradle b/maven_publish_helper.gradle new file mode 100644 index 0000000..eb88946 --- /dev/null +++ b/maven_publish_helper.gradle @@ -0,0 +1,198 @@ +apply plugin: 'maven-publish' + +def isAndroidSdkPresent() { + try { + android.getSdkDirectory() + return true + } catch(RuntimeException ex) { + return false + } +} + +task androidJavadocs(type: Javadoc) { + // Check if Android SDK is initialized at all + if (isAndroidSdkPresent()) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + + def propVariants = null + if (android.hasProperty('applicationVariants')) { + propVariants = android.getProperty('applicationVariants') + } else if (android.hasProperty('libraryVariants')) { + propVariants = android.getProperty('libraryVariants') + } + + if (propVariants != null) { + propVariants.all { variant -> + if (variant.name == 'release') { + owner.classpath += variant.javaCompileProvider.get().classpath + } + } + } + } + + exclude '**/R.html', '**/R.*.html', '**/index.html', '**/*.kt' +} + +task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { + archiveClassifier.set('javadoc') + from androidJavadocs.destinationDir +} + +task androidSourcesJar(type: Jar) { + // Check if Android SDK is initialized at all + if (isAndroidSdkPresent()) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs + } +} + +/* +void halt() { + try { + throw new RuntimeException('Break'); + } catch (RuntimeException e) { + print('Paused') + } +} + +task iterateDeclaredDependencies { + doLast { + Object configs = configurations.all + halt(); + print(configs) + } +} +*/ + +def mavenNexusArcsmed = { RepositoryHandler handler, String repoUrl -> + handler.maven { + url repoUrl + credentials { + username project.findProperty("mavenUserArcsmed") ?: System.getenv('CI_MAVEN_USER_ARCSMED') + password project.findProperty("mavenPasswordArcsmed") ?: System.getenv('CI_MAVEN_PASS_ARCSMED') + } + } +} + +// Because the components are created only during the afterEvaluate phase, you must +// configure your publications using the afterEvaluate() lifecycle method. +afterEvaluate { + + allprojects { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + options.addStringOption('encoding', 'UTF-8') + } + } + + + + + /* + def propVariants = null + if (android.hasProperty('applicationVariants')) { + propVariants = android.getProperty('applicationVariants') + } else if (android.hasProperty('libraryVariants')) { + propVariants = android.getProperty('libraryVariants') + } + + if (propVariants != null) { + propVariants.all { variant -> + println("VARIANT: " + variant + "\n\n") + println("VARIANT NAME: " + variant.name + "\n\n") + println("VARIANT PROPS: " + variant.properties + "\n\n") + println("VARIANT DATA: " + variant.variantData.properties + "\n\n") + } + } + */ + + println("COMPONENTS: " + project.components.properties + "\n\n") + + publishing { + // Check if Android SDK is initialized at all + if (isAndroidSdkPresent()) { + publications { + // Creates a Maven publication called "mavenRelease" + mavenRelease(MavenPublication) { + // Check for Android configuration and apply the component for the release build variant + // See https://developer.android.com/studio/build/maven-publish-plugin + + //println("COMPONENTS: " + components.properties) + + if (components.hasProperty('release_apk')) { + project.logger.info('Prepare to publish APK') + from components.release_apk + } else if (components.hasProperty('release_aab')) { + project.logger.info('Prepare to publish AAB') + from components.release_aab + } else if (components.hasProperty('release')) { + project.logger.info('Prepare to publish AAR') + from components.release + } + //from components.release + + // Adds javadocs and sources as separate jars + artifact androidJavadocsJar + artifact androidSourcesJar + + + + println("ANDROID: " + android.properties + "\n\n") + println("ANDROID DEF PUB: " + android.defaultPublishConfig.properties + "\n\n") + //from components.aar + + // You can customize attributes of the publication here or in module's build.gradle file + groupId GROUP + artifactId POM_ARTIFACT_ID + version android.defaultConfig.versionName + + // Other artifacts are added dynamically + pom.withXml { + final root = asNode() + root.appendNode('name', POM_NAME) + root.appendNode('description', POM_DESCRIPTION) + root.appendNode('url', POM_SCM_URL) + + // Append some additional properties + root.children().last() + { + resolveStrategy = Closure.DELEGATE_FIRST + + licenses { + license { + name POM_LICENCE_NAME + url POM_LICENCE_URL + distribution POM_LICENCE_DIST + } + } + organization { + name POM_ORG_NAME + url POM_ORG_URL + } + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + email POM_DEVELOPER_MAIL + } + } + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + } + } + } + } + repositories { + def releasesRepoUrl = NEXUS_REPO_URL + def snapshotsRepoUrl = NEXUS_REPO_URL_SNAPSHOT + def repoUrl = android.defaultConfig.versionName.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + + mavenNexusArcsmed(delegate, repoUrl) + } + } + } + +} diff --git a/survey/build.gradle.kts b/survey/build.gradle.kts index 721d81e..29f9ec1 100644 --- a/survey/build.gradle.kts +++ b/survey/build.gradle.kts @@ -1,13 +1,13 @@ @file:Suppress("SuspiciousCollectionReassignment") -import com.quickbirdstudios.surveykit.configureLibraryPublication +//import com.quickbirdstudios.surveykit.configureLibraryPublication plugins { id("com.android.library") kotlin("android") id("org.jetbrains.kotlin.android.extensions") - id("com.jfrog.bintray") - `maven-publish` + //id("com.jfrog.bintray") + //`maven-publish` } androidExtensions { isExperimental = true } @@ -18,12 +18,19 @@ android { defaultConfig { minSdkVersion(Project.Android.minSdkVersion) targetSdkVersion(Project.Android.targetSdkVersion) + + versionName = "v2.0.0-ait-SNAPSHOT" + testInstrumentationRunner = Project.Android.testInstrumentationRunner } testOptions { animationsDisabled = true } + + lintOptions { + isAbortOnError = false + } } dependencies { @@ -40,4 +47,8 @@ dependencies { testImplementation(Deps.Test.jUnitPlatform) } -project.configureLibraryPublication() +//project.configureLibraryPublication() + +apply { + from("../maven_publish_helper.gradle") +} \ No newline at end of file diff --git a/survey/gradle.properties b/survey/gradle.properties new file mode 100644 index 0000000..a4b8cd3 --- /dev/null +++ b/survey/gradle.properties @@ -0,0 +1,4 @@ +POM_NAME=SurveyKit - Library +POM_DESCRIPTION= +POM_ARTIFACT_ID=surveykit.library +POM_PACKAGING=aar \ No newline at end of file