diff --git a/.gitignore b/.gitignore index b62acd49..6c22dd3c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ .cxx local.properties buildSrc/build +buildSrc/.idea/ affected_module_detector.log \ No newline at end of file diff --git a/sample-core/.gitignore b/affectedmoduledetector/.gitignore similarity index 100% rename from sample-core/.gitignore rename to affectedmoduledetector/.gitignore diff --git a/affectedmoduledetector/build.gradle b/affectedmoduledetector/build.gradle new file mode 100644 index 00000000..2f789f65 --- /dev/null +++ b/affectedmoduledetector/build.gradle @@ -0,0 +1,84 @@ +plugins { + id 'java-library' + id 'kotlin' + id 'java-gradle-plugin' + id 'maven-publish' + id "com.gradle.plugin-publish" version "0.12.0" +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + testImplementation("junit:junit:4.13.1") + testImplementation("com.nhaarman:mockito-kotlin:1.5.0") + testImplementation("com.google.truth:truth:1.0.1") +} + +ext { + DESCRIPTION = "A Gradle Plugin and library to determine which modules were affected in a commit." + VERSION = "0.1.0-SNAPSHOT" + GIT_URL = 'https://github.com/Dropbox/AffectedModuleDetector' + GROUP_ID = "com.dropbox.affectedmoduledetector" +} + +group = GROUP_ID +version = VERSION +description = DESCRIPTION + +publishing { + publications { + maven(MavenPublication) { + pom { + name = 'Affected Module Detector' + description = 'A concise description of my library' + url = GIT_URL + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'mplat-dbx' + name = 'Dropbox' + } + } + scm { + connection = 'scm:git:git://github.com:dropbox/AffectedModuleDetector.git' + developerConnection = 'scm:git:ssh://github.com:dropbox/AffectedModuleDetector.git' + url = GIT_URL + } + } + + from components.java + } + } +} + +gradlePlugin { + plugins { + affectedModuleDetectorPlugin { + id = GROUP_ID + implementationClass = "com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin" + } + } +} + +pluginBundle { + website = GIT_URL + vcsUrl = GIT_URL + description = "A Gradle Plugin to determine which modules were affected in a commit." + tags = ["module", "git", "detector", "dependency"] + + plugins { + affectedModuleDetectorPlugin { + // id is captured from java-gradle-plugin configuration + displayName = "Affected Module Detector" + } + } +} diff --git a/buildSrc/src/main/kotlin/com/dropbox/detector/AffectedModuleDetector.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetector.kt similarity index 97% rename from buildSrc/src/main/kotlin/com/dropbox/detector/AffectedModuleDetector.kt rename to affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetector.kt index 489fa303..02a327a9 100644 --- a/buildSrc/src/main/kotlin/com/dropbox/detector/AffectedModuleDetector.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetector.kt @@ -19,19 +19,20 @@ */ @file:JvmName("AffectedModuleDetectorUtil") -package com.dropbox.detector - -import com.dropbox.detector.AffectedModuleDetector.Companion.CHANGED_PROJECTS_ARG -import com.dropbox.detector.AffectedModuleDetector.Companion.DEPENDENT_PROJECTS_ARG -import com.dropbox.detector.AffectedModuleDetector.Companion.ENABLE_ARG -import com.dropbox.detector.AffectedModuleDetector.Companion.MODULES_ARG +package com.dropbox.affectedmoduledetector + +import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.CHANGED_PROJECTS_ARG +import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.DEPENDENT_PROJECTS_ARG +import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.ENABLE_ARG +import com.dropbox.affectedmoduledetector.AffectedModuleDetector.Companion.MODULES_ARG +import com.dropbox.detector.GitClient +import com.dropbox.detector.GitClientImpl import org.gradle.api.GradleException import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.invocation.Gradle import org.gradle.api.logging.Logger import java.io.File -import java.util.UUID /** * The subsets we allow the projects to be partitioned into. diff --git a/buildSrc/src/main/kotlin/com/dropbox/detector/AffectedModuleDetectorPlugin.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt similarity index 93% rename from buildSrc/src/main/kotlin/com/dropbox/detector/AffectedModuleDetectorPlugin.kt rename to affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt index de738223..ecf45b94 100644 --- a/buildSrc/src/main/kotlin/com/dropbox/detector/AffectedModuleDetectorPlugin.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt @@ -2,7 +2,7 @@ * Copyright (c) 2020, Dropbox, Inc. All rights reserved. */ -package com.dropbox.detector +package com.dropbox.affectedmoduledetector import org.gradle.api.Plugin import org.gradle.api.Project diff --git a/buildSrc/src/main/kotlin/com/dropbox/detector/DependencyTracker.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/DependencyTracker.kt similarity index 98% rename from buildSrc/src/main/kotlin/com/dropbox/detector/DependencyTracker.kt rename to affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/DependencyTracker.kt index 8fc2e967..67eee837 100644 --- a/buildSrc/src/main/kotlin/com/dropbox/detector/DependencyTracker.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/DependencyTracker.kt @@ -17,7 +17,7 @@ /* * Copyright (c) 2020, Dropbox, Inc. All rights reserved. */ -package com.dropbox.detector +package com.dropbox.affectedmoduledetector import org.gradle.api.Project import org.gradle.api.artifacts.ProjectDependency diff --git a/buildSrc/src/main/kotlin/com/dropbox/detector/GitClient.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/GitClient.kt similarity index 100% rename from buildSrc/src/main/kotlin/com/dropbox/detector/GitClient.kt rename to affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/GitClient.kt diff --git a/buildSrc/src/main/kotlin/com/dropbox/detector/ProjectGraph.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/ProjectGraph.kt similarity index 98% rename from buildSrc/src/main/kotlin/com/dropbox/detector/ProjectGraph.kt rename to affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/ProjectGraph.kt index 4464ad2c..0e00469a 100644 --- a/buildSrc/src/main/kotlin/com/dropbox/detector/ProjectGraph.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/ProjectGraph.kt @@ -18,7 +18,7 @@ * Copyright (c) 2020, Dropbox, Inc. All rights reserved. */ -package com.dropbox.detector +package com.dropbox.affectedmoduledetector import org.gradle.api.Project import org.gradle.api.logging.Logger diff --git a/buildSrc/src/main/kotlin/com/dropbox/detector/ToStringLogger.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/ToStringLogger.kt similarity index 98% rename from buildSrc/src/main/kotlin/com/dropbox/detector/ToStringLogger.kt rename to affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/ToStringLogger.kt index 24693cb9..30d39d6d 100644 --- a/buildSrc/src/main/kotlin/com/dropbox/detector/ToStringLogger.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/ToStringLogger.kt @@ -18,7 +18,7 @@ * Copyright (c) 2020, Dropbox, Inc. All rights reserved. */ -package com.dropbox.detector +package com.dropbox.affectedmoduledetector import org.gradle.BuildAdapter import org.gradle.BuildResult diff --git a/affectedmoduledetector/src/main/resources/META-INF/gradle-plugins/com.dropbox.affectedmoduledetector.properties b/affectedmoduledetector/src/main/resources/META-INF/gradle-plugins/com.dropbox.affectedmoduledetector.properties new file mode 100644 index 00000000..f28b2428 --- /dev/null +++ b/affectedmoduledetector/src/main/resources/META-INF/gradle-plugins/com.dropbox.affectedmoduledetector.properties @@ -0,0 +1 @@ +implementation-class=com.dropbox.affectedmoduledetector.AffectedModuleDetectorPlugin \ No newline at end of file diff --git a/buildSrc/src/test/kotlin/com/dropbox/detector/AffectedModuleDetectorImplTest.kt b/affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorImplTest.kt similarity index 99% rename from buildSrc/src/test/kotlin/com/dropbox/detector/AffectedModuleDetectorImplTest.kt rename to affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorImplTest.kt index 1432f138..7f27e861 100644 --- a/buildSrc/src/test/kotlin/com/dropbox/detector/AffectedModuleDetectorImplTest.kt +++ b/affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorImplTest.kt @@ -1,11 +1,13 @@ -package com.dropbox.detector +package com.dropbox.affectedmoduledetector +import com.dropbox.detector.GitClient import com.google.common.truth.Truth import org.gradle.api.Project import org.gradle.api.plugins.ExtraPropertiesExtension import org.gradle.testfixtures.ProjectBuilder import org.hamcrest.CoreMatchers import org.hamcrest.MatcherAssert +import org.junit.Assert.fail import org.junit.Before import org.junit.Rule import org.junit.Test @@ -13,7 +15,6 @@ import org.junit.rules.TemporaryFolder import org.junit.runner.RunWith import org.junit.runners.JUnit4 import java.io.File -import kotlin.test.fail @RunWith(JUnit4::class) class AffectedModuleDetectorImplTest { diff --git a/buildSrc/src/test/kotlin/com/dropbox/detector/AttachLogsTestRule.kt b/affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AttachLogsTestRule.kt similarity index 95% rename from buildSrc/src/test/kotlin/com/dropbox/detector/AttachLogsTestRule.kt rename to affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AttachLogsTestRule.kt index e0a3284f..a775de27 100644 --- a/buildSrc/src/test/kotlin/com/dropbox/detector/AttachLogsTestRule.kt +++ b/affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AttachLogsTestRule.kt @@ -1,4 +1,4 @@ -package com.dropbox.detector +package com.dropbox.affectedmoduledetector import org.junit.rules.TestRule import org.junit.runner.Description diff --git a/buildSrc/src/test/kotlin/com/dropbox/detector/ProjectGraphTest.kt b/affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/ProjectGraphTest.kt similarity index 98% rename from buildSrc/src/test/kotlin/com/dropbox/detector/ProjectGraphTest.kt rename to affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/ProjectGraphTest.kt index 358a53c7..358c49c0 100644 --- a/buildSrc/src/test/kotlin/com/dropbox/detector/ProjectGraphTest.kt +++ b/affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/ProjectGraphTest.kt @@ -1,4 +1,4 @@ -package com.dropbox.detector +package com.dropbox.affectedmoduledetector import java.io.File import junit.framework.TestCase.assertEquals diff --git a/build.gradle b/build.gradle index ec133a5f..fc33b2a2 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,6 @@ buildscript { } apply plugin: "org.jlleitschuh.gradle.ktlint" -apply plugin: "com.dropbox.detector.AffectedModuleDetector" allprojects { repositories { diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/com.dropbox.detector.AffectedModuleDetector.properties b/buildSrc/src/main/resources/META-INF/gradle-plugins/com.dropbox.detector.AffectedModuleDetector.properties deleted file mode 100644 index a509b4ef..00000000 --- a/buildSrc/src/main/resources/META-INF/gradle-plugins/com.dropbox.detector.AffectedModuleDetector.properties +++ /dev/null @@ -1 +0,0 @@ -implementation-class=com.dropbox.detector.AffectedModuleDetectorPlugin diff --git a/releasing.md b/releasing.md new file mode 100644 index 00000000..71545a68 --- /dev/null +++ b/releasing.md @@ -0,0 +1,57 @@ +# Releasing + +* Create a local release branch from `main` +```bash +git checkout main +git pull +git checkout -b release_0.1.0 +``` + +* Update `version` in `buildSrc/build.gradle.kts` (remove `-SNAPSHOT`) +```kotlin +version = 0.1.0" +``` + + +* Commit all local changes +``` +git commit -am "Prepare 0.1.0 release" +``` + +* Create a tag and push it +```bash +git tag v0.1.0 +git push origin v0.1.0 +``` + +* Upload to Maven Central +```bash +./gradlew publishAllPublicationsToMavenRepository +``` + +* Upload to Gradle Plugin Portal +```bash +./gradlew login +./gradlew publishPlugins +``` + +* Merge the release branch to master +``` +git checkout master +git pull +git merge --no-ff release_0.1.0 +``` +* Update `version` in `buildSrc/build.gradle.kts` (increase version and add `-SNAPSHOT`) +```kotlin +version = "REPLACE_WITH_NEXT_VERSION_NUMBER-SNAPSHOT" +``` + +* Commit your changes +``` +git commit -am "Prepare for next development iteration" +``` + +* Push your changes +``` +git push +``` diff --git a/sample/.gitignore b/sample/.gitignore index 42afabfd..e335d8ee 100644 --- a/sample/.gitignore +++ b/sample/.gitignore @@ -1 +1,18 @@ -/build \ No newline at end of file +*.iml +.gradle +/local.properties +/.idea +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties +buildSrc/build +buildSrc/.idea/ \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 9e46b38e..d53c713f 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,57 +1,33 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' -} - -android { - compileSdkVersion 30 - buildToolsVersion "30.0.2" - defaultConfig { - applicationId "com.dropbox.detector.sample" - minSdkVersion 23 - targetSdkVersion 30 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + ext.kotlin_version = "1.3.72" + repositories { + google() + jcenter() + maven { + url "https://plugins.gradle.org/m2/" } + mavenLocal() } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' + dependencies { + classpath "com.android.tools.build:gradle:4.1.0" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath("org.jlleitschuh.gradle:ktlint-gradle:9.1.1") } +} - affectedModuleDetector { - baseDir = "${project.rootDir}" - pathsAffectingAllModules = [ - "buildSrc/" - ] +apply plugin: "org.jlleitschuh.gradle.ktlint" +apply plugin: "com.dropbox.affectedmoduledetector" - logFolder = "${project.rootDir}" +allprojects { + repositories { + google() + jcenter() } } -dependencies { - - implementation project(":sample-core") - implementation project(":sample-util") - - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.2.0' - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'com.google.android.material:material:1.1.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - testImplementation 'junit:junit:4.+' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +task clean(type: Delete) { + delete rootProject.buildDir } \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/sample/buildSrc/build.gradle.kts similarity index 76% rename from buildSrc/build.gradle.kts rename to sample/buildSrc/build.gradle.kts index 9875dbe5..1a14963d 100644 --- a/buildSrc/build.gradle.kts +++ b/sample/buildSrc/build.gradle.kts @@ -6,15 +6,15 @@ plugins { `java-gradle-plugin` } - repositories { google() jcenter() + mavenLocal() } dependencies { + implementation("com.dropbox.affectedmoduledetector:affectedmoduledetector:0.1.0-SNAPSHOT") testImplementation("junit:junit:4.13.1") testImplementation("com.nhaarman:mockito-kotlin:1.5.0") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.4.10") testImplementation("com.google.truth:truth:1.0.1") -} +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/com/dropbox/test/AffectedTestsPlugin.kt b/sample/buildSrc/src/main/kotlin/com/dropbox/sample/AffectedTestsPlugin.kt similarity index 87% rename from buildSrc/src/main/kotlin/com/dropbox/test/AffectedTestsPlugin.kt rename to sample/buildSrc/src/main/kotlin/com/dropbox/sample/AffectedTestsPlugin.kt index 9e6f05f1..ae95aebb 100644 --- a/buildSrc/src/main/kotlin/com/dropbox/test/AffectedTestsPlugin.kt +++ b/sample/buildSrc/src/main/kotlin/com/dropbox/sample/AffectedTestsPlugin.kt @@ -1,6 +1,6 @@ -package com.dropbox.test +package com.dropbox.sample -import com.dropbox.detector.AffectedModuleDetector +import com.dropbox.affectedmoduledetector.AffectedModuleDetector import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.tasks.testing.Test diff --git a/buildSrc/src/main/resources/META-INF/gradle-plugins/com.dropbox.test.AffectedTestPlugin.properties b/sample/buildSrc/src/main/resources/META-INF/gradle-plugins/com.dropbox.sample.AffectedTestPlugin.properties similarity index 100% rename from buildSrc/src/main/resources/META-INF/gradle-plugins/com.dropbox.test.AffectedTestPlugin.properties rename to sample/buildSrc/src/main/resources/META-INF/gradle-plugins/com.dropbox.sample.AffectedTestPlugin.properties diff --git a/sample/gradle.properties b/sample/gradle.properties new file mode 100644 index 00000000..98bed167 --- /dev/null +++ b/sample/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app"s APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true +# Kotlin code style for this project: "official" or "obsolete": +kotlin.code.style=official \ No newline at end of file diff --git a/sample/gradle/wrapper/gradle-wrapper.jar b/sample/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..f6b961fd Binary files /dev/null and b/sample/gradle/wrapper/gradle-wrapper.jar differ diff --git a/sample/gradle/wrapper/gradle-wrapper.properties b/sample/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..1cc659f5 --- /dev/null +++ b/sample/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu Oct 15 15:49:37 PDT 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/sample/gradlew b/sample/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/sample/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/sample/gradlew.bat b/sample/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/sample/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/sample-util/.gitignore b/sample/sample-app/.gitignore similarity index 100% rename from sample-util/.gitignore rename to sample/sample-app/.gitignore diff --git a/sample/sample-app/build.gradle b/sample/sample-app/build.gradle new file mode 100644 index 00000000..9e46b38e --- /dev/null +++ b/sample/sample-app/build.gradle @@ -0,0 +1,57 @@ +plugins { + id 'com.android.application' + id 'kotlin-android' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.2" + + defaultConfig { + applicationId "com.dropbox.detector.sample" + minSdkVersion 23 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + + affectedModuleDetector { + baseDir = "${project.rootDir}" + pathsAffectingAllModules = [ + "buildSrc/" + ] + + logFolder = "${project.rootDir}" + } +} + +dependencies { + + implementation project(":sample-core") + implementation project(":sample-util") + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.2.0' + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'com.google.android.material:material:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} \ No newline at end of file diff --git a/sample-core/proguard-rules.pro b/sample/sample-app/proguard-rules.pro similarity index 100% rename from sample-core/proguard-rules.pro rename to sample/sample-app/proguard-rules.pro diff --git a/sample/src/main/AndroidManifest.xml b/sample/sample-app/src/main/AndroidManifest.xml similarity index 100% rename from sample/src/main/AndroidManifest.xml rename to sample/sample-app/src/main/AndroidManifest.xml diff --git a/sample/src/main/java/com/dropbox/detector/sample/MainActivity.kt b/sample/sample-app/src/main/java/com/dropbox/detector/sample/MainActivity.kt similarity index 100% rename from sample/src/main/java/com/dropbox/detector/sample/MainActivity.kt rename to sample/sample-app/src/main/java/com/dropbox/detector/sample/MainActivity.kt diff --git a/sample/src/main/res/drawable-v24/ic_launcher_foreground.xml b/sample/sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from sample/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to sample/sample-app/src/main/res/drawable-v24/ic_launcher_foreground.xml diff --git a/sample/src/main/res/drawable/ic_launcher_background.xml b/sample/sample-app/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from sample/src/main/res/drawable/ic_launcher_background.xml rename to sample/sample-app/src/main/res/drawable/ic_launcher_background.xml diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/sample-app/src/main/res/layout/activity_main.xml similarity index 100% rename from sample/src/main/res/layout/activity_main.xml rename to sample/sample-app/src/main/res/layout/activity_main.xml diff --git a/sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sample/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to sample/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to sample/sample-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher.png b/sample/sample-app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from sample/src/main/res/mipmap-hdpi/ic_launcher.png rename to sample/sample-app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png b/sample/sample-app/src/main/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from sample/src/main/res/mipmap-hdpi/ic_launcher_round.png rename to sample/sample-app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher.png b/sample/sample-app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from sample/src/main/res/mipmap-mdpi/ic_launcher.png rename to sample/sample-app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png b/sample/sample-app/src/main/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from sample/src/main/res/mipmap-mdpi/ic_launcher_round.png rename to sample/sample-app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher.png b/sample/sample-app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from sample/src/main/res/mipmap-xhdpi/ic_launcher.png rename to sample/sample-app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/sample/sample-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename to sample/sample-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png b/sample/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from sample/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to sample/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/sample/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename to sample/sample-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/sample/sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to sample/sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/sample/sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to sample/sample-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/sample/src/main/res/values-night/themes.xml b/sample/sample-app/src/main/res/values-night/themes.xml similarity index 100% rename from sample/src/main/res/values-night/themes.xml rename to sample/sample-app/src/main/res/values-night/themes.xml diff --git a/sample/src/main/res/values/colors.xml b/sample/sample-app/src/main/res/values/colors.xml similarity index 100% rename from sample/src/main/res/values/colors.xml rename to sample/sample-app/src/main/res/values/colors.xml diff --git a/sample/src/main/res/values/strings.xml b/sample/sample-app/src/main/res/values/strings.xml similarity index 100% rename from sample/src/main/res/values/strings.xml rename to sample/sample-app/src/main/res/values/strings.xml diff --git a/sample/src/main/res/values/themes.xml b/sample/sample-app/src/main/res/values/themes.xml similarity index 100% rename from sample/src/main/res/values/themes.xml rename to sample/sample-app/src/main/res/values/themes.xml diff --git a/sample/src/test/java/com/dropbox/detector/sample/ExampleUnitTest.kt b/sample/sample-app/src/test/java/com/dropbox/detector/sample/ExampleUnitTest.kt similarity index 100% rename from sample/src/test/java/com/dropbox/detector/sample/ExampleUnitTest.kt rename to sample/sample-app/src/test/java/com/dropbox/detector/sample/ExampleUnitTest.kt diff --git a/sample/sample-core/.gitignore b/sample/sample-core/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/sample/sample-core/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/sample-core/build.gradle b/sample/sample-core/build.gradle similarity index 95% rename from sample-core/build.gradle rename to sample/sample-core/build.gradle index f333bcac..76f15fbb 100644 --- a/sample-core/build.gradle +++ b/sample/sample-core/build.gradle @@ -3,8 +3,6 @@ plugins { id 'kotlin-android' } -apply plugin: "com.dropbox.test.AffectedTestPlugin" - android { compileSdkVersion 30 buildToolsVersion "30.0.2" diff --git a/sample-core/consumer-rules.pro b/sample/sample-core/consumer-rules.pro similarity index 100% rename from sample-core/consumer-rules.pro rename to sample/sample-core/consumer-rules.pro diff --git a/sample-util/proguard-rules.pro b/sample/sample-core/proguard-rules.pro similarity index 100% rename from sample-util/proguard-rules.pro rename to sample/sample-core/proguard-rules.pro diff --git a/sample-core/src/main/AndroidManifest.xml b/sample/sample-core/src/main/AndroidManifest.xml similarity index 100% rename from sample-core/src/main/AndroidManifest.xml rename to sample/sample-core/src/main/AndroidManifest.xml diff --git a/sample-core/src/test/java/com/dropbox/detector/sample_core/ExampleUnitTest.kt b/sample/sample-core/src/test/java/com/dropbox/detector/sample_core/ExampleUnitTest.kt similarity index 100% rename from sample-core/src/test/java/com/dropbox/detector/sample_core/ExampleUnitTest.kt rename to sample/sample-core/src/test/java/com/dropbox/detector/sample_core/ExampleUnitTest.kt diff --git a/sample/sample-util/.gitignore b/sample/sample-util/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/sample/sample-util/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/sample-util/build.gradle b/sample/sample-util/build.gradle similarity index 100% rename from sample-util/build.gradle rename to sample/sample-util/build.gradle diff --git a/sample-util/consumer-rules.pro b/sample/sample-util/consumer-rules.pro similarity index 100% rename from sample-util/consumer-rules.pro rename to sample/sample-util/consumer-rules.pro diff --git a/sample/proguard-rules.pro b/sample/sample-util/proguard-rules.pro similarity index 100% rename from sample/proguard-rules.pro rename to sample/sample-util/proguard-rules.pro diff --git a/sample-util/src/main/AndroidManifest.xml b/sample/sample-util/src/main/AndroidManifest.xml similarity index 100% rename from sample-util/src/main/AndroidManifest.xml rename to sample/sample-util/src/main/AndroidManifest.xml diff --git a/sample-util/src/test/java/com/dropbox/detector/sample_util/ExampleUnitTest.kt b/sample/sample-util/src/test/java/com/dropbox/detector/sample_util/ExampleUnitTest.kt similarity index 100% rename from sample-util/src/test/java/com/dropbox/detector/sample_util/ExampleUnitTest.kt rename to sample/sample-util/src/test/java/com/dropbox/detector/sample_util/ExampleUnitTest.kt diff --git a/sample/settings.gradle b/sample/settings.gradle new file mode 100644 index 00000000..36e414ba --- /dev/null +++ b/sample/settings.gradle @@ -0,0 +1,3 @@ +include ':sample-app' +include ':sample-core' +include ':sample-util' \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 6eee8fd8..d789a8e1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1 @@ -include ':sample-util' -include ':sample-core' -include ':sample' -rootProject.name = "sample" \ No newline at end of file +include ':affectedmoduledetector' \ No newline at end of file